Advertisement
Guest User

Setup

a guest
May 22nd, 2017
595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.53 KB | None | 0 0
  1. //----------This Installer Uses Inno Setup Unicode Version----------\\
  2. #define AppName "Prey"
  3. #define AppPublisher "Vaszka"
  4. #define AppVersion "final"
  5. #define AppExec "Prey.exe"
  6. #define AppURL "https://google.com"
  7. #define AppSize "1000"
  8. #define SetupName "Setup"
  9. #define SetupOut "Output"
  10.  
  11. #define PrecompVer "Inside"
  12.  
  13. [Setup]
  14. AppName={#AppName}
  15. AppPublisher={#AppPublisher}
  16. AppVersion={#AppVersion}
  17. AppComments={#AppName}
  18. DefaultDirName={pf}\{#AppName}
  19. DefaultGroupName={#AppName}
  20. OutputBaseFilename={#SetupName}
  21. OutputDir={#SetupOut}
  22. SetupIconFile=Style\Setup.ico
  23. WizardImageFile=Style\Background.bmp
  24. WizardSmallImageFile=Style\smallbitmap.bmp
  25.  
  26. [Icons]
  27. Name: {group}\{#AppName}; Filename: {app}\{#AppExec}
  28. Name: {userdesktop}\{#AppName}; Filename: {app}\{#AppExec}; Tasks: desktopicon
  29. Name: {userstartmenu}\{#AppName}; Filename: {app}\{#AppExec}
  30.  
  31. [Files]
  32. Source: "Include\*.*"; DestDir: "{tmp}"; Flags: dontcopy
  33. Source: "Style\*.*"; DestDir: "{tmp}"; Flags: dontcopy
  34.  
  35. [Messages]
  36. SetupWindowTitle=Welcome to The Setup Wizard «{#AppName}»
  37.  
  38. [CustomMessages]
  39. SoundCtrlButtonCaptionSoundOn=Music on
  40. SoundCtrlButtonCaptionSoundOff=Music off
  41.  
  42. [Languages]
  43. Name: eng; MessagesFile: compiler:Default.isl
  44.  
  45. [Components]
  46. Name: directx; Description: Install DirectX
  47. Name: visualc; Description: Install Visual C++
  48. Name: framework; Description: Install Framework
  49.  
  50. [Tasks]
  51. Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
  52.  
  53. [UninstallDelete]
  54. Type: filesandordirs; Name: {app}
  55.  
  56. [Code]
  57.  
  58. const
  59. BASS_SAMPLE_LOOP = 4;
  60. BASS_ACTIVE_STOPPED = 0;
  61. BASS_ACTIVE_PLAYING = 1;
  62. BASS_ACTIVE_STALLED = 2;
  63. BASS_ACTIVE_PAUSED = 3;
  64. BASS_UNICODE = $80000000;
  65. BASS_CONFIG_GVOL_STREAM = 5;
  66. const
  67. #ifndef UNICODE
  68. EncodingFlag = 0;
  69. #else
  70. EncodingFlag = BASS_UNICODE;
  71. #endif
  72. type
  73. HSTREAM = DWORD;
  74.  
  75. function BASS_Init(device: LongInt; freq, flags: DWORD;
  76. win: HWND; clsid: Cardinal): BOOL;
  77. external 'BASS_Init@files:bass.dll stdcall';
  78. function BASS_StreamCreateFile(mem: BOOL; f: string; offset1: DWORD;
  79. offset2: DWORD; length1: DWORD; length2: DWORD; flags: DWORD): HSTREAM;
  80. external 'BASS_StreamCreateFile@files:bass.dll stdcall';
  81. function BASS_Start: BOOL;
  82. external 'BASS_Start@files:bass.dll stdcall';
  83. function BASS_Pause: BOOL;
  84. external 'BASS_Pause@files:bass.dll stdcall';
  85. function BASS_ChannelPlay(handle: DWORD; restart: BOOL): BOOL;
  86. external 'BASS_ChannelPlay@files:bass.dll stdcall';
  87. function BASS_SetConfig(option: DWORD; value: DWORD ): BOOL;
  88. external 'BASS_SetConfig@files:bass.dll stdcall';
  89. function BASS_ChannelIsActive(handle: DWORD): DWORD;
  90. external 'BASS_ChannelIsActive@files:bass.dll stdcall';
  91. function BASS_Free: BOOL;
  92. external 'BASS_Free@files:bass.dll stdcall';
  93.  
  94. var
  95. SoundStream: HSTREAM;
  96. SoundCtrlButton: TNewButton;
  97.  
  98. procedure SoundCtrlButtonClick(Sender: TObject);
  99. begin
  100. case BASS_ChannelIsActive(SoundStream) of
  101. BASS_ACTIVE_PLAYING:
  102. begin
  103. if BASS_Pause then
  104. SoundCtrlButton.Caption :=
  105. ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOn}');
  106. end;
  107. BASS_ACTIVE_PAUSED:
  108. begin
  109. if BASS_Start then
  110. SoundCtrlButton.Caption :=
  111. ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOff}');
  112. end;
  113. end;
  114. end;
  115.  
  116. { RedesignWizardFormBegin } // Don't remove this line!
  117. // Don't modify this section. It is generated automatically.
  118. procedure RedesignWizardForm;
  119. begin
  120. with WizardForm.ProgressGauge do
  121. begin
  122. Height := ScaleY(13);
  123. end;
  124.  
  125. { ReservationBegin }
  126. // This part is for you. Add your specialized code here.
  127.  
  128. { ReservationEnd }
  129. end;
  130. // Don't modify this section. It is generated automatically.
  131. { RedesignWizardFormEnd } // Don't remove this line!
  132.  
  133.  
  134. type
  135. #ifdef UNICODE
  136. PChar = PAnsiChar;
  137. #endif
  138. const
  139. PCFonFLY=true;
  140. notPCFonFLY=false;
  141. var
  142. LabelPct1,LabelCurrFileName,LabelTime1,LabelTime2,LabelTime3: TLabel;
  143. ISDoneProgressBar1: TNewProgressBar;
  144. MyCancelButton: TButton;
  145. ISDoneCancel:integer;
  146. ISDoneError:boolean;
  147. PCFVer:double;
  148.  
  149. type
  150. TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
  151.  
  152. function WrapCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:ISDone.dll stdcall delayload';
  153.  
  154. function ISArcExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath, ExtractedPath: AnsiString; DeleteInFile:boolean; Password, CfgFile, WorkPath: AnsiString; ExtractPCF: boolean ):boolean; external 'ISArcExtract@files:ISDone.dll stdcall delayload';
  155. function IS7ZipExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'IS7zipExtract@files:ISDone.dll stdcall delayload';
  156. function ISRarExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'ISRarExtract@files:ISDone.dll stdcall delayload';
  157. function ISPrecompExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISPrecompExtract@files:ISDone.dll stdcall delayload';
  158. function ISSRepExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISSrepExtract@files:ISDone.dll stdcall delayload';
  159. function ISxDeltaExtract(CurComponent:Cardinal; PctOfTotal:double; minRAM,maxRAM:integer; InName, DiffFile, OutFile: AnsiString; DeleteInFile, DeleteDiffFile:boolean):boolean; external 'ISxDeltaExtract@files:ISDone.dll stdcall delayload';
  160. function ISPackZIP(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString;ComprLvl:integer; DeleteInFile:boolean):boolean; external 'ISPackZIP@files:ISDone.dll stdcall delayload';
  161. function ShowChangeDiskWindow(Text, DefaultPath, SearchFile:AnsiString):boolean; external 'ShowChangeDiskWindow@files:ISDone.dll stdcall delayload';
  162.  
  163. function Exec2 (FileName, Param: PAnsiChar;Show:boolean):boolean; external 'Exec2@files:ISDone.dll stdcall delayload';
  164. function ISFindFiles(CurComponent:Cardinal; FileMask:AnsiString; var ColFiles:integer):integer; external 'ISFindFiles@files:ISDone.dll stdcall delayload';
  165. function ISPickFilename(FindHandle:integer; OutPath:AnsiString; var CurIndex:integer; DeleteInFile:boolean):boolean; external 'ISPickFilename@files:ISDone.dll stdcall delayload';
  166. function ISGetName(TypeStr:integer):PAnsichar; external 'ISGetName@files:ISDone.dll stdcall delayload';
  167. function ISFindFree(FindHandle:integer):boolean; external 'ISFindFree@files:ISDone.dll stdcall delayload';
  168. function ISExec(CurComponent:Cardinal; PctOfTotal,SpecifiedProcessTime:double; ExeName,Parameters,TargetDir,OutputStr:AnsiString;Show:boolean):boolean; external 'ISExec@files:ISDone.dll stdcall delayload';
  169.  
  170. function SrepInit(TmpPath:PAnsiChar;VirtMem,MaxSave:Cardinal):boolean; external 'SrepInit@files:ISDone.dll stdcall delayload';
  171. function PrecompInit(TmpPath:PAnsiChar;VirtMem:cardinal;PrecompVers:single):boolean; external 'PrecompInit@files:ISDone.dll stdcall delayload';
  172. function FileSearchInit(RecursiveSubDir:boolean):boolean; external 'FileSearchInit@files:ISDone.dll stdcall delayload';
  173. function ISDoneInit(RecordFileName:AnsiString; TimeType,Comp1,Comp2,Comp3:Cardinal; WinHandle, NeededMem:longint; callback:TCallback):boolean; external 'ISDoneInit@files:ISDone.dll stdcall';
  174. function ISDoneStop:boolean; external 'ISDoneStop@files:ISDone.dll stdcall';
  175. function ChangeLanguage(Language:AnsiString):boolean; external 'ChangeLanguage@files:ISDone.dll stdcall delayload';
  176. function SuspendProc:boolean; external 'SuspendProc@files:ISDone.dll stdcall';
  177. function ResumeProc:boolean; external 'ResumeProc@files:ISDone.dll stdcall';
  178.  
  179. function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
  180. begin
  181. if OveralPct<=1000 then ISDoneProgressBar1.Position := OveralPct;
  182. LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
  183. LabelCurrFileName.Caption:=' Extracting File: '+MinimizePathName(CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width-ScaleX(100));
  184. LabelTime1.Caption:=' Time Elapsed: '+TimeStr2;
  185. LabelTime2.Caption:='Time Remaining: '+TimeStr1;
  186. // LabelTime3.Caption:='Installing time:'+TimeStr3;
  187. Result := ISDoneCancel;
  188. end;
  189.  
  190. procedure CancelButtonOnClick(Sender: TObject);
  191. begin
  192. SuspendProc;
  193. if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then ISDoneCancel:=1;
  194. ResumeProc;
  195. end;
  196.  
  197. procedure HideControls;
  198. begin
  199. WizardForm.FileNamelabel.Hide;
  200. ISDoneProgressBar1.Hide;
  201. LabelPct1.Hide;
  202. LabelCurrFileName.Hide;
  203. LabelTime1.Hide;
  204. LabelTime2.Hide;
  205. MyCancelButton.Hide;
  206. end;
  207.  
  208. procedure CreateControls;
  209. var PBTop:integer;
  210. begin
  211. PBTop:=ScaleY(150);
  212. ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
  213. with ISDoneProgressBar1 do begin
  214. Parent := WizardForm;
  215. Height := 25;
  216. Left := ScaleX(77);
  217. Top := PBTop;
  218. Width := ScaleX(500);
  219. Max := 1000;
  220. end;
  221. LabelCurrFileName := TLabel.Create(WizardForm);
  222. with LabelCurrFileName do begin
  223. Parent := WizardForm;
  224. AutoSize := False;
  225. Width := ISDoneProgressBar1.Width+ScaleX(30);
  226. Left := ISDoneProgressBar1.Left;
  227. Top := PBTop-20;
  228. end;
  229.  
  230. LabelTime1 := TLabel.Create(WizardForm);
  231. with LabelTime1 do begin
  232. Parent := WizardForm;
  233. AutoSize := False;
  234. Width := ISDoneProgressBar1.Width div 2;
  235. Left := ISDoneProgressBar1.Left;
  236. Top := PBTop + ScaleY(30);
  237. end;
  238. LabelTime2 := TLabel.Create(WizardForm);
  239. with LabelTime2 do begin
  240. Parent := WizardForm;
  241. AutoSize := False;
  242. Width := LabelTime1.Width+ScaleX(40);
  243. Left := 400;
  244. Top := LabelTime1.Top;
  245. end;
  246. LabelPct1 := TLabel.Create(WizardForm);
  247. with LabelPct1 do begin
  248. Parent := WizardForm;
  249. AutoSize := true;
  250. Font.Height:=-24;
  251. Left := ISDoneProgressBar1.Left -33 + ISDoneProgressBar1.Width div 2;
  252. Top := ISDoneProgressBar1.Top + ScaleY(70);
  253. //Width := ScaleX(80);
  254. end;
  255. // LabelTime3 := TLabel.Create(WizardForm);
  256. // with LabelTime3 do begin
  257. // Parent := WizardForm;
  258. // AutoSize := False;
  259. // Width := 300;
  260. // Left := 180;
  261. // Top := 200;
  262. // end;
  263. MyCancelButton:=TButton.Create(WizardForm);
  264. with MyCancelButton do begin
  265. Parent:=WizardForm;
  266. Width:=ScaleX(150);
  267. Caption:='Cancel';
  268. Left:=ScaleX(347);
  269. Height:=ScaleX(30);
  270. Left:=(480);
  271. Top:=WizardForm.cancelbutton.top;
  272. OnClick:=@CancelButtonOnClick;
  273. end;
  274. end;
  275.  
  276.  
  277. function CheckError:boolean;
  278. begin
  279. result:= not ISDoneError;
  280. end;
  281.  
  282. // Importing LoadSkin API from ISSkin.DLL
  283. procedure LoadSkin(lpszPath: PAnsiChar; lpszIniFileName: PAnsiChar);
  284. external 'LoadSkin@{tmp}\isskin.dll stdcall delayload';
  285.  
  286. // Importing UnloadSkin API from ISSkin.DLL
  287. procedure UnloadSkin;
  288. external 'UnloadSkin@{tmp}\isskin.dll stdcall delayload';
  289.  
  290. // Importing ShowWindow Windows API from User32.DLL
  291. function ShowWindow(hWnd: Integer; uType: Integer): Integer;
  292. external 'ShowWindow@user32.dll stdcall';
  293.  
  294. var
  295. WelcomeLbl,DirLbl,GroupLbl,TasksLbl,FreeSpaceLabel,NeedSpaceLabel,GameSpaceLabel,PartitionSpaceLabel,Status: TLabel;
  296. DirBevel,GroupBevel,TasksBevel,TasksSeparateBevel,Bevel1,Bevel11,Bevel2,Bevel3,Bevel4,Bevel5,Bevel6,Bevel7,Bevel8,Bevel9,Bevel20,Bevel21,Bevel22,Bevel23: TBevel;
  297. FreeMB,TotalMB: cardinal;
  298.  
  299. function InitializeSetup1(): Boolean;
  300. begin
  301. ExtractTemporaryFile('isskin.dll');
  302. ExtractTemporaryFile('skin.cjstyles');
  303. LoadSkin(ExpandConstant('{tmp}\skin.cjstyles'), '');
  304. Result := True;
  305. end;
  306.  
  307. Function NumToStr(Float: Extended): String;
  308. Begin
  309. Result:= Format('%.2n', [Float]); StringChange(Result, ',', '.');
  310. while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
  311. SetLength(Result, Length(Result)-1);
  312. End;
  313.  
  314. Function MbOrTb(Byte: Extended): String;
  315. begin
  316. if Byte < 1024 then Result:= NumToStr(Byte) + ' MB' else
  317. if Byte/1024 < 1024 then Result:= NumToStr(round(Byte/1024*100)/100) + ' GB' else
  318. Result:= NumToStr(round((Byte/(1024*1024))*100)/100) + ' TB'
  319. end;
  320.  
  321. procedure GetFreeSpaceCaption(Sender: TObject);
  322. var Path: String;
  323. begin
  324. Path := ExtractFileDrive(WizardForm.DirEdit.Text);
  325. GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
  326. PartitionSpaceLabel.Caption:= ExpandConstant('Partition Space : ') + MbOrTb(TotalMB);
  327. FreeSpaceLabel.Caption := ExpandConstant('Free Space : ') + MbOrTb(FreeMB) + ' (' + IntToStr((FreeMB * 100) div TotalMB) + '%)';
  328. // GameSpaceLabel.Caption := ExpandConstant('Game Space : ') + MbOrTb({#AppSize});
  329. // NeedSpaceLabel.Caption := ExpandConstant('Total Needed Space : ') + MbOrTb({#AppSize});
  330. if (FreeMB<{#AppSize}) then
  331. FreeSpaceLabel.Font.Color:=clRed
  332. else
  333. PartitionSpaceLabel.Font.Color:=NeedSpaceLabel.Font.Color;
  334. WizardForm.NextButton.Enabled:=FreeMB>{#AppSize};
  335. end;
  336.  
  337. var
  338. DirectXCB,VisualCCB,Framework,IconCB: TNewCheckBox;
  339. //---COMPONENTS POSITION CONTROL---\\
  340. procedure Tasks;
  341. begin
  342. TasksBevel := TBevel.Create(WizardForm);
  343. with TasksBevel do
  344. begin
  345. Parent := WizardForm;
  346. Left := ScaleX(90);
  347. Top := ScaleY(150);
  348. Width := ScaleX(470);
  349. Height := ScaleY(73);
  350. end;
  351. //------------------------\\
  352.  
  353. //---Top---\\
  354. Bevel20 := TBevel.Create(WizardForm);
  355. with Bevel20 do
  356. begin
  357. Parent := WizardForm;
  358. Left := ScaleX(92);
  359. Top := ScaleY(150);
  360. Width := ScaleX(470);
  361. Height := ScaleY(2);
  362. end;
  363. //---Bottom---\\
  364. Bevel21 := TBevel.Create(WizardForm);
  365. with Bevel21 do
  366. begin
  367. Parent := WizardForm;
  368. Left := ScaleX(92);
  369. Top := ScaleY(308);
  370. Width := ScaleX(470);
  371. Height := ScaleY(2);
  372. end;
  373. //---Left---\\
  374. Bevel22 := TBevel.Create(WizardForm);
  375. with Bevel22 do
  376. begin
  377. Parent := WizardForm;
  378. Left := ScaleX(92);
  379. Top := ScaleY(152);
  380. Width := ScaleX(2);
  381. Height := ScaleY(158);
  382. end;
  383. //---Right---\\
  384. Bevel23 := TBevel.Create(WizardForm);
  385. with Bevel23 do
  386. begin
  387. Parent := WizardForm;
  388. Left := ScaleX(560);
  389. Top := ScaleY(152);
  390. Width := ScaleX(2);
  391. Height := ScaleY(156);
  392. end;
  393. //------------------------\\
  394.  
  395. DirectXCB := TNewCheckBox.Create(WizardForm);
  396. with DirectXCB do
  397. begin
  398. Parent := WizardForm;
  399. Left :=(112);
  400. Top :=(170);
  401. Width := ScaleX(265);
  402. Height := ScaleY(17);
  403. Caption:='Install DirectX';
  404. end;
  405.  
  406. VisualCCB := TNewCheckBox.Create(WizardForm);
  407. with VisualCCB do
  408. begin
  409. Parent := WizardForm;
  410. Left :=(112);
  411. Top :=(190);
  412. Width := ScaleX(265);
  413. Height := ScaleY(17);
  414. Caption := 'Install Visual C ++';
  415. end;
  416.  
  417. Framework := TNewCheckBox.Create(WizardForm);
  418. with Framework do
  419. begin
  420. Parent := WizardForm;
  421. Left :=(112);
  422. Top :=(210);
  423. Width := ScaleX(265);
  424. Height := ScaleY(17);
  425. Caption:='Install Framework';
  426. end;
  427.  
  428. TasksSeparateBevel := TBevel.Create(WizardForm);
  429. with TasksSeparateBevel do
  430. begin
  431. Parent := WizardForm;
  432. Left :=(10);
  433. Top :=(260);
  434. Width := TasksBevel.Width - 0;
  435. Height := ScaleY(2);
  436. Width := ScaleX(440);
  437. Left := ScaleX(107);
  438. end;
  439.  
  440. IconCB := TNewCheckBox.Create(WizardForm);
  441. with IconCB do
  442. begin
  443. Parent := WizardForm;
  444. Left := (112);
  445. Top :=(275);
  446. Width := ScaleX(255);
  447. Height := ScaleY(17);
  448. Caption := 'Create Desktop Shortcut';
  449. end;
  450. end;
  451.  
  452. //-----------------------------------\\
  453.  
  454. procedure LogoLabelOnClick(Sender: TObject);
  455. var
  456. ErrorCode: Integer;
  457. begin
  458. ShellExec('open', '{#AppURL}', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode)
  459. end;
  460.  
  461. procedure InitializeWizard1();
  462. begin
  463. WizardForm.WizardBitmapImage2.Cursor:=crHand;
  464. WizardForm.WizardBitmapImage2.OnClick:=@LogoLabelOnClick;
  465. WizardForm.ClientWidth:=654;
  466. WizardForm.ClientHeight:=402;
  467. WizardForm.InnerNotebook.Hide;
  468. WizardForm.OuterNotebook.Hide;
  469. WizardForm.WizardBitmapImage.Stretch:=True;
  470. WizardForm.WizardBitmapImage.Parent:=WizardForm;
  471. ExtractTemporaryFile ('logo.bmp');
  472. WizardForm.WizardBitmapImage2.Width := ScaleX(230);
  473. WizardForm.WizardBitmapImage2.Height := ScaleX(55);
  474. WizardForm.WizardBitmapImage2.Top:=340;
  475. WizardForm.WizardBitmapImage2.Left:=5;
  476. WizardForm.WizardBitmapImage2.Bitmap.LoadFromFile(ExpandConstant('{tmp}\logo.bmp'));
  477. WizardForm.WizardBitmapImage2.Parent:=WizardForm;
  478. WizardForm.WizardSmallBitmapImage.Stretch:=True;
  479. WizardForm.WizardSmallBitmapImage.Parent:=WizardForm;
  480. WizardForm.WizardSmallBitmapImage.SetBounds(0,0,WizardForm.ClientWidth,90);
  481. WizardForm.Bevel1.Parent:=WizardForm;
  482. WizardForm.Bevel1.Top:=90;
  483. WizardForm.Bevel1.Width:=WizardForm.ClientWidth;
  484. WizardForm.Bevel.Parent:=WizardForm;
  485. WizardForm.Bevel.Top:=330;
  486. WizardForm.Bevel.Width:=WizardForm.ClientWidth;
  487. WizardForm.SelectDirBitmapImage.Parent:=WizardForm;
  488. WizardForm.SelectDirBitmapImage.Top:=125;
  489. WizardForm.SelectDirBitmapImage.Left:=40;
  490. WizardForm.DirEdit.Parent:=WizardForm;
  491. WizardForm.DirEdit.Top:=130;
  492. WizardForm.DirEdit.Left:=75;
  493. WizardForm.DirEdit.Width:=430;
  494. WizardForm.DirEdit.OnChange:=@GetFreeSpaceCaption;
  495. WizardForm.DirBrowseButton.Parent:=WizardForm;
  496. WizardForm.DirBrowseButton.Top:=125;
  497. WizardForm.DirBrowseButton.Left:=515;
  498. WizardForm.DirBrowseButton.Width:=90;
  499. WizardForm.DirBrowseButton.Height:=30;
  500. WizardForm.GroupEdit.Parent:=WizardForm;
  501. WizardForm.GroupEdit.Top:=255;
  502. WizardForm.GroupEdit.Left:=75;
  503. WizardForm.GroupEdit.Width:=430;
  504. WizardForm.GroupBrowseButton.Parent:=WizardForm;
  505. WizardForm.GroupBrowseButton.Top:=250;
  506. WizardForm.GroupBrowseButton.Left:=515;
  507. WizardForm.GroupBrowseButton.Width:=90;
  508. WizardForm.GroupBrowseButton.Height:=30;
  509. WizardForm.NoIconsCheck.Parent:=WizardForm;
  510. WizardForm.NoIconsCheck.Left:=75;
  511. WizardForm.NoIconsCheck.Top:=285;
  512. WizardForm.SelectGroupBitmapImage.Parent:=WizardForm;
  513. WizardForm.SelectGroupBitmapImage.Top:=250;
  514. WizardForm.SelectGroupBitmapImage.Left:=40;
  515. WizardForm.WizardBitmapImage.SetBounds(0,0,WizardForm.ClientWidth,330);
  516. WizardForm.NextButton.SetBounds(525,347,100,30);
  517. WizardForm.CancelButton.SetBounds(420,347,100,30);
  518. WizardForm.BackButton.SetBounds(315,347,100,30);
  519.  
  520. WelcomeLbl:=TLabel.Create(WizardForm);
  521. With WelcomeLbl do begin
  522. Transparent:=true;
  523. Parent:=WizardForm;
  524. Alignment:=taCenter;
  525. Caption:='Welcome to The "{#AppName}" Setup Wizard' + #13#10#13#10 + 'Its recomended that you close all other applications before continuing.' + #13#10#13#10 + 'Click "Next" to continue';
  526. Font.Color:=clWhite;
  527. Font.Size:=9;
  528. SetBounds(126,205,400,90);
  529. end;
  530. //
  531. Tasks;
  532. DirBevel := TBevel.Create(WizardForm);
  533. with DirBevel do
  534. begin
  535. Parent := WizardForm;
  536. Left := ScaleX(28);
  537. Top := ScaleY(110);
  538. Width := ScaleX(594);
  539. Height := ScaleY(110);
  540. end;
  541.  
  542. //-----Bevel Line Page 2 Bottom-----\\
  543.  
  544. //---Top---\\
  545. Bevel3 := TBevel.Create(WizardForm);
  546. with Bevel3 do
  547. begin
  548. Parent := WizardForm;
  549. Left := ScaleX(27);
  550. Top := ScaleY(235);
  551. Width := ScaleX(594);
  552. Height := ScaleY(2);
  553. end;
  554. //---Bottom---\\
  555. Bevel4 := TBevel.Create(WizardForm);
  556. with Bevel4 do
  557. begin
  558. Parent := WizardForm;
  559. Left := ScaleX(27);
  560. Top := ScaleY(313);
  561. Width := ScaleX(595);
  562. Height := ScaleY(2);
  563. end;
  564. //---Left---\\
  565. Bevel5 := TBevel.Create(WizardForm);
  566. with Bevel5 do
  567. begin
  568. Parent := WizardForm;
  569. Left := ScaleX(27);
  570. Top := ScaleY(236);
  571. Width := ScaleX(2);
  572. Height := ScaleY(78);
  573. end;
  574. //---Right---\\
  575. Bevel6 := TBevel.Create(WizardForm);
  576. with Bevel6 do
  577. begin
  578. Parent := WizardForm;
  579. Left := ScaleX(620);
  580. Top := ScaleY(235);
  581. Width := ScaleX(2);
  582. Height := ScaleY(79);
  583. end;
  584. //------------------------\\
  585.  
  586. //-----Bevel Line Page 2 Top-----\\
  587.  
  588. //---Top---\\
  589. Bevel7 := TBevel.Create(WizardForm);
  590. with Bevel7 do
  591. begin
  592. Parent := WizardForm;
  593. Left := ScaleX(27);
  594. Top := ScaleY(110);
  595. Width := ScaleX(595);
  596. Height := ScaleY(2);
  597. end;
  598. //---Bottom---\\
  599. Bevel8 := TBevel.Create(WizardForm);
  600. with Bevel8 do
  601. begin
  602. Parent := WizardForm;
  603. Left := ScaleX(27);
  604. Top := ScaleY(218);
  605. Width := ScaleX(595);
  606. Height := ScaleY(2);
  607. end;
  608. //---Right---\\
  609. Bevel9 := TBevel.Create(WizardForm);
  610. with Bevel9 do
  611. begin
  612. Parent := WizardForm;
  613. Left := ScaleX(620);
  614. Top := ScaleY(110);
  615. Width := ScaleX(2);
  616. Height := ScaleY(108);
  617. end;
  618. //---Left---\\
  619. Bevel11 := TBevel.Create(WizardForm);
  620. with Bevel11 do
  621. begin
  622. Parent := WizardForm;
  623. Left := ScaleX(27);
  624. Top := ScaleY(111);
  625. Width := ScaleX(2);
  626. Height := ScaleY(109);
  627. end;
  628.  
  629. //------------------------\\
  630. Status:=TLabel.Create(WizardForm);
  631. With Status do begin
  632. //Transparent:=true;
  633. Parent:=WizardForm;
  634. Alignment:=taCenter;
  635. //Font.Color:=clWhite;
  636. Font.Height:=-15;
  637. SetBounds(0,250,650,30);
  638. end;
  639.  
  640. DirLbl:=TLabel.Create(WizardForm);
  641. With DirLbl do begin
  642. //Transparent:=true;
  643. Parent:=WizardForm;
  644. //Alignment:=taCenter;
  645. Caption:=' Setup will install The game into the following folder ';
  646. Font.Color:=clWhite;
  647. SetBounds(52,105,251,15);
  648. end;
  649. GroupLbl:=TLabel.Create(WizardForm);
  650. With GroupLbl do begin
  651. //Transparent:=true;
  652. Parent:=WizardForm;
  653. //Alignment:=taCenter;
  654. Caption:=' Setup will create shortcuts in the following Start ';
  655. Font.Color:=clWhite;
  656. SetBounds(52,230,235,15);
  657. end;
  658. TasksLbl:=TLabel.Create(WizardForm);
  659. With TasksLbl do begin
  660. //Transparent:=true;
  661. Parent:=WizardForm;
  662. //Alignment:=taCenter;
  663. Caption:='Select the components you want to install; clear the components you do not want to' + #13#10 + 'install. Click Next when you are ready to continue.';
  664. //Font.Color:=clWhite;
  665. SetBounds(125,105,407,30);
  666. end;
  667. //---PARTITION SPACE---\\
  668. PartitionSpaceLabel:=TLabel.Create(WizardForm);
  669. With PartitionSpaceLabel do begin
  670. //Transparent:=true;
  671. Parent:=WizardForm;
  672. //Alignment:=taCenter;
  673. //Font.Color:=clWhite;
  674. Font.Height:=-13;
  675. SetBounds(75,160,200,30);
  676. end;
  677. //---FREE SPACE---\\
  678. FreeSpaceLabel:=TLabel.Create(WizardForm);
  679. With FreeSpaceLabel do begin
  680. //Transparent:=true;
  681. Parent:=WizardForm;
  682. //Alignment:=taCenter;
  683. //Font.Color:=clWhite;
  684. Font.Height:=-13;
  685. SetBounds(335,160,200,30);
  686. end;
  687. //---GAME SPACE---\\
  688. GameSpaceLabel:=TLabel.Create(WizardForm);
  689. With GameSpaceLabel do begin
  690. //Transparent:=true;
  691. Parent:=WizardForm;
  692. //Alignment:=taCenter;
  693. //Font.Color:=clWhite;
  694. Font.Height:=-13;
  695. SetBounds(75,190,200,30);
  696. end;
  697. //---Total Needed Space---\\
  698. NeedSpaceLabel:=TLabel.Create(WizardForm);
  699. With NeedSpaceLabel do begin
  700. //Transparent:=true;
  701. Parent:=WizardForm;
  702. //Alignment:=taCenter;
  703. //Font.Color:=clWhite;
  704. Font.Height:=-13;
  705. SetBounds(335,190,200,30);
  706. end;
  707. end;
  708.  
  709. Procedure HideComponents();
  710. begin
  711. WizardForm.WizardSmallBitmapImage.Hide;
  712. WizardForm.Bevel1.Hide;
  713. DirBevel.Hide;
  714. Bevel3.Hide;
  715. Bevel4.Hide;
  716. Bevel5.Hide;
  717. Bevel6.Hide;
  718. Bevel7.Hide;
  719. Bevel8.Hide;
  720. Bevel9.Hide;
  721. Bevel11.Hide;
  722. Bevel20.Hide;
  723. Bevel21.Hide;
  724. Bevel22.Hide;
  725. Bevel23.Hide;
  726. TasksBevel.Hide;
  727. DirLbl.Hide;
  728. GroupLbl.Hide;
  729. TasksLbl.Hide;
  730. DirectXCB.Hide;
  731. VisualCCB.Hide;
  732. Framework.Hide;
  733. IconCB.Hide;
  734. WizardForm.SelectDirBitmapImage.Hide;
  735. WizardForm.SelectGroupBitmapImage.Hide;
  736. WizardForm.DirEdit.Hide;
  737. WizardForm.GroupEdit.Hide;
  738. WizardForm.DirBrowseButton.Hide;
  739. WizardForm.GroupBrowseButton.Hide;
  740. WizardForm.NoIconsCheck.Hide;
  741. WizardForm.WizardBitmapImage.Hide;
  742. WelcomeLbl.Hide;
  743. // WizardForm.ComponentsList.Hide;
  744. // WizardForm.TasksList.Hide;
  745. TasksSeparateBevel.Hide;
  746. PartitionSpaceLabel.Hide;
  747. FreeSpaceLabel.Hide;
  748. GameSpaceLabel.Hide;
  749. NeedSpaceLabel.Hide;
  750. Status.Hide;
  751. end;
  752.  
  753. procedure CurStepChanged1(CurStep: TSetupStep);
  754. var Comps1,Comps2,Comps3, TmpValue:cardinal;
  755. FindHandle1,ColFiles1,CurIndex1,tmp:integer;
  756. ExecError:boolean;
  757. InFilePath,OutFilePath,OutFileName:PAnsiChar;
  758. begin
  759. if CurStep = ssInstall then begin //If necessary, you can change to ssPostInstall
  760. WizardForm.ProgressGauge.Hide;
  761. WizardForm.CancelButton.Hide;
  762. CreateControls;
  763. WizardForm.StatusLabel.Caption:='Extracting Files...';
  764. ISDoneCancel:=0;
  765.  
  766. #ifdef PrecompVer
  767. #if PrecompVer == "0.38"
  768. ExtractTemporaryFile('precomp038.exe');
  769. #endif
  770. #if PrecompVer == "0.40"
  771. ExtractTemporaryFile('precomp040.exe');
  772. #endif
  773. #if PrecompVer == "0.41"
  774. ExtractTemporaryFile('precomp041.exe');
  775. #endif
  776. #if PrecompVer == "0.42"
  777. ExtractTemporaryFile('precomp042.exe');
  778. #endif
  779. #if PrecompVer == "0.43"
  780. ExtractTemporaryFile('precomp043.exe');
  781. #endif
  782. #if PrecompVer == "Inside"
  783. ExtractTemporaryFile('CLS-precomp.dll');
  784. ExtractTemporaryFile('CLS-MSC.dll');
  785. ExtractTemporaryFile('CLS-srep.dll');
  786. ExtractTemporaryFile('precomp.exe');
  787. #endif
  788. #endif
  789. ExtractTemporaryFile('arc.ini');
  790. ExtractTemporaryFile('facompress.dll');
  791. ExtractTemporaryFile('facompress_mt.dll');
  792. ExtractTemporaryFile('XDelta3.dll');
  793. ExtractTemporaryFile('7z.dll');
  794. ExtractTemporaryFile('PackZIP.exe');
  795. ExtractTemporaryFile('english.ini');
  796. ExtractTemporaryFile('FreeArc-LZMA-x64.exe');
  797. ExtractTemporaryFile('srep.exe');
  798. ExtractTemporaryFile('srep64.exe');
  799. ExtractTemporaryFile('unarc.dll');
  800. ExtractTemporaryFile('packjpg_dll.dll');
  801. ExtractTemporaryFile('packjpg_dll1.dll');
  802. ExtractTemporaryFile('zlib1.dll');
  803.  
  804. Comps1:=0; Comps2:=0; Comps3:=0;
  805. #ifdef Components
  806. TmpValue:=1;
  807. if IsComponentSelected('text\rus') then Comps1:=Comps1+TmpValue; //component 1
  808. TmpValue:=TmpValue*2;
  809. if IsComponentSelected('text\eng') then Comps1:=Comps1+TmpValue; //component 2
  810. TmpValue:=TmpValue*2;
  811. if IsComponentSelected('voice\rus') then Comps1:=Comps1+TmpValue; //component 3
  812. TmpValue:=TmpValue*2;
  813. if IsComponentSelected('voice\eng') then Comps1:=Comps1+TmpValue; //component 4
  814. #endif
  815.  
  816. #ifdef precomp
  817. PCFVer:={#precomp};
  818. #else
  819. PCFVer:=0;
  820. #endif
  821. ISDoneError:=true;
  822. if ISDoneInit(ExpandConstant('{src}\records.inf'), $F777, Comps1,Comps2,Comps3, MainForm.Handle, 512, @ProgressCallback) then begin
  823. repeat
  824. ChangeLanguage('english');
  825. if not SrepInit('',512,0) then break;
  826. if not PrecompInit('',128,PCFVer) then break;
  827. if not FileSearchInit(true) then break;
  828. #include 'Archives.ini'
  829. ISDoneError:=false;
  830. until true;
  831. ISDoneStop;
  832. end;
  833. HideControls;
  834. WizardForm.CancelButton.Visible:=true;
  835. WizardForm.CancelButton.Enabled:=false;
  836. Status.Show;
  837. end;
  838.  
  839. if CurStep=ssPostInstall then begin
  840.  
  841. Exec2(ExpandConstant('{sys}\cmd.exe'),'/c timeout /T 3 /NOBREAK & taskkill /f /im precomp*',false);
  842.  
  843. if DirectXCB.Checked then begin
  844. Status.Caption:='Installing DirectX...';
  845. Status.Left := 200;
  846. Status.Top := 200;
  847. Status.Width := 223;
  848. Status.Height := 20;
  849. Exec2(ExpandConstant('{src}\_CommonRedist\DXSETUP.exe'),'/silent',false);
  850. end;
  851. if VisualCCB.Checked then begin
  852. Status.Caption:='Installing Visual C++...';
  853. Status.Left := 200;
  854. Status.Top := 200;
  855. Status.Width := 227;
  856. Status.Height := 20;
  857. Exec2(ExpandConstant('{src}\_CommonRedist\vc\2005\vcx86.exe'),'/q',false);
  858. if IsWin64() then begin
  859. Exec2(ExpandConstant('{src}\_CommonRedist\vc\2005\vcx64.exe'),'/q',false);
  860. end;
  861. Exec2(ExpandConstant('{src}\_CommonRedist\vc\2008\vcx86.exe'),'/q',false);
  862. if IsWin64() then begin
  863. Exec2(ExpandConstant('{src}\_CommonRedist\vc\2008\vcx64.exe'),'/q',false);
  864. end;
  865. Exec2(ExpandConstant('{src}\_CommonRedist\vc\2010\vcx86.exe'),'/q',false);
  866. if IsWin64() then begin
  867. Exec2(ExpandConstant('{src}\_CommonRedist\vc\2010\vcx64.exe'),'/q',false);
  868. end;
  869. Exec2(ExpandConstant('{src}\_CommonRedist\vc\2012\vcx86.exe'),'/q',false);
  870. if IsWin64() then begin
  871. Exec2(ExpandConstant('{src}\_CommonRedist\vc\2012\vcx64.exe'),'/q',false);
  872. end;
  873. Exec2(ExpandConstant('{src}\_CommonRedist\vc\2013\vcx86.exe'),'/q',false);
  874. if IsWin64() then begin
  875. Exec2(ExpandConstant('{src}\_CommonRedist\vc\2013\vcx64.exe'),'/q',false);
  876. end;
  877. Exec2(ExpandConstant('{src}\_CommonRedist\vc\2015\vcx86.exe'),'/q',false);
  878. if IsWin64() then begin
  879. Exec2(ExpandConstant('{src}\_CommonRedist\vc\2015\vcx64.exe'),'/q',false);
  880. end;
  881.  
  882. end;
  883. if Framework.Checked then begin
  884. Status.Caption:='Installing Framework...';
  885. Status.Left := 200;
  886. Status.Top := 200;
  887. Status.Width := 227;
  888. Status.Height := 20;
  889. Exec2(ExpandConstant('{src}\_CommonRedist\dotNetFx451_Full_setup.exe'),'/q',false);
  890. end;
  891. end;
  892. if (CurStep=ssInstall) and ISDoneError then begin
  893. Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
  894. end;
  895. end;
  896. //-------- First Page --------\\
  897. procedure CurPageChanged1(CurPageID: integer);
  898. begin
  899. if CurPageID=wpWelcome then begin
  900. HideComponents;
  901. WizardForm.Position:=poScreenCenter;
  902. Bevel3.Hide;
  903. Bevel4.Hide;
  904. Bevel5.Hide;
  905. Bevel6.Hide;
  906. WizardForm.WizardBitmapImage.Show;
  907. WelcomeLbl.Show;
  908. WizardForm.CancelButton.show;
  909. end;
  910. //-------- Second Page --------\\
  911. if CurPageID=wpSelectDir then begin
  912. HideComponents;
  913. WizardForm.Position:=poScreenCenter;
  914. WizardForm.WizardSmallBitmapImage.Show;
  915. WizardForm.Bevel1.Show;
  916. DirBevel.Show;
  917. Bevel3.Show;
  918. Bevel4.Show;
  919. Bevel5.Show;
  920. Bevel6.Show;
  921. Bevel7.Show;
  922. Bevel8.Hide;
  923. Bevel9.Show;
  924. Bevel11.Show;
  925. WizardForm.Caption:= 'Select Dir «{#AppName}»';
  926. WizardForm.SelectDirBitmapImage.Show;
  927. WizardForm.SelectGroupBitmapImage.Show;
  928. WizardForm.DirEdit.Show;
  929. WizardForm.GroupEdit.Show;
  930. WizardForm.DirBrowseButton.Show;
  931. WizardForm.GroupBrowseButton.Show;
  932. WizardForm.NoIconsCheck.Show;
  933. DirLbl.Show;
  934. GroupLbl.Show;
  935. PartitionSpaceLabel.Show;
  936. FreeSpaceLabel.Show;
  937. GameSpaceLabel.Show;
  938. NeedSpaceLabel.Show;
  939. GetFreeSpaceCaption(nil);
  940. end;
  941. //--------Installation Page--------\\
  942. if CurPageID=wpInstalling then begin
  943. TasksSeparateBevel.Hide;
  944. HideComponents;
  945. WizardForm.Position:=poScreenCenter;
  946. WizardForm.WizardSmallBitmapImage.Show;
  947. WizardForm.Caption:= 'Installing «{#AppName}»';
  948. WizardForm.Bevel1.Show;
  949. WizardForm.TasksList.CheckItem(0,IconCB.Checked);
  950. end;
  951. //--------Game was successfully installed PAGE--------\\
  952. if CurPageID=wpFinished then begin
  953. HideComponents;
  954. WizardForm.Position:=poScreenCenter;
  955. WizardForm.WizardBitmapImage.Show;
  956. WelcomeLbl.Show;
  957. WelcomeLbl.Left:=145;
  958. WizardForm.Caption:= 'Finish «{#AppName}» Setup Wizard';
  959. WelcomeLbl.Caption:='«{#AppName}» was successfully installed on your computer.' + #13#10#13#10 + 'Run the game from shortcut in "start" menu or Desktop shortcut.' + #13#10#13#10 + 'Click "Finish" to exit the installation program.';
  960. end;
  961. //--------Game Fail To Install PAGE--------\\
  962. if (CurPageID = wpFinished) and ISDoneError then
  963. begin
  964. //LabelTime3.Hide;
  965. WizardForm.Caption:= 'Error! «{#AppName}»';
  966. WelcomeLbl.Font.Color:= clRed;
  967. WelcomeLbl.Caption:= 'Setup encountered an error while installing «{#AppName}»' + #13#10#13#10 + 'Changes were not saved , please re-run the setup again.';
  968. WelcomeLbl.Left:=163;
  969. end;
  970. end;
  971.  
  972. function ShouldSkipPage1(PageID: Integer): Boolean;
  973. begin
  974. if (PageID=wpSelectProgramGroup) or (PageID=wpReady) or (PageID=wpSelectComponents) then Result:=true;
  975. end;
  976.  
  977. procedure DeinitializeSetup1();
  978. begin
  979.  
  980. Exec2(ExpandConstant('{sys}\cmd.exe'),' /c timeout /T 3 /NOBREAK & taskkill /f /im precomp*',false);
  981.  
  982. ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
  983. UnloadSkin();
  984. end;
  985.  
  986. procedure ShowSplashScreen(p1:HWND;p2:AnsiString;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10 :integer); external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';
  987. procedure InitializeWizard2();
  988. begin
  989. ExtractTemporaryFile('Splash.png');
  990. ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}\Splash.png'),1000,3000,1000,0,255,True,$FFFFFF,10);
  991. end;
  992.  
  993. function InitializeSetup(): Boolean;
  994. begin
  995. Result := InitializeSetup1(); if not Result then exit;
  996. end;
  997.  
  998. procedure InitializeWizard();
  999. begin
  1000. ExtractTemporaryFile('music.mp3');
  1001. if BASS_Init(-1, 44100, 0, 0, 0) then
  1002. begin
  1003. SoundStream := BASS_StreamCreateFile(False,
  1004. ExpandConstant('{tmp}\music.mp3'), 0, 0, 0, 0,
  1005. EncodingFlag or BASS_SAMPLE_LOOP);
  1006. BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 2500);
  1007. BASS_ChannelPlay(SoundStream, False);
  1008.  
  1009. SoundCtrlButton := TNewButton.Create(WizardForm);
  1010. SoundCtrlButton.Parent := WizardForm;
  1011. SoundCtrlButton.SetBounds(210,347,100,30);
  1012. SoundCtrlButton.Caption :=
  1013. ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOff}');
  1014. SoundCtrlButton.OnClick := @SoundCtrlButtonClick;
  1015. RedesignWizardForm;
  1016. InitializeWizard1();
  1017. InitializeWizard2();
  1018. end;
  1019. end;
  1020.  
  1021. procedure CurStepChanged(CurStep: TSetupStep);
  1022. begin
  1023. CurStepChanged1(CurStep);
  1024. end;
  1025.  
  1026. procedure CurPageChanged(CurPageID: Integer);
  1027. begin
  1028. CurPageChanged1(CurPageID);
  1029. end;
  1030.  
  1031. function ShouldSkipPage(PageID: Integer): Boolean;
  1032. begin
  1033. Result := ShouldSkipPage1(PageID); if not Result then exit;
  1034. end;
  1035.  
  1036. procedure DeinitializeSetup();
  1037. begin
  1038.  
  1039. BASS_Free();
  1040. DeinitializeSetup1();
  1041. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement