Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 19-11-2015, 13:42
rinaldo's Avatar
rinaldo rinaldo is offline
Registered User
 
Join Date: Sep 2015
Location: Rome
Posts: 433
Thanks: 101
Thanked 696 Times in 191 Posts
rinaldo is on a distinguished road
look at this script and you'll understand

Code:

#define needsize 5000000

[Setup]              
AppName=Rina
DefaultDirName={pf}\Rina
DefaultGroupName=Rina
AppVerName=Rina

[Icons] 
Name: "{userdesktop}\un"; Filename: "{app}\unins000.exe"; WorkingDir: "{app}"; Check: "CheckError";

[Files]
Source: "Files\unarc.dll"; DestDir: "{tmp}"; Flags: "dontcopy";
Source: "Files\ISDone.dll"; DestDir: "{tmp}"; Flags: "dontcopy";

[messages]
ButtonNext=< install >

[code*]
var
  ISDoneCancel:integer;
  ISDoneError:boolean;

const
  PCFonFLY=true;
  notPCFonFLY=false;

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 Exec2 (FileName, Param: PAnsiChar;Show:boolean):boolean; external 'Exec2@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 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 WizardForm.ProgressGauge.Position := OveralPct;
  WizardForm.Caption:=CurrentFile;
  Result := ISDoneCancel;
end;

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

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

Function NumToStr(Float: Extended): String;
Begin
Result:= Format('%.2n', [Float]); StringChange(Result, ',', ',');
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = ',')) and (Pos(',', Result) > 0) do
SetLength(Result, Length(Result)-1);
End;

function MbOrTb(Float: Extended): String;
begin
if Float < 1024 then Result:= NumToStr(Float)+' MB' else
if Float/1024 < 1024 then Result:= NumToStr(Float/1024)+' GB' else
Result:= NumToStr(Float/(1024*1024))+' TB';
end;

function NextButtonClick(CurPageID: Integer): Boolean;
var
  FreeMB, TotalMB: Cardinal;
begin
  Result := True;
  if CurPageID = wpWelcome then begin
    GetSpaceOnDisk(ExtractFileDrive(WizardForm.DirEdit.Text), True, FreeMB, TotalMB);
    if FreeMB<{#needsize} then begin
      MsgBox('bla bla: '+MbOrTb({#needsize})+#13'bla bla bla '+MbOrTb(FreeMB)+' bla '+MbOrTb(TotalMB), mbError, mb_Ok);
      Result := False ;
    end;
  end;
end;

procedure InitializeWizard();
begin
WizardForm.ProgressGauge.Max:=1000;
end;

procedure CurStepChanged(CurStep: TSetupStep);
var ExecError:boolean;
begin
  case CurStep of
    ssInstall: begin
      WizardForm.CancelButton.OnClick := @CancelButtonOnClick;
      ISDoneCancel:=0;  
      ExtractTemporaryFile('unarc.dll');
      ISDoneError:=true;
      if ISDoneInit(ExpandConstant('{src}'), $F777, 0,0,0, MainForm.Handle, 512, @ProgressCallback) then begin
        repeat
          if not FileSearchInit(true) then break;
          if not ISArcExtract ( 0, 100, ExpandConstant('{src}\data1.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
          ISDoneError:=false;
        until true;
        ISDoneStop;
      end;
    end;
    ssPostInstall: begin
      if ISDoneError then begin
        WizardForm.ProgressGauge.Hide;
        WizardForm.StatusLabel.Caption:=SetupMessage(msgStatusRollback);
        Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
      end;
    end;                            
  end; 
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
if (PageID=8) or (PageID=10) or (PageID=7) or (PageID=6) then Result:=true;
end;
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conversion Designer/Installer Creator Razor12911 Conversion Tutorials 1613 03-10-2024 01:24
altef_4's installer altef_4 Conversion Tutorials 244 24-05-2024 22:20
Game Installer Designer by altef_4 altef_4 Conversion Tutorials 236 28-05-2021 02:54
Crysis 3 DVD9 to 3xDVD5 Custom Installer spawniectes PC Games - CD/DVD Conversions 79 31-08-2017 07:19
Tutorial using CI 8.0.0 yener90 Conversion Tutorials 424 21-10-2014 09:49



All times are GMT -7. The time now is 12:59.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com