2018-09-25 23:17:08 +00:00
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
2022-07-30 22:14:24 +00:00
#define MyAppName "@PROJECT_TITLE@"
2022-08-21 04:57:26 +00:00
#define MyAppVersion "@PROJECT_VERSION@"
#define MyAppVersionText "@_VERSION@"
2018-09-25 23:17:08 +00:00
#define MyAppPublisher "Xaymars Technology Workshop"
2020-12-04 05:46:31 +00:00
#define MyAppURL "https://xaymar.com/"
2022-07-30 22:14:24 +00:00
#define MyAppCopyright "@PROJECT_COPYRIGHT@"
2018-09-25 23:17:08 +00:00
[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.)
2020-07-15 16:07:09 +00:00
2020-09-29 03:39:20 +00:00
; Application Information
2018-12-23 19:49:18 +00:00
AppId={{DE56A03A-C8A4-474B-83B0-CFD270262D38}}
2018-09-25 23:17:08 +00:00
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
2022-09-15 02:07:57 +00:00
AppMutex=@PROJECT_NAME@,Global\@PROJECT_NAME@
2020-09-29 03:39:20 +00:00
; Versioning
2020-12-04 05:46:31 +00:00
VersionInfoProductName={#MyAppName}
VersionInfoProductVersion={#MyAppVersion}
2020-07-15 16:07:09 +00:00
VersionInfoVersion={#MyAppVersion}
2020-12-04 05:46:31 +00:00
VersionInfoProductTextVersion={#MyAppVersionText}
VersionInfoTextVersion={#MyAppVersionText}
2020-07-15 16:07:09 +00:00
VersionInfoCompany={#MyAppPublisher}
2020-12-04 05:46:31 +00:00
VersionInfoCopyright={#MyAppCopyright}
2020-07-15 16:07:09 +00:00
VersionInfoDescription={#MyAppName} Setup
2020-09-29 03:39:20 +00:00
; Architecture (Platform is always Windows)
2020-12-04 05:46:31 +00:00
ArchitecturesInstallIn64BitMode=x64 arm64 ia64
2020-09-29 03:39:20 +00:00
ArchitecturesAllowed=@ARCH@
2021-10-17 11:44:54 +00:00
; Installation Modes
2021-10-18 08:14:05 +00:00
UsePreviousPrivileges=no
PrivilegesRequired=admin
2021-10-17 11:44:54 +00:00
PrivilegesRequiredOverridesAllowed=dialog commandline
2020-09-29 03:39:20 +00:00
; Wizard Information
WizardStyle=modern
WizardResizable=yes
SetupIconFile="@PROJECT_SOURCE_DIR@/media/icon.ico"
2022-09-15 02:07:57 +00:00
SetupMutex=@PROJECT_NAME@-Setup,Global\@PROJECT_NAME@-Setup
2021-10-18 08:40:55 +00:00
UninstallDisplayIcon={uninstallexe}
2020-09-29 03:39:20 +00:00
2022-09-15 02:37:22 +00:00
; Directory Choices
2021-10-17 11:44:54 +00:00
UsePreviousAppDir=no
2022-09-15 02:37:22 +00:00
DisableDirPage=no
DirExistsWarning=no
2020-12-04 05:46:31 +00:00
DefaultDirName={code:GetDefaultDirectory}
2022-09-15 02:37:22 +00:00
AppendDefaultDirName=no
2018-09-25 23:17:08 +00:00
DefaultGroupName={#MyAppName}
2022-09-15 02:37:22 +00:00
AppendDefaultGroupName=yes
; Other Information
Uninstallable=yes
CreateUninstallRegKey=not IsPortablePagePortableChoiceChecked()
2018-09-25 23:17:08 +00:00
AllowNoIcons=yes
2019-12-22 05:26:28 +00:00
LicenseFile="@ISS_SOURCE_DIR@/LICENSE"
OutputDir="@ISS_PACKAGE_DIR@"
2021-01-31 21:05:23 +00:00
OutputBaseFilename=@PACKAGE_NAME@-@_PACKAGE_SUFFIX_OVERRIDE@
2020-09-29 03:39:20 +00:00
Compression=lzma2/ultra64
SolidCompression=yes
LZMAAlgorithm=1
2018-09-25 23:17:08 +00:00
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
2019-12-22 05:26:28 +00:00
Source: "@ISS_FILES_DIR@/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
2022-09-03 18:06:33 +00:00
Source: "@PROJECT_SOURCE_DIR@/templates/windows/msvc-redist-helper.exe"; DestDir: "{app}"; DestName: "msvc-redist-helper.exe"; Flags: ignoreversion dontcopy noencryption
2018-09-25 23:17:08 +00:00
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
[Code]
2021-10-17 11:44:54 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
var
2022-09-17 07:48:26 +00:00
oPortablePageStaticChoice: TNewRadioButton;
oPortablePagePortableChoice: TNewRadioButton;
2021-10-17 11:44:54 +00:00
2022-09-17 07:48:26 +00:00
// InnoSetup
procedure InitializeWizard; forward;
function ShouldSkipPage(PageID: Integer): Boolean; forward;
function PrepareToInstall(var NeedsRestart: Boolean): String; forward;
2021-10-17 11:44:54 +00:00
function GetDefaultDirectory(Value: String): String; forward;
2022-09-17 07:48:26 +00:00
// Which installation mode is selected?
function IsPortablePagePortableChoiceChecked(): Boolean; forward;
// Other Metadata
function FindRegistryKey(): String; forward;
2021-10-17 11:44:54 +00:00
function GetUninstallerPath(): String; forward;
function IsUpgrade(): Boolean; forward;
function UninstallOldVersion(): Integer; forward;
2022-09-17 07:48:26 +00:00
// Mode Page
function CreatePortablePage: TWizardPage; forward;
2021-10-17 11:44:54 +00:00
procedure OnPortablePagePortableChoiceClick(Sender: TObject); forward;
procedure OnPortablePageStaticChoiceClick(Sender: TObject); forward;
2022-09-17 07:48:26 +00:00
2021-10-17 11:44:54 +00:00
2020-12-04 05:46:31 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
2022-09-17 07:48:26 +00:00
procedure InitializeWizard;
var
oPortablePage: TWizardPage;
2020-12-04 05:46:31 +00:00
begin
2022-09-17 07:48:26 +00:00
oPortablePage := CreatePortablePage();
end;
// ------------------------------------------------------------------------------------------------------------------ //
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
end;
// ------------------------------------------------------------------------------------------------------------------ //
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
iResultCode: Integer;
begin
// Attempt to remove old version if it exists.
if (IsUpgrade()) then begin
UninstallOldVersion();
end;
// Also ensure that we have the necessary prerequisites installed to run the program.
ExtractTemporaryFile('msvc-redist-helper.exe');
Exec(ExpandConstant('{tmp}\msvc-redist-helper.exe'), '2019', '', SW_HIDE, ewWaitUntilTerminated, iResultCode);
2020-12-04 05:46:31 +00:00
end;
// ------------------------------------------------------------------------------------------------------------------ //
function GetDefaultDirectory(Value: String): String;
2018-09-25 23:17:08 +00:00
var
2020-12-04 05:46:31 +00:00
sInstallPath: String;
2018-09-25 23:17:08 +00:00
begin
2020-12-04 05:46:31 +00:00
// 1. Use the path we were given on call.
sInstallPath := Value;
// 2. If that was empty, try and find it ourselves from the registry.
if (sInstallPath = '') then
RegQueryStringValue(HKA64, FindRegistryKey(), 'InstallLocation', sInstallPath);
// 2. If empty, try and find the "Local Machine" installation of OBS Studio.
2021-10-17 11:44:54 +00:00
if (sInstallPath = '') then
2020-12-04 05:46:31 +00:00
RegQueryStringValue(HKLM64, 'SOFTWARE\OBS Studio', '', sInstallPath);
// 3. If empty, try and find the "Current User" installation of OBS Studio.
2021-10-17 11:44:54 +00:00
if (sInstallPath = '') then
2020-12-04 05:46:31 +00:00
RegQueryStringValue(HKCU64, 'SOFTWARE\OBS Studio', '', sInstallPath);
// 6. If empty, just use the default path.
2021-10-17 11:44:54 +00:00
if (sInstallPath = '') then
2020-12-04 05:46:31 +00:00
sInstallPath := ExpandConstant('{commonpf}\obs-studio');
2021-10-17 11:44:54 +00:00
2020-12-04 05:46:31 +00:00
Result := sInstallPath
2018-09-25 23:17:08 +00:00
end;
2022-09-17 07:48:26 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
function FindRegistryKey(): String;
begin
Result := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting('AppId')}_is1');
end;
2020-12-04 05:46:31 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
function GetUninstallerPath(): String;
2018-09-25 23:17:08 +00:00
var
2020-12-04 05:46:31 +00:00
sRegistryKey: String;
sUninstallerPath: String;
2018-09-25 23:17:08 +00:00
begin
2020-12-04 05:46:31 +00:00
sRegistryKey := FindRegistryKey();
RegQueryStringValue(HKLM64, sRegistryKey, 'UninstallString', sUninstallerPath);
if (sUninstallerPath = '') then
RegQueryStringValue(HKCU64, sRegistryKey, 'UninstallString', sUninstallerPath);
if (sUninstallerPath = '') then
RegQueryStringValue(HKLM32, sRegistryKey, 'UninstallString', sUninstallerPath);
if (sUninstallerPath = '') then
RegQueryStringValue(HKCU32, sRegistryKey, 'UninstallString', sUninstallerPath);
Result := sUninstallerPath;
2018-09-25 23:17:08 +00:00
end;
2020-12-04 05:46:31 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
2018-09-25 23:17:08 +00:00
function IsUpgrade(): Boolean;
begin
2021-10-17 11:44:54 +00:00
Result := (not IsPortablePagePortableChoiceChecked()) and (GetUninstallerPath() <> '');
2018-09-25 23:17:08 +00:00
end;
2020-12-04 05:46:31 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
function UninstallOldVersion(): Integer;
2018-09-25 23:17:08 +00:00
var
2020-12-04 05:46:31 +00:00
sUninstallerPath: String;
iResultCode: Integer;
2018-09-25 23:17:08 +00:00
begin
2020-12-04 05:46:31 +00:00
Result := 0;
sUninstallerPath := GetUninstallerPath();
if (sUninstallerPath <> '') then begin
sUninstallerPath := RemoveQuotes(sUninstallerPath);
if Exec(sUninstallerPath, '/VERYSILENT /NORESTART /SUPPRESSMSGBOXES', '', SW_HIDE, ewWaitUntilTerminated, iResultCode) then begin
Result := iResultCode
end else begin
Result := 1
end;
end;
2018-09-25 23:17:08 +00:00
end;
2021-10-17 11:44:54 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
procedure OnPortablePagePortableChoiceClick(Sender: TObject);
begin
2022-09-17 07:48:26 +00:00
oPortablePageStaticChoice.Checked := False;
oPortablePagePortableChoice.Checked := True;
2021-10-17 11:44:54 +00:00
end;
procedure OnPortablePageStaticChoiceClick(Sender: TObject);
begin
2022-09-17 07:48:26 +00:00
if (not oPortablePageStaticChoice.Enabled) then begin
OnPortablePagePortableChoiceClick(Sender);
end else begin
oPortablePageStaticChoice.Checked := True;
oPortablePagePortableChoice.Checked := False;
end;
2021-10-17 11:44:54 +00:00
end;
function IsPortablePagePortableChoiceChecked(): Boolean;
begin
Result := oPortablePagePortableChoice.Checked;
end;
function CreatePortablePage: TWizardPage;
var
2022-09-17 07:48:26 +00:00
oPage: TWizardPage;
oStaticPanel: TPanel;
oStaticChoice: TNewRadioButton;
oStaticText: TLabel;
oStaticWarningText: TLabel;
oPortablePanel: TPanel;
oPortableChoice: TNewRadioButton;
oPortableText: TLabel;
2018-09-25 23:17:08 +00:00
begin
2022-09-17 07:48:26 +00:00
// Build a page that asks a user if they want to use Movable or Static installation.
oPage := CreateCustomPage(wpLicense,
'Installation Type',
'Select how to install StreamFX on your System');
oStaticPanel := TPanel.Create(oPage);
oStaticPanel.Parent := oPage.Surface;
oStaticPanel.ParentBackground := False;
oStaticPanel.Left := ScaleX(5);
oStaticPanel.Top := ScaleY(5);
oStaticPanel.Width := oPage.SurfaceWidth - ScaleX(10);
oStaticPanel.Height := ScaleY(100);
oStaticPanel.Anchors := [akLeft, akTop, akRight];
oStaticPanel.Color := clWindow;
oStaticPanel.BevelKind := bkTile;
oStaticPanel.BevelInner := bvNone;
oStaticPanel.BevelOuter := bvRaised;
oStaticPanel.BevelWidth := 1;
oStaticPanel.OnClick := @OnPortablePageStaticChoiceClick;
oStaticChoice := TNewRadioButton.Create(oStaticPanel);
oPortablePageStaticChoice := oStaticChoice;
oStaticChoice.Parent := oStaticPanel;
oStaticChoice.ParentBackground := False;
oStaticChoice.Left := ScaleX(5);
oStaticChoice.Top := ScaleY(5);
oStaticChoice.Width := oStaticPanel.Width - ScaleX(10);
oStaticChoice.Height := ScaleY(20);
oStaticChoice.Anchors := [akLeft, akTop, akRight];
oStaticChoice.Caption := 'Static';
oStaticChoice.Font.Style := [fsBold];
oStaticChoice.OnClick := @OnPortablePageStaticChoiceClick;
oStaticText := TLabel.Create(oStaticPanel);
oStaticText.Parent := oStaticPanel;
oStaticText.AutoSize := False;
oStaticText.Left := ScaleX(5);
oStaticText.Top := ScaleY(5) + oStaticChoice.Top + oStaticChoice.Height;
oStaticText.Width := oStaticPanel.Width - ScaleX(10);
oStaticText.Height := oStaticPanel.Height - ScaleX(5) - oStaticText.Top;
oStaticText.Anchors := [akLeft, akTop, akRight];
oStaticText.WordWrap := True
oStaticText.Caption := 'Install for use in a static version of OBS Studio, with all necessary features to support it.';
oStaticText.OnClick := @OnPortablePageStaticChoiceClick;
oPortablePanel := TPanel.Create(oPage);
oPortablePanel.Parent := oPage.Surface;
oPortablePanel.ParentBackground := False;
oPortablePanel.Left := ScaleX(5);
oPortablePanel.Top := ScaleY(5) + oStaticPanel.Top + oStaticPanel.Height;
oPortablePanel.Width := oPage.SurfaceWidth - ScaleX(10);
oPortablePanel.Height := ScaleY(100);
oPortablePanel.Anchors := [akLeft, akTop, akRight];
oPortablePanel.Color := clWindow;
oPortablePanel.BevelKind := bkTile;
oPortablePanel.BevelInner := bvNone;
oPortablePanel.BevelOuter := bvRaised;
oPortablePanel.BevelWidth := 1;
oPortablePanel.OnClick := @OnPortablePagePortableChoiceClick;
oPortableChoice := TNewRadioButton.Create(oPortablePanel);
oPortablePagePortableChoice := oPortableChoice;
oPortableChoice.Parent := oPortablePanel;
oPortableChoice.ParentBackground := False;
oPortableChoice.Left := ScaleX(5);
oPortableChoice.Top := ScaleY(5);
oPortableChoice.Width := oPortablePanel.Width - ScaleX(10);
oPortableChoice.Height := ScaleY(20);
oPortableChoice.Anchors := [akLeft, akTop, akRight];
oPortableChoice.Caption := 'Portable';
oPortableChoice.Font.Style := [fsBold];
oPortableChoice.OnClick := @OnPortablePagePortableChoiceClick;
oPortableText := TLabel.Create(oPortablePanel);
oPortableText.Parent := oPortablePanel;
oPortableText.AutoSize := False;
oPortableText.Left := ScaleX(5);
oPortableText.Top := ScaleY(5) + oPortableChoice.Top + oPortableChoice.Height;
oPortableText.Width := oPortablePanel.Width - ScaleX(10);
oPortableText.Height := oPortablePanel.Height - ScaleX(5) - oPortableText.Top;
oPortableText.Anchors := [akLeft, akTop, akRight];
oPortableText.WordWrap := True
oPortableText.Caption := 'Install for use in portable or multi-environment scenarios, which require StreamFX to not be tied to the System itself. The uninstaller, automatic updates and other system-dependent features will be unavailable.';
oPortableText.OnClick := @OnPortablePagePortableChoiceClick;
if (not IsAdmin()) then begin
oStaticWarningText := TLabel.Create(oStaticPanel);
oStaticWarningText.Parent := oStaticPanel;
oStaticWarningText.AutoSize := False;
oStaticWarningText.Left := ScaleX(5);
oStaticWarningText.Top := oPortablePanel.Height - ScaleY(5) - ScaleY(15);
oStaticWarningText.Width := oPortablePanel.Width - ScaleX(10);
oStaticWarningText.Height := ScaleY(15);
oStaticWarningText.Anchors := [akLeft, akBottom, akRight];
oStaticWarningText.WordWrap := True
oStaticWarningText.Font.Color := clRed;
oStaticWarningText.Font.Style := [fsBold];
oStaticWarningText.Caption := 'Please launch the Installer as Administrator for static installations.';
oStaticPanel.Enabled := False;
oStaticChoice.Enabled := False;
oStaticText.Enabled := False;
oStaticChoice.Checked := False;
oPortableChoice.Checked := True;
end else begin
oStaticChoice.Checked := True;
oPortableChoice.Checked := False;
2020-12-04 05:46:31 +00:00
end;
2022-09-17 07:48:26 +00:00
Result := oPage;
2019-10-13 03:43:45 +00:00
end;
2022-09-17 07:48:26 +00:00