Автор: Despofix
Дата сообщения: 19.08.2011 17:54
bugron
полностью [more=скрипт]
#define NeedMem "512"
#define NeedSize "3,17 Гб" ;для установки
#define NeedSize2 "3,17 Гб" ;для игры
#define NeedSize3 "3247"
#define AppName "Unreal Tournament 3"
;#define SecondProgressBar
#define Components
#define records
#define facompress
;#define precomp "0.41"
;#define unrar
;#define XDelta
;#define PackZIP
[Setup]
;AppId=
SourceDir=.
OutputDir=.
AppName={#AppName}
AppVerName={#AppName}
DefaultDirName={pf}\{#AppName}
DefaultGroupName={#AppName}
AllowNoIcons=yes
OutputBaseFilename=Setup
WindowVisible=no
WindowShowCaption=no
WindowResizable=no
Compression=none
;DiskSpanning=yes
;DiskSliceSize=2100000000
AppPublisher=PUNISHER
RestartIfNeededByRun=no
SetupIconFile=Files\setup.ico
ShowTasksTreeLines=yes
ShowComponentSizes=false
DisableReadyPage=yes
#ifdef Components
[Types]
Name: rus1; Description: Перевод текста;
Name: rus2; Description: Перевод текста и озвучки;
[Components]
Name: rus1; Description: Перевод текста; Types:rus1
Name: rus2; Description: Перевод текста и озвучки; Types:rus2
#endif
[Icons]
Name: "{userdesktop}\{#AppName}"; Filename: "{app}\ZenoClash.exe"; WorkingDir: "{app}";
Name: "{group}\{#AppName}"; Filename: "{app}\ZenoClash.exe"; WorkingDir: "{app}";
Name: "{group}\Прочитать ReadMe"; Filename: "{app}\ReadMe.rtf"; WorkingDir: "{app}";
Name: "{group}\Удалить {#AppName}"; Filename:"{app}\unins000.exe";IconFileName:{app}\Uninstall.ico ;WorkingDir:"{app}"; Check: CheckError
[Tasks]
Name: "Descktop"; Description: "Создать ярлык на Рабочем столе"; GroupDescription: "Дополнительные ярлыки:";
Name: "soft"; Description: "Дополнительное программное обеспечение";
Name: "soft\direct"; Description: Обновить DirectX 9.0c;
Name: "soft\VisualC"; Description: Установить VisualC++ Redist;
[Run]
Filename: {src}\Soft\dxwebsetup.exe; StatusMsg: Идет обновление DirectX...; Parameters: /q;Flags: skipifdoesntexist; Check: CheckError;
Filename: {src}\Soft\vcredist_x86.exe; StatusMsg: Идет установка VisualC++ Redist...; Parameters: /q;Flags: skipifdoesntexist; Check: CheckError and not IsWin64
Filename: {src}\Soft\vcredist_x64.exe; StatusMsg: Идет установка VisualC++ Redist...; Parameters: /q;Flags: skipifdoesntexist; Check: CheckError and IsWin64
[Files]
Source: Files\botva2.dll; Flags: dontcopy
Source: Files\WizardImage.png; Flags: dontcopy
Source: Files\Button.png; DestDir: {tmp}; Flags: dontcopy
Source: Files\russian.ini; DestDir: {tmp}; Flags: dontcopy
Source: Files\unarc.dll; DestDir: {tmp}; Flags: dontcopy
Source: Files\ISDone.dll; DestDir: {tmp}; Flags: dontcopy
Source: C:\Program Files\Inno Setup 5\Dll Pack\innocallback.dll; DestDir: {tmp}; Flags: dontcopy
#ifdef records
Source: records.inf; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef facompress
Source: Files\facompress.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef precomp
#if precomp == "0.38"
Source: Files\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
#else
#if precomp == "0.4"
Source: Files\precomp040.exe; DestDir: {tmp}; Flags: dontcopy
#else
#if precomp == "0.41"
Source: Files\precomp041.exe; DestDir: {tmp}; Flags: dontcopy
#else
Source: Files\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
Source: Files\precomp040.exe; DestDir: {tmp}; Flags: dontcopy
Source: Files\precomp041.exe; DestDir: {tmp}; Flags: dontcopy
#endif
#endif
#endif
#endif
#ifdef unrar
Source: Files\Unrar.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef XDelta
Source: Files\XDelta3.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef PackZIP
Source: Files\7z.dll; DestDir: {tmp}; Flags: dontcopy
Source: Files\packZIP.exe; DestDir: {tmp}; Flags: dontcopy
#endif
Source: Files\Uninstall.ico; DestDir: {app}; Attribs: Hidden System
[CustomMessages]
russian.ExtractedFile=Извлекается файл:
russian.Extracted=Установка...
russian.CancelButton=Отмена
russian.Error=Установка не завершена!
russian.ElapsedTime=Прошло:
russian.RemainingTime=Осталось:
russian.EstimatedTime=Всего:
russian.AllElapsedTime=Время установки:
russian.Welcome=Программа установит игру {#AppName} на Ваш компьютер.%n%nРекомендуется закрыть все прочие приложения перед тем, как продолжить.%n%nНажмите «Далее», чтобы продолжить, или «Отмена», чтобы выйти из программы установки.
russian.Complete=Игра {#AppName} установлена на Ваш компьютер.%n%nИгру можно запустить с помощью соответствующего значка на Рабоучем столе или в меню «Пуск». %n%nНажмите «Завершить», чтобы выйти из программы установки.
russian.WarningCancel=Установка игры {#AppName} не была завершена.%n%nПожалуйста, устраните проблему и запустите установку снова.%n%nНажмите «Завершить», чтобы выйти из программы установки.
russian.Setup1=Программа установит игру {#AppName} в слежующую папку.
russian.Setup2=Нажмите «Далее», чтобы продолжить. Если требуется выполнить установку в другую папку, нажмите «Обзор» или напишите путь в строке ввода.
russian.Setup3=Выбор папки установки
russian.Setup4=В какую папку вы хотите установить игру?
russian.Group1=Программа создаст ярлыки в следующей папке меню «Пуск».
russian.Group2=Нажмите «Далее», чтобы продолжить. Если требуется поместить ярлыки в другую папку, нажмите «Обзор» или напишите путь в строке ввода.
russian.Group3=Выбор папки в меню «Пуск».
russian.Group4=Где программа установки должна создать ярлыки?
russian.Task1=Выберите дополнительные задачи, которые должны быть выполнены при установке {#AppName}, после этого нажмите «Далее»:
russian.Task2=Выберите дополнительные задачи.
russian.Task3=Какие дополнительные задачи необходимо выполнить?
russian.Component1=Выберите компоненты, которые Вы хотите установить; снимите флажки с компонентов, устанавливать которые не требуется. Нажмите «Далее», когда Вы будете готовы продолжить.
russian.Component2=Выбор компонентов.
russian.Component3=Какие компоненты должны быть установлены?
russian.Instal1=Установка...
russian.Instal2=Пожалуйста, подождите, пока {#AppName} установится на Ваш компьютер.
[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl
[UninstallDelete]
Type: filesandordirs; Name: {app}
[Code]
type
TButtonInfo = record ButtonName: array of TButton; Handle: array of HWND; Count: Integer; end;
TBtnEventProc = procedure(h:HWND);
const
BtnClickEventID = 1;
BtnMouseEnterEventID = 2;
BtnMouseLeaveEventID = 3;
BtnMouseMoveEventID = 4;
balLeft = 0;
balCenter = 1;
var
ButtonsBuff: TButtonInfo;
HCancelButton,HMyCancelButton, HNextButton, HBackButton, HDirBrowseButton, HGroupBrowseButton: HWND;
function WrapBtnCallback(Callback: TBtnEventProc; ParamCount: Integer): Longword; external 'wrapcallback@files:innocallback.dll stdcall';
function BtnCreate(hParent:HWND; Left,Top,Width,Height:integer; FileName:PChar; ShadowWidth:integer; IsCheckBtn:boolean):HWND; external 'BtnCreate@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetPosition(h:HWND; NewLeft, NewTop, NewWidth, NewHeight: integer); external 'BtnSetPosition@files:botva2.dll stdcall';
procedure BtnRefresh(h:HWND); external 'BtnRefresh@files:botva2.dll stdcall';
function BtnGetChecked(h:HWND):boolean; external 'BtnGetChecked@files:botva2.dll stdcall';
procedure BtnSetChecked(h:HWND; Value:boolean); external 'BtnSetChecked@files:botva2.dll stdcall';
procedure BtnSetText(h:HWND; Text:PAnsiChar); external 'BtnSetText@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetTextAlignment(h:HWND; HorIndent, VertIndent:integer; Alignment:DWORD); external 'BtnSetTextAlignment@files:botva2.dll stdcall';
procedure BtnSetVisibility(h:HWND; Value:boolean); external 'BtnSetVisibility@files:botva2.dll stdcall';
function BtnGetEnabled(h:HWND):boolean; external 'BtnGetEnabled@files:botva2.dll stdcall';
procedure BtnSetEnabled(h:HWND; Value:boolean); external 'BtnSetEnabled@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetFont(h:HWND; Font:Cardinal); external 'BtnSetFont@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetFontColor(h:HWND; NormalFontColor, FocusedFontColor, PressedFontColor, DisabledFontColor: Cardinal); external 'BtnSetFontColor@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetEvent(h:HWND; EventID:integer; Event:Longword); external 'BtnSetEvent@files:botva2.dll stdcall';
procedure BtnSetCursor(h:HWND; hCur:Cardinal); external 'BtnSetCursor@files:botva2.dll stdcall';
function GetSysCursorHandle(id:integer):Cardinal; external 'GetSysCursorHandle@files:botva2.dll stdcall';
procedure UpdateButtons();
var I: integer;
begin
for I:=0 to (ButtonsBuff.Count-1) do begin
BtnSetEnabled(ButtonsBuff.Handle[I], ButtonsBuff.ButtonName[I].Enabled)
BtnSetVisibility(ButtonsBuff.Handle[I], ButtonsBuff.ButtonName[I].Visible)
BtnSetText(ButtonsBuff.Handle[I], ButtonsBuff.ButtonName[I].Caption)
BtnRefresh(ButtonsBuff.Handle[I])
end;
end;
procedure ButtonOnClick(hBtn: HWND);
var Btn: TButton; I: Integer;
begin
for I:=0 to (ButtonsBuff.Count-1) do begin
if hBtn = ButtonsBuff.Handle[I] then Btn:= ButtonsBuff.ButtonName[I];
end;
Btn.OnClick(Btn)
UpdateButtons;
end;
function EffectTextureButton(Handle: HWND; Button: TButton; ImageName: PAnsiChar; ShadowWidth: Integer; EnterEvent, MoveEvent, LeaveEvent: TbtnEventProc): HWND;
begin
Result:=BtnCreate(Handle, Button.Left, Button.Top, Button.Width, Button.Height, ImageName, ShadowWidth, False) //Размеры подобраны для текущей текстуры
BtnSetEvent(Result, BtnClickEventID, WrapBtnCallback(@ButtonOnClick, 1))
if EnterEvent <> nil then BtnSetEvent(Result, BtnMouseEnterEventID, WrapBtnCallback(EnterEvent, 1));
if MoveEvent <> nil then BtnSetEvent(Result, BtnMouseMoveEventID, WrapBtnCallback(MoveEvent, 1));
if LeaveEvent <> nil then BtnSetEvent(Result, BtnMouseLeaveEventID, WrapBtnCallback(LeaveEvent, 1));
BtnSetFont(Result, Button.Font.Handle)
BtnSetText(Result, Button.Caption);
BtnSetVisibility(Result, Button.Visible);
BtnSetFontColor(Result,clBlack,clBlack,clBlack,clGray);
BtnSetCursor(Result,GetSysCursorHandle(32649));
Button.Width:=0; Button.Height:= 0;
SetArrayLength(ButtonsBuff.Handle, ButtonsBuff.Count+1);SetArrayLength(ButtonsBuff.ButtonName, ButtonsBuff.Count+1);
ButtonsBuff.ButtonName[ButtonsBuff.Count]:= Button; ButtonsBuff.Handle[ButtonsBuff.Count]:= Result;
ButtonsBuff.Count:= ButtonsBuff.Count+1;
end;
procedure ButtonChangeFont(ButtonHandle: HWND; Font: TFont; NormalColor, FocusedColor, PressedColor, DisabledColor: Cardinal);
begin
if Font <> nil then BtnSetFont(ButtonHandle, Font.Handle);
BtnSetFontColor(ButtonHandle, NormalColor, FocusedColor, PressedColor, DisabledColor)
end;
const
NeedSize= {#NeedSize3};
function ShowWindow(hWnd: Integer; uType: Integer): Integer;
external 'ShowWindow@user32.dll stdcall';
function InitializeSetup(): Boolean;
begin
if not FileExists(ExpandConstant('{tmp}\botva2.dll')) then ExtractTemporaryFile('botva2.dll');
if not FileExists(ExpandConstant('{tmp}\innocallback.dll')) then ExtractTemporaryFile('innocallback.dll');
Result:=True;
end;
const
PCFonFLY=true;
notPCFonFLY=false;
var
ISDoneProgressBar1: TNewProgressBar;
MyCancelButton: TButton;
ISDoneCancel:integer;
ISDoneError:boolean;
PCFVer:double;
WelcomeLabel2, FinishedLabel,SetupLabel1, SetupLabel2, SetupLabel3, SetupLabel4, GroupLabel1, Grouplabel2, Grouplabel3, Grouplabel4, TaskLabel1, TaskLabel2, TaskLabel3, ComponentLabel1, ComponentLabel2, ComponentLabel3, Installabel1, Installabel2, NeedSpaceLabel,FreeSpaceLabel, SpaceLabel, LabelPct1,LabelCurrFileName,LabelTime1,LabelTime2: TLabel;
FreeMb, TotalMB: Cardinal;
WizardImage: Longint;
function ImgLoad(Wnd :HWND; FileName: PAnsiChar; Left, Top, Width, Height :integer; Stretch, IsBkg :boolean) :Longint; external 'ImgLoad@{tmp}\botva2.dll stdcall delayload';
procedure ImgSetVisibility(img :Longint; Visible :boolean); external 'ImgSetVisibility@{tmp}\botva2.dll stdcall delayload';
procedure ImgApplyChanges(h:HWND); external 'ImgApplyChanges@{tmp}\botva2.dll stdcall delayload';
procedure gdipShutdown; external 'gdipShutdown@{tmp}\botva2.dll stdcall delayload';
type
TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
function WrapCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:ISDone.dll stdcall delayload';
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: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(TmpFile:PAnsiChar;VirtMem,MaxSave:Cardinal):boolean; external 'SrepInit@files:ISDone.dll stdcall delayload';
function PrecompInit(PrecompVers:single):boolean; external 'PrecompInit@files:ISDone.dll stdcall delayload';
function FileSearchInit(RecursiveSubDir:boolean):boolean; external 'FileSearchInit@files:ISDone.dll stdcall delayload';
function ISDoneInit(RecordFileName:AnsiString; TimeType,Comp1,Comp2,Comp3:Cardinal; WinHandle, NeededMem:longint; callback:TCallback):boolean; external 'ISDoneInit@files:ISDone.dll stdcall';
function ISDoneStop:boolean; external 'ISDoneStop@files:ISDone.dll stdcall';
function ChangeLanguage(Language:string):boolean; external 'ChangeLanguage@files:ISDone.dll stdcall';
function SuspendProc:boolean; external 'SuspendProc@files:ISDone.dll stdcall';
function ResumeProc:boolean; external 'ResumeProc@files:ISDone.dll stdcall';
function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
if OveralPct<=1000 then ISDoneProgressBar1.Position := OveralPct;
LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
Result := ISDoneCancel;
end;
procedure CancelButtonOnClick(Sender: TObject);
begin
SuspendProc;
if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then ISDoneCancel:=1;
ResumeProc;
end;
procedure GetFreeSpaceCaption( Sender: TObject);
var
Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB > 1024 then
FreeSpaceLabel.Caption := 'Свободно на выбранном диске: ' + FloatToStr(round(FreeMB/1024*100)/100) + ' Гб'
else
FreeSpaceLabel.Caption := 'Свободно на выбранном диске: ' + IntToStr(FreeMB)+ ' Мб';
begin
if FreeMB < NeedSize then
begin
WizardForm.NextButton.Enabled:=false;
end else
WizardForm.NextButton.Enabled:=true;
end;
end;
procedure InitializeWizard();
var PBTop:integer;
begin
PBTop:=ScaleY(182);
ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar1 do begin
Parent := WizardForm;
Height := WizardForm.ProgressGauge.Height;
Left := ScaleX(280);
Top := PBTop;
Width := ScaleX(365);
Max := 1000;
end;
LabelPct1 := TLabel.Create(WizardForm);
with LabelPct1 do begin
Parent := WizardForm;
AutoSize := False;
Left := ScaleX(450);
Top := PBTop+ScaleY(35);
Width := ScaleX(150);
Height := ScaleX(100);
Font.Name := 'Arial';
Font.Size:= 13
Transparent:=True;
LabelTime1 := TLabel.Create(WizardForm);
with LabelTime1 do begin
Parent := WizardForm;
AutoSize := False;
Width := ISDoneProgressBar1.Width div 2;
Left := ScaleX(280);
Top := PBTop + ScaleY(90);
Transparent :=True;
end;
LabelTime2 := TLabel.Create(WizardForm);
with LabelTime2 do begin
Parent := WizardForm;
AutoSize := False;
Width := LabelTime1.Width+ScaleX(40);
Left := LabelTime1.Left;
Top := LabelTime1.Top + ScaleY(20);
Transparent :=True;
end;
MyCancelButton:=TButton.Create(WizardForm);
with MyCancelButton do begin
Parent:=WizardForm;
Width:=ScaleX(80);
Height:=ScaleY(23)
Caption:=ExpandConstant('{cm:CancelButton}');
Left:=ScaleX(530);
Top:=ScaleY(450)
OnClick:=@CancelButtonOnClick;
ExtractTemporaryFile('WizardImage.png');
//скрываем элементы формы
WizardForm.InnerNotebook.Hide;
WizardForm.OuterNotebook.Hide;
WizardForm.Bevel.Hide;
//меняем размер формы
WizardForm.Width := ScaleX(706)
WizardForm.Height := ScaleY(534)
WizardForm.ClientWidth := ScaleX(690)
WizardForm.ClientHeight := ScaleY(495);
ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\WizardImage.png'),0,0,WizardForm.ClientWidth,WizardForm.ClientHeight,True,True);
ImgApplyChanges(WizardForm.Handle);
ExtractTemporaryFile('Button.png')
HNextButton:= EffectTextureButton(WizardForm.Handle, WizardForm.NextButton, ExpandConstant('{tmp}\Button.png'), 18, nil, nil, nil)
HMyCancelButton:= EffectTextureButton(WizardForm.Handle, MyCancelButton, ExpandConstant('{tmp}\Button.png'), 18, nil, nil, nil)
HCancelButton:= EffectTextureButton(WizardForm.Handle, WizardForm.CancelButton, ExpandConstant('{tmp}\Button.png'), 18, nil, nil, nil)
HBackButton:= EffectTextureButton(WizardForm.Handle, WizardForm.BackButton, ExpandConstant('{tmp}\Button.png'), 18, nil, nil, nil)
HDirBrowseButton:= EffectTextureButton(WizardForm.Handle, WizardForm.DirBrowseButton, ExpandConstant('{tmp}\Button.png'), 18, nil, nil, nil)
HGroupBrowseButton:= EffectTextureButton(WizardForm.Handle, WizardForm.GroupBrowseButton, ExpandConstant('{tmp}\Button.png'), 18, nil, nil, nil)
// меняем расположение кнопок
BtnSetPosition(HNextButton, ScaleX(440),ScaleY(442),ScaleX(96),ScaleY(39));
BtnSetPosition(HMyCancelButton, ScaleX(530),ScaleY(442),ScaleX(96),ScaleY(39));
BtnSetPosition(HCancelButton, ScaleX(530),ScaleY(442),ScaleX(96),ScaleY(39));
BtnSetPosition(HBackButton, ScaleX(350),ScaleY(442),ScaleX(96),ScaleY(39));
BtnSetPosition(HDirBrowseButton, ScaleX(590),ScaleY(182),ScaleX(96),ScaleY(39));
BtnSetPosition(HGroupBrowseButton, ScaleX(590),ScaleY(202),ScaleX(96),ScaleY(39));
begin
WelcomeLabel2:= TLabel.Create(WizardForm);
with WelcomeLabel2 do begin
AutoSize:= False;
Font.Name:= 'Arial';
Font.Size:=10;
Font.Style:=[fsBold];
Font.Color:= ClBlack;
Transparent:= True;
WordWrap:= true;
Caption:= ExpandConstant('{cm:Welcome}');
Parent:= WizardForm
Left:= ScaleX(280);
Top:= ScaleY(90);
Width:= ScaleX(400);
Height:= ScaleY(250);
SetupLabel1 := TLabel.Create(WizardForm);
with SetupLabel1 do begin
Left:= ScaleX(280);
Top:= ScaleY(90);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Setup1}');
Parent := WizardForm;
SetupLabel2 := TLabel.Create(WizardForm);
with SetupLabel2 do begin
Left:= ScaleX(280);
Top:= ScaleY(120);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Setup2}');
Parent := WizardForm;
SetupLabel3 := TLabel.Create(WizardForm);
with SetupLabel3 do begin
Left:= ScaleX(320);
Top:= ScaleY(10);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Style:=[fsBold];
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Setup3}');
Parent := WizardForm;
SetupLabel4 := TLabel.Create(WizardForm);
with SetupLabel4 do begin
Left:= ScaleX(340);
Top:= ScaleY(30);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Setup4}');
Parent := WizardForm;
GroupLabel1 := TLabel.Create(WizardForm);
with GroupLabel1 do begin
Left:= ScaleX(280);
Top:= ScaleY(90);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Group1}');
Parent := WizardForm;
GroupLabel2 := TLabel.Create(WizardForm);
with GroupLabel2 do begin
Left:= ScaleX(280);
Top:= ScaleY(120);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Group2}');
Parent := WizardForm;
GroupLabel3 := TLabel.Create(WizardForm);
with GroupLabel3 do begin
Left:= ScaleX(320);
Top:= ScaleY(10);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Style:=[fsBold];
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Group3}');
Parent := WizardForm;
GroupLabel4 := TLabel.Create(WizardForm);
with GroupLabel4 do begin
Left:= ScaleX(340);
Top:= ScaleY(30);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Group4}');
Parent := WizardForm;
TaskLabel1 := TLabel.Create(WizardForm);
with TaskLabel1 do begin
Left:= ScaleX(280);
Top:= ScaleY(120);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Task1}');
Parent := WizardForm;
TaskLabel2 := TLabel.Create(WizardForm);
with TaskLabel2 do begin
Left:= ScaleX(320);
Top:= ScaleY(10);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Style:=[fsBold];
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Task2}');
Parent := WizardForm;
TaskLabel3 := TLabel.Create(WizardForm);
with TaskLabel3 do begin
Left:= ScaleX(340);
Top:= ScaleY(30);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Task3}');
Parent := WizardForm;
ComponentLabel1 := TLabel.Create(WizardForm);
with ComponentLabel1 do begin
Left:= ScaleX(280);
Top:= ScaleY(120);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Component1}');
Parent := WizardForm;
ComponentLabel2 := TLabel.Create(WizardForm);
with ComponentLabel2 do begin
Left:= ScaleX(320);
Top:= ScaleY(10);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Style:=[fsBold];
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Component2}');
Parent := WizardForm;
ComponentLabel3 := TLabel.Create(WizardForm);
with ComponentLabel3 do begin
Left:= ScaleX(340);
Top:= ScaleY(30);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Component3}');
Parent := WizardForm;
InstalLabel1 := TLabel.Create(WizardForm);
with InstalLabel1 do begin
Left:= ScaleX(320);
Top:= ScaleY(10);
Width:= ScaleX(400);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Style:=[fsBold];
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Instal1}');
Parent := WizardForm;
InstalLabel2 := TLabel.Create(WizardForm);
with InstalLabel2 do begin
Left:= ScaleX(340);
Top:= ScaleY(30);
Width:= ScaleX(350);
Height:= ScaleY(250);
AutoSize:= false;
Transparent:= true;
WordWrap:= true;
Font.Color:=clBlack;
Font.Name:='Arial';
Font.Size:=9;
Caption := ExpandConstant('{cm:Instal2}');
Parent := WizardForm;
FinishedLabel:= TLabel.Create(WizardForm);
with FinishedLabel do begin
AutoSize:= False;
Font.Name:= 'Arial';
Font.Size:= 10
Font.Style:=[fsBold];
Font.Color:= ClBlack;
Transparent:= True;
WordWrap:= true;
Caption:= ExpandConstant('{cm:Complete}');
Parent:= WizardForm
Left:= ScaleX(280);
Top:= ScaleY(90);
Width:= ScaleX(400);
Height:= ScaleY(250);
NeedSpaceLabel := TLabel.Create(WizardForm);
with NeedSpaceLabel do
begin
Parent := WizardForm;
Left := ScaleX(280);
Top := ScaleY(240);
Width := ScaleX(209);
Height := ScaleY(13);
Caption := 'Требуется для установки: {#NeedSize}';
Transparent:=True;
SpaceLabel := TLabel.Create(WizardForm);
with SpaceLabel do
begin
Parent := WizardForm;
Left := ScaleX(280);
Top := ScaleY(260);
Width := ScaleX(209);
Height := ScaleY(13);
Transparent:=True;
Caption := 'Игра займет после установки: {#NeedSize2}';
FreeSpaceLabel := TLabel.Create(WizardForm);
with FreeSpaceLabel do
begin
Parent := WizardForm;
Left := ScaleX(280);
Top := ScaleY(280);
Width := ScaleX(209);
Height := ScaleY(13);
Transparent:=True;
WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption;
WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
with WizardForm do begin
DirEdit.Left:= ScaleX(280);
DirEdit.Top:= ScaleY(212);
DirEdit.Width:= ScaleX(300);
DirEdit.Height:= ScaleY(21);
DirEdit.Parent:= WizardForm;
DirEdit.Font.Color:= ClBlack
with WizardForm do begin
GroupEdit.Left:= ScaleX(280);
GroupEdit.Top:= ScaleY(212);
GroupEdit.Width:= ScaleX(300);
GroupEdit.Height:= ScaleY(21);
GroupEdit.Parent:= WizardForm;
GroupEdit.Font.Color:= ClBlack
with WizardForm do begin
TasksList.Left:= ScaleX(280);
TasksList.Top:= ScaleY(192);
TasksList.Width:= ScaleX(400);
TasksList.Height:= ScaleY(192);
TasksList.Parent:= WizardForm;
TasksList.Font.Color:= ClBlack
TasksList.Color:= $fafafd;
with WizardForm do begin
ComponentsList.Left:= ScaleX(280);
ComponentsList.Top:= ScaleY(182);
ComponentsList.Width:= ScaleX(400);
ComponentsList.Height:= ScaleY(192);
ComponentsList.Parent:= WizardForm;
ComponentsList.Font.Color:= ClBlack
ComponentsList.Color:= $fafafd;
ComponentsList.BorderStyle:= bsNone;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
Procedure HideComponent(CurPageID: Integer);
begin
WelcomeLabel2.Hide
SetupLabel1.Hide;
SetupLabel2.Hide;
SetupLabel3.Hide;
SetupLabel4.Hide;
NeedSpaceLabel.Hide;
FreeSpaceLabel.Hide;
SpaceLabel.Hide;
WizardForm.DirBrowseButton.Hide;
WizardForm.DirEdit.Hide;
WizardForm.GroupBrowseButton.Hide;
WizardForm.GroupEdit.Hide;
FinishedLabel.Hide
GroupLabel1.Hide;
Grouplabel2.Hide;
Grouplabel3.Hide;
Grouplabel4.Hide;
ISDoneProgressBar1.Hide;
LabelPct1.Hide
LabelTime1.Hide;
labelTime2.Hide;
InstalLabel1.Hide;
InstalLabel2.Hide;
MyCancelButton.Hide;
WizardForm.TasksList.Hide;
TaskLabel1.Hide;
TaskLabel2.Hide;
TaskLabel3.Hide;
WizardForm.ComponentsList.Hide;
ComponentLabel1.Hide;
ComponentLabel2.Hide;
ComponentLabel3.Hide;
end;
Procedure ShowComponent(CurPageID: Integer);
begin
case CurPageID of
wpWelcome:
begin
WelcomeLabel2.Show;
end;
wpSelectDir:
begin
SetupLabel1.Show;
SetupLabel2.Show;
SetupLabel3.Show;
SetupLabel4.Show;
WizardForm.DirBrowseButton.Show;
WizardForm.DirEdit.Show;
NeedSpaceLabel.Show;
FreeSpaceLabel.Show;
SpaceLabel.Show;
end;
wpSelectComponents:
begin
WizardForm.ComponentsList.Show;
ComponentLabel1.Show;
ComponentLabel2.Show;
ComponentLabel3.Show;
end;
wpSelectProgramGroup:
begin
WizardForm.GroupBrowseButton.Show;
WizardForm.GroupEdit.Show;
GroupLabel1.Show;
Grouplabel2.Show;
Grouplabel3.Show;
Grouplabel4.Show;
end;
wpSelectTasks:
begin
WizardForm.TasksList.Show;
TaskLabel1.Show;
TaskLabel2.Show;
TaskLabel3.Show;
end;
wpInstalling:
begin
ISDoneProgressBar1.Show;
LabelPct1.Show;
LabelTime1.Show;
labelTime2.Show;
InstalLabel1.Show;
InstalLabel2.Show;
MyCancelButton.Show;
end;
wpFinished:
begin
FinishedLabel.Show;
end;
end;
end;
Procedure CurPageChanged(CurPageID: Integer);
begin
HideComponent(CurPageID);
ShowComponent(CurPageID);
begin
if CurPageID = wpSelectDir then
if FreeMB < NeedSize then
begin
WizardForm.NextButton.Enabled:=False
end
begin
if CurPageID=wpSelectTasks then
begin
If WizardForm.FindComponent('NextButton') is TButton
then
TButton(WizardForm.FindComponent('NextButton')).Caption:='Установить';
end
begin
if (CurPageID = wpFinished) and ISDoneError then begin
FinishedLabel.Caption:= ExpandConstant('{cm:WarningCancel}');
end;
begin
UpdateButtons
end;
end;
end;
end;
end;
function CheckError:boolean;
begin
result:= not ISDoneError;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var Comps1,Comps2,Comps3, TmpValue:cardinal;
FindHandle1,ColFiles1,CurIndex1,tmp:integer;
ExecError:boolean;
InFilePath,OutFilePath,OutFileName:PAnsiChar;
begin
if CurStep = ssInstall then begin //Если необходимо, можно поменять на ssPostInstall
WizardForm.ProgressGauge.Hide;
WizardForm.CancelButton.Hide;
WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');
ISDoneCancel:=0;
// Распаковка всех необходимых файлов в папку {tmp}.
ExtractTemporaryFile('unarc.dll');
#ifdef facompress
ExtractTemporaryFile('facompress.dll'); //ускоряет распаковку .arc архивов.
#endif
#ifdef records
ExtractTemporaryFile('records.inf');
#endif
#ifdef precomp
#if precomp == "0.38"
ExtractTemporaryFile('precomp038.exe');
#else
#if precomp == "0.4"
ExtractTemporaryFile('precomp040.exe');
#else
#if precomp == "0.41"
ExtractTemporaryFile('precomp041.exe');
#else
ExtractTemporaryFile('precomp038.exe');
ExtractTemporaryFile('precomp040.exe');
ExtractTemporaryFile('precomp041.exe');
#endif
#endif
#endif
#endif
#ifdef unrar
ExtractTemporaryFile('Unrar.dll');
#endif
#ifdef XDelta
ExtractTemporaryFile('XDelta3.dll');
#endif
#ifdef PackZIP
ExtractTemporaryFile('7z.dll');
ExtractTemporaryFile('PackZIP.exe');
#endif
ExtractTemporaryFile('russian.ini');
// Подготавливаем переменную, содержащую всю информацию о выделенных компонентах для ISDone.dll
// максимум 96 компонентов.
Comps1:=0; Comps2:=0; Comps3:=0;
#ifdef Components
TmpValue:=1;
if IsComponentSelected('rus1') then Comps1:=Comps1+TmpValue; //компонент 1
TmpValue:=TmpValue*2;
if IsComponentSelected('rus2') then Comps1:=Comps1+TmpValue; //компонент 2
TmpValue:=TmpValue*2;
// if IsComponentSelected('eng') then Comps1:=Comps1+TmpValue; //компонент 3
// TmpValue:=TmpValue*2;
// if IsComponentSelected('voice\eng') then Comps1:=Comps1+TmpValue; //компонент 4
// .....
// см. справку
#endif
#ifdef precomp
PCFVer:={#precomp};
#else
PCFVer:=0;
#endif
ISDoneError:=true;
if ISDoneInit(ExpandConstant('{src}\records.inf'), $F777, Comps1,Comps2,Comps3, MainForm.Handle, {#NeedMem}, @ProgressCallback) then begin
repeat
ChangeLanguage('Russian');
if not SrepInit('',512,0) then break;
if not PrecompInit(PCFVer) then break;
if not FileSearchInit(false) then break;
if not ISArcExtract ( 0, 0, ExpandConstant('{src}\data.bin'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
//if not ISArcExtract ( 0, 0, ExpandConstant('{src}\Setup 2.bin'), ExpandConstant('{app}\zenozoik'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
//if not ISArcExtract ( 0, 0, ExpandConstant('{src}\Setup 3.bin'), ExpandConstant('{app}\zenozoik'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
//if not ISArcExtract ( 0, 0, ExpandConstant('{src}\Setup 4.bin'), ExpandConstant('{app}\zenozoik'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
//if not ISArcExtract ( 1, 0, ExpandConstant('{src}\Setup 5.bin'), ExpandConstant('{app}\zenozoik\sound'), '', false, '', '', '', notPCFonFLY ) then break;
//if not ISArcExtract ( 2, 0, ExpandConstant('{src}\Setup 6.bin'), ExpandConstant('{app}\zenozoik\sound'), '', false, '', '', '', notPCFonFLY ) then break;
//далее находятся закомментированые примеры различных функций распаковки (чтобы каждый раз не лазить в справку за примерами)
(*
if not ISArcExtract ( 0, 0, ExpandConstant('{src}\arc.arc'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
if not IS7ZipExtract ( 0, 0, ExpandConstant('{src}\CODMW2.7z'), ExpandConstant('{app}\data1'), false, '') then break;
if not ISRarExtract ( 0, 0, ExpandConstant('{src}\data_*.rar'), ExpandConstant('{app}'), false, '') then break;
if not ISSRepExtract ( 0, 0, ExpandConstant('{app}\data1024_1024.srep'),ExpandConstant('{app}\data1024.arc'), true) then break;
if not ISPrecompExtract( 0, 0, ExpandConstant('{app}\data.pcf'), ExpandConstant('{app}\data.7z'), true) then break;
if not ISxDeltaExtract ( 0, 0, 0, 640, ExpandConstant('{app}\in.pcf'), ExpandConstant('{app}\*.diff'), ExpandConstant('{app}\out.dat'), false) then break;
if not ISPackZIP ( 0, 0, ExpandConstant('{app}\1a1\*'), ExpandConstant('{app}\1a1.pak'), 2, false ) then break;
if not ISExec ( 0, 0, 0, ExpandConstant('{tmp}\Arc.exe'), ExpandConstant('x -o+ "{src}\001.arc" "{app}\"'), ExpandConstant('{tmp}'), '...',true) then break;
if not ShowChangeDiskWindow ('Пожалуйста, вставьте второй диск и дождитесь его инициализации.', ExpandConstant('{src}'),'CODMW_2.arc') then break;
// распаковка группы файлов посредством внешнего приложения
FindHandle1:=ISFindFiles(0,ExpandConstant('{app}\*.ogg'),ColFiles1);
ExecError:=false;
while not ExecError and ISPickFilename(FindHandle1,ExpandConstant('{app}\'),CurIndex1,true) do begin
InFilePath:=ISGetName(0);
OutFilePath:=ISGetName(1);
OutFileName:=ISGetName(2);
ExecError:=not ISExec(0, 0, 0, ExpandConstant('{tmp}\oggdec.exe'), '"'+InFilePath+'" "'+OutFilePath+'"',ExpandConstant('{tmp}'),OutFileName,false);
end;
ISFindFree(FindHandle1);
if ExecError then break;
*)
ISDoneError:=false;
until true;
ISDoneStop;
end;
LabelPct1.Hide
LabelTime1.Hide;
labelTime2.Hide;
WizardForm.CancelButton.Visible:=true;
WizardForm.CancelButton.Enabled:=false;
end;
if (CurStep=ssPostInstall) and ISDoneError then begin
Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
end;
end;
procedure DeinitializeSetup();
begin
// Hide Window before unloading skin so user does not get
// a glimse of an unskinned window before it is closed.
ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
begin
gdipShutdown;
end;
end;
[/more]