Автор: avzaytsev
Дата сообщения: 20.08.2007 21:39
Unc1e
[more=лови код...]
[Setup]
AppName=S.T.A.L.K.E.R.
AppVerName=S.T.A.L.K.E.R. (Version 1.0003)
UninstallDisplayName=S.T.A.L.K.E.R.
AppVersion=1.0003
AppPublisher=GSC World Publishing
AppPublisherURL=http://www.gsc-game.ru/
AppSupportURL=http://www.stalker-game.com/ru/
AppUpdatesURL=http://www.stalker-game.com/ru/
VersionInfoVersion=1.0003
VersionInfoCompany=Packed by Krolik
LicenseFile=e:\4\{app}\License.txt
DefaultDirName=d:\Games\S.T.A.L.K.E.R
DefaultGroupName=Игры\S.T.A.L.K.E.R
OutputDir=e:\Stalker
OutputBaseFilename=Stalker_setup
UninstallDisplayIcon={app}\stalker.ico
AllowNoIcons=yes
DiskSpanning=yes
DiskSliceSize=731906048
AlwaysShowDirOnReadyPage=yes
AlwaysShowGroupOnReadyPage=yes
Compression=lzma
SolidCompression=yes
SetupIconFile=e:\4\{app}\stalker.ico
WizardImageFile=d:\1\big.bmp
WizardSmallImageFile=d:\1\small.bmp
[Languages]
Name: "rus"; MessagesFile: "compiler:Languages\Russian.isl"
[Messages]
BeveledLabel=Packed by Krolik
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "d:\1\Stalker.bmp"; DestDir: "{tmp}"; Flags: dontcopy
Source: "compiler:get_hw_caps.dll"; DestDir: "{tmp}"; Flags: dontcopy
Source: "e:\4\{app}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "e:\4\{userdocs}\*"; DestDir: "{userdocs}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\S.T.A.L.K.E.R."; Filename: "{app}\bin\XR_3DA.exe"; WorkingDir: "{app}\bin"; Comment: "Запустить игру"
Name: "{group}\Просмотреть ReadMe"; Filename: "{app}\ReadMe.txt"; Comment: "Просмотреть ReadMe"
Name: "{group}\Readme патча"; Filename: "{app}\Patch-any-3.txt"; Comment: "Readme патча"
Name: "{group}\{cm:UninstallProgram,игру}"; Filename: "{uninstallexe}"; WorkingDir: "{app}"; Comment: "Удалить игру"
Name: "{userdesktop}\S.T.A.L.K.E.R."; Filename: "{app}\bin\XR_3DA.exe"; WorkingDir: "{app}\bin"; Tasks: desktopicon
[Registry]
Root: HKLM; Subkey: "SOFTWARE\GSC Game World"; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: "SOFTWARE\GSC Game World\STALKER-SHOC\Keys"; Flags: uninsdeletekey
Root: HKLM; Subkey: "SOFTWARE\GSC Game World\STALKER-SHOC"; Flags: uninsdeletekey
Root: HKLM; Subkey: "SOFTWARE\GSC Game World\STALKER-SHOC"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"
Root: HKLM; Subkey: "SOFTWARE\GSC Game World\STALKER-SHOC"; ValueType: string; ValueName: "InstallLang"; ValueData: "ru"
Root: HKLM; Subkey: "SOFTWARE\GSC Game World\STALKER-SHOC"; ValueType: string; ValueName: "InstallSource"; ValueData: "stk-rus-pack-starforce-keydisk-r"
Root: HKLM; Subkey: "SOFTWARE\GSC Game World\STALKER-SHOC"; ValueType: string; ValueName: "InstallVers"; ValueData: "1.0003"
Root: HKLM; Subkey: "SOFTWARE\GSC Game World\STALKER-SHOC"; ValueType: string; ValueName: "InstallCDKEY"; ValueData: "84TH-9DVT-ZM6H-HDPD"
Root: HKLM; Subkey: "SOFTWARE\GSC Game World\STALKER-SHOC"; ValueType: string; ValueName: "InstallUserName"; ValueData: ""
Root: HKLM; Subkey: "SOFTWARE\GSC Game World\STALKER-SHOC"; ValueType: dword; ValueName: "BonusPack1"; ValueData: "$1"
Root: HKLM; Subkey: "SOFTWARE\GSC Game World\STALKER-SHOC"; ValueType: dword; ValueName: "BonusPack2"; ValueData: "$1"
Root: HKLM; Subkey: "SOFTWARE\GSC Game World\STALKER-SHOC"; ValueType: string; ValueName: "UnInstConfirm"; ValueData: "Удалить сохраненные игры и профили?"
Root: HKLM; Subkey: "SOFTWARE\GSC Game World\STALKER-SHOC"; ValueType: dword; ValueName: "InstallPatchID"; ValueData: "$54c"
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu2\Programs\Игры\S.T.A.L.K.E.R."; Flags: uninsdeletekey
[Run]
Filename: "{app}\bin\XR_3DA.exe"; WorkingDir: "{app}\bin"; Description: "{cm:LaunchProgram,игру}"; Flags: nowait postinstall unchecked
[Code]
const
NeedMHZ = 2000;
NeedVRAM = 128;
NeedRAM = 512;
oneMB= 1024*1024;
BufferLen= 32;
DRIVE_FIXED = 3;
type TMemoryStatus = record dwLength, dwMemoryLoad, dwTotalPhys, dwAvailPhys, dwTotalPageFile, dwAvailPageFile, dwTotalVirtual, dwAvailVirtual: Longint; end;
var
Memory: TMemoryStatus;
FreeMB, TotalMB: Cardinal;
VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
VolumeName, FileSystemName, Uninstall, Location: String;
ListBox: TListBox;
StaticText: TNewStaticText;
RadioButton_1,RadioButton_2: TRadioButton;
ResultCode: Integer;
procedure ListBoxOnClick(Sender: TObject);
var
NewLetter, OldString: String;
i: Integer;
begin
for i:= 0 to ListBox.Items.Count-1 do
begin
if ListBox.Selected[i] then
begin
NewLetter:= Copy(ListBox.Items[i], 0, 1);
OldString:= Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text));
WizardForm.DirEdit.Text:= NewLetter + OldString;
end;
end;
end;
procedure GlobalMemoryStatus(var lpBuffer: TMemoryStatus); external 'GlobalMemoryStatus@kernel32.dll';
function GetSystemMetrics(nIndex: Integer):Integer; external 'GetSystemMetrics@user32.dll stdcall';
function GetHardDrivesCount: Integer; external 'hwc_GetHardDrivesCount@files:get_hw_caps.dll stdcall';
function GetHardDriveName(hdd: Integer): PChar; external 'hwc_GetHardDriveName@files:get_hw_caps.dll stdcall';
function GetSoundCards: Integer; external 'hwc_GetSoundCards@files:get_hw_caps.dll stdcall';
function GetSoundCardName: PChar; external 'hwc_GetSoundCardName@files:get_hw_caps.dll stdcall';
function GetVideoCardName: PChar; external 'hwc_GetVideoCardName@files:get_hw_caps.dll stdcall';
function GetVidMemLocal: Integer; external 'hwc_GetVidMemLocal@files:get_hw_caps.dll stdcall';
function GetVolumeInformation(PathName,VolumeName: PChar; VolumeNameSize,VolumeSerialNumber,MaxComponentLength,FileSystemFlags: Longint; FileSystemName: PChar; FileSystemNameSize: Longint): Longint; external 'GetVolumeInformationA@kernel32.dll stdcall';
function MorG(MB: Integer; autoGB: Boolean): string;
begin if (MB < 1000) or not autoGB then Result:= IntToStr(MB)+ 'Мб' else Result:= FloatToStr(round(MB/1024*1000)/1000)+ 'Гб'
end;
function DelSp(const s:string):string;
var
c, i: integer;
stt, st, st1: string;
begin
c := 0;
st := s;
for i := 0 to Length(st) do
begin
stt := copy(st, i, 1);
if (stt = ' ') and (c >= 1) then
begin
st1 := st1;
c := c + 1;
end
else if (stt = ' ') and (c = 0) then
begin
c := c + 1;
st1 := st1 + stt;
end
else if (stt <> ' ') then
begin
c := 0;
st1 := st1 + stt;
end
end;
Result:= st1;
end;
procedure DecodeVersion( verstr: String; var verint: array of Integer );
var
i,p: Integer; s: string;
begin
verint := [0,0,0,0];
i := 0;
while ( (Length(verstr) > 0) and (i < 4) ) do
begin
p := pos('.', verstr);
if p > 0 then
begin
if p = 1 then s:= '0' else s:= Copy( verstr, 1, p - 1 );
verint[i] := StrToInt(s);
i := i + 1;
verstr := Copy( verstr, p+1, Length(verstr));
end
else
begin
verint[i] := StrToInt( verstr );
verstr := '';
end;
end;
end;
function CompareVersion( ver1, ver2: String ) : Integer;
var
verint1, verint2: array of Integer;
i: integer;
begin
SetArrayLength( verint1, 4 );
DecodeVersion( ver1, verint1 );
SetArrayLength( verint2, 4 );
DecodeVersion( ver2, verint2 );
Result := 0; i := 0;
while ( (Result = 0) and ( i < 4 ) ) do
begin
if verint1[i] > verint2[i] then
Result := 1
else
if verint1[i] < verint2[i] then
Result := -1
else
Result := 0;
i := i + 1;
end;
end;
function GetDirectXVersion(): String;
var
sVersion: String;
begin
sVersion := '';
RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\DirectX', 'Version', sVersion );
Result := sVersion;
end;
function Page_NextButtonClick(Page: TWizardPage): Boolean;
begin
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\S.T.A.L.K.E.R._is1','UninstallString', Uninstall) then
Uninstall:=RemoveQuotes(Uninstall);
if RadioButton_1.Checked then
begin
if not Exec(Uninstall, '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
MsgBox('Ошибка удаления. ' #13#13 '' + SysErrorMessage(ResultCode) + '.' #13#13 'Вероятно, деинсталлятор был перемещен, удален или переименован. ', mbError, MB_OK);
Result:=True;
end
else
begin
if not RadioButton_1.Checked then
Result:=True;
end;
end;
procedure Page_CancelButtonClick(Page: TWizardPage; var Cancel, Confirm: Boolean);
begin
Confirm:=False;
Cancel:=True;
end;
function CheckInstalledPage(PreviousPageId: Integer): Integer;
var
Page: TWizardPage;
begin
RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\S.T.A.L.K.E.R._is1','InstallLocation', Location)
Page := CreateCustomPage(PreviousPageId,'Обнаружена установленная игра','Пожалуйста, выберите действие для продолжения установки.');
StaticText := TNewStaticText.Create(Page);
StaticText.Parent := Page.Surface;
StaticText.Caption :='Программа установки обнаружила уже установленную игру в директории:' #13#13'" ' + Location + ' "';
StaticText.Left := 0;
StaticText.Top := ScaleY(24);
StaticText.TabOrder := 0;
StaticText.AutoSize:=True;
RadioButton_1 := TRadioButton.Create(Page);
RadioButton_1.Parent := Page.Surface;
RadioButton_1.Caption := 'Удалить предыдущюю версию игры (рекомендуется)';
RadioButton_1.Left := 0;
RadioButton_1.Top := ScaleY(104);
RadioButton_1.Width := ScaleX(287);
RadioButton_1.Height := ScaleY(17);
RadioButton_1.Checked := True;
RadioButton_1.TabOrder := 1;
RadioButton_1.TabStop := True;
RadioButton_2 := TRadioButton.Create(Page);
RadioButton_2.Parent := Page.Surface;
RadioButton_2.Caption := 'Продолжить установку без удаления';
RadioButton_2.Left := 0;
RadioButton_2.Top := ScaleY(144);
RadioButton_2.Width := ScaleX(263);
RadioButton_2.Height := ScaleY(17);
RadioButton_2.TabOrder := 2;
Page.OnNextButtonClick := @Page_NextButtonClick;
Page.OnCancelButtonClick := @Page_CancelButtonClick;
Result := Page.ID;
end;
function CheckSystemPage(PreviousPageId: Integer): Integer;
var
Page: TWizardPage;
ProcessorName,ProductName,CSDVersion: string;
ProcessorPanel,ProcessorNamePanel,VideoCardPanel,VideoCardNamePanel,AudioCardPanel,AudioCardNamePanel,RAMPanel,RAMTotalPanel,DirectXPanel,DirectXTotalPanel,OSPanel,OSTotalPanel: TPanel;
ProcessorMHZ,FreeMB,TotalMB: Cardinal;
StaticText,StaticText2: TNewStaticText;
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
GlobalMemoryStatus(Memory);
GetSpaceOnDisk(ExpandConstant('{sd}'),True,FreeMB,TotalMB);
GetVolumeInformation(ExpandConstant('{sd}'), VolumeName, BufferLen-1,VolumeSerialNo,MaxComponentLength,FileSystemFlags,FileSystemName,BufferLen-1);
RegQueryStringValue(HKLM, 'HARDWARE\DESCRIPTION\System\CentralProcessor\0','ProcessorNameString', ProcessorName);
RegQueryDWordValue(HKLM, 'HARDWARE\DESCRIPTION\System\CentralProcessor\0','~MHz', ProcessorMHZ);
RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion','ProductName', ProductName);
RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion','CSDVersion', CSDVersion);
GetVidMemLocal;
GetSoundCards;
Page := CreateCustomPage(PreviousPageId,'Проверка системных требований','Программа установки обнаружила следующие необходимые компоненты:');
StaticText:=TNewStaticText.Create(Page);
with StaticText do
begin
Parent:=Page.Surface;
Caption:='Все компоненты удовлетворяют требованиям игры.';
Left:=0;
Top:=170;
AutoSize:=True;
end;
StaticText2:=TNewStaticText.Create(Page);
with StaticText2 do
begin
Parent:=Page.Surface;
Caption:='Когда будуте готовы продолжить установку, нажмите <<Далее>>.'
Left:=0;
Top:=210;
AutoSize:=True;
end;
OSPanel:=TPanel.Create(Page);
with OSPanel do
begin
Parent:=Page.Surface;
Caption:=' Система';
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(101);
Height := ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=0;
Alignment:=taLeftJustify;
end;
OSTotalPanel:=TPanel.Create(Page);
with OSTotalPanel do
begin
Parent:=Page.Surface;
Caption:=+' '+ProductName+' '+CSDVersion+' сборка '+IntToStr(Version.Major)+'.'+IntToStr(Version.Minor)+'.'+IntToStr(Version.Build);
Left := ScaleX(108);
Top := ScaleY(0);
Width := ScaleX(309);
Height := ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=1;
Color:=12639424;
Alignment:=taLeftJustify;
GetWindowsVersionEx(Version);
if Version.NTPlatform and (Version.Major = 5) and (Version.Minor = 1) and (Version.ServicePackMajor < 1) then
begin
OSTotalPanel.Color:=$ccccff;
StaticText.Caption:='Компоненты, выделенные красным цветом, не удовлетворяют требованиям' + #13 + 'игры.';
end;
end;
ProcessorPanel := TPanel.Create(Page);
with ProcessorPanel do
begin
Parent := Page.Surface;
Caption := ' Процессор';
Left:=ScaleX(0);
Top:=OSPanel.Top+27;
Width:=OSPanel.Width;
Height:=ScaleY(25);
BevelInner := bvLowered;
TabOrder := 0;
Alignment:=taLeftJustify;
end;
ProcessorNamePanel := TPanel.Create(Page);
with ProcessorNamePanel do
begin
Parent := Page.Surface;
Caption := DelSp(ProcessorName)+' '+'['+IntToStr(ProcessorMHZ)+' МГц]';
Left:=OSTotalPanel.Left;
Top:=ProcessorPanel.Top;
Width:=OSTotalPanel.Width;
Height:=ScaleY(25);
BevelInner := bvLowered;
Color := 12639424;
TabOrder := 1;
Alignment:=taLeftJustify;
if ProcessorMHZ<NeedMHZ then
begin
Caption := Caption+' < '+FloatToStr(round(NeedMHZ))+ ' МГц'
ProcessorNamePanel.Color:=$ccccff;
StaticText.Caption:='Компоненты, выделенные красным цветом, не удовлетворяют требованиям' + #13 + 'игры.';
end;
end;
VideoCardPanel:=TPanel.Create(Page);
with VideoCardPanel do
begin
Parent:=Page.Surface;
Caption:=' Видеоадаптер';
Left:=ScaleX(0);
Top:=ProcessorPanel.Top+27;
Width:=ProcessorPanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=0;
Alignment:=taLeftJustify;
end;
VideoCardNamePanel:=TPanel.Create(Page);
with VideoCardNamePanel do
begin
Parent:=Page.Surface;
Caption:= ' ' + Trim(GetVideoCardName)+ ', '+ MorG(round(GetVidMemLocal/oneMB/64)*64,False);
Left:=ProcessorNamePanel.Left;
Top:=VideoCardPanel.Top;
Width:=ProcessorNamePanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
Color:=12639424;
TabOrder:=1;
Alignment:=taLeftJustify;
if round(GetVidMemLocal/oneMB/64)*64 < NeedVRAM then
begin Caption:= Caption + ' < ' + MorG(NeedVRAM,False);
VideoCardNamePanel.Color:=$ccccff;
StaticText.Caption:='Компоненты, выделенные красным цветом, не удовлетворяют требованиям' + #13 + 'игры.';
end;
Caption:= Caption + ', '+ IntToStr(GetSystemMetrics(0)) + 'x' +IntToStr(GetSystemMetrics(1));
end;
RAMPanel:=TPanel.Create(Page);
with RAMPanel do
begin
Parent:=Page.Surface;
Caption:=' Объём памяти'
Left:=0;
Top:=VideoCardPanel.Top+27;
Width:=VideoCardPanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=0;
Alignment:=taLeftJustify;
end;
RAMTotalPanel:=TPanel.Create(Page);
with RAMTotalPanel do
begin
Parent:=Page.Surface;
Caption:=' '+MorG(round(Memory.dwTotalPhys/oneMB/64)*64,False)+' всего, '+MorG(Memory.dwAvailPhys/oneMB,False)+' свободно, '
Left:=VideoCardNamePanel.Left;
Top:=RAMPanel.Top;
Width:=VideoCardNamePanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=1;
Color:=12639424;
Alignment:=taLeftJustify;
if round(Memory.dwTotalPhys/oneMB/64)*64<NeedRAM then
begin
Caption:= Caption+'требуется '+MorG(NeedRAM,False);
Color:= $ccccff;
StaticText.Caption:='Компоненты, выделенные красным цветом, не удовлетворяют требованиям' + #13 + 'игры.';
end
else
Caption:= Caption +MorG((Memory.dwTotalPhys - Memory.dwAvailPhys)/oneMB,False) +' используется';
end;
AudioCardPanel:=TPanel.Create(Page);
with AudioCardPanel do
begin
Parent:=Page.Surface;
Caption:=' Звуковая карта';
Left:=ScaleX(0);
Top:=RAMPanel.Top+27;
Width:=RAMPanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=0;
Alignment:=taLeftJustify;
end;
AudioCardNamePanel:=TPanel.Create(Page);
with AudioCardNamePanel do
begin
Parent:=Page.Surface;
Caption:=+' '+GetSoundCardName;
Left:=RAMTotalPanel.Left;
Top:=AudioCardPanel.Top;
Width:=RAMTotalPanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=1;
Color:=12639424;
Alignment:=taLeftJustify;
if GetSoundCards = 0 then
begin
Caption:=' Устройство не обнаружено';
StaticText.Caption:='Компоненты, выделенные красным цветом, не удовлетворяют требованиям' + #13 + 'игры.';
AudioCardNamePanel.Color:=$ccccff;
end;
end;
DirectXPanel:=TPanel.Create(Page);
with DirectXPanel do
begin
Parent:=Page.Surface;
Caption:=' DirectX';
Left:=0;
Top:=AudioCardPanel.Top+27;
Width:=AudioCardPanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=0;
Alignment:=taLeftJustify;
end;
DirectXTotalPanel:=TPanel.Create(Page);
with DirectXTotalPanel do
begin
Parent:=Page.Surface;
Left:=AudioCardNamePanel.Left;
Top:=DirectXPanel.Top;
Width:=AudioCardNamePanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=1;
Color:=12639424;
Alignment:=taLeftJustify;
// DirectX 8.0 is 4.8.0
// DirectX 8.1 is 4.8.1
// DirectX 9.0 is 4.9.0
if CompareVersion( GetDirectXVersion(), '4.9.0') > 0 then
begin
Caption:=+' DirectX 9.0 ('+GetDirectXVersion+')';
end
else
begin
Caption:=+' Требуется DirectX 9.0 или выше';
DirectXTotalPanel.Color:=$ccccff;
StaticText.Caption:='Компоненты, выделенные красным цветом, не удовлетворяют требованиям' + #13 + 'игры.';
end;
end;
Result := Page.ID;
end;
function InitializeSetup: Boolean;
begin
if FindWindowByClassName('TWizardForm') =0 then
Result:= True
else MsgBox('Данный инсталлятор уже запущен! ', mbError, MB_OK)
end;
procedure InitializeWizard();
var
i: integer;
BackgroundBitmapImage: TBitmapImage;
s:string;
width, height:Integer;
begin
if RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\S.T.A.L.K.E.R._is1','UninstallString', Uninstall) then
CheckInstalledPage(wpLicense);
WizardForm.Position:=poScreenCenter;
WizardForm.CancelButton.BringToFront;
MainForm.BORDERSTYLE:=bsNone;
width:=GetSystemMetrics(0);
height:=GetSystemMetrics(1);
MainForm.Width:=width;
MainForm.Height:=height;
width:=MainForm.ClientWidth;
height:=MainForm.ClientHeight;
ExtractTemporaryFile('Stalker.bmp');
s:=ExpandConstant('{tmp}')+'\Stalker.bmp';
BackgroundBitmapImage:=TBitmapImage.Create(MainForm);
BackgroundBitmapImage.Bitmap.LoadFromFile(s);
BackgroundBitmapImage.Align:=alClient;
BackgroundBitmapImage.Parent:=MainForm;
BackgroundBitmapImage.Stretch:=True;
MainForm.Visible:=True;
MainForm.Left := 0;
MainForm.Top := 0;
CheckSystemPage(wpLicense);
ListBox:= TListBox.Create(WizardForm)
with ListBox do begin
Color:= $EEEEEE; Font.Size:= 9; Font.Name:= 'Courier New'; Parent:= WizardForm.SelectDirPage; OnClick:= @ListBoxOnClick; Top:= WizardForm.DirEdit.Top +WizardForm.DirEdit.Height +ScaleY(30); Width:= WizardForm.DirBrowseButton.Left + WizardForm.DirBrowseButton.Width - WizardForm.DirEdit.Left; Height:= WizardForm.DiskSpaceLabel.Top -Top -9;
for i:=0 to GetHardDrivesCount-1 do begin
VolumeName:= StringOfChar(' ', BufferLen); GetSpaceOnDisk(GetHardDriveName(i), True, FreeMB, TotalMB); GetVolumeInformation(GetHardDriveName(i), VolumeName, BufferLen-1, VolumeSerialNo, MaxComponentLength, FileSystemFlags, FileSystemName, BufferLen-1); if Trim(VolumeName)='' then VolumeName:='без метки';
Items.Add(Copy(Uppercase(GetHardDriveName(i)),0,2)+ Copy(' ',0,11-Length(MorG(TotalMB,True)))+ MorG(TotalMB,True)+ Copy(' всего, ',0,17-Length(MorG(FreeMB,True)))+ MorG(FreeMB,True)+ Copy(' (0',0,4-Length(IntToStr(round(FreeMB/TotalMB*100)))) + FloatToStr(round(FreeMB/TotalMB*100))+ '%) свободно, '+ Trim(VolumeName)); end;
end;
with TNewStaticText.Create(WizardForm) do begin Top:= WizardForm.DirEdit.Top +WizardForm.DirEdit.Height +ScaleY(8); Caption:='Список локальных дисков, присутствующих в системе:'; Parent:= WizardForm.SelectDirPage; end;
end;
procedure CancelButtonClick(CurPage: Integer; var Cancel, Confirm: Boolean);
begin
Cancel:=False;
Confirm:=False;
if MsgBox('Вы действительно хотите отменить установку игры? ', mbError, MB_YESNO) = idYes
then
Cancel:=true;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID=wpInstalling
then
begin
WizardForm.MainPanel.Visible:=False;
WizardForm.Bevel1.Visible:=False;
WizardForm.Width:=ScaleX(395);
WizardForm.Height:=ScaleY(142);
WizardForm.Left:=ScaleX(MainForm.Width-420);
WizardForm.Top:=ScaleY(MainForm.Height-170);
WizardForm.InnerNotebook.Left:=ScaleX(10);
WizardForm.InnerNotebook.Top:=ScaleY(10);
WizardForm.InnerNotebook.Width:=ScaleX(370);
WizardForm.StatusLabel.Left:=ScaleX(0);
WizardForm.StatusLabel.Top:=ScaleY(0);
WizardForm.StatusLabel.Width:=WizardForm.InnerNotebook.Width;
WizardForm.FileNameLabel.Left:=ScaleX(0);
WizardForm.FileNameLabel.Top:=ScaleY(20);
WizardForm.FileNameLabel.Width:=WizardForm.InnerNotebook.Width;
WizardForm.ProgressGauge.Top:=ScaleY(40);
WizardForm.ProgressGauge.Width:=WizardForm.InnerNotebook.Width;
WizardForm.CancelButton.Left:=ScaleX(154);
WizardForm.CancelButton.Top:=ScaleY(80);
end
if CurPageID=wpFinished
then
begin
WizardForm.Width:=502;
WizardForm.Height:=392;
WizardForm.Position:=poScreenCenter;
end
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
S: String;
begin
If CurStep=ssPostInstall then
begin
S := ExpandConstant('{userdocs}\STALKER-SHOC\')
StringChangeEx(S, ':\', ':\|', True);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$app_data_root$=true|false|' + S + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$game_data$ = false| true| $fs_root$| gamedata\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$game_ai$ = true| false| $game_data$| ai\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$game_spawn$ = true| false| $game_data$| spawns\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$game_anims$ = true| true| $game_data$| anims\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$game_levels$ = true| false| $game_data$| levels\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$game_meshes$ = true| true| $game_data$| meshes\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$game_dm$ = true| true| $game_data$| meshes\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$game_shaders$ = true| true| $game_data$| shaders\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$game_sounds$ = true| true| $game_data$| sounds\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$game_textures$ = true| true| $game_data$| textures\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$game_scripts$ = true| false| $game_data$| scripts\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$game_config$ = true| false| $game_data$| config\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$level$ = false| false| $game_levels$' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$game_saves$ = true| false| $app_data_root$| savedgames\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$logs$ = true| false| $app_data_root$| logs\' + #13, true);
SaveStringToFile(ExpandConstant('{app}')+'\fsgame.ltx', '$screenshots$ = true| false| $app_data_root$| screenshots\' + #13, true);
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
case CurUninstallStep of
usUninstall:
if MsgBox('Вы хотите удалить сохраненные игры? ', mbError, MB_YESNO)= idYes
then
begin
DelTree(ExpandConstant('{userdocs}')+'\STALKER-SHOC', True, True, True);
end;
end;
end;
[UninstallDelete]
Type: filesandordirs; Name: "{app}"
[/more]