Files
archived-pcsx2-installer/PCSX2 Installer.iss
2024-07-13 16:32:41 +02:00

171 lines
6.2 KiB
Plaintext

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "PCSX2"
#define MyAppVersion "2.0"
#define MyAppPublisher "PCSX2 Team"
#define MyAppURL "http:/pcsx2.net/"
#define MyAppExeName "pcsx2-qt.exe"
#define MyAppSourceDir "main"
#define MySetupResourceDir "res"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{13CEE6E5-8EB3-47D3-882E-E9DBB6A3251C}}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
Compression=lzma/max
SolidCompression=yes
ArchitecturesInstallIn64BitMode=win64
DefaultGroupName={#MyAppName}
DefaultDirName={commonpf64}\{#MyAppName}
OutputDir=PCSX2
OutputBaseFilename={#MyAppName}-{#MyAppVersion}-setup
; InfoAfterFile=README.txt
UninstallDisplayIcon={app}\{#MyAppExeName},0
SetupIconFile={#MySetupResourceDir}\AppIconLarge.ico
;WizardImageFile={#MySetupResourceDir}\banner.bmp
WizardSmallImageFile={#MySetupResourceDir}/AppIconLarge.bmp
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
;Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkedonce
[Files]
Source: "{#MySetupResourceDir}\Redist\VC_redist.x64.exe"; DestDir: {tmp}
Source: "{#MyAppSourceDir}\*"; Excludes: "PUT PCSX2 BUILD HERE.txt"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "{#MySetupResourceDir}\portable.txt"; DestDir: {app} ; Check: IsPortableInstallation;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Code]
const
StandardDescText =
'All PCSX2 Data will be stores in Documents, separate from the program.';
PortableDescText =
'All PCSX2 Data will be kept in the same folder as PCSX2 itself by default.';
var
StandardRadioButton: TNewRadioButton;
PortableRadioButton: TNewRadioButton;
procedure InitializeWizard();
var
CustomPage: TWizardPage;
FullDescLabel: TLabel;
PartDescLabel: TLabel;
begin
CustomPage := CreateCustomPage(wpWelcome, 'Installation type', '');
StandardRadioButton := TNewRadioButton.Create(WizardForm);
StandardRadioButton.Parent := CustomPage.Surface;
StandardRadioButton.Checked := True;
StandardRadioButton.Top := 16;
StandardRadioButton.Width := CustomPage.SurfaceWidth;
StandardRadioButton.Font.Style := [fsBold];
StandardRadioButton.Font.Size := 9;
StandardRadioButton.Caption := 'Standard Installation'
FullDescLabel := TLabel.Create(WizardForm);
FullDescLabel.Parent := CustomPage.Surface;
FullDescLabel.Left := 8;
FullDescLabel.Top := StandardRadioButton.Top + StandardRadioButton.Height + 8;
FullDescLabel.Width := CustomPage.SurfaceWidth;
FullDescLabel.Height := 40;
FullDescLabel.AutoSize := False;
FullDescLabel.Wordwrap := True;
FullDescLabel.Caption := StandardDescText;
PortableRadioButton := TNewRadioButton.Create(WizardForm);
PortableRadioButton.Parent := CustomPage.Surface;
PortableRadioButton.Top := FullDescLabel.Top + FullDescLabel.Height + 16;
PortableRadioButton.Width := CustomPage.SurfaceWidth;
PortableRadioButton.Font.Style := [fsBold];
PortableRadioButton.Font.Size := 9;
PortableRadioButton.Caption := 'Portable Installation'
PartDescLabel := TLabel.Create(WizardForm);
PartDescLabel.Parent := CustomPage.Surface;
PartDescLabel.Left := 8;
PartDescLabel.Top := PortableRadioButton.Top + PortableRadioButton.Height + 8;
PartDescLabel.Width := CustomPage.SurfaceWidth;
PartDescLabel.Height := 40;
PartDescLabel.AutoSize := False;
PartDescLabel.Wordwrap := True;
PartDescLabel.Caption := PortableDescText;
end;
{TODO: Need to find a way to determine how to dynamically adjust "WizardForm.DirEdit.Text := ''" at runtime, how to if else on pascal?;}
function isPortableInstallation: Boolean;
begin
Result := PortableRadioButton.Checked;
end;
procedure SetDefaultDirName();
begin
if isPortableInstallation = true then
WizardForm.DirEdit.Text := 'C:\{#MyAppName}'
else
WizardForm.DirEdit.Text := ExpandConstant('{commonpf}') + '\{#MyAppName}';
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = 100 then
SetDefaultDirName();
if CurPageID = 6 then
begin
if Pos('C:\Windows\', WizardForm.DirEdit.Text) <> 0 then
begin
MsgBox('Installing PCSX2 in the Windows folder is not advised. Please choose another folder.', mbError, MB_OK);
Result := false;
Exit;
end;
if (isPortableInstallation = true) and (Pos('Program Files', WizardForm.DirEdit.Text) <> 0) then
begin
MsgBox('Portable install cannot be inside Program Files, please choose another folder.', mbError, MB_OK);
Result := false;
Exit;
end;
end;
Result := true;
end;
[Icons]
; StartMenu (Directly)
Name: "{commonprograms}\{#MyAppName}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; WorkingDir: "{app}"
Name: "{commonprograms}\{#MyAppName}\Uninstall {#MyAppName}"; Filename: "{uninstallexe}";
; or
; StartMenu Group
;Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
;Name: "{group}\{#MyAppName} README"; Filename: "{app}\readme.txt"
;Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
; Desktop
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Registry]
; Local Machine
Root: HKLM; Subkey: "Software\{#MyAppPublisher}"; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: "Software\{#MyAppPublisher}\{#MyAppName}"; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\{#MyAppPublisher}\{#MyAppName}"; ValueType: string; ValueName: "InstallPath"; ValueData: {app}
[Run]
Filename: "{tmp}\VC_redist.x64.exe"; Parameters: "/q /norestart"; \
Flags: waituntilterminated; \
StatusMsg: "Installing VC++ 2019-2022 Redistributables..."
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent