ISDone

DLL ISDone 0.6 final

Нет прав для скачивания

vint56

Ветеран
Проверенный
cepbl4,
[Files]
Source: Include\English.ini; DestDir: {tmp}; Flags: dontcopy
Source: Include\Russian.ini; DestDir: {tmp}; Flags: dontcopy

Код:
procedure CurStepChanged(CurStep: TSetupStep);
ExtractTemporaryFile('English.ini');
ExtractTemporaryFile('Russian.ini');

if ActiveLanguage='russian' then
ChangeLanguage('russian')
else
if ActiveLanguage='english' then
ChangeLanguage('english');
 

Вложения

cepbl4

Мимокрокодил
vint56, Ваш код не смог вставить в нужное место, поэтому у меня выдавало ошибку.
Зато разобрался с дефолтным кодом, который в шапке, там не хватает строк
вот так у себя сделал и все стало хорошо:
Код:
[Files]
Source: Include\English.ini; DestDir: {tmp}; Flags: dontcopy
Source: Include\Russian.ini; DestDir: {tmp}; Flags: dontcopy

[Code]
    ExtractTemporaryFile('English.ini');
    ExtractTemporaryFile('Russian.ini');

//        ChangeLanguage('English');
          ChangeLanguage('Russian');

мой весь код (совмещено 3 кода - распак архивов - поиск открытого exe и предложение его закрыть и поиск пути установки в реестре
#define NeedSize "19430670336"

#define NeedMem 512

;#define SecondProgressBar

;#define Components

#define records

#define facompress

;#define PrecompInside
;#define SrepInside
;#define MSCInside
;#define precomp "0.42"
#define unrar
;#define XDelta
;#define PackZIP

[Setup]
#ifdef NeedSize
ExtraDiskSpaceRequired={#NeedSize}
#endif
AppName=Team Fortress 2 Steam version
AppVerName=Team Fortress 2
;DefaultDirName={pf}/Steam
DefaultDirName={code:GetInstallDir}
;- убрать комментирование
;DefaultGroupName=Assassin's Creed™ Dirесtоr's Cut Еditiоn
AllowNoIcons=yes
OutputDir=d:\Repacks\TF2
OutputBaseFilename=setup
SetupIconFile=ico\tf2_icon_256_full_round.ico
Compression=lzma
;SolidCompression=no
;DiskSpanning=yes
;DiskSliceSize=max
;AppCopyright=Valve
;VersionInfoCompany=Valve
VersionInfoDescription=Team Fortress 2 Setup
;VersionInfoVersion=1.02
;UninstallLogMode=overwrite
WizardImageFile=bmp\WizardImage5.bmp
;WizardImageFile=D:\Cloud@Mail.Ru1\Distr\Inno Setup Projects\inno\assassin_rus\2009-01-04_135907.bmp
WizardSmallImageFile=bmp\tf2_icon_256_full.bmp
;WindowVisible=yes
;SlicesPerDisk=6
;ReserveBytes=73232483
InfoBeforeFile=info\iNFO.txt
Uninstallable=no
DirExistsWarning=no
EnableDirDoesntExistWarning=yes

#ifdef Components
[Types]
Name: full; Description: Full installation; Flags: iscustom

[Components]
Name: text; Description: Язык субтитров; Types: full; Flags: fixed
Name: text\rus; Description: Русский; Flags: exclusive; ExtraDiskSpaceRequired: 100000000
Name: text\eng; Description: Английский; Flags: exclusive; ExtraDiskSpaceRequired: 200000000
Name: voice; Description: Язык озвучки; Types: full; Flags: fixed
Name: voice\rus; Description: Русский; Flags: exclusive; ExtraDiskSpaceRequired: 500000000
Name: voice\eng; Description: Английский; Flags: exclusive; ExtraDiskSpaceRequired: 600000000
#endif

[Registry]
;Root: HKLM; Subkey: Software\ProFrager; ValueName: path; ValueType: String; ValueData: {app}; Flags: uninsdeletekey; Check: CheckError
;Root: HKLM; Subkey: Software\ProFrager; ValueName: name; ValueType: String; ValueData: Data; Flags: uninsdeletekey; Check: CheckError

[Icons]
;Name: {group}\Удалить пример ISDone; Filename: {app}\unins000.exe; WorkingDir: {app}; Check: CheckError
;Name: {commondesktop}\Удалить пример ISDone; Filename: {app}\unins000.exe; WorkingDir: {app}; Check: CheckError

[Tasks]
;Name: VCCheck; Description: Установить Microsoft Visual C++ 2005 Redist
;Name: PhysXCheck; Description: Установить Nvidia PhysX

[Run]
;Filename: {src}\Redist\vcredist_x86.exe; Parameters: /q; StatusMsg: Устанавливаем Microsoft Visual C++ 2005 Redist...; Flags: skipifdoesntexist; Tasks: VCCheck; Check: CheckError
;Filename: {src}\Redist\PhysX.exe; Parameters: /qn; StatusMsg: Устанавливаем Nvidia PhysX...; Flags: skipifdoesntexist; Tasks: PhysXCheck; Check: CheckError
Filename: "{app}\steam.exe"; WorkingDir: "{app}"; Description: {cm:LaunchProgram,Steam}; Flags: shellexec postinstall skipifsilent; Check: CheckError

[Files]
;Source: D:\Download\Games\TF2 test\Steam\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs; Check: CheckError
Source: dll\ISTask.dll; Flags: dontcopy solidbreak;
Source: Include\English.ini; DestDir: {tmp}; Flags: dontcopy
Source: Include\Russian.ini; DestDir: {tmp}; Flags: dontcopy
Source: Include\unarc.dll; DestDir: {tmp}; Flags: dontcopy
Source: dll\ISDone.dll; DestDir: {tmp}; Flags: dontcopy
#ifdef records
Source: D:\Repacks\TF2\records.inf; DestDir: {tmp}; Flags: dontcopy
#endif

#ifdef PrecompInside
Source: Include\CLS-precomp.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\packjpg_dll.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\packjpg_dll1.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\zlib1.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef SrepInside
Source: Include\CLS-srep.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef MSCInside
Source: Include\CLS-MSC.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef facompress
Source: Include\facompress.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef precomp
#if precomp == "0.38"
Source: Include\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
#else
#if precomp == "0.4"
Source: Include\precomp040.exe; DestDir: {tmp}; Flags: dontcopy
#else
#if precomp == "0.41"
Source: Include\precomp041.exe; DestDir: {tmp}; Flags: dontcopy
#else
#if precomp == "0.42"
Source: Include\precomp042.exe; DestDir: {tmp}; Flags: dontcopy
#else
Source: Include\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp040.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp041.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp042.exe; DestDir: {tmp}; Flags: dontcopy
#endif
#endif
#endif
#endif
#endif
#ifdef unrar
Source: Include\Unrar.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef XDelta
Source: Include\XDelta3.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef PackZIP
Source: Include\7z.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\packZIP.exe; DestDir: {tmp}; Flags: dontcopy
#endif

[Messages]
BeveledLabel=--- L|Steam-Rip by CEPbl4 v.2016.11.24
;SetupWindowTitle=Установка Assassin's Creed™ Dirесtоr's Cut Еditiоn
;UninstallAppFullTitle=Удаление Assassin's Creed™ Dirесtоr's Cut Еditiоn
SelectDirLabel3=Выберете папку с установленным Steam (он должен быть закрыт).

[CustomMessages]
russian.ExtractedFile=Извлекается файл:
russian.Extracted=Распаковка архивов...
russian.CancelButton=Отменить распаковку
russian.Error=Ошибка распаковки!
russian.ElapsedTime=Прошло:
russian.RemainingTime=Осталось времени:
russian.EstimatedTime=Всего:
russian.AllElapsedTime=Время установки:

[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl

[UninstallDelete]
Type: filesandordirs; Name: {app}

[ Code]
// --- Generated by InnoSetup Script Joiner version 3.0, Jul 22 2009, (c) Bulat Ziganshin <Bulat.Ziganshin@gmail.com>. More info at http://issjoiner.codeplex.com/

// --- Source: Распаковка архивов ISDone.iss ------------------------------------------------------------
const
PCFonFLY=true;
notPCFonFLY=false;
var
LabelPct1,LabelCurrFileName,LabelTime1,LabelTime2,LabelTime3: TLabel;
ISDoneProgressBar1: TNewProgressBar;
#ifdef SecondProgressBar
LabelPct2: TLabel;
ISDoneProgressBar2:TNewProgressBar;
#endif
MyCancelButton: TButton;
ISDoneCancel:integer;
ISDoneError:boolean;
PCFVer:double;

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, 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 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: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 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)+'%';
#ifdef SecondProgressBar
if CurrentPct<=1000 then ISDoneProgressBar2.Position := CurrentPct;
LabelPct2.Caption := IntToStr(CurrentPct div 10)+'.'+chr(48 + CurrentPct mod 10)+'%';
#endif
LabelCurrFileName.Caption:=ExpandConstant('{cm:ExtractedFile} ')+MinimizePathName(CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width-ScaleX(100));
LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
LabelTime3.Caption:=ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;
Result := ISDoneCancel;
end;

procedure CancelButtonOnClick(Sender: TObject);
begin
SuspendProc;
if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then ISDoneCancel:=1;
ResumeProc;
end;

procedure HideControls;
begin
WizardForm.FileNamelabel.Hide;
ISDoneProgressBar1.Hide;
LabelPct1.Hide;
LabelCurrFileName.Hide;
LabelTime1.Hide;
LabelTime2.Hide;
MyCancelButton.Hide;
#ifdef SecondProgressBar
ISDoneProgressBar2.Hide;
LabelPct2.Hide;
#endif
end;

procedure CreateControls;
var PBTop:integer;
begin
PBTop:=ScaleY(50);
ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar1 do begin
Parent := WizardForm.InstallingPage;
Height := WizardForm.ProgressGauge.Height;
Left := ScaleX(0);
Top := PBTop;
Width := ScaleX(365);
Max := 1000;
end;
LabelPct1 := TLabel.Create(WizardForm);
with LabelPct1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ISDoneProgressBar1.Width+ScaleX(5);
Top := ISDoneProgressBar1.Top + ScaleY(2);
Width := ScaleX(80);
end;
LabelCurrFileName := TLabel.Create(WizardForm);
with LabelCurrFileName do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := ISDoneProgressBar1.Width+ScaleX(30);
Left := ScaleX(0);
Top := ScaleY(30);
end;
#ifdef SecondProgressBar
PBTop:=PBTop+ScaleY(25);
ISDoneProgressBar2 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar2 do begin
Parent := WizardForm.InstallingPage;
Left := ScaleX(0);
Top := PBTop+ScaleY(8);
Width := ISDoneProgressBar1.Width;
Max := 1000;
Height := WizardForm.ProgressGauge.Height;
end;
LabelPct2 := TLabel.Create(WizardForm);
with LabelPct2 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ISDoneProgressBar2.Width+ScaleX(5);
Top := ISDoneProgressBar2.Top + ScaleY(2);
Width := ScaleX(80);
end;
#endif
LabelTime1 := TLabel.Create(WizardForm);
with LabelTime1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := ISDoneProgressBar1.Width div 2;
Left := ScaleX(0);
Top := PBTop + ScaleY(35);
end;
LabelTime2 := TLabel.Create(WizardForm);
with LabelTime2 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := LabelTime1.Width+ScaleX(40);
Left := ISDoneProgressBar1.Width div 2;
Top := LabelTime1.Top;
end;
LabelTime3 := TLabel.Create(WizardForm);
with LabelTime3 do begin
Parent := WizardForm.FinishedPage;
AutoSize := False;
Width := WizardForm.FinishedLabel.Width;
Left := WizardForm.FinishedLabel.Left;
end;
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;
end;

Procedure CurPageChanged1(CurPageID: Integer);
Begin
if CurPageID = wpFinished then
begin
WizardForm.Runlist.Top := WizardForm.Runlist.Top + ScaleY(30);
WizardForm.Runlist.Height := WizardForm.Runlist.Height - ScaleY(30);
LabelTime3.Top := WizardForm.FinishedLabel.Top + WizardForm.FinishedLabel.Height;

if ISDoneError then begin
LabelTime3.Hide;
WizardForm.Caption:= ExpandConstant('{cm:Error}');
WizardForm.FinishedLabel.Font.Color:= clRed;
WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) ;
end;
end;
end;

function CheckError:boolean;
begin
result:= not ISDoneError;
end;

procedure CurStepChanged1(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;
CreateControls;
WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');
ISDoneCancel:=0;

// Распаковка всех необходимых файлов в папку {tmp}.

ExtractTemporaryFile('unarc.dll');

#ifdef PrecompInside
ExtractTemporaryFile('CLS-precomp.dll');
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('packjpg_dll1.dll');
ExtractTemporaryFile('precomp.exe');
ExtractTemporaryFile('zlib1.dll');
#endif
#ifdef SrepInside
ExtractTemporaryFile('CLS-srep.dll');
#endif
#ifdef MSCInside
ExtractTemporaryFile('CLS-MSC.dll');
#endif
#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
#if precomp == "0.42"
ExtractTemporaryFile('precomp042.exe');
#else
ExtractTemporaryFile('precomp038.exe');
ExtractTemporaryFile('precomp040.exe');
ExtractTemporaryFile('precomp041.exe');
ExtractTemporaryFile('precomp042.exe');
#endif
#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('English.ini');
ExtractTemporaryFile('Russian.ini');

// Подготавливаем переменную, содержащую всю информацию о выделенных компонентах для ISDone.dll
// максимум 96 компонентов.
Comps1:=0; Comps2:=0; Comps3:=0;
#ifdef Components
TmpValue:=1;
if IsComponentSelected('text\rus') then Comps1:=Comps1+TmpValue; //компонент 1
TmpValue:=TmpValue*2;
if IsComponentSelected('text\eng') then Comps1:=Comps1+TmpValue; //компонент 2
TmpValue:=TmpValue*2;
if IsComponentSelected('voice\rus') 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('English');
ChangeLanguage('Russian');
if not SrepInit('',512,0) then break;
if not PrecompInit('',128,PCFVer) then break;
if not FileSearchInit(true) then break;

// if not ISArcExtract ( 0, 0, ExpandConstant('{src}\*.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
if not ISArcExtract ( 0, 0, ExpandConstant('{src}\*.bin'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
// if not IS7ZipExtract ( 0, 0, ExpandConstant('{src}\*.7z'), ExpandConstant('{app}'), false, '') 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, 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}'), '...',false) 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+'" -w "'+OutFilePath+'"',ExpandConstant('{tmp}'),OutFileName,false);
end;
ISFindFree(FindHandle1);
if ExecError then break;
*)

ISDoneError:=false;
until true;
ISDoneStop;
end;
HideControls;
WizardForm.CancelButton.Visible:=true;
WizardForm.CancelButton.Enabled:=false;
end;
if (CurStep=ssPostInstall) and ISDoneError then begin
Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
end;
end;

// --- Source: 1.iss ------------------------------------------------------------
// Завершение процесса по имени файла
function KillTask(ExeFileName: AnsiString): Integer;
external 'KillTask@files:ISTask.dll stdcall';

// Проверка, запущен ли процесс по имени файла
function RunTask(FileName: AnsiString; bFullpath: Boolean): Boolean;
external 'RunTask@files:ISTask.dll stdcall';

function InitializeSetup2(): Boolean;
begin
Result := True;
if RunTask('steam.exe', False) then
if MsgBox('Для продолжения установки требуется закрыть программу Steam. Закрыть Steam?', mbConfirmation, MB_YESNO) = IDYES then
KillTask('steam.exe')
else
Result := False;
end;

// --- Source: 2.iss ------------------------------------------------------------
{=====Старт. Проверка наличия установки Steam через реестр. Работает.=====}

Function GetInstallDir(Path: String ): String;
begin
RegQueryStringValue(HKCU, 'SOFTWARE\Valve\Steam\', 'SteamPath', Path); //Какой ключ реестра ищет ...
Result := Path;
end;

function InitializeSetup3(): Boolean;
begin
Result:= true;
if not RegKeyExists(HKCU, 'SOFTWARE\Valve\Steam\') then
MsgBox('Программа Steam не найдена! Укажите путь к Steam вручную!', mbinformation, mb_ok);
end;
{=====Конец. Проверка наличия установки Steam через реестр=====}

// --- Dispatching code ------------------------------------------------------------

procedure CurPageChanged(CurPageID: Integer);
begin
CurPageChanged1(CurPageID);
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
CurStepChanged1(CurStep);
end;

function InitializeSetup(): Boolean;
begin
Result := InitializeSetup2(); if not Result then exit;
Result := InitializeSetup3(); if not Result then exit;
end;
Поправил несколько ошибок и некорректностей в файле russian.ini. Можете мой в шапку добавить
 

Вложения

Последнее редактирование:

crysis_1830

Новичок
vint56,

Код:
procedure CurStepChanged(CurStep: TSetupStep);
#ifdef pZLibInside
ExtractTemporaryFile('arc.ini');
ExtractTemporaryFile('pZLib.exe');
#endif
if not ISArcExtract    ( 0, 0, ExpandConstant('{src}\data.arc'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;

во время установки при нажатии отмена pZLib.exe висит в процессе.

как это исправить?
 

crysis_1830

Новичок
SBalykov,
Код:
///////////////////////////////Использование/////////////////////////////////
Добавьте этот скрипт в свой проект, с помощью директивы препроцессора #include.
Пример://
#include "ExecAndWait.iss"                                                 


После добавления этого скрипта в свой проект, вы можете вызвать функцию:
function ExecAndWait(const Filename, Params, WorkingDir: string;
                  const ShowCmd: Word; TerminateChild: Boolean): Boolean; где:                                                                          
Filename - имя файла;                                                        
Params - параметр командной строки, с которым нужно запустить программу;
WorkingDir - каталог, где находится программа;                           
ShowCmd - параметр для запуска программы (SW_HIDE, SW_SHOWNORMAL и т.д.);
TerminateChild - указывается, нужно ли завершить запущенную инсталлятором 
                программу, если пользователь отменил установку во время 
          её работы.
  Возможные значения: True (запущенная программа будет закрыта
              вместе с инсталлятором), False (продолжит свою работу); 
Примечание:                                                                  
Params и WorkingDir можно не указывать.                                                                   
Пример 1:                                                                    
ExecAndWait(ExpandConstant('{sys}\notepad.exe'), '', '', SW_SHOW, True);
Пример 2:                                                                  
ExecAndWait('notepad.exe', '', ExpandConstant('{sys}'), SW_SHOW, False); 


////////////////////////////////////////////////////////////////////////////////////
const
   MAX_PATH              = 260;
   TH32CS_SNAPPROCESS    = $00000002;
   INVALID_HANDLE_VALUE  = -1;
   PROCESS_TERMINATE     = $0001;
   PM_REMOVE             = 1;
   STARTF_USESHOWWINDOW  = 1;
   NORMAL_PRIORITY_CLASS = $00000020;

type
   TProcessEntry32 = record
     dwSize: DWORD;
     cntUsage: DWORD;
     th32ProcessID: DWORD;
     th32DefaultHeapID: DWORD;
     th32ModuleID: DWORD;
     cntThreads: DWORD;
     th32ParentProcessID: DWORD;
     pcPriClassBase: Longint;
     dwFlags: DWORD;
     szExeFile: array[0..MAX_PATH] of Char;
   end;

   _TMsg = record
     hWnd: HWND;
     msg: Word;
     wParam: Word;
     lParam: LongWord;
     Time: TFileTime;
     pt: TPoint;
   end;

   TProcessInformation = record
     hProcess: THandle;
     hThread: THandle;
     dwProcessId: DWORD;
     dwThreadId: DWORD;
   end;

   TStartupInfo = record
     cb: DWORD;
     lpReserved: Longint;
     lpDesktop: Longint;
     lpTitle: PChar;
     dwX: DWORD;
     dwY: DWORD;
     dwXSize: DWORD;
     dwYSize: DWORD;
     dwXCountChars: DWORD;
     dwYCountChars: DWORD;
     dwFillAttribute: DWORD;
     dwFlags: DWORD;
     wShowWindow: Word;
     cbReserved2: Word;
     lpReserved2: Byte;
     hStdInput: THandle;
     hStdOutput: THandle;
     hStdError: THandle;
   end;

function _CreateToolhelp32Snapshot(dwFlags, th32ProcessID: DWORD): THandle;
   external 'CreateToolhelp32Snapshot@kernel32.dll stdcall';
function _Process32First(hSnapshot: THandle; var lppe: TProcessEntry32): BOOL;
   external 'Process32First@kernel32.dll stdcall';
function _Process32Next(hSnapshot: THandle; var lppe: TProcessEntry32): BOOL;
   external 'Process32Next@kernel32.dll stdcall';
function _OpenProcess(dwDesiredAccess: DWORD; bInheritHandle: BOOL; dwProcessId: DWORD): THandle;
   external 'OpenProcess@kernel32.dll stdcall';
function _TerminateProcess(hProcess: THandle; uExitCode: UINT): BOOL;
   external 'TerminateProcess@kernel32.dll stdcall';
function _CloseHandle(hObject: THandle): BOOL; external 'CloseHandle@kernel32.dll stdcall';
function _PeekMessage(var lpMsg: _TMsg; hWnd: HWND; wMsgFilterMin, wMsgFilterMax,
   wRemoveMsg: UINT): BOOL; external 'PeekMessageA@user32.dll stdcall';
function _TranslateMessage(const lpMsg: _TMsg): BOOL; external 'TranslateMessage@user32.dll stdcall';
function _DispatchMessage(const lpMsg: _TMsg): Longint; external 'DispatchMessageA@user32.dll stdcall';
function _CreateProcess(lpApplicationName: PChar; lpCommandLine: PChar;
   lpProcessAttributes, lpThreadAttributes: DWORD; bInheritHandles: BOOL; dwCreationFlags: DWORD;
     lpEnvironment: PChar; lpCurrentDirectory: PChar; const lpStartupInfo: TStartupInfo;
       var lpProcessInformation: TProcessInformation): BOOL;
         external 'CreateProcessA@kernel32.dll stdcall';

var
   _QUIT: Boolean;

procedure _Application_ProcessMessages;
var
   Msg: _TMsg;
begin
   if not _PeekMessage(Msg, 0, 0, 0, PM_REMOVE) then
     Exit;
   _TranslateMessage(Msg);
   _DispatchMessage(Msg);
end;

function _KillProcess(ProcessID: DWORD): Boolean;
var
   hProcess: THandle;
begin
   hProcess:= _OpenProcess(PROCESS_TERMINATE, False, ProcessID);
   Result:= _TerminateProcess(hProcess, 0);
   _CloseHandle(hProcess);
end;

function _ArrayCharToString(ArrayChar: array of Char): string;
var
   i: Integer;
   str: string;
begin
   for i:= 0 to MAX_PATH do
     if (ArrayChar) <> #0 then
       str:= str + ArrayChar
     else Break;
   Result:= str;
end;

function _ProcIsRunning(Process: string; ProcessID: DWORD): Boolean;
var
   Snap: THandle;
   pe32: TProcessEntry32;
begin
   Result:= False;
   if Pos('\', Process) > 0 then Process:= ExtractFileName(Process);
   Snap:= _CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
   if Snap = INVALID_HANDLE_VALUE then Exit;
   pe32.dwSize:= SizeOf(pe32);
   if _Process32First(Snap, pe32) then
     while _Process32Next(Snap, pe32) do
       begin
         if pe32.th32ProcessID = ProcessID then
           if (LowerCase(_ArrayCharToString(pe32.szExeFile)) = LowerCase(Process)) then
             begin
               Result:= True;
               Break;
             end;
         if _QUIT then Break;
         _Application_ProcessMessages;
       end;
   _CloseHandle(Snap);
end;

procedure _WizardFormOnCloseQuery(Sender: TObject;  var CanClose: Boolean);
begin
   _QUIT:= True;
end;

function _StartProc(const Filename, Params, WorkingDir: string; const ShowCmd: Word;
   TerminateChild: Boolean): Boolean;
var
   PI: TProcessInformation;
   SI: TStartupInfo;
   ProcessId: DWORD;
   ProcessName: string;
   CmdLine: string;
begin
   _QUIT:= False;
   CmdLine:= '"' + Filename + '" ' + Params;
   SI.cb:= SizeOf(SI);
   SI.dwFlags:= STARTF_USESHOWWINDOW;
   SI.wShowWindow:= ShowCmd;
   try
     Result:= _CreateProcess('', PChar(CmdLine), 0, 0, False, NORMAL_PRIORITY_CLASS,
                             '', PChar(WorkingDir), SI, PI);
   except
     ShowExceptionMessage;
   end;
   if Result then
     begin
       WizardForm.OnCloseQuery:= @_WizardFormOnCloseQuery;
       ProcessName:= ExtractFileName(Filename);
       ProcessId:= PI.dwProcessId;
       _CloseHandle(PI.hProcess);
       _CloseHandle(PI.hThread);
       while _ProcIsRunning(ProcessName, ProcessID) do;
       if _QUIT and TerminateChild then _KillProcess(ProcessID);
     end;
end;
////////////////////////////////////////////////////////////////////////////////////
function ExecAndWait(const Filename, Params, WorkingDir: string;
                      const ShowCmd: Word; TerminateChild: Boolean): Boolean;
// ôóíêöèÿ çàïóñêàåò óêàçàííûé ôàéë è æä¸ò åãî çàâåðøåíèÿ
begin
   Result:= _StartProc(Filename, Params, WorkingDir, ShowCmd, TerminateChild);
end;
////////////////////////////////////////////////////////////////////////////////////

вот это нашел в справке, но что-то не получается
 
Последнее редактирование:

SBalykov

Старожил
SBalykov,
вот это нашел в справке, но что-то не получается
Выше, я Вам дал простой и эффективный пример, для завершения процесса в диспетчере задач.
Если не устраивает простой путь, можно найти и более сложный, чем представленный Вами ...
 

vint56

Ветеран
Проверенный
crysis_1830,
Код:
1) Убивать процесс при отмены установки
procedure CancelButtonOnClick(Sender: TObject);
begin
  SuspendProc;
  if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then ISDoneCancel:=1;
  Exec(ExpandConstant('{sys}\taskkill.exe'), ' /F /IM pZLib.exe', '', SW_HIDE, ewWaitUntilTerminated, i);
  ResumeProc;
end;
2) Убивать процесс при ошибке
  if (CurStep=ssInstall) and ISDoneError then
  begin
  Exec(ExpandConstant('{sys}\taskkill.exe'), ' /F /IM pZLib.exe', '', SW_HIDE, ewWaitUntilTerminated, i);
  end;
  if (CurStep=ssPostInstall) and ISDoneError then begin
    Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
  end;
end;
 

dixen18

Ветеран
Как сделать чтоб при определенных операциях инсталлятора высвечивался нужный текст? например

if not ISArcExtract ( 0, 0, ExpandConstant('{src}\*.dxn'), ExpandConstant('{app}\Temp'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break; Текст - Распаковка временных файлов
if not ISExec (0, 0, 0, ExpandConstant('{tmp}\rmt.exe'), ExpandConstant(''), ExpandConstant('{app}\Temp'), 'Temp\Completed_1.bin', False {Показать окно cmd: True} ) then break; Текст - Восстановление игровых ресурсов (Этап 1 из 2)
DelTree(ExpandConstant('{app}\Temp'), True, True, True);
if not ISArcExtract ( 0, 0, ExpandConstant('{app}\Completed.bin'), ExpandConstant('{app}'), '', True, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break; Текст - Восстановление игровых ресурсов (Этап 2 из 2)
 

Toximan69

Новичок
Здравствуйте.

Потестил я на упаковке pzlib, на примере Euro truck Simulator 2. Попробовал все файлы с расширением scs упаковать, он ошибку выбил. Взял отдельно файл base.scs, он его запаковал, потом пробовал еще два файла паковать, пакует, а как беру их все (их там дольше 40-ка) не хочет паковать, выдает ошибку(((( Ошибка "general error in pzlib"

В чем может быть причина, не подскажете ребята?
 

vint56

Ветеран
Проверенный
Toximan69, версия какая pzlib pzlib_1210 или pZLib_v2 если pzlib_1210 то попробуй добавить
[External compressor: zlib]
header = 0
packcmd = pzlib e -v $$arcdatafile$$.tmp -o $$arcpackedfile$$.tmp
unpackcmd = pzlib d - -o - <stdin> <stdout>
Потому как версия pZLib_v2 расжала 2,96 ГБ (3 184 115 712 байт) до 12,3 ГБ (13 292 314 624 байт)
 

Toximan69

Новичок
vint56
Да, скорее всего была проблема в версии, скачал и поставил pZlib_v2 и упаковка проходит нормально. Спасибо за помощь
 

Toximan69

Новичок
Еще одна проблема получилось уже при распаковке


Все, вопрос снят. Поставил в arc.ini
[External compressor: pzlib]
header = 0
unpackcmd = pZLib d -t4 - -o - <stdin> <stdout>
В место:
[External compressor: pzlib]
header = 0
unpackcmd = pZLib d -t8 - -o - <stdin> <stdout>
А так же убрал параметры srep и др. Все заработало. Спасибо
 
Последнее редактирование:

dixen18

Ветеран
Парни напомните мне пожалуйста как запустить через ISDone декодирование пожатых OGG файлов назад в WAV?)) Что-то не найду
 

vint56

Ветеран
Проверенный
dixen18, Пример
#define OggWav
[Setup]

[Files]
#ifdef OggWav
Source: Include\ffmpeg.exe; DestDir: {tmp}; Flags: dontcopy;
Source: Include\oggdec.exe; DestDir: {tmp}; Flags: dontcopy;
#endif

Код:
procedure CurStepChanged(CurStep: TSetupStep);
  if not ISArcExtract ( 0, 0, ExpandConstant('{src}\1.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) 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}\ffmpeg.exe'), '-i "'+InFilePath+'" "'+OutFilePath+'"',ExpandConstant('{tmp}'),OutFileName,false); // 1 Вариант
    ExecError:=not ISExec(0, 0, 0, ExpandConstant('{tmp}\oggdec.exe'), '"'+InFilePath+'" "'+OutFilePath+'"',ExpandConstant('{tmp}'),OutFileName,false);   // 2 Вариант
  end;
  ISFindFree(FindHandle1);
  if ExecError then break;
Батники
for /r %%i in (*.wav) do (
oggenc2 "%%i" -q 5
del "%%i"
) 2>>log.txt


for /r %%i in (*.ogg) do (
oggdec "%%i"
del "%%i"
)


1.В Audio
1.1.В WAV - Waveform Audio File Format
1.1.1.В wav to mp3
Convert wav to mp3 with ffmpeg:
ffmpeg -i audio.wav -acodec libmp3lame audio.mp3

1.1.2.В wav to ogg
Convert wav to ogg with ffmpeg:
ffmpeg -i audio.wav -acodec libvorbis audio.ogg
1.1.3.В wav to aac
Convert wav to acc with ffmpeg:
ffmpeg -i audio.wav -acodec libfaac audio.aac

1.1.4.В wav to ac3
Convert wav to ac3 with ffmpeg:
ffmpeg -i audio.wav -acodec ac3 audio.mp3

1.2.В OGG - Free, open standard container
1.2.1.В ogg to mp3
Convert ogg to mp3 with ffmpeg:
ffmpeg -i audio.ogg -acodec libmp3lame audio.mp3

1.2.2.В ogg to wav
Convert ogg to wav with ffmpeg:
ffmpeg -i audio.ogg audio.wav
1.2.3.В ogg to aac
Convert ogg to aac with ffmpeg:
ffmpeg -i audio.ogg -acodec libfaac audio.aac

1.2.4.В ogg to ac3
Convert ogg to ac3 with ffmpeg:
ffmpeg -i audio.ogg -acodec ac3 audio.ac3

1.3.В AC3 - Acoustic Coder 3
1.3.1.В ac3 to mp3
Convert ac3 to mp3 with ffmpeg:
ffmpeg -i audio.ac3 -acodec libmp3lame audio.mp3

1.3.2.В ac3 to wav
Convert ac3 to wav with ffmpeg:
ffmpeg -i audio.ac3 audio.wav
1.3.3.В ac3 to aac
Convert ac3 to aac with ffmpeg:
ffmpeg -i audio.ac3 -acodec libfaac audio.aac

1.3.4.В ac3 to ogg
Convert ac3 to ogg with ffmpeg:
ffmpeg -i audio.ac3 -acodec libvorbis audio.ogg

1.4.В AAC - Advanced Audio Coding
1.4.1.В aac to mp3
Convert aac to mp3 with ffmpeg:
ffmpeg -i audio.aac -acodec libmp3lame audio.mp3

1.4.2.В aac to wav
Convert aac to wav with ffmpeg:
ffmpeg -i audio.aac audio.wav
1.4.3.В aac to ac3
Convert aac to ac3 with ffmpeg:
ffmpeg -i audio.aac -acodec ac3 audio.ac3

1.4.4.В aac to ogg
Convert aac to ogg with ffmpeg:
ffmpeg -i audio.aac -libvorbis audio.ogg
 
Последнее редактирование:

dixen18

Ветеран
vint56,
http://f2.s.qip.ru/tfn6TOc9.png

Код:
[Code]
type
  TCallback = function (OveralPct, CurrentPct: integer; CurrentFile, TimeStr1, TimeStr2, TimeStr3 :PAnsiChar): longword;

const
  PCFonFLY=true;
  notPCFonFLY=false;

var
  ISDoneProgressBar1: TImgPB;
  ISDoneError: boolean;
  PCFVer: double;
  ISDoneCancel: Integer;
  LabelPct1, LabelCurrFileName, LabelTime1, LabelTime2, LabelTime3: Tlabel;

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(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 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:AnsiString):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 ImgPBSetPosition(ISDoneProgressBar1,OveralPct);
  LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
//  LabelCurrFileName.Caption:=ExpandConstant('{cm:ExtractedFile} ')+MinimizePathName(CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width-ScaleX(100));
  LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
  LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
  LabelTime3.Caption:=ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;
  Result := ISDoneCancel;
  ImgApplyChanges(WizardForm.Handle);
end;

procedure CancelButtonOnClick(Sender: TObject);
begin
  SuspendProc;
  if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then ISDoneCancel:=1;
  ResumeProc;
end;

procedure IsDoneAddComponents();
begin
  ISDoneProgressBar1:=ImgPBCreate(WizardForm.Handle, ExpandConstant('pbbkg.png'),ExpandConstant('pb.png'), ScaleX(105), ScaleY(280), ScaleX(495), ScaleY(22));

  LabelCurrFileName := TLabel.Create(WizardForm);
  with LabelCurrFileName do begin
    Parent := WizardForm;
    SetBounds(ScaleX(105), ScaleY(255), ScaleX(430), ScaleY(15));
    AutoSize:=False;
    Transparent := True;
    Font.Name:='Tahoma';
    Font.Size:= 8;
    Font.Color:=$FFFFFF;
    Font.Style:=[fsBold];
  end;

  LabelPct1 := TLabel.Create(WizardForm);
  with LabelPct1 do begin
    Parent := WizardForm;
    SetBounds(ScaleX(560), ScaleY(260), ScaleX(0), ScaleY(0));
    AutoSize:=True;
    Transparent := True;
    Font.Name:='Tahoma';
    Font.Size:= 10;
    Font.Color:=$FFFFFF;
    Font.Style:=[fsBold];
  end;

LabelTime1 := TLabel.Create(WizardForm);
with LabelTime1 do begin
  Parent := WizardForm;
  SetBounds(ScaleX(105), ScaleY(312), ScaleX(0), ScaleY(0));
  AutoSize:=True;
  Transparent := True;
  Font.Name:='Tahoma';
  Font.Size:= 8;
  Font.Color:=$FFFFFF;
  Font.Style:=[fsBold];
end;

LabelTime2 := TLabel.Create(WizardForm);
with LabelTime2 do begin
  Parent := WizardForm;
  SetBounds(ScaleX(105), ScaleY(327), ScaleX(0), ScaleY(0));
  AutoSize:=True;
  Transparent := True;
  Font.Name:='Tahoma';
  Font.Size:= 8;
  Font.Color:=$FFFFFF;
  Font.Style:=[fsBold];
end;

LabelTime3 := TLabel.Create(WizardForm);
with LabelTime3 do begin
  Parent := WizardForm;
  SetBounds(ScaleX(105), ScaleY(367), ScaleX(0), ScaleY(0));
  AutoSize:=True;
  Transparent := True;
  Font.Name:='Tahoma';
  Font.Size:= 8;
  Font.Color:=$00FFFF;
  Font.Style:=[fsBold];
end;
end;

procedure IsDoneHide();
begin
  LabelPct1.Hide;
  LabelCurrFileName.Hide;
  LabelTime1.Hide;
  LabelTime2.Hide;
  LabelTime3.Hide;
  ImgPBVisibility(ISDoneProgressBar1, False);
end;

procedure IsDoneShow();
begin
  LabelPct1.Show;
  LabelCurrFileName.Show;
  LabelTime1.Show;
  LabelTime2.Show;
  ImgPBVisibility(ISDoneProgressBar1, true);
end;

#ifdef PrecompME
Function CreateCMD():Boolean;
var
  List: TStringList;
  app, tmp, cmd: string;
begin
  app:= ExpandConstant('{app}');
  tmp:= ExpandConstant('{tmp}');
  cmd:= ExpandConstant('{tmp}\Timick.cmd');

  List:= TStringList.Create;
  List.Add('cmd /Q /C call "'+tmp+'\UPR.exe" %NUMBER_OF_PROCESSORS% "'+app+'" 5 "'+tmp+'\Precomp043.exe"');
  List.SaveToFile(cmd);
  List.Free;
end;
#endif

procedure IsDoneUnpack(CurStep: TSetupStep);
var
  Comps1,Comps2,Comps3, TmpValue: cardinal;
begin
  if CurStep = ssInstall then begin
    WizardForm.CancelButton.OnClick := @CancelButtonOnClick;
    ISDoneCancel:=0;
    // Распаковка всех необходимых файлов в папку {tmp}.

    ExtractTemporaryFile('unarc.dll');

    #ifdef PrecompInside
      ExtractTemporaryFile('CLS-precomp.dll');
      ExtractTemporaryFile('packjpg_dll.dll');
      ExtractTemporaryFile('packjpg_dll1.dll');
      ExtractTemporaryFile('precomp.exe');
      ExtractTemporaryFile('zlib1.dll');
    #endif
    #ifdef SrepInside
      ExtractTemporaryFile('CLS-srep.dll');
    #endif
    #ifdef MSC
    ExtractTemporaryFile('CLS-MSC.dll');
    #endif
    #ifdef facompress
      ExtractTemporaryFile('facompress.dll'); //ускоряет распаковку .arc архивов.
    #endif
    #ifdef records
      ExtractTemporaryFile('records.inf');
    #endif
    #ifdef precomp
      #if precomp == "0.38"
        ExtractTemporaryFile('precomp038.exe');
      #endif
      #if precomp == "0.4"
        ExtractTemporaryFile('precomp040.exe');
      #endif
      #if precomp == "0.41"
        ExtractTemporaryFile('precomp041.exe');
      #endif
      #if precomp != "0.38" && precomp != "0.4" && precomp != "0.41" && precomp != "0.44"
        ExtractTemporaryFile('precomp038.exe');
        ExtractTemporaryFile('precomp040.exe');
        ExtractTemporaryFile('precomp041.exe');
        ExtractTemporaryFile('precomp044.exe');
      #endif
     #endif
    #ifdef PackZIP
      ExtractTemporaryFile('7z.dll');
      ExtractTemporaryFile('PackZIP.exe');
    #endif
    #ifdef pZlib
      ExtractTemporaryFile('pZlib.exe');
      ExtractTemporaryFile('arc.ini');
    #endif
    #ifdef ReflateMT
      ExtractTemporaryFile('rmt.exe');
    #endif
    #ifdef ZCM
      ExtractTemporaryFile('ZCM.exe');
      ExtractTemporaryFile('cls-zcm.dll');
      ExtractTemporaryFile('cls-zcm.ini');
    #endif
    ExtractTemporaryFile('russian.ini');
    #ifdef OggWav
    ExtractTemporaryFile('oggdec.exe');
    #endif

    // Подготавливаем переменную, содержащую всю информацию о выделенных компонентах для ISDone.dll
    // максимум 96 компонентов.
    Comps1:=0; Comps2:=0; Comps3:=0;
    #ifdef Components
      TmpValue:=1;
      if IsComponentSelected('text\rus') then Comps1:=Comps1+TmpValue;  // Компонент русс озвучки
      TmpValue:=TmpValue*2;
      if IsComponentSelected('text\eng') then Comps1:=Comps1+TmpValue;  // Компонент англ озвучки
      #endif

    #ifdef precomp
      PCFVer:={#precomp};
    #else
      PCFVer:=0;
    #endif
    #ifdef PrecompME
      CreateCMD;
    #endif
     ISDoneError:=true;
     WizardForm.ProgressGauge.Hide;
     WizardForm.CancelButton.Hide;
     //CreateControls;
     WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');
     ISDoneCancel:=0;

    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('',128,PCFVer) then break;
        if not FileSearchInit(false) then break;

        if not ISArcExtract    ( 0, 0, ExpandConstant('{src}\*.dxn'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) 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;
        //if not ISExec (0, 0, 0, ExpandConstant('{tmp}\rmt.exe'),  ExpandConstant(''), ExpandConstant('{app}\Temp'), 'Temp\Completed_1.bin', False {Показать окно cmd: True} ) then break;
        // DelTree(ExpandConstant('{app}\Temp'), True, True, True);
        //if not ISArcExtract ( 0, 0, ExpandConstant('{app}\Completed.bin'), ExpandConstant('{app}'), '', True, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        //  if not ISPackZIP       ( 0, 0, ExpandConstant('{app}\UnpackTemp\Game\GameData\'), ExpandConstant('{app}\Game\GameData.pak'), 2, true ) then break;
        //  if not ISPackZIP       ( 0, 0, ExpandConstant('{app}\UnpackTemp\Game\Objects\'), ExpandConstant('{app}\Game\Objects.pak'), 2, true ) then break;
        //  if not ISPackZIP       ( 0, 0, ExpandConstant('{app}\UnpackTemp\Game\Textures\'), ExpandConstant('{app}\Game\Textures.pak'), 2, true ) then break;
        //#ifdef Components
        //  if not ISArcExtract    ( 1, 0, ExpandConstant('{src}\Data03.dxn'), ExpandConstant('{app}\'), 'Russian', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
        // if not ISArcExtract    ( 2, 0, ExpandConstant('{src}\Data03.dxn'), ExpandConstant('{app}\'), 'English', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
        //#endif
        (*#ifdef Components
        if not ISArcExtract    ( 1, 0, ExpandConstant('{src}\Data03.dxn'), ExpandConstant('{app}\'), 'text_rus', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
        if not ISArcExtract    ( 2, 0, ExpandConstant('{src}\Data03.dxn'), ExpandConstant('{app}\'), 'text_eng', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
        if not ISArcExtract    ( 3, 0, ExpandConstant('{src}\Data03.dxn'), ExpandConstant('{app}\'), 'sound_rus', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
        if not ISArcExtract    ( 4, 0, ExpandConstant('{src}\Data03.dxn'), ExpandConstant('{app}\'), 'sound_eng', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) 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   ( 1, 0, ExpandConstant('{src}\Data04.dxn'), ExpandConstant('{app}\'), 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;
        //распаковка группы файлов посредством внешнего приложения
    
*)
        ISDoneError:=false;
      until true;
      ISDoneStop;
    end;
  end;
  if (CurStep=ssPostInstall) and ISDoneError then begin
    IsDoneHide;
    InstallingLabel.hide;
    BtnSetEnabled(hCancelBtn, False);
    ImgApplyChanges(WizardForm.Handle);
    StatusLabel.Caption:=ExpandConstant('{cm:StatusRollback}');
    ImgApplyChanges(WizardForm.Handle);
    Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
  end;
end;

function CheckError: Boolean;
begin
  Result:= not ISDoneError;
end;
 

vint56

Ветеран
Проверенный
dixen18, у тебя
procedure IsDoneUnpack(CurStep: TSetupStep);
var
Comps1,Comps2,Comps3, TmpValue: cardinal;
а
procedure CurStepChanged(CurStep: TSetupStep);
var Comps1,Comps2,Comps3, TmpValue:cardinal;
FindHandle1,ColFiles1,CurIndex1,tmp:integer;
ExecError:boolean;
InFilePath,OutFilePath,OutFileName:pAnsiChar;
 

Toximan69

Новичок
dixen18, можно еще так.

Код:
#define oggdec

[Files]
#ifdef oggdec
Source: Include\oggdec.exe; DestDir: {tmp}; Flags: dontcopy;
#endif

[code]
#ifdef oggdec
ExtractTemporaryFile('oggdec.exe');
#endif

if not ISArcExtract ( 0, 0, ExpandConstant('{src}\OGG.arc'), ExpandConstant('{app}\data\sounds\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\data\sounds\'), notPCFonFLY{PCFonFLY}) then break;

FindHandle1:=ISFindFiles(0,ExpandConstant('{app}\data\sounds\*.ogg'),ColFiles1);
        ExecError:=false;
        while not ExecError and ISPickFilename(FindHandle1,ExpandConstant('{app}\data\sounds\'),CurIndex1,true) do begin
          InFilePath:=ISGetName(0);
          OutFilePath:=ISGetName(1)+'.wav';
          OutFileName:=ISGetName(2)+'.wav';
          ExecError:=not ISExec(0, 0, 0, ExpandConstant('{tmp}\oggdec.exe'), '"'+InFilePath+'" -w "'+OutFilePath+'"',ExpandConstant('{tmp}'),OutFileName,false);
        end;
        ISFindFree(FindHandle1);
        if ExecError then break;
 
Сверху