Автор: Dark_Delphin
Дата сообщения: 06.06.2011 23:12
Что надо поправить в скрипте что-бы сначала распаковывались файлы, а потом сам *.arc арихив?
[more]#define GameName "Crysis Warhead"
#define NeedSize "10000000000"
#define precomp038
#define ExeName "Crysis2Launcher.exe"
#define ExeDir "bin32\"
[Setup]
AppName={#GameName}
AppVerName={#GameName}
DefaultDirName={pf}\{#GameName}
DefaultGroupName={#GameName}
OutputDir=.
OutputBaseFilename=Setup
SolidCompression=true
#ifdef NeedSize
ExtraDiskSpaceRequired={#NeedSize}
#endif
WizardImageFile=img.bmp
WizardSmallImageFile=shapka.bmp
#ifdef Components
SetupIconFile=iconset.ico
Compression=lzma2/ultra64
InternalCompressLevel=ultra64
[Types]
Name: "full"; Description: "Full installation"; Flags: iscustom
#endif
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
; лого (нижнє)
Source: "logo2.bmp"; DestDir: "{app}"; Attribs: hidden system;
; Іконка папки при виборі папки установки
Source: "DirBitmap.bmp"; DestDir: "{tmp}"; Flags: dontcopy
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 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
[Run]
Filename: "{src}\Redist\dxwebsetup.exe"; StatusMsg: "Обновление DirectX..."; Flags: waituntilterminated
Filename: "{src}\Redist\vcredist_x86_2005_sp1.exe"; Parameters: "/q"; StatusMsg: "Установка Microsoft Visual C++ 2005 SP1 Redist..."; Flags: runhidden waituntilterminated ;
[Icons]
Name: {group}\{#GameName}; Filename: {app}\{#ExeDir}{#ExeName}; WorkingDir: {app}\{#ExeDir}; Comment: {#GameName};
Name: {group}\Удалить игру; Filename: {app}\Uninstall\unins000; WorkingDir: {app}\Uninstall\; Comment: Удалить игру;
; Іконка на роб. стіл
Name: "{commondesktop}\{#GameName}"; Filename: "{app}\{#ExeDir}{#ExeName}"; WorkingDir: "{app}\{#ExeDir}"; Comment: "{#GameName}"; Tasks: desktopicon;
[CustomMessages]
russian.ExtractedFile=Распаковывается файл:
russian.CancelButton=Отменить распаковку
russian.Error=Ошибка распаковки!
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
[UninstallDelete]
Type: filesandordirs; Name: {app}
[Code]
var
LabelPct,LabelCurrFileName: TLabel;
ISDoneProgressBar: TNewProgressBar;
MyCancelButton: TButton;
OveralPct,Cancel:integer;
CallBack:longword;
MyError:boolean;
FinishedLabel: TLabel;
Text: TNewStaticText;
LogoImage: TBitmapImage;
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: AnsiString; DeleteInFile:boolean; callback: longword; Password, CfgFile, WorkPath: AnsiString):BOOL; external 'ISArcExtract@files:ISDone.dll stdcall';
function IS7ZipExtract(CurComponent:longword; var OveralPct:integer; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; callback: longword; Password: AnsiString):BOOL; external 'IS7zipExtract@files:ISDone.dll stdcall';
function ISPrecompExtract(CurComponent:longword; var OveralPct:integer; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean; callback: longword):BOOL; external 'ISPrecompExtract@files:ISDone.dll stdcall';
function ISSRepExtract(CurComponent:longword; var OveralPct:integer; PctOfTotal:double; InName, OutFile, IdxFile: AnsiString; DeleteInFile:boolean; callback: longword):BOOL; external 'ISSrepExtract@files:ISDone.dll stdcall';
function ShowChangeDiskWindow(Text, DefaultPath, SearchFile:AnsiString):BOOL; external 'ShowChangeDiskWindow@files:ISDone.dll stdcall';
function StartRecord(RecordFileName:AnsiString; 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 ProgressCallback(Pct: integer; CurrentFile:AnsiString): longword;
var Msg: TMessage;
begin
if Pct<=ISDoneProgressBar.Max then
ISDoneProgressBar.Position := Pct;
LabelPct.Caption := IntToStr(Pct div 10)+'.'+chr(48 + Pct mod 10)+'%';
LabelCurrFileName.Caption :=ExpandConstant('{cm:ExtractedFile} ')+CurrentFile;
while PeekMessage(Msg, 0, 0, 0, 1) do begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
Result := Cancel;
end;
procedure CancelButtonOnClick(Sender: TObject);
begin
if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then Cancel:=1;
end;
procedure InitializeWizard();
begin
// розпаковка темп. іконки папки
ExtractTemporaryFile('DirBitmap.bmp');
// розпаковка темп. лого (внизу)
ExtractTemporaryFile('logo2.bmp');
/////////////////// КОД для лого (внизу)
LogoImage := TBitmapImage.Create(WizardForm);
with LogoImage do
begin
// розміри
SetBounds(ScaleX(10), ScaleY(320), ScaleX(175), ScaleY(35));
Bitmap.LoadFromFile(ExpandConstant('{tmp}\logo2.bmp'));
Parent := WizardForm;
end;
//////////////// КІНЕЦЬ для лого (внизу)
//////////////// лого вверху
with WizardForm.WizardSmallBitmapImage do
begin
// розміри
SetBounds(ScaleX(0), ScaleY(2), ScaleX(497), ScaleY(56));
end;
///////////// іконка папки
with WizardForm.SelectDirBitmapImage do
begin
// розміри
SetBounds(ScaleX(0), ScaleY(0), ScaleX(42), ScaleY(42));
end;
///////////////////////////////////////////////////////
WizardForm.SelectDirBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\DirBitmap.bmp'));
///////////
WizardForm.MainPanel.Color := clGray;
WizardForm.WizardBitmapImage.Width := 497;
WizardForm.WizardBitmapImage2.Width := 497;
WizardForm.PageNameLabel.Width:=0;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.Font.Color:=clblack;
// background colour
WizardForm.Color:=clGray; // Цвет панелі та шо внизу
WizardForm.WelcomePage.Color:=clGray;
WizardForm.InnerPage.Color:=clGray; // цвет панели посеред инстала
WizardForm.SelectDirPage.Color:=clGray;
WizardForm.FinishedPage.Color:=clGray;
/////////////// перша сторінка
WizardForm.WelcomeLabel1.Hide;
WizardForm.WelcomeLabel2.Hide;
with TLabel.Create(WizardForm) do begin
AutoSize:=WizardForm.WelcomeLabel1.AutoSize;
Left:=WizardForm.WelcomeLabel1.Left;
Top:=WizardForm.WelcomeLabel1.Top
Width:=WizardForm.WelcomeLabel1.Width
Height:=WizardForm.WelcomeLabel1.Height
WordWrap:=WizardForm.WelcomeLabel1.WordWrap;
Font.Name:=WizardForm.WelcomeLabel1.Font.Name;
Font.Size:=WizardForm.WelcomeLabel1.Font.Size;
Font.Color:=clblack; // text colour верхнє
Font.Style:=WizardForm.WelcomeLabel1.Font.Style;
Caption:=WizardForm.WelcomeLabel1.Caption;
Parent:=WizardForm.WelcomeLabel1.Parent
Transparent:=True
end;
with TLabel.Create(WizardForm) do begin
AutoSize:=WizardForm.WelcomeLabel2.AutoSize;
Left:=WizardForm.WelcomeLabel2.Left;
Top:=WizardForm.WelcomeLabel2.Top
Width:=WizardForm.WelcomeLabel2.Width
Height:=WizardForm.WelcomeLabel2.Height
WordWrap:=WizardForm.WelcomeLabel2.WordWrap;
Font.Name:=WizardForm.WelcomeLabel2.Font.Name;
Font.Size:=WizardForm.WelcomeLabel2.Font.Size;
Font.Color:=clblack; // text colour нижнє
Font.Style:=WizardForm.WelcomeLabel2.Font.Style;
Caption:=WizardForm.WelcomeLabel2.Caption;
Parent:=WizardForm.WelcomeLabel2.Parent
Transparent:=True
end;
/////////////////////////
///////// фініш
WizardForm.FinishedHeadingLabel.Hide;
with TLabel.Create(WizardForm) do begin
AutoSize:=WizardForm.FinishedHeadingLabel.AutoSize;
Left:=WizardForm.FinishedHeadingLabel.Left;
Top:=WizardForm.FinishedHeadingLabel.Top
Width:=WizardForm.FinishedHeadingLabel.Width
Height:=WizardForm.FinishedHeadingLabel.Height
WordWrap:=WizardForm.FinishedHeadingLabel.WordWrap;
Font.Name:=WizardForm.FinishedHeadingLabel.Font.Name;
Font.Size:=WizardForm.FinishedHeadingLabel.Font.Size;
Font.Color:=clblack; // text colour в конце инсталлятора
Font.Style:=WizardForm.FinishedHeadingLabel.Font.Style;
Caption:=WizardForm.FinishedHeadingLabel.Caption;
Parent:=WizardForm.FinishedHeadingLabel.Parent
Transparent:=True
end;
FinishedLabel:= TLabel.Create(WizardForm)
WizardForm.FinishedLabel.Hide;
with TLabel.Create(WizardForm) do begin
Font.Name:=WizardForm.FinishedLabel.Font.Name;
Font.Size:=WizardForm.FinishedLabel.Font.Size;
Font.Color:=clgreen; // text colour
Font.Style:=WizardForm.FinishedLabel.Font.Style;
Caption:=WizardForm.FinishedLabel.Caption;
Parent:=WizardForm.FinishedLabel.Parent
Transparent:=True
end;
/////////////////////////////////////////////
ISDoneProgressBar := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar do begin
Left := ScaleX(0);
Top := ScaleY(40);
Width := ScaleX(417);
Max := 1000;
Height := WizardForm.ProgressGauge.Height;
Parent := WizardForm.InstallingPage;
end;
LabelPct := TLabel.Create(WizardForm);
with LabelPct do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := WizardForm.ProgressGauge.Width;
Top := WizardForm.ProgressGauge.Top + ScaleY(40);
Alignment := taCenter;
Caption := '';
end;
LabelCurrFileName := TLabel.Create(WizardForm);
with LabelCurrFileName do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := WizardForm.ProgressGauge.Width;
Left := ScaleX(0);
Top := WizardForm.ProgressGauge.Top + ScaleY(25);
Caption := '';
end;
end;
Procedure CurPageChanged(CurPageID: Integer);
Begin
if (CurPageID = wpFinished) and MyError then
begin
/////////
with TLabel.Create(WizardForm) do begin
WizardForm.FinishedLabel.Hide;
AutoSize:=WizardForm.FinishedHeadingLabel.AutoSize;
Left:=WizardForm.FinishedLabel.Left;
Top:=WizardForm.FinishedLabel.Top
Width:=WizardForm.FinishedLabel.Width
Height:=WizardForm.FinishedLabel.Height
WordWrap:=WizardForm.FinishedLabel.WordWrap;
Font.Name:=WizardForm.FinishedLabel.Font.Name;
Font.Size:=WizardForm.FinishedLabel.Font.Size;
//
WizardForm.Caption:= ExpandConstant('{cm:Error}');
WizardForm.FinishedLabel.Font.Color:= clyellow;
WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted);
Font.Color:=clwhite;
//
Font.Style:=WizardForm.FinishedLabel.Font.Style;
Caption:=WizardForm.FinishedLabel.Caption;
Parent:=WizardForm.FinishedLabel.Parent
Transparent:=True
end;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var ChComp, TmpValue:longword;
n:integer;
begin
if CurStep = ssInstall then begin //Если необходимо, можно переделать на ssPostInstall
WizardForm.ProgressGauge.Hide;
WizardForm.CancelButton.Visible:=false;
MyCancelButton:=TButton.Create(WizardForm);
with MyCancelButton do begin
Parent:=WizardForm;
Width:=ScaleX(135);
Caption:=ExpandConstant('{cm:CancelButton}');
Left:=ScaleX(360);
Top:=WizardForm.cancelbutton.top;
OnClick:=@CancelButtonOnClick;
end;
CallBack:=WrapMyCallback(@ProgressCallback,2);
Cancel:=0;
OveralPct:=0;
// Распаковка всех необходимых файлов в папку {tmp}. Это необходимо для того, чтобы
//выполнять установку в момент ssInstall, и секция [Run] выполнялась после установки.
#ifdef records
ExtractTemporaryFile('records.inf');
#endif
#ifdef precomp038
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('RTconsole.exe');
ExtractTemporaryFile('precomp038.exe');
ExtractTemporaryFile('zlib1.dll');
#endif
// Подготавливаем переменную, содержащую всю информацию о выделенных компонентах для ISDone.dll
ChComp:=0;
StartRecord(ExpandConstant('{src}\records.inf'),ChComp);
repeat
MyError:=true;
if not ISArcExtract ( 0, OveralPct, 0, ExpandConstant('{src}\muzk.arc'), ExpandConstant('{app}'), false,CallBack, '', '', '') then break;
if not ISSRepExtract ( 0, OveralPct, 0, ExpandConstant('{app}\muzk.srep'), ExpandConstant('{app}\muzk.pcf'), '', true, CallBack ) then break;
if not ISPrecompExtract( 0, OveralPct, 0, ExpandConstant('{app}\muzk.pcf'), ExpandConstant('{app}\muzk.7z'), true, CallBack ) then break;
if not IS7ZipExtract ( 0, OveralPct, 0, ExpandConstant('{app}\muzk.7z'), ExpandConstant('{app}'), true, CallBack, '' ) then break;
MyError:=false;
until true;
StopRecord;
MyCancelButton.Visible:=false;
WizardForm.CancelButton.Visible:=true;
end;
if (CurStep=ssPostInstall) and MyError then
Exec(ExpandConstant('{uninstallexe}'), '/SILENT','', sw_Hide, ewWaitUntilTerminated, n);
end;[/more]