#define Theme "Theme.cjstyles"
#define PathUpdate "C:\Users\Matheus Catarino\Desktop\sc-dxhr-1.4.651\*"
#define AppVerName "Deus Ex HR Update 1.4"
#define AppExec "dxhr.exe"
#define AppFile1 "steam_api.dll"
#define AppVersion "1.4"
#define AppFile2 "Steamclient.dll"
#include "Resource\Include\trayiconctrl.iss"
[Setup]
AppName=Deus Ex Human Revolution
AppVerName={#AppVerName}
UsePreviousAppDir=yes
AppVersion={#AppVersion}
VersionInfoVersion={#AppVersion}
OutputBaseFilename=Setup
DefaultDirName={pf}\SQUARE ENIX\Deus Ex Human Revolution
Uninstallable=false
Compression=lzma
;#ifdef PathUpdate
;DiskSpanning=true
;DiskSliceSize=1556000000
;SlicesPerDisk=3
;SolidCompression=true
;#endif
SolidCompression=yes
SetupIconFile=Resource\Icons\Icon.ico
OutputDir=.
WizardImageFile=Resource\Wizard\Installer.bmp
WizardSmallImageFile=Resource\Wizard\SmallInstaller.bmp
[Languages]
Name: "brazilianportuguese"; MessagesFile: "compiler:Resource\Include\BrazilianPortuguese.isl"
[Files]
#ifdef PathUpdate
Source: {#PathUpdate}; DestDir:"{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
#endif
Source: Resource\Include\callvpatch.dll; Flags: dontcopy
Source: Resource\Include\VPatch.dll; Flags: dontcopy
Source: Patcher\MyPatch.dat; Flags: dontcopy
; Add the ISSkin DLL used for skinning Inno Setup installations.
Source: Resource\Include\ISSkin.dll; DestDir: {app}; Flags: dontcopy
; Add the Visual Style resource contains resources used for skinning,
; you can also use Microsoft Visual Styles (*.msstyles) resources.
Source: Resource\Include\{#Theme}; DestDir: {tmp}; Flags: dontcopy
[Code - setup]
function GetCursorPos(var lpPoint: TPoint): BOOL; external 'GetCursorPos@user32.dll stdcall';
function IsWindowEnabled(hWnd: HWND): BOOL; external 'IsWindowEnabled@user32.dll stdcall';
const
WM_USER = $400;
WM_ICON_NOTIFY = WM_USER + 22;
WM_RBUTTONUP = $205;
var
PupMnu: TPopupMenu; VersionText: TNewStaticText;
procedure MenuOnClick(Sender: TObject);
begin
case TMenuItem(Sender).HelpContext of
101: ToggleWizardVisible;
102: MainForm.ShowAboutBox;
103: WizardForm.Close;
end;
WizardForm.BringToFront;
end;
procedure PMenuOnPopup(Sender: TObject);
begin
PupMnu.Items.Items[2].Enabled := not WizardFormInTray;
PupMnu.Items.Items[4].Enabled := not WizardFormInTray;
end;
function LOWORD(DW: LongWord): LongWord;
begin
Result := DW and $FFFF;
end;
function MyTrayIconMsgCallBack(wParam, lParam: LongWord): Boolean;
var
lpPoint: TPoint;
begin
Result := False;
if LOWORD(lParam) = WM_RBUTTONUP then
if IsWindowEnabled(WizardForm.Handle) then
begin
GetCursorPos(lpPoint);
PupMnu.Popup(lpPoint.x, lpPoint.y);
Result := True;
end;
end;
// Importing LoadSkin API from ISSkin.DLL
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin@files:isskin.dll stdcall';
// Importing UnloadSkin API from ISSkin.DLL
procedure UnloadSkin();
external 'UnloadSkin@files:isskin.dll stdcall';
// Importing ShowWindow Windows API from User32.DLL
function ShowWindow(hWnd: Integer; uType: Integer): Integer;
external 'ShowWindow@user32.dll stdcall';
function InitializeSetup(): Boolean;
begin
ExtractTemporaryFile('{#Theme}');
LoadSkin(ExpandConstant('{tmp}\{#Theme}'), '');
Result := True;
end;
procedure DeinitializeSetup();
begin
// Hide Window before unloading skin so user does not get
// a glimpse of an unskinned window before it is closed.
ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
UnloadSkin();
MainForm.Hide;
WizardForm.Hide;
UninitTrayIconCtrl();
end;
procedure InitializeWizard;
begin
with WizardForm do begin
WizardForm.WizardBitmapImage2.Width:= ScaleX(497);
WizardBitmapImage.Width := ClientWidth;
WizardSmallBitmapImage.Left := MainPanel.Left;
WizardSmallBitmapImage.Width := MainPanel.Width;
FinishedHeadingLabel.Hide;
WizardBitmapImage.Parent := WelcomePage;
FinishedLabel.Hide;
VersionText := TNewStaticText.Create(WizardForm);
PageDescriptionLabel.Hide;
PageNameLabel.Hide;
WelcomeLabel2.Hide;
WelcomeLabel1.Hide;
end;
with VersionText do
begin
Name := 'VersionText';
Parent := WizardForm;
Caption := '{#AppVerName}'; // CHANGE VERSION NUMBER ACCORDING TO SETUP, OR LEAVE ENTIRELY
Color := clBtnFace;
Enabled := False;
ParentColor := False;
Left := ScaleX(44);
Top := ScaleY(331);
Width := ScaleX(154); // 74 WITHOUT VERSION NUMBER
Height := ScaleY(14);
end;
begin
ExtractTemporaryFile('VPatch.dll');
ExtractTemporaryFile('MyPatch.dat');
end;
begin
PupMnu := NewPopupMenu(WizardForm, 'MyPopupMenu', paLeft, True, [
NewItem('&Show/Hide WizardForm', 0, False, True, @MenuOnClick, 101, 'piShowHideWizardForm'),
NewLine,
NewItem('&About...', 0, False, True, @MenuOnClick, 102, 'piAbort'),
NewLine,
NewItem('E&xit', 0, False, True, @MenuOnClick, 103, 'piExit')
]);
PupMnu.OnPopup := @PMenuOnPopup;
InitTrayIconCtrl(MainForm.Handle, WizardForm.Handle,
WM_ICON_NOTIFY,
'{#AppVerName}',
0,
True,
False,
'',
-1,
nil,
nil,
@MyTrayIconMsgCallBack
);
ShowBalloon('Setup is starting...', '{#AppVerName} By Kassane', 0, 10, False);
end;
end;
const
BackupDir = 'Backup';
PatchFile = 'MyPatch.dat';
function vpatch(parentwnd: Integer; pluginname,funcname,param1,param2,param3: PChar): Integer;
external 'vpatch@files:callvpatch.dll stdcall';
function PatchFileFunc(FileName: String): Integer;
begin
Result := vpatch(0,ExpandConstant('{tmp}\VPatch.dll'),'vpatchfile',ExpandConstant('{tmp}\'+PatchFile),
ExpandConstant('{app}\'+BackupDir+'\'+FileName),ExpandConstant('{app}\'+FileName));
end;
procedure BackupFile(FileName: String);
begin
if not FileExists(ExpandConstant('{app}\'+BackupDir+'\'+Filename)) then
FileCopy(ExpandConstant('{app}\'+Filename),ExpandConstant('{app}\'+BackupDir+'\'+Filename),True);
end;
procedure RestoreFile(FileName: String);
begin
FileCopy(ExpandConstant('{app}\'+BackupDir+'\'+Filename),ExpandConstant('{app}\'+Filename),False);
DeleteFile(ExpandConstant('{app}\'+BackupDir+'\'+Filename));
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = wpSelectDir then
Result := FileExists(ExpandConstant('{app}\{#AppExec}'))
else
Result := True;
if not Result then
MsgBox('Não Encontrado', mbInformation, MB_OK);
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpInstalling then
begin
CreateDir(ExpandConstant('{app}\'+BackupDir));
BackupFile('{#AppExec}');
if PatchFileFunc('{#AppExec}') = 1 then
RestoreFile('{#AppExec}')
WizardForm.PROGRESSGAUGE.POSITION := 33;
BackupFile('{#AppFile1}');
if PatchFileFunc('{#AppFile1}') = 1 then
RestoreFile('{#AppFile1}')
WizardForm.PROGRESSGAUGE.POSITION := 66;
BackupFile('{#AppFile2}');
if PatchFileFunc('{#AppFile2}') = 1 then
RestoreFile('{#AppFile2}')
WizardForm.PROGRESSGAUGE.POSITION := 100;
end;
end;