HTML Code:
/////Script created by y_thelastknight@fileforums and Razor12911@fileforums/////
[Setup]
AppName={code:GameName}
AppPublisher={code:GamePublisher}
AppVersion={code:GameVersion}
AppComments={code:GameName}
DefaultDirName={pf}\{code:GamePublisher}\{code:GameName}
DefaultGroupName={code:GamePublisher}\{code:GameName}
OutputBaseFilename=Setup
OutputDir=Output
Compression=lzma2/ultra64
UsePreviousLanguage=no
SetupIconFile=Image\Icon.ico
#ifdef Internal
DiskSpanning=yes
DiskSliceSize=906993073
SlicesPerDisk=5
#endif
[files]
Source: Include\*.*; Flags: dontcopy;
Source: Image\*.*; Flags: dontcopy;
#ifexist "Image\Video.avi"
#define Video
Source: Image\video.avi; Flags: dontcopy;
#endif
#define i 0
#ifexist "Slides\1.jpg"
#sub AddFile
Source: Slides\{#i}.jpg; DestDir: {tmp}; Flags: dontcopy;
#endsub
#for {i = 1; FileExists(StringChange("Slides\FileName.jpg", "FileName", Str(i))) != 0; i++} AddFile
#endif
[Icons]
Name: {group}\Uninstall {code:GameName}; Filename: {app}\unins000.exe; WorkingDir: {app};
Name: {group}\{code:GameName}; Filename: {app}\{code:GameIcon1}; WorkingDir: {app};
Name: {group}\{code:GameName} {code:GameIcon2N}; Filename: {app}\{code:GameIcon2}; WorkingDir: {app}; Check: Icon2
Name: {commondesktop}\{code:GameName}; Filename: {app}\{code:GameIcon1}; WorkingDir: {app}; Check: Desktop
Name: {commondesktop}\{code:GameName} {code:GameIcon2N}; Filename: {app}\{code:GameIcon2}; WorkingDir: {app}; Check: Desktop and Icon2
[CustomMessages]
hour= hour
min= min
sec= secs
[UninstallDelete]
Type: filesandordirs; Name: {app};
[code]
var
CanUseXvid,
XvidInstalled : boolean;
Type
TMargins = record
cxLeftWidth: Integer;
cxRightWidth: Integer;
cyTopHeight: Integer;
cyBottomHeight: Integer;
end;
type
TProc=procedure(HandleW, msg, idEvent, TimeSys: LongWord);
TTimerProc = procedure(HandleW, Msg, idEvent, TimeSys: LongWord);
TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
TCallback2 = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
var
BmpFile : TBitmapImage;
LogoImage: TBitmapImage;
WizardPanel:TPanel;
ISDoneCancel: Integer;
ISDoneError: Boolean;
LogoLinkLabel,DiskSpaceLablel,SocialLabel,CreateDLabel,VisualCLabel,DirectXLabel,DirWelcomeLabel,DirWelcomeLabel1,InstallpathLabel,SoftwaresLabel,ShortcutLabel: TLabel;
EndFailLabel,EndPassLabel,WLabel:TLabel;
TasksSeparateBevel,TasksSeparateBevel2:TBevel;
ShortcutCB,DirectXCB,VisualCCB,SocialCB:TNewCheckBox;
TimerID2,TimerID: LongWord;
CurrentPicture:integer;
PicList: TStringlist;
BGRadio1,BGRadio2:TNewRadioButton;
BGRadio1Label,BGRadio2Label:TLabel;
StartInstall: Integer;
#ifdef Unicode
#define A "W"
#else
#define A "A"
#endif
function GetTickCount: DWord; external 'GetTickCount@kernel32';
procedure ISWin7_Apply(File: PAnsiChar; X, Y: Integer; Handle: HWND; Left, Right, Top, Bottom: Integer); external 'iswin7_6594@files:iswin7logo.dll stdcall';
procedure ISWin7_AddCtrl(Handle: HWND); external 'iswin7_9736@files:iswin7logo.dll stdcall';
procedure ISWin7_Shutdown(); external 'iswin7_2054@files:iswin7logo.dll stdcall';
procedure ISWin7_ShowLogo(CmdShow: BOOL); external 'iswin7_2541@files:iswin7logo.dll stdcall';
function SetTimer(hWnd: longword; nIDEvent, uElapse: longword; lpTimerFunc: longword): longword; external '[email protected] stdcall';
procedure InitializeSlideShow(Hwnd:Thandle; l,t,w,h:integer;Animate:boolean; Stretch:integer); external 'InitializeSlideShow@files:isslideshow.dll stdcall';
procedure DeinitializeSlideShow; external 'DeinitializeSlideShow@files:isslideshow.dll stdcall';
procedure ShowImage(ipath:PAnsiChar; Effect:integer); external 'ShowImage@files:isslideshow.dll stdcall';
function sndPlaySound(lpszSoundName: string; uFlags: cardinal):integer;
external 'sndPlaySound{#A}@winmm.dll stdcall';
#ifdef UNICODE
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';
#else
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';
#endif
function WrapCallback(callback:TCallback2; paramcount:integer):longword;external 'wrapcallback@files:ISDone.dll stdcall delayload';
function ISDoneInit(RecordFileName:AnsiString; TimeType,Comp1,Comp2,Comp3:Cardinal; WinHandle, NeededMem:longint; callback:TCallback2):boolean; external 'ISDoneInit@files:ISDone.dll stdcall';
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';
function IS7ZipExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'IS7zipExtract@files:ISDone.dll stdcall delayload';
function ISRarExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'ISRarExtract@files:ISDone.dll stdcall delayload';
function ISPrecompExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISPrecompExtract@files:ISDone.dll stdcall delayload';
function ISSRepExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISSrepExtract@files:ISDone.dll stdcall delayload';
function ISxDeltaExtract(CurComponent:Cardinal; PctOfTotal:double; minRAM,maxRAM:integer; InName, DiffFile, OutFile: AnsiString; DeleteInFile, DeleteDiffFile:boolean):boolean; external 'ISxDeltaExtract@files:ISDone.dll stdcall delayload';
function ISPackZIP(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString;ComprLvl:integer; DeleteInFile:boolean):boolean; external 'ISPackZIP@files:ISDone.dll stdcall delayload';
function ShowChangeDiskWindow(Text, DefaultPath, SearchFile:AnsiString):boolean; external 'ShowChangeDiskWindow@files:ISDone.dll stdcall delayload';
function Exec2 (FileName, Param: PAnsiChar;Show:boolean):boolean; external 'Exec2@files:ISDone.dll stdcall delayload';
function ISFindFiles(CurComponent:Cardinal; FileMask:AnsiString; var ColFiles:integer):integer; external 'ISFindFiles@files:ISDone.dll stdcall delayload';
function ISPickFilename(FindHandle:integer; OutPath:AnsiString; var CurIndex:integer; DeleteInFile:boolean):boolean; external 'ISPickFilename@files:ISDone.dll stdcall delayload';
function ISGetName(TypeStr:integer):PAnsichar; external 'ISGetName@files:ISDone.dll stdcall delayload';
function ISFindFree(FindHandle:integer):boolean; external 'ISFindFree@files:ISDone.dll stdcall delayload';
function ISExec(CurComponent:Cardinal; PctOfTotal,SpecifiedProcessTime:double; ExeName,Parameters,TargetDir,OutputStr:AnsiString;Show:boolean):boolean; external 'ISExec@files:ISDone.dll stdcall delayload';
function SrepInit(TmpPath:PAnsiChar;VirtMem,MaxSave:Cardinal):boolean; external 'SrepInit@files:ISDone.dll stdcall delayload';
function PrecompInit(TmpPath:PAnsiChar;VirtMem:cardinal;PrecompVers:single):boolean; external 'PrecompInit@files:ISDone.dll stdcall delayload';
function FileSearchInit(RecursiveSubDir:boolean):boolean; external 'FileSearchInit@files:ISDone.dll stdcall delayload';
function ISDoneStop:boolean; external 'ISDoneStop@files:ISDone.dll stdcall';
function ChangeLanguage(Language:AnsiString):boolean; external 'ChangeLanguage@files:ISDone.dll stdcall delayload';
function SuspendProc:boolean; external 'SuspendProc@files:ISDone.dll stdcall';
function ResumeProc:boolean; external 'ResumeProc@files:ISDone.dll stdcall';
function mciSendString(lpstrCommand, lpstrReturnString: PAnsiChar; uReturnLength, hWndCallback: Integer): Integer; external 'mciSendStringA@winmm stdcall delayload';
Function TicksToTime(Ticks: DWord; h,m,s: String; detail: Boolean): String;
Begin
if detail then {hh: mm:ss format}
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)
else if Ticks/3600 >= 1000 then {more than hour}
Result:= IntToStr(Ticks/3600000) +h+' '+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +m
else if Ticks/60 >= 1000 then {1..60 minutes}
Result:= IntToStr(Ticks/60000) +m+' '+ IntToStr(Ticks/1000 - Ticks/1000/60*60) +s
else Result:= Format('%.1n', [Abs(Ticks/1000)]) +s {less than one minute}
End;
procedure GetTime(HandleW, Msg, idEvent, TimeSys: LongWord);
var Remaining: Integer;
begin
with WizardForm.ProgressGauge do begin
if position > 0 then Remaining:= trunc((GetTickCount - StartInstall) * Abs((max - position)/position));
// WizardForm.Caption:= 'Remaining ' + TicksToTime(Remaining, cm('hour'), cm('min'), cm('sec'), false);
end;
end;
procedure XvidDelete;
begin
DeleteFile(ExpandConstant('{sys}\xvidcore.dll'));
DeleteFile(ExpandConstant('{sys}\xvidvfw.dll'));
RegDeleteValue(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32','VIDC.XVID');
end;
procedure XvidInstall;
var
f:boolean;
begin
CanUseXvid:=False;
XvidInstalled:=False;
if not (FileExists(ExpandConstant('{sys}\xvidcore.dll')) and
FileExists(ExpandConstant('{sys}\xvidvfw.dll')) and
RegValueExists(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32','VIDC.XVID')) then
try
XvidDelete;
ExtractTemporaryFile('xvidcore.dll');
ExtractTemporaryFile('xvidvfw.dll');
f:=FileCopy(ExpandConstant('{tmp}\xvidcore.dll'),ExpandConstant('{sys}\xvidcore.dll'),False);
f:=f and FileCopy(ExpandConstant('{tmp}\xvidvfw.dll'),ExpandConstant('{sys}\xvidvfw.dll'),False);
f:=f and RegWriteStringValue(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32','VIDC.XVID','xvidvfw.dll');
if f then begin
XvidInstalled:=True;
CanUseXvid:=True;
end else XvidDelete;
except
end
else CanUseXvid:=True;
end;
procedure XvidUnInstall;
begin
if XvidInstalled then XvidDelete;
end;
Function cm(Message: String): String;
Begin
Result:= ExpandConstant('{cm:'+ Message +'}')
End;
function ProgressPercent:Integer;
var
pr,i1,i2: Extended;
begin
if (WizardForm.ProgressGauge.Position>WizardForm.ProgressGauge.Min) then begin
i1:=WizardForm.ProgressGauge.Position-WizardForm.ProgressGauge.Min;
i2:=WizardForm.ProgressGauge.Max-WizardForm.ProgressGauge.Min;
pr:=i1*100/i2;
Result:=Round(100*pr/100);;
end;
end;
function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
var
Remaining: Integer;
begin
if OveralPct<=Wizardform.ProgressGauge.Max then
Wizardform.Progressgauge.Position := OveralPct;
Result := ISDoneCancel;
with WizardForm.ProgressGauge do begin
if position > 0 then Remaining:= trunc((GetTickCount - StartInstall) * Abs((max - position)/position));
WizardForm.Caption:=(IntToStr(ProgressPercent)+'%')+(' Wait ' + TicksToTime(Remaining, cm('hour'), cm('min'), cm('sec'), false));
end;
end;
function Desktop: Boolean;
begin
Result:= ShortcutCB.Checked;
end;
function Icon2: Boolean;
begin
Result:= ExpandConstant('{code:GameIcon2}') <> '';
end;
function GameName(Default: String):String;
begin
Result:=GetIniString('Game','Name','',ExpandConstant('{tmp}\Setup.ini'));
end;
function GamePublisher(Default: String):String;
begin
Result:=GetIniString('Game','Publisher','',ExpandConstant('{tmp}\Setup.ini'));
end;
function GameVersion(Default: String):String;
begin
Result:=GetIniString('Game','Version','',ExpandConstant('{tmp}\Setup.ini'));
end;
function GameIcon1(Default: String):String;
begin
Result:=GetIniString('Game','Exec','',ExpandConstant('{tmp}\Setup.ini'));
end;
function GameIcon2N(Default: String):String;
begin
Result:=GetIniString('Game','Exec2Name','',ExpandConstant('{tmp}\Setup.ini'));
end;
function GameIcon2(Default: String):String;
begin
Result:=GetIniString('Game','Exec2','',ExpandConstant('{tmp}\Setup.ini'));
end;
function GameSize:Integer;
begin
Result:=GetIniInt('Game','Size',0,0,0,ExpandConstant('{tmp}\Setup.ini'));
end;
function Redist1Name(Default: String):String;
begin
Result:=GetIniString('Redist','Redist1Name','',ExpandConstant('{tmp}\Setup.ini'));
end;
function Redist2Name(Default: String):String;
begin
Result:=GetIniString('Redist','Redist2Name','',ExpandConstant('{tmp}\Setup.ini'));
end;
function Redist3Name(Default: String):String;
begin
Result:=GetIniString('Redist','Redist3Name','',ExpandConstant('{tmp}\Setup.ini'));
end;
var
FreeMB,TotalMB: cardinal;
procedure LogoLabelOnClick(Sender: TObject);
var
ErrorCode: Integer;
begin
ShellExec('open', 'http://fileforums.com/member.php?u=155239', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode)
end;
function CreateDS:boolean;
begin
if ShortcutCB.Checked then
Result:=True
else
Result:=False;
end;
Function NumToStr(Float: Extended): String;
Begin
Result:= Format('%.2n', [Float]); StringChange(Result, ',', ',');
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = ',')) and (Pos(',', Result) > 0) do
SetLength(Result, Length(Result)-1);
End;
function MbOrTb(Float: Extended): String;
begin
if Float < 1024 then Result:= NumToStr(Float)+' MB' else
if Float/1024 < 1024 then Result:= NumToStr(Float/1024)+' GB' else
Result:= NumToStr(Float/(1024*1024))+' TB';
end;
procedure DirEditOnChange(Sender: TObject);
var
HD1, HD2: Cardinal;
begin
GetSpaceOnDisk(ExtractFileDrive(WizardForm.DirEdit.Text), True, HD1, HD2);
DiskSpaceLablel.Caption:='Drive ' + ExtractFileDrive(WizardForm.DirEdit.Text) + ' Needed ' +MbOrTb(GameSize)+'('+MbOrTb(HD1)+'Available)';
end;
procedure CheckBoxOnclick(Sender:TObject);
begin
sndPlaySound(ExpandConstant('{tmp}\Click.wav'), $0001);
end;
procedure CreateDLabelOnclick(Sender:TObject);
begin
if ShortcutCB.Checked=true then ShortcutCB.Checked:=False else ShortcutCB.Checked:=true;
end;
procedure DirectXLabelOnclick(Sender:TObject);
begin
if DirectXCB.Checked=true then DirectXCB.Checked:=False else DirectXCB.Checked:=true;
end;
procedure VisualCLabelOnclick(Sender:TObject);
begin
if VisualCCB.Checked=true then VisualCCB.Checked:=False else VisualCCB.Checked:=true;
end;
procedure SocialLabelOnclick(Sender:TObject);
begin
if SocialCB.Checked=true then SocialCB.Checked:=False else SocialCB.Checked:=true;
end;
function InitializeSetup:boolean;
begin
if FileExists(ExpandConstant('{src}\Setup.ini')) = False then
MsgBox('Cannot locate configuration file.', mbInformation, MB_OK)
else
FileCopy(ExpandConstant('{src}\Setup.ini'),ExpandConstant('{tmp}\Setup.ini'),False);
Result:=FileExists(ExpandConstant('{src}\Setup.ini'));
XvidInstall;
#ifexist "Image\Video.avi"
if not FileExists(ExpandConstant('{tmp}\video.avi')) then ExtractTemporaryFile('video.avi');
#endif
ExtractTemporaryFile('splash.png');
ShowSplashScreen(0,ExpandConstant('{tmp}\splash.png'),1000,1000,1000,0,255,False,$FFFFFF,10);
end;
procedure InitializeWizard();
var
mr: TMargins;
HD1, HD2: Cardinal;
begin
ExtractTemporaryFile('1.bmp');
ExtractTemporaryFile('2.bmp');
ExtractTemporaryFile('click.wav');
with WizardForm do begin
Font.Name:= 'Tahoma';
Font.Color:= $ffffff;
ClientWidth:= ScaleX(654);
ClientHeight:= ScaleY(402);
OuterNotebook.Hide;
InnerNotebook.Hide;
Center;
end;
WizardPanel := TPanel.Create(WizardForm);
with WizardPanel do begin
Name := 'WizardPanel';
Parent := WizardForm;
Left := ScaleX(0);
Top := ScaleY(313);
Width := ScaleX(185);
Height := ScaleY(355);
Align := alTop;
BorderStyle := bsNone;
end;
BmpFile:= TBitmapImage.Create(WizardForm);
with BmpFile do begin
Bitmap.LoadFromFile(ExpandConstant('{tmp}\1.bmp'));
SetBounds(ScaleX(0), ScaleY(0), ScaleX(654), ScaleY(355));
Stretch:= true;
Parent:= WizardPanel;
end;
WizardForm.DirEdit.Parent:=WizardPanel;
WizardForm.DirEdit.Top:=ScaleY(211);
WizardForm.DirEdit.Left:=ScaleX(120);
WizardForm.DirEdit.Width:=ScaleX(332);
WizardForm.DirEdit.Font.Color:=clblack;
WizardForm.DirBrowseButton.Parent:=WizardPanel;
WizardForm.DirBrowseButton.Top:=ScaleY(210);
WizardForm.DirBrowseButton.Left:=ScaleX(455);
WizardForm.DirBrowseButton.Width:=ScaleX(75);
WizardForm.DirBrowseButton.Height:=ScaleY(23);
TasksSeparateBevel := TBevel.Create(WizardForm);
with TasksSeparateBevel do
begin
Shape:=bsFrame;
Parent:=WizardPanel;
Width:=ScaleX(500);
Height:=ScaleY(80);
Left:=ScaleX(36);
Top:=ScaleY(189);
end;
TasksSeparateBevel2 := TBevel.Create(WizardForm);
with TasksSeparateBevel2 do
begin
Shape:=bsFrame;
Parent:=WizardPanel;
Width:=ScaleX(500);
Height:=ScaleY(60);
Left:=ScaleX(36);
Top:=ScaleY(289);
end;
DirWelcomeLabel:=TLabel.Create(WizardForm);
With DirWelcomeLabel do begin
Transparent:=true;
Parent:=WizardPanel;
Font.Color:=clWhite;
Font.Height:=ScaleY(-20);
Font.Style:=[fsBold];
SetBounds(ScaleX(16), ScaleY(120), ScaleX(200), ScaleY(30));
Caption:='<<Setup Wizard Configuration>>';
end;
DirWelcomeLabel1:=TLabel.Create(WizardForm);
With DirWelcomeLabel1 do begin
Transparent:=true;
Parent:=WizardPanel;
Font.Color:=clWhite;
Font.Height:=ScaleY(-14);
SetBounds(ScaleX(28), ScaleY(150), ScaleX(200), ScaleY(30));
Caption:='From here you can change the setup configuration.';
end;
InstallpathLabel:=TLabel.Create(WizardForm);
With InstallpathLabel do begin
Transparent:=true;
Parent:=WizardPanel;
Font.Color:=clWhite;
Font.Height:=ScaleY(-13);
SetBounds(ScaleX(46), ScaleY(211), ScaleX(200), ScaleY(30));
Caption:='Install Path:';
end;
GetSpaceOnDisk(ExtractFileDrive(WizardForm.DirEdit.Text), True, HD1, HD2);
DiskSpaceLablel:=TLabel.Create(WizardForm);
With DiskSpaceLablel do begin
Transparent:=true;
Parent:=WizardPanel;
Font.Color:=clWhite;
SetBounds(ScaleX(121), ScaleY(249), ScaleX(200), ScaleY(30));
Caption:='Drive ' + ExtractFileDrive(WizardForm.DirEdit.Text) + ' Needed ' +MbOrTb(GameSize)+'('+MbOrTb(HD1)+'Available)';
end;
WizardForm.DirEdit.OnChange:=@DirEditOnChange;
ShortcutLabel:=TLabel.Create(WizardForm);
With ShortcutLabel do begin
Transparent:=true;
Parent:=WizardPanel;
Font.Color:=clWhite;
Font.Height:=ScaleY(-13);
SetBounds(ScaleX(46), ScaleY(297), ScaleX(200), ScaleY(30));
Caption:='Shortcuts :';
end;
SoftwaresLabel:=TLabel.Create(WizardForm);
With SoftwaresLabel do begin
Transparent:=true;
Parent:=WizardPanel;
Font.Color:=clWhite;
Font.Height:=ScaleY(-13);
SetBounds(ScaleX(46), ScaleY(318), ScaleX(200), ScaleY(30));
Caption:='Softwares :';
end;
ShortcutCB := TNewCheckBox.Create(WizardForm);
with ShortcutCB do
begin
Parent := WizardPanel;
Left :=ScaleX(116);
Top :=ScaleY(299);
Width := ScaleX(14);
Height := ScaleY(14);
Cursor:=crHand;
Checked:=true;
OnClick:=@CheckBoxOnclick;
end;
CreateDLabel:=TLabel.Create(WizardForm);
With CreateDLabel do begin
Transparent:=true;
Parent:=WizardPanel;
Font.Color:=clWhite;
SetBounds(ScaleX(136), ScaleY(299), ScaleX(200), ScaleY(30));
Caption:='Create Desktop icon';
Cursor:=crHand;
OnClick:=@CreateDLabelOnclick;
end;
DirectXCB := TNewCheckBox.Create(WizardForm);
with DirectXCB do
begin
Parent := WizardPanel;
Left :=ScaleX(116);
Top :=ScaleY(320);
Width := ScaleX(14);
Height := ScaleY(14);
Cursor:=crHand;
Checked:=true;
OnClick:=@CheckBoxOnclick;
end;
DirectXLabel:=TLabel.Create(WizardForm);
With DirectXLabel do begin
Transparent:=true;
Parent:=WizardPanel;
Font.Color:=clWhite;
SetBounds(ScaleX(136), ScaleY(320), ScaleX(200), ScaleY(30));
Caption:='Install ' + ExpandConstant('{code:Redist1Name}');
Cursor:=crHand;
OnClick:=@DirectXLabelOnclick;
end;
VisualCCB := TNewCheckBox.Create(WizardForm);
with VisualCCB do
begin
Parent := WizardPanel;
Left :=ScaleX(250);
Top :=ScaleY(320);
Width := ScaleX(14);
Height := ScaleY(14);
Cursor:=crHand;
Checked:=true;
OnClick:=@CheckBoxOnclick;
end;
VisualCLabel:=TLabel.Create(WizardForm);
With VisualCLabel do begin
Transparent:=true;
Parent:=WizardPanel;
Font.Color:=clWhite;
SetBounds(ScaleX(270), ScaleY(320), ScaleX(200), ScaleY(30));
Caption:='Install ' + ExpandConstant('{code:Redist2Name}');
Cursor:=crHand;
OnClick:=@VisualCLabelOnclick;
end;
SocialCB := TNewCheckBox.Create(WizardForm);
with SocialCB do
begin
Parent := WizardPanel;
Left :=ScaleX(410);
Top :=ScaleY(320);
Width := ScaleX(14);
Height := ScaleY(14);
Cursor:=crHand;
Checked:=true;
OnClick:=@CheckBoxOnclick;
end;
SocialLabel:=TLabel.Create(WizardForm);
With SocialLabel do begin
Transparent:=true;
Parent:=WizardPanel;
Font.Color:=clWhite;
SetBounds(ScaleX(430), ScaleY(320), ScaleX(200), ScaleY(30));
Caption:='Install ' + ExpandConstant('{code:Redist3Name}');
Cursor:=crHand;
OnClick:=@SocialLabelOnclick;
end;
WLabel:=TLabel.Create(WizardForm);
With WLabel do begin
Transparent:=true;
Parent:=WizardPanel;
Font.Color:=clWhite;
Font.Size:=15;
Font.Style:=[fsBold];
SetBounds(ScaleX(160), ScaleY(315), ScaleX(200), ScaleY(30));
Caption:='<<Welcome to Setup Wizard>>';
end;
EndFailLabel:=TLabel.Create(WizardForm);
With EndFailLabel do begin
Transparent:=true;
Parent:=WizardPanel;
Font.Color:=clRed;
Font.Size:=15;
Font.Style:=[fsBold];
SetBounds(ScaleX(64), ScaleY(315), ScaleX(200), ScaleY(30));
Caption:='<<Setup encountered an error while Installing>>';
end;
EndPassLabel:=TLabel.Create(WizardForm);
With EndPassLabel do begin
Transparent:=true;
Parent:=WizardPanel;
Font.Color:=clWhite;
Font.Size:=14;
Font.Style:=[fsBold];
SetBounds(ScaleX(120), ScaleY(315), ScaleX(200), ScaleY(30));
Caption:='<<Installation Completed Successfully>>';
end;
WizardForm.NextButton.SetBounds(ScaleX(530), ScaleY(365), ScaleX(90), ScaleY(30));
WizardForm.CancelButton.SetBounds(ScaleX(530), ScaleY(365), ScaleX(90), ScaleY(30));
WizardForm.ProgressGauge.Parent:=WizardForm
WizardForm.ProgressGauge.Top:=ScaleY(365);
WizardForm.ProgressGauge.Left:=ScaleX(10);
WizardForm.ProgressGauge.Height:=ScaleY(31);
WizardForm.ProgressGauge.Width:=ScaleX(510)
LogoLinkLabel:=TLabel.Create(WizardForm);
With LogoLinkLabel do begin
Transparent:=true;
Parent:=WizardForm;
Font.Color:=clWhite;
SetBounds(ScaleX(23), ScaleY(365), ScaleX(200), ScaleY(30));
LogoLinkLabel.Cursor:=crHand;
LogoLinkLabel.OnClick:=@LogoLabelOnClick;
end;
BGRadio1:=TNewRadioButton.Create(WizardForm)
BGRadio1.Parent:=WizardForm;
BGRadio1.Caption:='Video BG';
BGRadio1.SetBounds(WizardForm.NextButton.Left + ScaleX(-90),WizardForm.NextButton.Top + ScaleY(-2),ScaleX(70),ScaleY(13));
BGRadio2:=TNewRadioButton.Create(WizardForm)
BGRadio2.Parent:=WizardForm;
#ifdef video
BGRadio1.Enabled:=True;
BGRadio1.Checked:=True;
BGRadio2.Checked:=False;
#else
BGRadio1.Enabled:=False;
BGRadio1.Checked:=False;
BGRadio2.Checked:=True;
#endif
BGRadio2.Caption:='Picture BG';
BGRadio2.SetBounds(WizardForm.NextButton.Left-ScaleX(90),WizardForm.NextButton.Top+ScaleY(17),ScaleX(70),ScaleY(13));
ExtractTemporaryFile('Logo.png');
ISWin7_AddCtrl(WizardForm.BackButton.Handle);
ISWin7_AddCtrl(BGRadio1.Handle);
ISWin7_AddCtrl(BGRadio2.Handle);
ISWin7_AddCtrl(WizardForm.NextButton.Handle);
ISWin7_AddCtrl(WizardForm.CancelButton.Handle);
ISWin7_AddCtrl(WizardForm.DirBrowseButton.Handle);
ISWin7_Apply(ExpandConstant('{tmp}\logo.png'), ScaleX(23), ScaleY(358), ScaleX(0), ScaleY(0), 0, WizardForm.ClientHeight - WizardPanel.Height, WizardForm.Handle);
end;
function DirBrowseButtonClick(CurPageID: Integer): Boolean;
begin
sndPlaySound(ExpandConstant('{tmp}\click.wav'), $0001);
Result := True;
end;
function GroupBrowseButtonClick(CurPageID: Integer): Boolean;
begin
sndPlaySound(ExpandConstant('{tmp}\click.wav'), $0001);
Result := True;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
sndPlaySound(ExpandConstant('{tmp}\click.wav'), $0001);
Result := True;
end;
function BackButtonClick(CurPageID: Integer): Boolean;
begin
sndPlaySound(ExpandConstant('{tmp}\click.wav'), $0001);
Result := True;
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
sndPlaySound(ExpandConstant('{tmp}\click.wav'), $0001);
Confirm:=False;
Cancel:=ExitSetupMsgBox;
if CurPageID=wpInstalling then begin;
if Cancel then begin
ISDoneError:=True;
ISDoneCancel:=1;
DelTree(ExpandConstant('{app}'), True, True, True);
WizardForm.CancelButton.Enabled:=False;
end;
end;
end;
procedure TaskingProgress(h: Longword; msg: Longword; idevent: Longword; dwTime: Longword);
begin
WizardForm.ProgressGauge.Max:=100;
if WizardForm.ProgressGauge.Position = 100 then
WizardForm.ProgressGauge.Position:=0;
WizardForm.ProgressGauge.Position:=WizardForm.ProgressGauge.Position + 10;
end;
procedure VideoPlay();
begin
begin
mciSendString('open "'+ ExpandConstant('{tmp}\Video.avi') +'" alias AVIFile parent '+ IntToStr(WizardForm.Handle) +' style child','',0,0)
mciSendString('put AVIFile window at 0 0 654 355','',0,0);
mciSendString('play AVIFile repeat','',0,0)
end;
end;
procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
begin
CurrentPicture:=CurrentPicture+1;
if CurrentPicture=piclist.count+1 then CurrentPicture:=1;
ShowImage(piclist.strings[CurrentPicture - 1], 1);
end;
procedure MakeSlideShow();
var
i :integer;
begin
PicList:=tstringlist.Create;
#ifexist "Slides\1.jpg"
#sub ExtractFile
ExtractTemporaryFile('{#i}.jpg');
#endsub
#for {i = 1; FileExists(StringChange("Slides\FileName.jpg", "FileName", Str(i))) != 0; i++} ExtractFile
#endif
i:=1;
repeat
piclist.add(ExpandConstant('{tmp}\'+IntToStr(i)+'.jpg'));
i:=i+1;
until FileExists(ExpandConstant('{tmp}\'+IntToStr(i)+'.jpg')) = False;
InitializeSlideShow(WizardForm.Handle, 0, 0, scaleX(654), ScaleY(355), true, 2);
CurrentPicture:=2;
ShowImage(piclist.strings[CurrentPicture-2], 1);
end;
Procedure HideComponents();
begin
WizardForm.ProgressGauge.Hide;
WizardForm.DirEdit.Hide;
WizardForm.BackButton.Hide;
WizardForm.NextButton.Hide;
WizardForm.DirBrowseButton.Hide;
TasksSeparateBevel.Hide;
TasksSeparateBevel2.Hide;
DirWelcomeLabel.Hide;
DirWelcomeLabel1.Hide;
InstallpathLabel.Hide;
DiskSpaceLablel.Hide;
ShortcutLabel.Hide;
ShortcutCB.Hide;
CreateDLabel.Hide;
SoftwaresLabel.Hide;
DirectXCB.Hide;
DirectXLabel.Hide;
VisualCCB.Hide;
VisualCLabel.Hide;
SocialCB.Hide;
SocialLabel.Hide;
WLabel.hide;
EndFailLabel.Hide;
EndPassLabel.Hide;
BGRadio1.Hide;
BGRadio2.Hide;
end;
function InstallationError: Boolean;
begin
if ISDoneError = True then Result := False else Result := True;
end;
procedure CurPageChanged(CurPageID: integer);
begin
if CurPageID=wpWelcome then
begin
HideComponents;
WLabel.show;
WizardForm.NextButton.Show;
WizardForm.NextButton.Caption := 'Configure';
end;
if CurPageID=wpSelectDir then
begin
HideComponents;
BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\2.bmp'));
WizardForm.DirEdit.Show;
WizardForm.NextButton.Show;
WizardForm.NextButton.Caption := 'Begin Install';
WizardForm.DirBrowseButton.Show;
TasksSeparateBevel.Show;
TasksSeparateBevel2.Show;
DirWelcomeLabel.Show;
DirWelcomeLabel1.Show;
InstallpathLabel.Show;
DiskSpaceLablel.Show;
ShortcutLabel.Show;
ShortcutCB.Show;
CreateDLabel.Show;
BGRadio1.Show;
BGRadio2.Show;
SoftwaresLabel.Visible:=ExpandConstant('{code:Redist1Name}') <> '';
DirectXCB.Visible:=ExpandConstant('{code:Redist1Name}') <> '';
DirectXLabel.Visible:=ExpandConstant('{code:Redist1Name}') <> '';
VisualCCB.Visible:=ExpandConstant('{code:Redist2Name}') <> '';
VisualCLabel.Visible:=ExpandConstant('{code:Redist2Name}') <> '';
SocialCB.Visible:=ExpandConstant('{code:Redist3Name}') <> '';
SocialLabel.Visible:=ExpandConstant('{code:Redist3Name}') <> '';
end;
if CurPageID=wpInstalling then
begin
HideComponents;
If BGRadio1.Checked=true then
begin
VideoPlay;
end;
If BGRadio2.Checked=True then
Begin
MakeSlideShow;
SetTimer(0, 101, 3000, CallbackAddr('OnTimer'));
end;
WizardForm.CancelButton.show;
WizardForm.ProgressGauge.show;
end;
if CurPageID=wpInstalling then
begin
iswin7_showlogo(false);
end else begin
iswin7_showlogo(true);
end;
if CurPageID=wpFinished then
begin
HideComponents;
mciSendString('Close AVIFile','',0,0);
EndPassLabel.Show;
DeinitializeSlideShow;
WizardForm.NextButton.Show;
BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\1.bmp'));
WizardForm.Caption:='Setup - ' + ExpandConstant('{code:GameName}');
end;
if (CurPageID = wpFinished) and ISDoneError then
begin
EndPassLabel.Hide;
EndFailLabel.show;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
res, i, ResultCode: integer;
Arc1, Arc2, Arc3: Array of String;
PCF: String;
begin
If CurStep = ssInstall then
begin
StartInstall:= GetTickCount
ExtractTemporaryFile('arc.ini');
ExtractTemporaryFile('unarc.dll');
ExtractTemporaryFile('english.ini');
ExtractTemporaryFile('unrar.dll');
ExtractTemporaryFile('facompress.dll');
ExtractTemporaryFile('facompress_mt.dll');
ExtractTemporaryFile('CLS-precomp.dll');
ExtractTemporaryFile('CLS-MSC.dll');
ExtractTemporaryFile('CLS-srep.dll');
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('zlib1.dll');
ExtractTemporaryFile('lzma64.exe');
ExtractTemporaryFile('srep.exe');
ExtractTemporaryFile('srep64.exe');
ExtractTemporaryFile('precomp038_Inside.exe');
ExtractTemporaryFile('precomp040_Inside.exe');
ExtractTemporaryFile('precomp041_Inside.exe');
ExtractTemporaryFile('precomp042_Inside.exe');
PCF:=GetIniString('Settings', 'Precomp', '', ExpandConstant('{tmp}\Setup.ini'));
if PCF = '0.38' then
begin
ExtractTemporaryFile('precomp038.exe');
FileCopy(ExpandConstant('{tmp}\precomp038_Inside.exe'),ExpandConstant('{tmp}\precomp.exe'),False);
end;
if PCF = '0.40' then
begin
ExtractTemporaryFile('precomp040.exe');
FileCopy(ExpandConstant('{tmp}\precomp040_Inside.exe'),ExpandConstant('{tmp}\precomp.exe'),False);
end;
if PCF = '0.41' then
begin
ExtractTemporaryFile('precomp041.exe');
FileCopy(ExpandConstant('{tmp}\precomp041_Inside.exe'),ExpandConstant('{tmp}\precomp.exe'),False);
end;
if PCF = '0.42' then
begin
ExtractTemporaryFile('precomp042.exe');
FileCopy(ExpandConstant('{tmp}\precomp042_Inside.exe'),ExpandConstant('{tmp}\precomp.exe'),False);
end;
i:=1;
if (GetIniString('FreearcFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')) <> '') or
(GetIniString('7ZipFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')) <> '') or
(GetIniString('RarFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')) <> '') then
begin
WizardForm.ProgressGauge.Max:=0;
repeat
WizardForm.ProgressGauge.Max:= WizardForm.ProgressGauge.Max + 1000;
i:= i + 1;
until (GetIniString('FreearcFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')) = '') and
(GetIniString('7ZipFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')) = '') and
(GetIniString('RarFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')) = '');
end;
if ISDoneInit(ExpandConstant('{tmp}\records.inf'), $F777, 0,0,0, MainForm.Handle, 512, @ProgressCallback) then begin
repeat
ChangeLanguage('English');
if not SrepInit('',512,0) then ISDoneError := True;
if not PrecompInit('',128,0) then ISDoneError := True;
if not FileSearchInit(true) then ISDoneError := True;
i:=1;
if (GetIniString('FreearcFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')) <> '') or
(GetIniString('7ZipFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')) <> '') or
(GetIniString('RarFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')) <> '') then
begin
SetArrayLength(Arc1,4);
SetArrayLength(Arc2,4);
SetArrayLength(Arc3,4);
repeat
Arc1[0]:=ExpandConstant(GetIniString('FreearcFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')));
Arc1[1]:=ExpandConstant(GetIniString('FreearcFile' + IntToStr(i),'Output','',ExpandConstant('{tmp}\Setup.ini')));
Arc1[2]:=ExpandConstant(GetIniString('FreearcFile' + IntToStr(i),'Disk','1',ExpandConstant('{tmp}\Setup.ini')));
Arc1[3]:=GetIniString('FreearcFile' + IntToStr(i),'Password','',ExpandConstant('{tmp}\Setup.ini'));
Arc2[0]:=ExpandConstant(GetIniString('7ZipFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')));
Arc2[1]:=ExpandConstant(GetIniString('7ZipFile' + IntToStr(i),'Output','',ExpandConstant('{tmp}\Setup.ini')));
Arc2[2]:=ExpandConstant(GetIniString('7ZipFile' + IntToStr(i),'Disk','1',ExpandConstant('{tmp}\Setup.ini')));
Arc2[3]:=GetIniString('7ZipFile' + IntToStr(i),'Password','',ExpandConstant('{tmp}\Setup.ini'));
Arc3[0]:=ExpandConstant(GetIniString('RarFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')));
Arc3[1]:=ExpandConstant(GetIniString('RarFile' + IntToStr(i),'Output','',ExpandConstant('{tmp}\Setup.ini')));
Arc3[2]:=ExpandConstant(GetIniString('RarFile' + IntToStr(i),'Disk','1',ExpandConstant('{tmp}\Setup.ini')));
Arc3[3]:=GetIniString('RarFile' + IntToStr(i),'Password','',ExpandConstant('{tmp}\Setup.ini'));
if Arc1[0] <> '' then
begin
if not FileExists(Arc1[0]) then
begin
if MsgBox('Insert disc: ' + Arc1[2], mbError, MB_OKCANCEL) = IDCANCEL then ISDoneError := True;
end else begin
if not ISArcExtract( 0, 0, Arc1[0], Arc1[1], '', false, Arc1[3], ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}'), False) then ISDoneError := True;
i:= i + 1;
end;
end;
if Arc2[0] <> '' then
begin
if not FileExists(Arc2[0]) then
begin
if MsgBox('Insert disc: ' + Arc2[2], mbError, MB_OKCANCEL) = IDCANCEL then ISDoneError := True;
end else begin
if not IS7ZipExtract( 0, 0, Arc2[0], Arc2[1], false, Arc2[3]) then ISDoneError := True;
i:= i + 1;
end;
end;
if Arc3[0] <> '' then
begin
if not FileExists(Arc3[0]) then
begin
if MsgBox('Insert disc: ' + Arc3[2], mbError, MB_OKCANCEL) = IDCANCEL then ISDoneError := True;
end else begin
if not ISRarExtract( 0, 0, Arc3[0], Arc3[1], false, Arc3[3]) then ISDoneError := True;
i:= i + 1;
end;
end;
until ((GetIniString('FreearcFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')) = '') and
(GetIniString('7ZipFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')) = '') and
(GetIniString('RarFile' + IntToStr(i),'Archive','',ExpandConstant('{tmp}\Setup.ini')) = '')) or (ISDoneError = True);
end;
until true;
ISDoneStop;
end;
end;
if (CurStep=ssPostInstall) and ISDoneError then begin
Exec(ExpandConstant('{uninstallexe}'), '/VERYSILENT','', sw_Hide, ewWaitUntilTerminated, ResultCode);
end;
if (CurStep=ssPostInstall) and (ISDoneError = False) then begin
if (DirectXCB.Checked = True) then begin
SetTimer(WizardForm.Handle,1,1000,CallBackAddr('TaskingProgress'));
WizardForm.Caption := 'Installing ' + ExpandConstant('{code:Redist1Name}') + '...';
Exec(ExpandConstant(GetIniString('Redist','Redist1Command', '', ExpandConstant('{tmp}\Setup.ini'))), ExpandConstant(GetIniString('Redist','Redist1Parameter', '', ExpandConstant('{tmp}\Setup.ini'))), '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
end;
if (VisualCCB.Checked = True) then begin
SetTimer(WizardForm.Handle,1,1000,CallBackAddr('TaskingProgress'));
WizardForm.Caption := 'Installing ' +ExpandConstant('{code:Redist2Name}') + '...';
Exec(ExpandConstant(GetIniString('Redist','Redist2Command', '', ExpandConstant('{tmp}\Setup.ini'))), ExpandConstant(GetIniString('Redist','Redist2Parameter', '', ExpandConstant('{tmp}\Setup.ini'))), '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
end;
if (SocialCB.Checked = True) then begin
SetTimer(WizardForm.Handle,1,1000,CallBackAddr('TaskingProgress'));
WizardForm.Caption := 'Installing ' + ExpandConstant('{code:Redist3Name}') + '...';
Exec(ExpandConstant(GetIniString('Redist','Redist3Command', '', ExpandConstant('{tmp}\Setup.ini'))), ExpandConstant(GetIniString('Redist','Redist3Parameter', '', ExpandConstant('{tmp}\Setup.ini'))), '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
end;
end;
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
if (PageID=wpSelectProgramGroup) or (PageID=wpReady) or (PageID=wpSelectComponents) then Result:=true;
end;
procedure DeinitializeSetup();
begin
XvidUnInstall;
DeinitializeSlideShow;
ISWin7_Shutdown();
mciSendString('Close AVIFile','',0,0);
end;