Advertisement
Guest User

Source: GTA SA_4.iss

a guest
Aug 28th, 2017
749
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; --- Generated by InnoSetup Script Joiner version 3.0, Jul 22 2009, (c) Bulat Ziganshin <Bulat.Ziganshin@gmail.com>. More info at http://issjoiner.codeplex.com/
  2.  
  3. ; --- Source: FreeArc_Example.iss ------------------------------------------------------------
  4. ;[English]
  5. ;Example of using unarc.dll for decompression of FreeArc archives with displaying of progress indicator in Inno Setup window.
  6. ;All you need to use the script is to compile it and put .arc archives to the same directory as installer.
  7. ;The script requires Inno Setup QuickStart Pack 5.2.3 and above! (http://files.jrsoftware.org)
  8.  
  9. ;[Russian]
  10. ;Пример распаковки FreeArc архива при помощи unarc.dll, с отображением прогресса распаковки в окне Inno Setup.
  11.  
  12. ; Версия 3.2 от Bulat Ziganshin, 31-07-2009
  13. ;   - исправлена unarc.dll - теперь она не вылетает на сбойных архивах
  14. ; miniFAQ
  15. ;   - Подготовка скрипта: добавьте строки с архивами в секцию [Files], установите флаги external dontcopy, если надо, укажите компоненты/задачи.
  16. ;   - один архив можно слить с инсталятором, если их общий размер не более 2Гб, через "copy /b setup.exe+xxx.arc newsetup.exe", добавив в [Files] "{srcexe}"
  17.  
  18. ; Версия 3.1 от Bulat Ziganshin, 29-07-2009
  19. ;   - более плавный индикатор прогресса (данные из LZMA пишутся кусками по 8 мб вместо dictsize)
  20. ;   - больше не грузятся всякие левые facompress.dll из PATH
  21. ;
  22. ; Версия 3.0 от Bulat Ziganshin, 29-07-2009
  23. ;   - функция ArchiveOrigSize возвращает объём данных в архиве
  24. ;   - наименования колбэков изменены на read и write (было progress и written)
  25. ;
  26. ; Версия 2.1 от Bulat Ziganshin, 10-07-2009
  27. ;   - Кнопка 'Отмена установки' теперь по расположению, размеру и надписи точно дублирует стандартную кнопку Отмена
  28. ;   - В unarc.dll исправлена ошибка, чреватая потенциальными проблемами при распаковке множества архивов
  29. ;
  30. ; Версия 2.0 от Bulat Ziganshin, 08-07-2009
  31. ;   - Корректно отображает общий объём установки и сколько данных уже распаковано
  32. ;   - Индикатор прогресса теперь основан на объёме распакованных и записанных на диск данных
  33. ;   - Дополнительно отображается сколько осталось времени
  34. ;   - FreeArcCallback вызывается не менее 100 раз в секунду, что заменяет вызов по таймеру
  35. ;   - Добавлен placeholder для периодически выполняемого кода (в начале процедуры FreeArcCallback)
  36. ;   - Исправлена проблема с удалением последнего распакованного файла при отмене инсталяции
  37. ;   - Исправлена проблема с русскими именами/путями распаковываемых архивов
  38. ;   - Кнопка 'Отменить распаковку' масштабируется в зависимости от размеров формы
  39. ;   - Исправлено вычисление оставшегося времени (теперь отсчёт начинается в момент начала распаковки)
  40. ;   - За пределами процесса распаковки все лишние надписи убираются с экрана
  41. ;
  42. ; Изменения от Victor_Dobrov, 02-07-2009
  43. ;   - Кнопка инсталлятора в панели задач отображает время до завершения обработки всех архивов и общий процент распаковки.
  44. ;   - В Unicode-версиях инсталлятора правильно отображаются имена файлов.
  45. ;
  46. ; Изменения от CTACKo & SotM'а. 01-07-2009
  47. ;   - Правильно создаются папки, если в пути установки встречаются русские буквы
  48. ;   - При компиляции определяется использование PAnsiChar/PChar. Можно использовать как обычную так и UNICODE версию с установленным препроцессором.
  49. ;
  50. ; Изменения от SotM'а. 23-06-2009
  51. ;   - Нижний прогресс бар сместил чуть-чуть вниз, чтобы было видно имя распаковываемого файла.
  52. ;   - Русские имена файлов теперь правильно отображаются.
  53. ;   - При нажатии "отмены" при распаковке теперь появляется запрос на подтверждение отмены.
  54. ;   - Переименовал некоторые переменные, чтобы их имена несли больше информации.
  55. ;   - Немного переформатировал сам исходный код для более удобного и понятного чтения.
  56. ;   - Исправил пару сообщений на английском языке.
  57.  
  58. ; Изменения от Victor_Dobrov, 15-06-2009
  59. ;   - Оптимизация и локализация скрипта, более подробная строка статуса, общий прогресс-бар, при неудачной распаковке выполняется откат (деинсталляция) и показывается текст ошибки.
  60.  
  61. ; Bulat Ziganshin, 13-06-2009
  62. ;   - Создание библиотеки unarc.dll и скрипта распаковки freearc_example.iss.
  63.  
  64.  
  65. [Setup]
  66.  
  67. ; --- Source: GTA SA_4.iss ------------------------------------------------------------
  68. AppName=GTA:SA
  69. AppVerName=GTA:SA
  70. AppVersion=1.0.0
  71. DefaultDirName={pf}\Grand Theft Auto San Andreas
  72. OutputDir=D:\Репаки\GTA SA
  73. DefaultGroupName=Rockstar Games\GTA San Andreas
  74. UninstallFilesDir={app}\Uninstall
  75. Compression=lzma/ultra64
  76. InternalCompressLevel=ultra64
  77. SolidCompression=true
  78. DiskSpanning=yes
  79. SlicesPerDisk=3
  80. DiskSliceSize=1100000000
  81. DisableProgramGroupPage=true
  82. DisableReadyPage=true
  83. //SetupIconFile=D:\Documents and Settings\Admin\Рабочий стол\Новая папка\GTA.ico
  84. VersionInfoDescription=Compiled by |AngelDead| R.G.RUSgamers
  85. VersionInfoCompany=http://www.rustorka.com
  86. VersionInfoVersion=1.0.0.0
  87. ;WizardImageFile=D:\Documents and Settings\Admin\Рабочий стол\19_cr4_1.bmp
  88. ;WizardSmallImageFile=D:\Для InstallShield\Prototype\SmallImage.bmp
  89. UninstallDisplayIcon={app}\gta_sa.exe, 0
  90. UninstallDisplayName=Grand Theft Auto: San Andreas
  91.  
  92.  
  93.  
  94. [Icons]
  95. Name: {group}\Техническая поддержка\Диагностика DirectX; Filename: {sys}\dxdiag.exe; WorkingDir: {sys}; Check: GroupIcons
  96. Name: {group}\Техническая поддержка\Сведения о системе; Filename: {pf}\Common Files\Microsoft Shared\MSInfo\msinfo32.exe; Check: GroupIcons
  97. Name: {group}\Запустить игру; Filename: {app}\gta_sa.exe; WorkingDir: {app}; Check: GroupIcons
  98. Name: {group}\Удалить игру; Filename: {app}\Uninstall\unins000; WorkingDir: {app}; Check: GroupIcons
  99. Name: {userdesktop}\GTA San Andreas; Filename: {app}\gta_sa.exe; WorkingDir: {app}; Check: GroupIcons
  100. Name: {group}\gta_sa.exe; Filename: {app}\gta_sa.exe; WorkingDir: {app}
  101. Name: {userdesktop}\Мультиплеер; Filename: {app}\samp.exe; WorkingDir: {app}; Check: GroupIcons
  102. Name: {group}\samp.exe; Filename: {app}\samp.exe; WorkingDir: {app}
  103.  
  104. [Registry]
  105. Root: HKLM; SubKey: SOFTWARE\Rockstar Games\GTA San Andreas\Installation; ValueType: string; ValueName: ExePath; ValueData: "\""\Rockstar Games\GTA San Andreas\gta_sa.exe\"""
  106. Root: HKLM; SubKey: SOFTWARE\Rockstar Games\GTA San Andreas\Installation; ValueType: string; ValueName: Installed; ValueData: 1
  107.  
  108. [Run]
  109. Filename: {src}\DirectX\dxsetup.exe; Parameters: /silent; StatusMsg: Идет установка дополнительных программ...; Check: InstallDop
  110. Filename: {src}\Redist\vcredist_x86.exe; Parameters: /Q; StatusMsg: Идет установка дополнительных программ...; Check: InstallDop
  111.  
  112.  
  113.  
  114. [Languages]
  115. Name: eng; MessagesFile: compiler:Default.isl
  116. Name: rus; MessagesFile: compiler:Languages\Russian.isl
  117.  
  118. [CustomMessages]
  119. eng.ArcBreak=Installation cancelled!
  120. eng.ExtractedInfo=Extracted %1 Mb of %2 Mb
  121. eng.ArcInfo=Archive: %1 of %2
  122. eng.ArcTitle=Extracting FreeArc archive
  123. eng.ArcError=Decompression failed with error code %1
  124. eng.ArcFail=Decompression failed!
  125. eng.AllProgress=Overall extraction progress: %1%%
  126. eng.ArcBroken=Archive %1 is damaged%nor not enough free space.
  127. eng.Extracting=Extracting: %1
  128. eng.taskbar=%1%%, %2 remains
  129. eng.remains=Remaining time: %1
  130. eng.LongTime=at no time
  131. eng.ending=ending
  132. eng.hour=hours
  133. eng.min=mins
  134. eng.sec=secs
  135.  
  136. rus.ArcBreak=Установка прервана!
  137. rus.ExtractedInfo=Распаковано %1 Мб из %2 Мб
  138. rus.ArcInfo=Архив: %1 из %2
  139. rus.ArcTitle=Распаковка архивов FreeArc
  140. rus.ArcError=Распаковщик FreeArc вернул код ошибки: %1
  141. rus.ArcFail=Распаковка не завершена!
  142. rus.AllProgress=Общий прогресс распаковки: %1%%
  143. rus.ArcBroken=Возможно, архив %1 повреждён%nили недостаточно места на диске назначения.
  144. rus.Extracting=Распаковывается: %1
  145. rus.taskbar=%1%%, жди %2
  146. rus.remains=Осталось ждать %1
  147. rus.LongTime=вечно
  148. rus.ending=завершение
  149. rus.hour=часов
  150. rus.min=мин
  151. rus.sec=сек
  152. rus.but=Установить
  153. rus.space=Доступно места на диске:
  154. rus.space1=Требуется места на диске:
  155. rus.drt=Обновить DirectX
  156. rus.up=Идет обновление DirectX...
  157.  
  158. [Files]
  159. ;Source: *.arc; DestDir: {app}; Flags: nocompression
  160. Source: compiler:Dll Pack\unarc.dll; DestDir: {tmp}; Flags: dontcopy deleteafterinstall
  161. Source: compiler:Dll Pack\InnoCallback.dll; DestDir: {tmp}; Flags: dontcopy
  162.  
  163.  
  164. Source: compiler:ISSkin\ISSkin.dll; DestDir: {app}; Flags: dontcopy
  165. Source: compiler:ISSkin\Styles\Vista.cjstyles; DestDir: {tmp}; Flags: dontcopy
  166. Source: 9.bmp; DestDir: {tmp}; Flags: dontcopy
  167. ///Source: Rockstar Games\GTA San Andreas\*; DestDir: {app}; BeforeInstall: ProgressExt(); Flags: ignoreversion recursesubdirs createallsubdirs
  168. Source: logo.png; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
  169. Source: compiler:Dll Pack\isgsg.dll; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
  170. Source: compiler:Dll Pack\bass.dll; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
  171. Source: michael_hunter_-_gta_san_andreas_theme.mp3; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
  172. ///Source: Rockstar Games\GTA San Andreas\gta_sa.exe; DestDir: {app}; BeforeInstall: ProgressExt(); Flags: ignoreversion
  173. ///Source: Rockstar Games\GTA San Andreas\samp.exe; DestDir: {app}; BeforeInstall: ProgressExt(); Flags: ignoreversion
  174.  
  175.  
  176. [UninstallDelete]
  177. Type: filesandordirs; Name: {app}
  178.  
  179. Name: {app}\GTA San Andreas\*; Type: filesandordirs
  180. Name: {app}\*.*; Type: filesandordirs
  181.  
  182.  
  183. [Code]
  184. const
  185.     Archives = '{src}\*.arc';    // укажите расположение архивов FreeArc; для внешних файлов строку в [Files] добавлять необязательно
  186.  
  187.     PM_REMOVE = 1;
  188.     CP_ACP = 0; CP_UTF8 = 65001;
  189.     oneMb = 1048576;
  190.  
  191. type
  192. #ifdef UNICODE  ; если у вас ошибка на этой строке, то установите препроцессор или исправьте скрипт для вашей версии Inno Setup
  193.     #define A "W"
  194. #else
  195.     #define A "A"  ; точка входа в SetWindowText, {#A} меняется на A или W в зависимости от версии
  196. //    PAnsiChar = PChar;  // Required for Inno Setup 5.3.0 and higher. (требуется для Inno Setup версии 5.3.0 и ниже)
  197. #endif
  198. #if Ver < 84018176
  199.     AnsiString = String; // There is no need for this line in Inno Setup 5.2.4 and above (для Inno Setup версий 5.2.4 и выше эта строка не нужна)
  200. #endif
  201.  
  202.     TMyMsg = record
  203.         hwnd: HWND;
  204.         message: UINT;
  205.         wParam: Longint;
  206.         lParam: Longint;
  207.         time: DWORD;
  208.         pt: TPoint;
  209.     end;
  210.  
  211.     TFreeArcCallback = function (what: PAnsiChar; int1, int2: Integer; str: PAnsiChar): Integer;
  212.     TArc = record Path: string; OrigSize: Integer; Size: Extended; end;
  213.  
  214. var
  215.     ExtractFile: TLabel;
  216.     lblExtractFileName: TLabel;
  217.     btnCancelUnpacking: TButton;
  218.     CancelCode, n, UnPackError, StartInstall: Integer;
  219.     Arcs: array of TArc;
  220.     msgError: string;
  221.     lastMb: Integer;
  222.     baseMb: Integer;
  223.     totalUncompressedSize: Integer;             // total uncompressed size of archive data in mb
  224.     LastTimerEvent: DWORD;
  225.  
  226. Function MultiByteToWideChar(CodePage: UINT; dwFlags: DWORD; lpMultiByteStr: string; cbMultiByte: integer; lpWideCharStr: string; cchWideChar: integer): longint; external 'MultiByteToWideChar@kernel32.dll stdcall';
  227. Function WideCharToMultiByte(CodePage: UINT; dwFlags: DWORD; lpWideCharStr: string; cchWideChar: integer; lpMultiByteStr: string; cbMultiByte: integer; lpDefaultChar: integer; lpUsedDefaultChar: integer): longint; external 'WideCharToMultiByte@kernel32.dll stdcall';
  228.  
  229. function PeekMessage(var lpMsg: TMyMsg; hWnd: HWND; wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL; external 'PeekMessageA@user32.dll stdcall';
  230. function TranslateMessage(const lpMsg: TMyMsg): BOOL; external 'TranslateMessage@user32.dll stdcall';
  231. function DispatchMessage(const lpMsg: TMyMsg): Longint; external 'DispatchMessageA@user32.dll stdcall';
  232.  
  233. Function OemToChar(lpszSrc, lpszDst: AnsiString): longint; external 'OemToCharA@user32.dll stdcall';
  234. function GetWindowLong(hWnd, nIndex: Integer): Longint; external 'GetWindowLongA@user32 stdcall delayload';
  235. function SetWindowText(hWnd: Longint; lpString: String): Longint; external 'SetWindowText{#A}@user32 stdcall delayload';
  236.  
  237. function GetTickCount: DWord; external 'GetTickCount@kernel32';
  238. function WrapFreeArcCallback (callback: TFreeArcCallback; paramcount: integer):longword; external 'wrapcallback@files:innocallback.dll stdcall';
  239. function FreeArcExtract (callback: longword; cmd1,cmd2,cmd3,cmd4,cmd5,cmd6,cmd7,cmd8,cmd9,cmd10: PAnsiChar): integer; external 'FreeArcExtract@files:unarc.dll cdecl';
  240.  
  241. procedure AppProcessMessage;
  242. var
  243.     Msg: TMyMsg;
  244. begin
  245.     while PeekMessage(Msg, 0, 0, 0, PM_REMOVE) do begin
  246.         TranslateMessage(Msg);
  247.         DispatchMessage(Msg);
  248.     end;
  249. end;
  250.  
  251. // Перевод числа в строку с точностью 3 знака (%.3n) с округлением дробной части, если она есть
  252. Function NumToStr(Float: Extended): String;
  253. Begin
  254.     Result:= Format('%.3n', [Float]); StringChange(Result, ',', '.');
  255.     while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Length(Result) > 1) do
  256.         SetLength(Result, Length(Result)-1);
  257. End;
  258.  
  259. function cm(Message: String): String; Begin Result:= ExpandConstant('{cm:'+ Message +'}') End;
  260.  
  261. Function Size64(Hi, Lo: Integer): Extended;
  262. Begin
  263.     Result:= Lo;
  264.     if Lo<0 then Result:= Result + $7FFFFFFF + $7FFFFFFF + 2;
  265.     for Hi:= Hi-1 Downto 0 do
  266.         Result:= Result + $7FFFFFFF + $7FFFFFFF + 2;
  267. End;
  268.  
  269. // Converts OEM encoded string into ANSI
  270. // Преобразует OEM строку в ANSI кодировку
  271. function OemToAnsiStr( strSource: AnsiString): AnsiString;
  272. var
  273.     nRet : longint;
  274. begin
  275.     SetLength( Result, Length( strSource ) );
  276.     nRet:= OemToChar( strSource, Result );
  277. end;
  278.  
  279. // Converts ANSI encoded string into UTF-8
  280. // Преобразует строку из ANSI в UTF-8 кодировку
  281. function AnsiToUtf8( strSource: string ): string;
  282. var
  283.     nRet : integer;
  284.     WideCharBuf: string;
  285.     MultiByteBuf: string;
  286. begin
  287.     strSource:= strSource + chr(0);
  288.     SetLength( WideCharBuf, Length( strSource ) * 2 );
  289.     SetLength( MultiByteBuf, Length( strSource ) * 2 );
  290.  
  291.     nRet:= MultiByteToWideChar( CP_ACP, 0, strSource, -1, WideCharBuf, Length(WideCharBuf) );
  292.     nRet:= WideCharToMultiByte( CP_UTF8, 0, WideCharBuf, -1, MultiByteBuf, Length(MultiByteBuf), 0, 0);
  293.  
  294.     Result:= MultiByteBuf;
  295. end;
  296.  
  297. // OnClick event function for btnCancel
  298. procedure btnCancelUnpackingOnClick(Sender: TObject);
  299. begin
  300.     if MsgBox( SetupMessage( msgExitSetupMessage ), mbInformation, MB_YESNO ) = IDYES then
  301.         CancelCode:= -127;
  302. end;
  303.  
  304. var origsize: Integer;
  305. // The callback function for getting info about FreeArc archive
  306. function FreeArcInfoCallback (what: PAnsiChar; Mb, sizeArc: Integer; str: PAnsiChar): Integer;
  307. begin
  308.     if string(what)='origsize'    then origsize := Mb else
  309.     if string(what)='compsize'    then                else
  310.     if string(what)='total_files' then                else
  311.     Result:= CancelCode;
  312. end;
  313.  
  314. // Returns decompressed size of files in archive
  315. function ArchiveOrigSize(arcname: string): Integer;
  316. var
  317.     callback: longword;
  318. Begin
  319.     callback:= WrapFreeArcCallback(@FreeArcInfoCallback,4);   //FreeArcInfoCallback has 4 arguments
  320.     CancelCode:= 0;
  321.     AppProcessMessage;
  322.     try
  323.         // Pass the specified arguments to 'unarc.dll'
  324.         Result:= FreeArcExtract (callback, 'l', '--', AnsiToUtf8(arcname), '', '', '', '', '', '', '');
  325.         if CancelCode < 0 then Result:= CancelCode;
  326.         if Result >= 0 then Result:= origsize;
  327.     except
  328.         Result:= -63;  //    ArcFail
  329.     end;
  330. end;
  331.  
  332. // Scans the specified folders for archives and add them to list
  333. function FindArcs(dir: string): Extended;
  334. var
  335.     FSR: TFindRec;
  336. Begin
  337.     Result:= 0;
  338.     if FindFirst(ExpandConstant(dir), FSR) then begin
  339.         try
  340.             repeat
  341.                 // Skip everything but the folders
  342.                 if FSR.Attributes and FILE_ATTRIBUTE_DIRECTORY > 0 then CONTINUE;
  343.                 n:= GetArrayLength(Arcs);
  344.                 // Expand the folder list
  345.                 SetArrayLength(Arcs, n +1);
  346.                 Arcs[n].Path:= ExtractFilePath(ExpandConstant(dir)) + FSR.Name;
  347.                 Arcs[n].Size:= Size64(FSR.SizeHigh, FSR.SizeLow);
  348.                 Result:= Result + Arcs[n].Size;
  349.                 Arcs[n].OrigSize := ArchiveOrigSize(Arcs[n].Path)
  350.                 totalUncompressedSize := totalUncompressedSize + Arcs[n].OrigSize
  351.             until not FindNext(FSR);
  352.         finally
  353.             FindClose(FSR);
  354.         end;
  355.     end;
  356. End;
  357.  
  358. // Sets the TaskBar title
  359. Procedure SetTaskBarTitle(Title: String); var h: Integer;
  360. Begin
  361.     h:= GetWindowLong(MainForm.Handle, -8); if h <> 0 then SetWindowText(h, Title);
  362. End;
  363.  
  364. // Converts milliseconds to human-readable time
  365. // Конвертирует милисекунды в человеко-читаемое изображение времени
  366. Function TicksToTime(Ticks: DWord; h,m,s: String; detail: Boolean): String;
  367. Begin
  368.     if detail                               {hh:mm:ss format} then
  369.         Result:= PADZ(IntToStr(Ticks/3600000), 2) +':'+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +':'+ PADZ(IntToStr(Ticks/1000 - Ticks/1000/60*60), 2)
  370.     else if Ticks/3600 >= 1000              {more than hour}  then
  371.         Result:= IntToStr(Ticks/3600000) +h+' '+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +m
  372.     else if Ticks/60 >= 1000                {1..60 minutes}   then
  373.         Result:= IntToStr(Ticks/60000) +m+' '+ PADZ(IntToStr(Ticks/1000 - Ticks/1000/60*60), 2) +s
  374.    else Result:= IntToStr(Ticks/1000) +s    {less than one minute}
  375. End;
  376.  
  377. // The main callback function for unpacking FreeArc archives
  378. function FreeArcCallback (what: PAnsiChar; Mb, sizeArc: Integer; str: PAnsiChar): Integer;
  379. var
  380.     percents, Remaining: Integer;
  381.     s: String;
  382. begin
  383.     if GetTickCount - LastTimerEvent > 1000 then begin
  384.         // This code will be executed once each 1000 ms (этот код будет выполняться раз в 1000 миллисекунд)
  385.         //  ....
  386.         // End of code executed by timer
  387.         LastTimerEvent := LastTimerEvent+1000;
  388.     end;
  389.  
  390.     if string(what)='filename' then begin
  391.         // Update FileName label
  392.         lblExtractFileName.Caption:= FmtMessage( cm( 'Extracting' ), [OemToAnsiStr( str )] )
  393.     end else if (string(what)='write') and (totalUncompressedSize>0) and (Mb>lastMb) then begin
  394.         // Assign to Mb *total* amount of data extracted to the moment from all archives
  395.         lastMb := Mb;
  396.         Mb := baseMb+Mb;
  397.  
  398.         // Update progress bar
  399.         WizardForm.ProgressGauge.Position:= Mb;
  400.  
  401.         // Show how much megabytes/archives were processed up to the moment
  402.         percents:= (Mb*1000) div totalUncompressedSize;
  403.         s := FmtMessage(cm('ExtractedInfo'), [IntToStr(Mb), IntToStr(totalUncompressedSize)]);
  404.         if GetArrayLength(Arcs)>1 then
  405.             s := s + '. '+FmtMessage(cm('ArcInfo'), [IntToStr(n+1), IntToStr(GetArrayLength(Arcs))])
  406.         ExtractFile.Caption := s
  407.  
  408.         // Calculate and show current percents
  409.         percents:= (Mb*1000) div totalUncompressedSize;
  410.         s:= FmtMessage(cm('AllProgress'), [Format('%.1n', [Abs(percents/10)])]);
  411.         if Mb > 0 then Remaining:= trunc((GetTickCount - StartInstall) * Abs((totalUncompressedSize - Mb)/Mb)) else Remaining:= 0;
  412.         if Remaining = 0 then SetTaskBarTitle(cm('ending')) else begin
  413.             s:= s + '.  '+FmtMessage(cm('remains'), [TicksToTime(Remaining, cm('hour'), cm('min'), cm('sec'), false)])
  414.             SetTaskBarTitle(FmtMessage(cm('taskbar'), [IntToStr(percents/10), TicksToTime(Remaining, 'h', 'm', 's', false)]))
  415.         end;
  416.         WizardForm.FileNameLabel.Caption := s
  417.     end;
  418.     AppProcessMessage;
  419.     Result:= CancelCode;
  420. end;
  421.  
  422. // Extracts all found archives
  423. function UnPack(Archives: string): Integer;
  424. var
  425.     totalCompressedSize: Extended;
  426.     callback: longword;
  427.     FreeMB, TotalMB: Cardinal;
  428.    
  429. begin
  430.     // Display 'Extracting FreeArc archive'
  431.     lblExtractFileName.Caption:= '';
  432.     lblExtractFileName.Show;
  433.     ExtractFile.caption:= cm('ArcTitle');
  434.     ExtractFile.Show;
  435.     // Show the 'Cancel unpacking' button and set it as default button
  436.     btnCancelUnpacking.Caption:= WizardForm.CancelButton.Caption;
  437.     btnCancelUnpacking.Show;
  438.     WizardForm.ActiveControl:= btnCancelUnpacking;
  439.     WizardForm.ProgressGauge.Position:= 0;
  440.     // Get the size of all archives
  441.     totalUncompressedSize := 0;
  442.     totalCompressedSize := FindArcs(Archives);
  443.     WizardForm.ProgressGauge.Max:= totalUncompressedSize;
  444.     // Other initializations
  445.     callback:= WrapFreeArcCallback(@FreeArcCallback,4);   //FreeArcCallback has 4 arguments
  446.     StartInstall:= GetTickCount;    {время начала распаковки}
  447.     LastTimerEvent:= GetTickCount;
  448.     baseMb:= 0
  449.  
  450.     for n:= 0 to GetArrayLength(Arcs) -1 do
  451.     begin
  452.         lastMb := 0
  453.         CancelCode:= 0;
  454.         AppProcessMessage;
  455.         try
  456.             // Pass the specified arguments to 'unarc.dll'
  457.             Result:= FreeArcExtract (callback, 'x', '-o+', '-dp' + AnsiToUtf8( ExpandConstant('{app}') ), '--', AnsiToUtf8(Arcs[n].Path), '', '', '', '', '');
  458.             if CancelCode < 0 then Result:= CancelCode;
  459.         except
  460.             Result:= -63;  //    ArcFail
  461.         end;
  462.         baseMb:= baseMb+lastMb
  463.  
  464.         // Error occured
  465.         if Result <> 0 then
  466.         begin
  467.             msgError:= FmtMessage(cm('ArcError'), [IntToStr(Result)]);
  468.             GetSpaceOnDisk(ExtractFileDrive(ExpandConstant('{app}')), True, FreeMB, TotalMB);
  469.             case Result of
  470.                 -1: if FreeMB < 32 {Мб на диске} then msgError:= SetupMessage(msgDiskSpaceWarningTitle)
  471.                     else msgError:= msgError + #13#10 + FmtMessage(cm('ArcBroken'), [ExtractFileName(Arcs[n].Path)]);
  472.                 -127:   msgError:= cm('ArcBreak');    //Cancel button
  473.                 -63:    msgError:= cm('ArcFail');
  474.             end;
  475. //          MsgBox(msgError, mbInformation, MB_OK);    //сообщение показывается на странице завершения
  476.             Log(msgError);
  477.             Break;    //прервать цикл распаковки
  478.         end;
  479.     end;
  480.     // Hide labels and button
  481.     WizardForm.FileNameLabel.Caption:= '';
  482.     lblExtractFileName.Hide;
  483.     ExtractFile.Hide;
  484.     btnCancelUnpacking.Hide;
  485. end;
  486.  
  487. procedure CurStepChanged(CurStep: TSetupStep);
  488. begin
  489.     if CurStep = ssInstall then
  490.     begin
  491.         UnPackError:= UnPack(Archives)
  492.         if UnPackError = 0 then
  493.             SetTaskBarTitle(SetupMessage(msgSetupAppTitle))
  494.         else
  495.         begin
  496.             // Error occured, uninstall it then
  497.             Exec(ExpandConstant('{uninstallexe}'), '/SILENT','', sw_Hide, ewWaitUntilTerminated, n);    //откат установки из-за ошибки unarc.dll
  498.             SetTaskBarTitle(SetupMessage(msgErrorTitle))
  499.             WizardForm.Caption:= SetupMessage(msgErrorTitle) +' - '+ cm('ArcBreak')
  500.         end;
  501.     end;
  502. end;
  503.  
  504. //    стандартный способ отката (не нужна CurPageChanged1), но архивы распаковываются до извлечения файлов инсталлятора
  505. //    if CurStep = ssInstall then
  506. //      if UnPack(Archives) <> 0 then Abort;
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513. const
  514. Indent=10;
  515. procedure ShowSplashScreen(p1:HWND;p2:string;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10:integer); external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';
  516. procedure ShowMP3Panel(hMainFrm:HWND;StartVolume:integer;DefMP3Dir,BASSDir,MLabel:PChar;IsShowMP3Info,IsBkgFrmVisible:boolean;ShowTimeMP3Info:integer;dBottom:integer);external 'ShowMP3Panel@files:isgsg.dll stdcall';
  517. procedure KillMP3Panel;external 'KillMP3Panel@files:isgsg.dll stdcall';
  518.  
  519. var
  520.   Dop, Icons, Group: TCheckBox;
  521.   lblDirectX, lblSelectDir, lblSelectDirBrowse, lblRedist: TLabel;
  522.   lblIcons, lblGroup, lblDop: TLabel;
  523.   PageNameLabel, PageDescriptionLabel: TLabel;
  524.   PageNameLabel1, PageDescriptionLabel1: TLabel;
  525.   StatusLabel, FilenameLabel: TLabel;
  526.   WelcomeLabel1, WelcomeLabel2,
  527.   FinishedLabel, FinishedHeadingLabel: TLabel;
  528.   NeedSize:Integer;
  529.   FreeMB, TotalMB: Cardinal;
  530.   NeedSpaceLabel,FreeSpaceLabel: TLabel;
  531.   BmpFile: TBitmapImage;
  532.  
  533.  
  534. Function InstallDop:Boolean;
  535. begin
  536.   Result:=Dop.Checked;
  537. end;
  538.  
  539. function CreateIcons: Boolean;
  540. begin
  541.   Result:=Icons.Checked;
  542. end;
  543.  
  544. function GroupIcons: Boolean;
  545. begin
  546.   Result:=Group.Checked;
  547. end;
  548.  
  549. procedure LogoOnClick(Sender: TObject);
  550. var ReturnCode: Integer;
  551. begin
  552.   ShellExec('open', 'http://www.rustorka.com', '', '', SW_SHOWNORMAL, ewNoWait, ReturnCode)
  553. end;
  554.  
  555. // задал процедуру, чтоб отмечался чебокс еси кликнуть по надписи lblCheckBox
  556. procedure DopOnClick(Sender: TObject);
  557. begin
  558.   if Dop.Checked = False then
  559.   Dop.Checked:= True else
  560.   Dop.Checked:= False;
  561. end;
  562.  
  563. procedure IconsOnClick(Sender: TObject);
  564. begin
  565.   if Icons.Checked = False then
  566.   Icons.Checked:= True else
  567.   Icons.Checked:= False;
  568. end;
  569.  
  570. procedure GroupOnClick(Sender: TObject);
  571. begin
  572.   if Group.Checked = False then
  573.   Group.Checked:= True else
  574.   Group.Checked:= False;
  575. end;
  576. // задал процедуру, чтоб отмечался чебокс еси кликнуть по надписи lblCheckBox
  577.  
  578. //Свободное место
  579. procedure GetFreeSpaceCaption(Sender: TObject);
  580. var
  581. Path: String;
  582. begin
  583.   Path := ExtractFileDrive(WizardForm.DirEdit.Text);
  584.   GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
  585.   if FreeMB > 1024 then
  586.   FreeSpaceLabel.Caption := ExpandConstant('{cm:SPACE} ')+ FloatToStr(round(FreeMB/1024*100)/100) + ' GB' else
  587.   FreeSpaceLabel.Caption := ExpandConstant('{cm:SPACE} ')+ IntToStr(FreeMB)+ ' MB';
  588.   if FreeMB < NeedSize then
  589.   WizardForm.NextButton.Enabled := False else
  590.   WizardForm.NextButton.Enabled := True;
  591. end;
  592.  
  593. procedure GetNeedSpaceCaption;
  594. begin
  595.   if NeedSize > 1024 then
  596.   NeedSpaceLabel.Caption := ExpandConstant('{cm:SPACE1} ')+ FloatToStr(round(NeedSize/1024*100)/100) + ' GB' else
  597.   NeedSpaceLabel.Caption := ExpandConstant('{cm:SPACE1} ')+ IntToStr(NeedSize)+ ' MB';
  598. end;
  599.  
  600. //Свободное место
  601. procedure ProgressExt();
  602. begin
  603.   FilenameLabel.Caption:= ExpandConstant(ExtractFileDir(CurrentFilename)) + '\' + ExtractFilename(CurrentFilename);
  604. end;
  605.  
  606. //Загрузка скина
  607. procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
  608. external 'LoadSkin@files:isskin.dll stdcall';
  609. procedure UnloadSkin();
  610. external 'UnloadSkin@files:isskin.dll stdcall';
  611. function ShowWindow(hWnd: Integer; uType: Integer): Integer;
  612. external 'ShowWindow@user32.dll stdcall';
  613.  
  614. function InitializeSetup(): Boolean;
  615. begin
  616.   ExtractTemporaryFile('Vista.cjstyles');
  617.   LoadSkin(ExpandConstant('{tmp}\Vista.cjstyles'), '');
  618.   Result := True;
  619.   ExtractTemporaryFile('michael_hunter_-_gta_san_andreas_theme.mp3');
  620.   ExtractTemporaryFile('bass.dll');
  621. //  Result := InitializeSetup(); if not Result then exit;
  622.   if not Result then exit;
  623. end;
  624.  
  625.  
  626. //Загрузка скина
  627. procedure InitializeWizard();
  628. begin
  629.   ExtractTemporaryFile('9.bmp');
  630.   NeedSize:= 4900;
  631.   BmpFile:= TBitmapImage.Create(WizardForm);
  632.   BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\9.bmp'));
  633.   BmpFile.SetBounds(0, 0, 497, 360);
  634.   BmpFile.Stretch:= true
  635.   BmpFile.Parent:= WizardForm.WelcomePage;
  636.   BmpFile:= TBitmapImage.Create(WizardForm);
  637.   BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\9.bmp'));
  638.   BmpFile.SetBounds(0, 0, 497, 360);
  639.   BmpFile.Stretch:= true
  640.   BmpFile.Parent:= WizardForm.LicensePage;
  641.   BmpFile:= TBitmapImage.Create(WizardForm);
  642.   BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\9.bmp'));
  643.   BmpFile.SetBounds(0, 0, 497, 360);
  644.   BmpFile.Stretch:= true
  645.   BmpFile.Parent:= WizardForm.SelectDirPage;
  646.   BmpFile:= TBitmapImage.Create(WizardForm);
  647.   BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\9.bmp'));
  648.   BmpFile.SetBounds(0, 0, 497, 360);
  649.   BmpFile.Stretch:= true
  650.   BmpFile.Parent:= WizardForm.InstallingPage;
  651.   BmpFile:= TBitmapImage.Create(WizardForm);
  652.   BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\9.bmp'));
  653.   BmpFile.SetBounds(0, 0, 497, 360);
  654.   BmpFile.Stretch:= true
  655.   BmpFile.Parent:= WizardForm.FinishedPage;
  656.   BmpFile:= TBitmapImage.Create(WizardForm);
  657.   ShowMP3Panel(WizardForm.Handle,80,ExpandConstant('{tmp}'),ExpandConstant('{tmp}'),'',True,False,7000,Indent);
  658.  
  659.   // Create a 'Cancel unpacking' button and hide it for now.
  660.   btnCancelUnpacking:=TButton.create(WizardForm);
  661.   btnCancelUnpacking.Parent:= WizardForm;
  662.   btnCancelUnpacking.SetBounds(WizardForm.CancelButton.Left, WizardForm.CancelButton.top, WizardForm.CancelButton.Width, WizardForm.CancelButton.Height);
  663.   btnCancelUnpacking.OnClick:= @btnCancelUnpackingOnClick;
  664.   btnCancelUnpacking.Hide;
  665.  
  666.   with WizardForm do
  667.   begin
  668.     PageNameLabel.Hide;
  669.     PageDescriptionLabel.Hide;
  670.     WelcomeLabel1.Hide;
  671.     WelcomeLabel2.Hide;
  672.     DiskSpaceLabel.Hide;
  673.     SelectDirBitmapImage.Hide;
  674.     SelectDirBrowseLabel.Hide;
  675.     SelectDirLabel.Hide;
  676.     FinishedHeadingLabel.Hide;
  677.     FinishedLabel.Hide;
  678.     MainPanel.Hide
  679.     FilenameLabel.Hide;
  680.     StatusLabel.Hide;
  681.   end;
  682.  
  683.   with WizardForm do
  684.   begin
  685.     DirBrowseButton.Left:= DirBrowseButton.Left + ScaleX(40);
  686.     DirBrowseButton.Top:= DirBrowseButton.Top + ScaleY(72);
  687.     DirEdit.Left:= DirEdit.Left + ScaleX(40);
  688.     DirEdit.Top:= DirEdit.Top + ScaleY(72);
  689.     NextButton.BringToFront;
  690.     BackButton.BringToFront;
  691.     CancelButton.BringToFront;
  692.     Font.Style:=[];
  693.     Font.Name:= 'MS Sans Serif';
  694.     DirEdit.Color:=clBlack;
  695.     Font.Color:=clWhite;
  696.     ProgressGauge.Top:=ScaleY(120);
  697.     ProgressGauge.Left:=ScaleX(20);
  698.   end;
  699.  
  700.   with WizardForm do
  701.   begin
  702.     InnerNotebook.Left := ScaleX(0);
  703.     InnerNotebook.Top := ScaleY(0);
  704.     InnerNotebook.Width := ScaleX(497);
  705.     InnerNotebook.Height := ScaleY(360);
  706.     OuterNotebook.Left := ScaleX(0);
  707.     OuterNotebook.Top := ScaleY(0);
  708.     OuterNotebook.Width := ScaleX(497);
  709.     OuterNotebook.Height := ScaleY(360);
  710.   end;
  711.  
  712.   WelcomeLabel1:= TLabel.Create(WizardForm);
  713.   with WelcomeLabel1 do
  714.   begin
  715.     Left:= ScaleX(176);
  716.     Top:= ScaleY(66);
  717.     Width:= ScaleX(301);
  718.     Height:= ScaleY(54);
  719.     AutoSize:= false;
  720.     Transparent:= true;
  721.     WordWrap:= true;
  722.     Font.Size:= 14;
  723.     Font.Color:=ClWhite
  724.     Font.Style := [fsBold]
  725.     Parent:= WizardForm.WelcomePage;
  726.     Caption:= WizardForm.WelcomeLabel1.Caption; //'Вас приветствует Мастер' + #10 + 'установки Prototype'
  727.     Caption:= 'Вас приветствует Мастер' + #10 + 'установки GTA: San Andreas'
  728.   end;
  729.  
  730.   WelcomeLabel2:=TLabel.Create(WizardForm);
  731.   with WelcomeLabel2 do
  732.   begin
  733.     Top:= ScaleY(136);
  734.     Left:= ScaleX(176);
  735.     Width:= ScaleX(301);
  736.     Height:= ScaleY(300);
  737.     AutoSize:= false;
  738.     WordWrap:= true;
  739.     Transparent:= true;
  740.     Parent:= WizardForm.WelcomePage;
  741.     Caption:= WizardForm.WelcomeLabel2.Caption; //'Программа установит Prototype на Ваш компьютер.' + #10#13#10 + 'Рекомендуется закрыть все прочие приложения перед' + #10 + 'тем, как продолжить.' + #10#13#10 + 'Нажмите «Далее», чтобы продолжить или «Отмена»,' + #10 + 'чтобы выйти из прошраммы установки.';
  742.     Caption:= 'Программа установит Grand Theft Auto: San Andreas на Ваш компьютер.' + #10#13#10 + 'Рекомендуется закрыть все прочие приложения перед' + #10 + 'тем, как продолжить.' + #10#13#10 + 'Нажмите «Далее», чтобы продолжить или «Отмена»,' + #10 + 'чтобы выйти из прошраммы установки.'
  743.   end;
  744.  
  745.   FinishedHeadingLabel:=TLabel.Create(WizardForm);
  746.   with FinishedHeadingLabel do
  747.   begin
  748.     Top:= ScaleY(66);
  749.     Left:= ScaleX(176);
  750.     Width:= ScaleX(301);
  751.     Height:= ScaleY(53);
  752.     AutoSize:= false;
  753.     WordWrap:= true;
  754.     Font.Size:= 14;
  755.     Font.Color:=ClWhite
  756.     Font.Style := [fsBold]
  757.     Transparent:= true;
  758.     Parent:= WizardForm.FinishedPage;
  759.     Caption:= WizardForm.FinishedHeadingLabel.Caption; //'Завершение Мастера установки' + #10 + 'Prototype'
  760.     Caption:= 'Завершение Мастера установки' + #10 + 'Grand Theft Auto: San Andreas'
  761.   end;
  762.  
  763.   FinishedLabel:= TLabel.Create(WizardForm);
  764.   with FinishedLabel do
  765.   begin
  766.     Left:= ScaleX(176);
  767.     Top:= ScaleY(136);
  768.     Width:= ScaleX(301);
  769.     Height:= ScaleY(54);
  770.     AutoSize:= false;
  771.     WordWrap:= true;
  772.     Transparent:= true;
  773.     Parent:= WizardForm.FinishedPage;
  774.     Caption:= 'Игра Grand Theft Auto: San Andreas установлена на Ваш компьютер.' + #10#13#10 + 'Нажмите «Завершить», чтобы выйти из программы' + #10 + 'установки.'
  775.   end;
  776.  
  777.   // уменьшил размер CheckBox'а, по другому никак
  778.   begin
  779.   dop := TCheckBox.Create(WizardForm);
  780.   with Dop do
  781.     begin
  782.       Parent := WizardForm.SelectDirPage;
  783.       Left := WizardForm.DirEdit.Left;
  784.       Top := WizardForm.DirEdit.Top+53;
  785.       Width := ScaleX(13);
  786.       Height := ScaleY(13);
  787.       TabOrder := 2;
  788.       Checked := False;
  789.     end;
  790.   end;
  791.  
  792.   lblDop:= TLabel.Create(WizardForm);
  793.   with lblDop do
  794.   begin
  795.     Caption:='Установить дополнительные программы (рекомендуется)';
  796.     Left:= WizardForm.DirEdit.Left + 20;
  797.     Top:= WizardForm.DirEdit.Top + 53;
  798.     Width:= ScaleX(150);
  799.     Height:= ScaleY(13);
  800.     Transparent := True;
  801.     Parent:= WizardForm.SelectDirPage;
  802.     OnClick:= @DopOnClick;
  803.   end;
  804.  
  805.   Icons:= TCheckBox.Create(WizardForm);
  806.   with Icons do
  807.   begin
  808.     Parent:= WizardForm.SelectDirPage;
  809.     Left:= WizardForm.DirEdit.Left;
  810.     Top:= WizardForm.DirEdit.Top + 35;
  811.     Width:= ScaleX(13);
  812.     Height:= ScaleY(13);
  813.     TabOrder:= 2;
  814.     Checked:= False;
  815.   end;
  816.  
  817.   lblIcons:= TLabel.Create(WizardForm);
  818.   with lblIcons do
  819.   begin
  820.     Caption:='Создать ярлык на рабочем столе';
  821.     Left:= WizardForm.DirEdit.Left + 20;
  822.     Top:= WizardForm.DirEdit.Top + 35;
  823.     Width:= ScaleX(150);
  824.     Height:= ScaleY(13);
  825.     Transparent := True;
  826.     Parent:= WizardForm.SelectDirPage;
  827.     OnClick:= @IconsOnClick;
  828.   end;
  829.  
  830.   Group:= TCheckBox.Create(WizardForm);
  831.   with Group do
  832.   begin
  833.     Parent:= WizardForm.SelectDirPage;
  834.     Left:= WizardForm.DirEdit.Left;
  835.     Top:= WizardForm.DirEdit.Top + 71;
  836.     Width:= ScaleX(13);
  837.     Height:= ScaleY(13);
  838.     TabOrder:= 3;
  839.     Checked:= False;
  840.   end;
  841.  
  842.   lblGroup:= TLabel.Create(WizardForm);
  843.   with lblGroup do
  844.   begin
  845.     Caption:='Создать ярлыки в меню "Пуск"';
  846.     Left:= WizardForm.DirEdit.Left + 20;
  847.     Top:= WizardForm.DirEdit.Top + 71;
  848.     Width:= ScaleX(150);
  849.     Height:= ScaleY(13);
  850.     Transparent := True;
  851.     Parent:= WizardForm.SelectDirPage;
  852.     OnClick:= @GroupOnClick;
  853.   end;
  854.  
  855.   // создаём lblSelectDir
  856.   lblSelectDir:= TLabel.Create(WizardForm);
  857.   with lblSelectDir do
  858.   begin
  859.     Caption:= WizardForm.SelectDirLabel.Caption;
  860.     Left:= ScaleX(40);
  861.     Top:= WizardForm.SelectDirLabel.Top + ScaleY(62);
  862.     Width:= WizardForm.SelectDirLabel.Width;
  863.     Height:= WizardForm.SelectDirLabel.Height;
  864.     Transparent := True;
  865.     Parent:= WizardForm.SelectDirPage;
  866.   end;
  867.  
  868.   // создаём lblSelectDirBrowse
  869.   lblSelectDirBrowse:= TLabel.Create(WizardForm);
  870.   with lblSelectDirBrowse do
  871.   begin
  872.     Caption:= WizardForm.SelectDirBrowseLabel.Caption;
  873.     Left:= ScaleX(40);
  874.     Top:= WizardForm.SelectDirBrowseLabel.Top + ScaleY(62);
  875.     Width:= WizardForm.SelectDirBrowseLabel.Width;
  876.     Height:= WizardForm.SelectDirBrowseLabel.Height;
  877.     WordWrap:= True;
  878.     Transparent:= True;
  879.     Parent:= WizardForm.SelectDirPage;
  880.   end;
  881.  
  882.   NeedSpaceLabel:= TLabel.Create(WizardForm);
  883.   with NeedSpaceLabel do
  884.   begin
  885.     Parent:= WizardForm.SelectDirPage;
  886.     Left:= WizardForm.DirEdit.Left;
  887.     Top:= ScaleY(262);
  888.     Width:= ScaleX(209);
  889.     Height:= ScaleY(13);
  890.     Transparent:= True;
  891.   end;
  892.  
  893.   FreeSpaceLabel:= TLabel.Create(WizardForm);
  894.   with FreeSpaceLabel do
  895.   begin
  896.     Parent:= WizardForm.SelectDirPage;
  897.     Left:= WizardForm.DirEdit.Left;
  898.     Top:= ScaleY(280);
  899.     Width:= ScaleX(209);
  900.     Height:= ScaleY(13);
  901.     Transparent:= True;
  902.   end;
  903.  
  904.   WizardForm.DirEdit.OnChange:= @GetFreeSpaceCaption;
  905.   WizardForm.DirEdit.Text:= WizardForm.DirEdit.Text + #0;
  906.   PageNameLabel:= TLabel.Create(WizardForm);
  907.   with PageNameLabel do
  908.   begin
  909.     Left:= WizardForm.PageNameLabel.Left;
  910.     Top:= WizardForm.PageNameLabel.Top;
  911.     Width:= ScaleX(300);
  912.     Height:= ScaleY(14);
  913.     AutoSize:= False;
  914.     Font.Style:= [fsBold];
  915.     Font.Color:= ClWhite;
  916.     Transparent := True;
  917.     Parent:= WizardForm.SelectDirPage;
  918. end;
  919.  
  920.   PageNameLabel1:= TLabel.Create(WizardForm);
  921.   with PageNameLabel1 do
  922.   begin
  923.     Left:= WizardForm.PageNameLabel.Left;
  924.     Top:= WizardForm.PageNameLabel.Top;
  925.     Width:= ScaleX(300);
  926.     Height:= ScaleY(14);
  927.     AutoSize:= False;
  928.     Font.Style:= [fsBold];
  929.     Font.Color:= ClWhite;
  930.     Transparent := True;
  931.     Parent:= WizardForm.InstallingPage;
  932.   end;
  933.  
  934.   PageDescriptionLabel:= TLabel.Create(WizardForm);
  935.   with PageDescriptionLabel do
  936.   begin
  937.     Left:= WizardForm.PageDescriptionLabel.Left;
  938.     Top:= WizardForm.PageDescriptionLabel.top;
  939.     Width:= WizardForm.PageDescriptionLabel.Width;
  940.     Height:= WizardForm.PageDescriptionLabel.Height;
  941.     AutoSize:= False;
  942.     Transparent := True;
  943.     Parent:= WizardForm.SelectDirPage;
  944.   end;
  945.  
  946.   PageDescriptionLabel1:= TLabel.Create(WizardForm);
  947.   with PageDescriptionLabel1 do
  948.   begin
  949.     Left:= WizardForm.PageDescriptionLabel.Left;
  950.     Top:= WizardForm.PageDescriptionLabel.top;
  951.     Width:= WizardForm.PageDescriptionLabel.Width;
  952.     Height:= WizardForm.PageDescriptionLabel.Height;
  953.     AutoSize:= False;
  954.     Transparent := True;
  955.     Parent:= WizardForm.InstallingPage;
  956.   end;
  957.  
  958.   StatusLabel:= TLabel.Create(WizardForm);
  959.   with StatusLabel do
  960.   begin
  961.     Left:= ScaleX(20);
  962.     Top:= ScaleY(80);
  963.     Width:= WizardForm.StatusLabel.Width;
  964.     Height:= WizardForm.StatusLabel.Height;
  965.     AutoSize:= False;
  966.     Transparent := True;
  967.     Parent:= WizardForm.InstallingPage;
  968.     Caption:= 'Распаковка файлов игры...'
  969.   end;
  970.  
  971.   FilenameLabel:= TLabel.Create(WizardForm);
  972.   with FilenameLabel do
  973.   begin
  974.     Left:= ScaleX(20);
  975.     Top:= ScaleY(100);
  976.     Width:= WizardForm.StatusLabel.Width;
  977.     Height:= WizardForm.StatusLabel.Height;
  978.     AutoSize:= False;
  979.     Transparent := True;
  980.     Parent:= WizardForm.InstallingPage;
  981.   end;
  982.  
  983.   with WizardForm.ProgressGauge do
  984.   begin
  985.     // Create a label to show current FileName being extracted
  986.     lblExtractFileName:= TLabel.Create(WizardForm);
  987.     lblExtractFileName.parent:=WizardForm.InstallingPage;
  988.     lblExtractFileName.autosize:=false;
  989.     lblExtractFileName.Width:= Width;
  990.     lblExtractFileName.top:=Top + ScaleY(35);
  991.     lblExtractFileName.Caption:= '';
  992.     lblExtractFileName.Hide;
  993.  
  994.     // Create a label to show percentage
  995.     ExtractFile:= TLabel.Create(WizardForm);
  996.     ExtractFile.parent:=WizardForm.InstallingPage;
  997.     ExtractFile.autosize:=false;
  998.     ExtractFile.Width:= Width;
  999.     ExtractFile.top:=lblExtractFileName.Top + ScaleY(16);
  1000.     ExtractFile.caption:= '';
  1001.     ExtractFile.Hide;
  1002.   end;
  1003. end;
  1004.  
  1005.  
  1006.  
  1007. procedure CurPageChanged(CurPageID: Integer);
  1008. begin
  1009.   PageNameLabel.Caption:= WizardForm.PageNameLabel.Caption;
  1010.   PageDescriptionLabel.Caption:= WizardForm.PageDescriptionLabel.Caption;
  1011.   PageNameLabel1.Caption:= WizardForm.PageNameLabel.Caption;
  1012.   PageDescriptionLabel1.Caption:= WizardForm.PageDescriptionLabel.Caption;
  1013.  
  1014.   if CurPageID = wpSelectDir then
  1015.     begin
  1016.       WizardForm.NextButton.Caption:= ExpandConstant('{cm:BUT}');
  1017.       GetNeedSpaceCaption;
  1018.       if FreeMB < NeedSize then
  1019.       WizardForm.NextButton.Enabled:=False;
  1020.         begin
  1021.           if CurPageID=wpInstalling
  1022.           then
  1023.           if CurPageID=wpFinished
  1024.           then
  1025.           begin
  1026.             WizardForm.Width:=497;
  1027.             WizardForm.Height:=358;
  1028.             WizardForm.Position:=poScreenCenter;
  1029.           end
  1030.         end;
  1031.     end;
  1032.  
  1033.  
  1034.  
  1035.   if (CurPageID = wpFinished) and (UnPackError <> 0) then
  1036.   begin // Extraction was unsuccessful (распаковщик вернул ошибку)
  1037.     // Show error message
  1038.     WizardForm.FinishedLabel.Font.Color:= $0000C0;    // red (красный)
  1039.     WizardForm.FinishedLabel.Height:= WizardForm.FinishedLabel.Height * 2;
  1040.     WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) + #13#10#13#10 + msgError;
  1041.   end;
  1042. end;
  1043.  
  1044.  
  1045. //function InitializeSetup(): Boolean;
  1046. //begin
  1047. //  Result := InitializeSetup2(); if not Result then exit;
  1048. //end;
  1049.  
  1050.  
  1051.  
  1052. procedure DeinitializeSetup();
  1053. begin
  1054.   ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
  1055.   UnloadSkin();
  1056. end;
  1057.  
  1058. //; --- Dispatching code ------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement