[CustomMessages]
rus.ArcTitle=Распаковка игровых архивов...
rus.ExtractedInfo=Распаковано %1 Мб из %2 Мб
rus.ArcInfo=Архив: %1 из %2
rus.AllProgress=Прогресс распаковки архивов:
rus.Extracting=Распаковывается: %1
rus.Taskbar=%1%%, ждите %2
rus.ArcRemains=Осталось ждать %1
rus.LongTime=вечно
rus.Ending=завершение
rus.ArcFail=Распаковка архивов не завершена!
rus.ArcBreak=Распаковка архивов прервана!
rus.ArcFinishedHeading=Установка игры {#AppName} не завершена
rus.ArcError=Установка игры {#MyAppName} не была завершена.
rus.ArcTrouble=Пожалуйста, устраните проблему и запустите установку снова.
rus.ArcBroken=Возможно, архив %1 повреждён или недостаточно места на диске назначения.
rus.ExtractedFile=Распаковывается файл:
rus.CancelButton=Отменить распаковку
rus.ArcTitleBack=Откат изменений...
rus.ISDoneError=Ошибка распаковки!
[Files]
Source: ISDone.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\InnoCallback.dll; DestDir: {tmp}; Flags: dontcopy
#ifdef records
Source: records.inf; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef precomp04
Source: Include\packjpg_dll.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\RTconsole.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp04.exe; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef precomp038
Source: Include\packjpg_dll.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\RTconsole.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\zlib1.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef unrar
Source: Include\Unrar.dll; DestDir: {tmp}; Flags: dontcopy
#endif
[UninstallDelete]
Type: filesandordirs; Name: {app}
[Code]
var
LabelPct, LabelCurrFileName, LabelStatusRollback, LabelStatus: TLabel;
ISDoneProgressBar: TNewProgressBar;
CancelUnpackingBtn: HWND;
OveralPct,Cancel, n:integer;
CallBack:longword;
MyError:boolean;
pr:Extended;
msgError: string;
ISDonePB: TImgPB;
type
TCallback = function (Pct: integer;CurrentFile:string): longword;
TMessage = record hWnd: HWND; msg, wParam: Word; lParam: LongWord; Time: TFileTime; pt: TPoint; end;
function PeekMessage(var lpMsg: TMessage; hWnd: HWND; wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL; external 'PeekMessageA@user32.dll stdcall';
function TranslateMessage(const lpMsg: TMessage): BOOL; external 'TranslateMessage@user32.dll stdcall';
function DispatchMessage(const lpMsg: TMessage): Longint; external 'DispatchMessageA@user32.dll stdcall';
function WrapMyCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:innocallback.dll stdcall';
function ISArcExtract(CurComponent:longword; var OveralPct:integer; PctOfTotal:double; InName, OutPath: string; DeleteInFile:boolean; callback: longword; Password, CfgFile, WorkPath: String):BOOL; external 'ISArcExtract@files:ISDone.dll stdcall';
function IS7ZipExtract(CurComponent:longword; var OveralPct:integer; PctOfTotal:double; InName, OutPath: string; DeleteInFile:boolean; callback: longword; Password: String):BOOL; external 'IS7zipExtract@files:ISDone.dll stdcall';
function ISRarExtract(CurComponent:longword; var OveralPct:integer; PctOfTotal:double; InName, OutPath: string; DeleteInFile:boolean; callback: longword; Password: String):BOOL; external 'ISRarExtract@files:ISDone.dll stdcall';
function ISPrecompExtract(CurComponent:longword; var OveralPct:integer; PctOfTotal:double; InName, OutFile: string; DeleteInFile:boolean; callback: longword):BOOL; external 'ISPrecompExtract@files:ISDone.dll stdcall';
function ISSRepExtract(CurComponent:longword; var OveralPct:integer; PctOfTotal:double; InName, OutFile, IdxFile: string; DeleteInFile:boolean; callback: longword):BOOL; external 'ISSrepExtract@files:ISDone.dll stdcall';
function ShowChangeDiskWindow(Text, DefaultPath, SearchFile:string):BOOL; external 'ShowChangeDiskWindow@files:ISDone.dll stdcall';
function StartRecord(RecordFileName:string; AllComponents:longword):BOOL; external 'StartRecord@files:ISDone.dll stdcall';
function CheckPoint(CurComponent:Integer):BOOL; external 'CheckPoint@files:ISDone.dll stdcall';
function StopRecord:BOOL; external 'StopRecord@files:ISDone.dll stdcall';
function GetWindowLong(hWnd, nIndex: Integer): Longint; external 'GetWindowLongA@user32 stdcall delayload';
function SetWindowText(hWnd: Longint; lpString: AnsiString): Longint; external 'SetWindowTextA@user32 stdcall delayload';
function cm(Message: String): String; Begin Result:= ExpandConstant('{cm:'+ Message +'}') End;
Procedure SetTaskBarTitle(Title: AnsiString); var h: Integer;
begin
h:= GetWindowLong(MainForm.Handle, -8); if h <> 0 then SetWindowText(h, Title);
end;
procedure AppProcessMessage;
var
Msg: TMessage;
begin
while PeekMessage(Msg, 0, 0, 0, 1) do begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end;
function ProgressCallback(Pct: integer; CurrentFile:string): longword;
begin
ImgPBSetPosition(ISDonePB,Pct/10);
LabelPct.Caption :=ExpandConstant('{cm:AllProgress} ')+IntToStr(Pct div 10)+'.'+IntToStr(Pct mod 10)+'%';
LabelCurrFileName.Caption :=ExpandConstant('{app}\')+CurrentFile;
AppProcessMessage;
Result := Cancel;
ImgApplyChanges(WizardForm.Handle);
end;
procedure Error;
var n:integer;
begin
Cancel:= -1;
Exec(ExpandConstant('{uninstallexe}'), '/SILENT','', sw_Hide, ewWaitUntilTerminated, n);
end;
procedure CreateISDoneComponents;
begin
LabelPct := TLabel.Create(WizardForm);
with LabelPct do begin
AutoSize:=False;
SetBounds(ScaleX(-70), ScaleY(170), ScaleX(638), ScaleY(17));
Alignment := taCenter;
Transparent:=True;
Font.Name:= 'Georgia'
Font.Size:= 8;
Font.Color:=$FFFFFF;
Font.Style:=[fsItalic];
Parent := WizardForm;
end;
LabelCurrFileName := TLabel.Create(WizardForm);
with LabelCurrFileName do begin
AutoSize:=False;
SetBounds(ScaleX(41), ScaleY(105), ScaleX(638), ScaleY(17));
Transparent:=True;
Font.Name:= 'Georgia'
Font.Size:= 8;
Font.Color:=$FFFFFF;
Font.Style:=[fsItalic];
Caption:= '';
Parent := WizardForm;
Hide;
end;
LabelStatusRollback := TLabel.Create(WizardForm);
with LabelStatusRollback do begin
Parent := WizardForm;
AutoSize := False;
SetBounds(ScaleX(41), ScaleY(80), ScaleX(400), ScaleY(17));
Transparent:=True;
Font.Name:= 'Georgia';
Font.Size:= 8;
Font.Color:=$FFFFFF;
Font.Style:=[fsBold,fsItalic];
Caption := cm('ArcTitleBack');
end;
LabelStatus := TLabel.Create(WizardForm);
with LabelStatus do begin
Parent := WizardForm;
AutoSize := False;
SetBounds(ScaleX(41), ScaleY(80), ScaleX(400), ScaleY(17));
Transparent:=True;
Font.Name:= 'Georgia';
Font.Size:= 8;
Font.Color:=$FFFFFF;
Font.Style:=[fsBold,fsItalic];
Caption := cm('ArcTitle');
end;
end;
procedure CancelUnpackingOnEnter(hBtn:HWND);
begin
sndPlaySound(ExpandConstant('{tmp}\WFEnter.wav'),$0001);
end;
procedure CancelUnpackingOnClick(hBtn:HWND);
begin
sndPlaySound(ExpandConstant('{tmp}\Click.wav'),$0001);
if MsgBox( SetupMessage( msgExitSetupMessage ), mbConfirmation, MB_YESNO ) = IDYES then Cancel:= 1;
end;
Procedure UnpackingISDoneFinished(CurPageID: Integer);
begin
if (CurPageID = wpFinished) and (Cancel <> 0) then
begin
WizardForm.Caption:= ExpandConstant('{cm:ISDoneError}');
SetTaskBarTitle(SetupMessage(msgErrorTitle));
FinishedHeadingLabel.Caption:=cm('ArcFinishedHeading');
FinishedHeadingLabel.Font.Color:= $0000C0; // red (красный)
FinishedLabel.Caption:= msgError + ExpandConstant(' {cm:ArcTrouble}') + #10#13#10#13+ExpandConstant('{cm:FinishedLabel2}');
FinishedLabel.Font.Color:= $0000C0; // red (красный)
end;
CancelUnpackingBtn:=BtnCreate(WizardForm.Handle,408,297,80,80,ExpandConstant('{tmp}\button.png'),10,False);
BtnSetEvent(CancelUnpackingBtn,BtnMouseEnterEventID,WrapBtnCallback(@CancelUnpackingOnEnter,1));
BtnSetEvent(CancelUnpackingBtn,BtnClickEventID,WrapBtnCallback(@CancelUnpackingOnClick,1));
BtnSetFont(CancelUnpackingBtn,WFButtonFont.Handle);
BtnSetFontColor(CancelUnpackingBtn,$ffffff,$000000,$ffffff,$B6B6B6);
BtnSetCursor(CancelUnpackingBtn,GetSysCursorHandle(32649));
BtnSetVisibility(CancelUnpackingBtn, False);
end;
procedure UnpackingISDone(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
if MyError then Error;
if CurStep = ssInstall then begin
ISDonePB:=ImgPBCreate(WizardForm.Handle, ExpandConstant('{tmp}\ProgressBackground.png'), ExpandConstant('{tmp}\ProgressImg.png'),ScaleX(41),ScaleY(130),ScaleX(330),WizardForm.ProgressGauge.Height);
NewPB:=ImgPBCreate(WizardForm.Handle, ExpandConstant('{tmp}\ProgressBackground2.png'), ExpandConstant('{tmp}\ProgressImg.png'),376,130,80,WizardForm.ProgressGauge.Height);
ImgApplyChanges(WizardForm.Handle);
PBOldProc:=SetWindowLong(WizardForm.ProgressGauge.Handle,-4,CallBackProc(@PBProc,4));
LabelStatus.Show;
BtnSetText(CancelUnpackingBtn,WizardForm.CancelButton.Caption);
BtnSetVisibility(CancelUnpackingBtn, True);
BtnSetVisibility(hCancelBtn, False);
LabelPct.Show;
LabelCurrFileName.Show;
ProgressInfoLabel.Hide;
CallBack:=WrapMyCallback(@ProgressCallback,2);
Cancel:=0;
OveralPct:=0;
// Распаковка всех необходимых файлов в папку {tmp}. Это необходимо для того, чтобы
//выполнять установку в момент ssInstall, и секция [Run] выполнялась после установки.
#ifdef records
ExtractTemporaryFile('records.inf');
#endif
#ifdef precomp04
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('RTconsole.exe');
ExtractTemporaryFile('precomp04.exe');
#endif
#ifdef precomp038
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('RTconsole.exe');
ExtractTemporaryFile('precomp038.exe');
ExtractTemporaryFile('zlib1.dll');
#endif
#ifdef unrar
ExtractTemporaryFile('Unrar.dll');
#endif
StartRecord(ExpandConstant('{src}\records.inf'),0);
repeat
MyError:=true;
if not ISArcExtract ( 1, OveralPct, 0, ExpandConstant('{src}\setup-1.bin'), ExpandConstant('{app}'), false,CallBack, '', '', '') then break;
if not ISArcExtract ( 2, OveralPct, 0, ExpandConstant('{src}\setup-2.bin'), ExpandConstant('{app}'), false,CallBack, '', '', '') then break;
if not ISArcExtract ( 3, OveralPct, 0, ExpandConstant('{src}\setup-3.bin'), ExpandConstant('{app}\DI\Data'), false,CallBack, '', '', '') then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_buildinginterior_b_PC.srep'), ExpandConstant('{app}\DI\Data\bs_buildinginterior_b_PC.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_buildinginterior_b_PC.pcf'), ExpandConstant('{app}\DI\Data\bs_buildinginterior_b_PC.rpack'), true, CallBack ) then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_buildinginterior_PC.srep'), ExpandConstant('{app}\DI\Data\bs_buildinginterior_PC.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_buildinginterior_PC.pcf'), ExpandConstant('{app}\DI\Data\bs_buildinginterior_PC.rpack'), true, CallBack ) then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_jungle_b_PC.srep'), ExpandConstant('{app}\DI\Data\bs_jungle_b_PC.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_jungle_b_PC.pcf'), ExpandConstant('{app}\DI\Data\bs_jungle_b_PC.rpack'), true, CallBack) then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_jungle_high_PC.srep'), ExpandConstant('{app}\DI\Data\bs_jungle_high_PC.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_jungle_high_PC.pcf'), ExpandConstant('{app}\DI\Data\bs_jungle_high_PC.rpack'), true, CallBack) then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_jungle_PC.srep'), ExpandConstant('{app}\DI\Data\bs_jungle_PC.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_jungle_PC.pcf'), ExpandConstant('{app}\DI\Data\bs_jungle_PC.rpack'), true, CallBack) then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_laboratory_PC.srep'), ExpandConstant('{app}\DI\Data\bs_laboratory_PC.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_laboratory_PC.pcf'), ExpandConstant('{app}\DI\Data\bs_laboratory_PC.rpack'), true, CallBack) then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_military_quarters_PC.srep'), ExpandConstant('{app}\DI\Data\bs_military_quarters_PC.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_military_quarters_PC.pcf'), ExpandConstant('{app}\DI\Data\bs_military_quarters_PC.rpack'), true, CallBack) then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_quarantine_PC.srep'), ExpandConstant('{app}\DI\Data\bs_quarantine_PC.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_quarantine_PC.pcf'), ExpandConstant('{app}\DI\Data\bs_quarantine_PC.rpack'), true, CallBack) then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_ship_PC.srep'), ExpandConstant('{app}\DI\Data\bs_ship_PC.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_ship_PC.pcf'), ExpandConstant('{app}\DI\Data\bs_ship_PC.rpack'), true, CallBack) then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_town_PC.srep'), ExpandConstant('{app}\DI\Data\bs_town_PC.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_town_PC.pcf'), ExpandConstant('{app}\DI\Data\bs_town_PC.rpack'), true, CallBack) then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_tunnels_PC.srep'), ExpandConstant('{app}\DI\Data\bs_tunnels_PC.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\bs_tunnels_PC.pcf'), ExpandConstant('{app}\DI\Data\bs_tunnels_PC.rpack'), true, CallBack) then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\menuback_PC.srep'), ExpandConstant('{app}\DI\Data\menuback_PC.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\menuback_PC.pcf'), ExpandConstant('{app}\DI\Data\menuback_PC.rpack'), true, CallBack) then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\weapons_PC.srep'), ExpandConstant('{app}\DI\Data\weapons_PC.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\weapons_PC.pcf'), ExpandConstant('{app}\DI\Data\weapons_PC.rpack'), true, CallBack) then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\DI\Data\music_stream.srep'), ExpandConstant('{app}\DI\Data\music_stream.xwb'), '', true, CallBack ) then break;
//if not ISRarExtract ( 0, OveralPct, 0, ExpandConstant('{src}\aaa.rar'), ExpandConstant('{app}'), false,CallBack, '' ) then break;
//if not ISArcExtract ( 0, OveralPct, 0, ExpandConstant('{src}\setup-1.bin'), ExpandConstant('{app}'), false,CallBack, '', '', '') then break;
//if not ISArcExtract ( 0, OveralPct, 0, ExpandConstant('{src}\setup-2.bin'), ExpandConstant('{app}'), false,CallBack, '', '', '') then break;
//if not ISArcExtract ( 0, OveralPct, 0, ExpandConstant('{src}\setup-3.bin'), ExpandConstant('{app}'), false,CallBack, '', '', '') then break;
//if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\bs_buildinginterior_b_PC.pcf'), ExpandConstant('{app}\bs_buildinginterior_b_PC.rpack'), true, CallBack ) then break;
//if not IS7ZipExtract ( 0, OveralPct, 0, ExpandConstant('{app}\data1\CODMW2.7z'), ExpandConstant('{app}\data1'), true, CallBack, '' ) then break;
//if not ShowChangeDiskWindow('Пожалуйста, вставьте диск 2 и дождитесь его инициализации.', ExpandConstant('{src}'),'CODMW2_Disk2.arc' ) then break;
//if not ISArcExtract ( 1, OveralPct, 0, ExpandConstant('{src}\rustext.arc'), ExpandConstant('{app}'), false,CallBack, '', '', '') then break;
//if not ISArcExtract ( 2, OveralPct, 0, ExpandConstant('{src}\engtext.arc'), ExpandConstant('{app}'), false,CallBack, '', '', '') then break;
//if not ISArcExtract ( 3, OveralPct, 0, ExpandConstant('{src}\rusvoice.arc'),ExpandConstant('{app}'), false,CallBack, '', '', '') then break;
//if not ISArcExtract ( 4, OveralPct, 0, ExpandConstant('{src}\engvoice.arc'),ExpandConstant('{app}'), false,CallBack, '', '', '') then break;
MyError:=false;
until true;
StopRecord;
BtnSetVisibility(CancelUnpackingBtn, False);
BtnSetVisibility(hCancelBtn, True);
BtnSetEnabled(hCancelBtn, False);
LabelStatus.Hide;
LabelPct.Hide;
LabelCurrFileName.Hide;
ProgressInfoLabel.Show;
end;
end;