2023-02-28 01:15:26 +00:00
; AUTOGENERATED COPYRIGHT HEADER START
; Copyright (C) 2022-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
; AUTOGENERATED COPYRIGHT HEADER END
2018-09-25 23:17:08 +00:00
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
2022-09-19 22:47:20 +00:00
AlwaysShowComponentsList=no
UsePreviousTasks=no
UsePreviousSetupType=no
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-19 21:53:12 +00:00
AppendDefaultDirName=yes
DisableProgramGroupPage=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
2022-09-17 08:06:02 +00:00
CreateUninstallRegKey=not IsPortableMode()
2022-09-15 02:37:22 +00:00
ChangesEnvironment=yes
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"
2022-09-19 22:47:20 +00:00
[Components]
name: "startmenu"; Description: "Start Menu Entries"
2018-09-25 23:17:08 +00:00
[Files]
2022-09-17 07:55:28 +00:00
Source: "@ISS_FILES_DIR@/data/obs-plugins/@PROJECT_NAME@/*"; DestDir: "{code:GetOutputDataDir}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "@ISS_FILES_DIR@/obs-plugins/@D_PLATFORM_BITS@bit/*"; DestDir: "{code:GetOutputBinaryDir}"; 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]
2022-09-19 22:47:20 +00:00
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"; Components: startmenu
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Components: startmenu
2018-09-25 23:17:08 +00:00
[Code]
2021-10-17 11:44:54 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
2022-09-15 02:37:22 +00:00
#ifdef UNICODE
#define AW "W"
#else
#define AW "A"
#endif
type
WPARAM = UINT_PTR;
LPARAM = INT_PTR;
LRESULT = INT_PTR;
const
SMTO_ABORTIFHUNG = 2;
WM_WININICHANGE = $001A;
WM_SETTINGCHANGE = WM_WININICHANGE;
2022-09-19 21:50:38 +00:00
function user32_SendTextMessageTimeoutA(
2022-09-15 02:37:22 +00:00
hWnd: HWND;
Msg: UINT;
wParam: WPARAM;
lParam: PAnsiChar;
fuFlags: UINT;
uTimeout: UINT;
out lpdwResult: DWORD): LRESULT;
external 'SendMessageTimeoutA@user32.dll stdcall';
procedure RefreshEnvironment();
2021-10-17 11:44:54 +00:00
var
2022-09-15 02:37:22 +00:00
S: AnsiString;
MsgResult: DWORD;
begin
S := 'Environment';
2022-09-19 21:50:38 +00:00
user32_SendTextMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
2022-09-15 02:37:22 +00:00
PAnsiChar(S), SMTO_ABORTIFHUNG, 5000, MsgResult);
end;
2022-09-19 21:40:50 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
function ParamExists(Name: String): Boolean;
var
Idx: Integer;
Limit: Integer;
Param: String;
begin
Limit := ParamCount()
for Idx := 1 to Limit do begin
Param := ParamStr(Idx);
if SameText(Param, '/' + Name) then begin
Result := True;
exit;
end;
end;
Result := False;
end;
2022-09-15 02:37:22 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
var
oModePageSystemChoice: TNewRadioButton;
oModePageUserChoice: TNewRadioButton;
oModePagePortableChoice: TNewRadioButton;
bIsPortableMode: Boolean;
bIsUserMode: Boolean;
bIsSystemMode: Boolean;
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:55:28 +00:00
function GetOutputBinaryDir(Value: String): String; forward;
function GetOutputDataDir(Value: String): String; forward;
2022-09-17 07:48:26 +00:00
2022-09-15 02:37:22 +00:00
// Which installation is present?
function IsSystemInstallPresent(): Boolean; forward;
function GetSystemUninstaller(): String; forward;
function IsUserInstallPresent(): Boolean; forward;
function GetUserUninstaller(): String; forward;
2022-09-17 07:48:26 +00:00
// Which installation mode is selected?
2022-09-15 02:37:22 +00:00
function IsSystemMode(): Boolean; forward;
function IsUserMode(): Boolean; forward;
2022-09-17 08:06:02 +00:00
function IsPortableMode(): Boolean; forward;
2022-09-17 07:48:26 +00:00
// Other Metadata
2022-09-17 08:06:02 +00:00
function AppRegistryKey(): 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
2022-09-15 02:37:22 +00:00
function CreateModePage: TWizardPage; forward;
procedure OnModePagePortableChoiceClick(Sender: TObject); forward;
procedure OnModePageSystemChoiceClick(Sender: TObject); forward;
2022-09-17 07:48:26 +00:00
2022-09-15 02:37:22 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
function InitializeSetup(): Boolean;
begin
2022-09-19 21:40:50 +00:00
if ParamExists('Portable') then begin
bIsSystemMode := False;
bIsUserMode := False;
bIsPortableMode := True;
end else begin
bIsSystemMode := IsAdmin();
bIsUserMode := not IsAdmin();
bIsPortableMode := False;
end;
2022-09-15 02:37:22 +00:00
Result := True;
end;
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
2022-09-15 02:37:22 +00:00
oModePage: TWizardPage;
2020-12-04 05:46:31 +00:00
begin
2022-09-15 02:37:22 +00:00
oModePage := CreateModePage();
2022-09-19 22:47:20 +00:00
if (IsPortableMode()) then begin
WizardSelectComponents('!startmenu');
end else begin
WizardSelectComponents('startmenu');
end;
2022-09-17 07:48:26 +00:00
end;
// ------------------------------------------------------------------------------------------------------------------ //
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
2022-09-19 22:47:20 +00:00
if (PageID = wpSelectDir) then begin
Result := not IsPortableMode();
end else if (PageID = wpSelectComponents) then begin
2022-09-19 22:47:20 +00:00
Result := True;
end else if (PageID = wpSelectProgramGroup) then begin
Result := not WizardIsComponentSelected('startmenu');
end;
2022-09-17 07:48:26 +00:00
end;
// ------------------------------------------------------------------------------------------------------------------ //
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
iResultCode: Integer;
2022-09-15 02:37:22 +00:00
sPluginsPath: String;
sPluginsDataPath: String;
2022-09-17 07:48:26 +00:00
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);
2022-09-15 02:37:22 +00:00
// If this is a User install, register the necessary environment changes.
if (IsUserMode()) then begin
sPluginsPath := ExpandConstant('{userpf}\obs-studio\plugins\%module%\bin\');
StringChangeEx(sPluginsPath, '\', '/', True);
2022-09-19 21:50:38 +00:00
RegWriteExpandStringValue(HKEY_CURRENT_USER, 'Environment', 'OBS_PLUGINS_PATH', sPluginsPath);
2022-09-15 02:37:22 +00:00
sPluginsDataPath := ExpandConstant('{userpf}\obs-studio\plugins\%module%\data\');
StringChangeEx(sPluginsDataPath, '\', '/', True);
2022-09-19 21:50:38 +00:00
RegWriteExpandStringValue(HKEY_CURRENT_USER, 'Environment', 'OBS_PLUGINS_DATA_PATH', sPluginsDataPath);
2022-09-15 02:37:22 +00:00
RefreshEnvironment();
end;
2020-12-04 05:46:31 +00:00
end;
// ------------------------------------------------------------------------------------------------------------------ //
function GetDefaultDirectory(Value: String): String;
2018-09-25 23:17:08 +00:00
var
2022-09-17 07:55:28 +00:00
sPath: String;
2018-09-25 23:17:08 +00:00
begin
2022-09-15 02:37:22 +00:00
// In all other cases, change depending on the chosen install method.
if (IsSystemMode()) then begin
// Default to ProgramData/obs-studio/@PROJECT_NAME@
Result := ExpandConstant('{commonappdata}\obs-studio\plugins\@PROJECT_NAME@');
2022-09-19 22:47:20 +00:00
end else if (IsUserMode()) then begin
Result := ExpandConstant('{userpf}\obs-studio\plugins\@PROJECT_NAME@');
end else begin
// If a path was given as an argument, use it.
if (Value <> '') then begin
Result := Value;
exit;
end;
2020-12-04 05:46:31 +00:00
2022-09-19 22:47:20 +00:00
Result := ExpandConstant('{userdesktop}\obs-studio');
end;
2022-09-17 07:55:28 +00:00
end;
2020-12-04 05:46:31 +00:00
2022-09-17 07:55:28 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
function GetOutputBinaryDir(Value: String): String;
var
sPath: String;
begin
2022-09-15 02:37:22 +00:00
if (IsSystemMode()) then begin
2022-09-17 08:06:02 +00:00
sPath := ExpandConstant('{app}\bin\@D_PLATFORM_BITS@bit\');
2022-09-15 02:37:22 +00:00
end else if (IsUserMode()) then begin
sPath := ExpandConstant('{app}\bin\');
end else if (IsPortableMode()) then begin
sPath := ExpandConstant('{app}\obs-plugins\@D_PLATFORM_BITS@bit\');
2022-09-17 08:06:02 +00:00
end;
2022-09-17 07:55:28 +00:00
Result := sPath;
end;
2021-10-17 11:44:54 +00:00
2022-09-17 07:55:28 +00:00
function GetOutputDataDir(Value: String): String;
var
sPath: String;
begin
2022-09-15 02:37:22 +00:00
if (IsSystemMode()) then begin
2022-09-17 08:06:02 +00:00
sPath := ExpandConstant('{app}\data\');
2022-09-15 02:37:22 +00:00
end else if (IsUserMode()) then begin
sPath := ExpandConstant('{app}\data\@PROJECT_NAME@\');
end else if (IsPortableMode()) then begin
sPath := ExpandConstant('{app}\data\obs-plugins\@PROJECT_NAME@\');
2022-09-17 08:06:02 +00:00
end;
2022-09-17 07:55:28 +00:00
Result := sPath;
2018-09-25 23:17:08 +00:00
end;
2020-12-04 05:46:31 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
2022-09-15 02:37:22 +00:00
function GetSystemUninstaller(): String;
2018-09-25 23:17:08 +00:00
var
2022-09-15 02:37:22 +00:00
sPath : String;
2018-09-25 23:17:08 +00:00
begin
2022-09-15 02:37:22 +00:00
Result := '';
if (RegQueryStringValue(HKLM64, AppRegistryKey(), 'UninstallString', sPath)) then begin
Result := sPath;
end;
end;
2020-12-04 05:46:31 +00:00
2022-09-15 02:37:22 +00:00
function IsSystemInstallPresent(): Boolean;
var
sPath : String;
begin
sPath := GetSystemUninstaller();
if (sPath <> '') then begin
Result := True;
end else begin
Result := False;
end;
end;
2020-12-04 05:46:31 +00:00
2022-09-15 02:37:22 +00:00
function GetUserUninstaller(): String;
var
sPath : String;
begin
Result := '';
if (RegQueryStringValue(HKCU64, AppRegistryKey(), 'UninstallString', sPath)) then begin
Result := sPath;
end;
end;
2020-12-04 05:46:31 +00:00
2022-09-15 02:37:22 +00:00
function IsUserInstallPresent(): Boolean;
var
sPath : String;
begin
sPath := GetUserUninstaller();
if (sPath <> '') then begin
Result := True;
end else begin
Result := False;
end;
end;
2020-12-04 05:46:31 +00:00
2022-09-15 02:37:22 +00:00
function GetUninstallerPath(): String;
begin
if (IsSystemMode()) then begin
Result := GetSystemUninstaller();
end else if (IsUserMode()) then begin
Result := GetUserUninstaller();
end else begin
Result := '';
end;
2018-09-25 23:17:08 +00:00
end;
2022-09-17 08:06:02 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
2022-09-15 02:37:22 +00:00
function IsSystemMode(): Boolean;
begin
Result := bIsSystemMode;
end;
function IsUserMode(): Boolean;
begin
Result := bIsUserMode;
end;
2022-09-17 08:06:02 +00:00
function IsPortableMode(): Boolean;
begin
2022-09-15 02:37:22 +00:00
Result := bIsPortableMode;
2022-09-17 08:06:02 +00:00
end;
// ------------------------------------------------------------------------------------------------------------------ //
function AppRegistryKey(): String;
begin
Result := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting('AppId')}_is1');
end;
2020-12-04 05:46:31 +00:00
// ------------------------------------------------------------------------------------------------------------------ //
2018-09-25 23:17:08 +00:00
function IsUpgrade(): Boolean;
begin
2022-09-17 08:06:02 +00:00
Result := (not IsPortableMode()) 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
// ------------------------------------------------------------------------------------------------------------------ //
2022-09-15 02:37:22 +00:00
procedure OnModePageSystemChoiceClick(Sender: TObject);
2021-10-17 11:44:54 +00:00
begin
2022-09-15 02:37:22 +00:00
if (not oModePageSystemChoice.Enabled) then begin
OnModePagePortableChoiceClick(Sender);
end else begin
oModePageSystemChoice.Checked := True;
oModePageUserChoice.Checked := False;
oModePagePortableChoice.Checked := False;
bIsSystemMode := True;
bIsUserMode := False;
bIsPortableMode := False;
2022-09-19 22:47:20 +00:00
WizardSelectComponents('startmenu');
2022-09-15 02:37:22 +00:00
end;
2021-10-17 11:44:54 +00:00
end;
2022-09-15 02:37:22 +00:00
procedure onModePageUserChoiceClick(Sender: TObject);
2021-10-17 11:44:54 +00:00
begin
2022-09-15 02:37:22 +00:00
if (not oModePageUserChoice.Enabled) then begin
OnModePagePortableChoiceClick(Sender);
2022-09-17 07:48:26 +00:00
end else begin
2022-09-15 02:37:22 +00:00
oModePageSystemChoice.Checked := False;
oModePageUserChoice.Checked := True;
oModePagePortableChoice.Checked := False;
bIsSystemMode := False;
bIsUserMode := True;
bIsPortableMode := False;
2022-09-19 22:47:20 +00:00
WizardSelectComponents('startmenu');
2022-09-17 07:48:26 +00:00
end;
2021-10-17 11:44:54 +00:00
end;
2022-09-15 02:37:22 +00:00
procedure OnModePagePortableChoiceClick(Sender: TObject);
begin
oModePageSystemChoice.Checked := False;
oModePageUserChoice.Checked := False;
oModePagePortableChoice.Checked := True;
bIsSystemMode := False;
bIsUserMode := False;
bIsPortableMode := True;
2022-09-19 22:47:20 +00:00
WizardSelectComponents('!startmenu');
2022-09-15 02:37:22 +00:00
end;
function CreateModePage: TWizardPage;
2021-10-17 11:44:54 +00:00
var
2022-09-17 07:48:26 +00:00
oPage: TWizardPage;
2022-09-15 02:37:22 +00:00
oSystemPanel: TPanel;
oSystemChoice: TNewRadioButton;
oSystemText: TLabel;
oSystemWarningText: TLabel;
oUserPanel: TPanel;
oUserChoice: TNewRadioButton;
oUserText: TLabel;
oUserWarningText: TLabel;
2022-09-17 07:48:26 +00:00
oPortablePanel: TPanel;
oPortableChoice: TNewRadioButton;
oPortableText: TLabel;
2022-09-15 02:37:22 +00:00
oPortableWarningText: TLabel;
oFractionalHeight: Integer;
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,
2022-09-15 02:37:22 +00:00
'Installation Mode',
2022-09-17 07:48:26 +00:00
'Select how to install StreamFX on your System');
2022-09-15 02:37:22 +00:00
oFractionalHeight := ScaleY((oPage.SurfaceHeight - 10) / 3);
// System-Wide installation
if (True) then begin
oSystemPanel := TPanel.Create(oPage);
oSystemPanel.Parent := oPage.Surface;
oSystemPanel.ParentBackground := False;
oSystemPanel.Left := ScaleX(5);
oSystemPanel.Top := ScaleY(5);
oSystemPanel.Width := oPage.SurfaceWidth - ScaleX(10);
oSystemPanel.Height := oFractionalHeight;
oSystemPanel.Anchors := [akLeft, akTop, akRight];
oSystemPanel.Color := clWindow;
oSystemPanel.BevelKind := bkTile;
oSystemPanel.BevelInner := bvNone;
oSystemPanel.BevelOuter := bvRaised;
oSystemPanel.BevelWidth := 1;
oSystemPanel.OnClick := @OnModePageSystemChoiceClick;
oSystemChoice := TNewRadioButton.Create(oSystemPanel);
oModePageSystemChoice := oSystemChoice;
oSystemChoice.Parent := oSystemPanel;
oSystemChoice.ParentBackground := False;
oSystemChoice.Left := ScaleX(5);
oSystemChoice.Top := ScaleY(5);
oSystemChoice.Width := oSystemPanel.Width - ScaleX(10);
oSystemChoice.Height := ScaleY(20);
oSystemChoice.Anchors := [akLeft, akTop, akRight];
oSystemChoice.Caption := 'All Users';
oSystemChoice.Font.Style := [fsBold];
oSystemChoice.OnClick := @OnModePageSystemChoiceClick;
oSystemText := TLabel.Create(oSystemPanel);
oSystemText.Parent := oSystemPanel;
oSystemText.AutoSize := False;
oSystemText.Left := ScaleX(5);
oSystemText.Top := ScaleY(5) + oSystemChoice.Top + oSystemChoice.Height;
oSystemText.Width := oSystemPanel.Width - ScaleX(10);
oSystemText.Height := oSystemPanel.Height - ScaleX(5) - oSystemText.Top;
oSystemText.Anchors := [akLeft, akTop, akRight];
oSystemText.WordWrap := True
oSystemText.Caption := 'Install for all users of this System, which will require Administrator rights for future updates. May cause problems with Portable and Current User installations.';
oSystemText.OnClick := @OnModePageSystemChoiceClick;
// Not available without Administrator rights.
if (not IsAdmin()) then begin
oSystemWarningText := TLabel.Create(oSystemPanel);
oSystemWarningText.Parent := oSystemPanel;
oSystemWarningText.AutoSize := False;
oSystemWarningText.Left := ScaleX(5);
oSystemWarningText.Top := oSystemPanel.Height - ScaleY(5) - ScaleY(15);
oSystemWarningText.Width := oSystemPanel.Width - ScaleX(10);
oSystemWarningText.Height := ScaleY(15);
oSystemWarningText.Anchors := [akLeft, akBottom, akRight];
oSystemWarningText.WordWrap := True
oSystemWarningText.Font.Color := clRed;
oSystemWarningText.Font.Style := [fsBold];
oSystemWarningText.Caption := 'Please launch the installer with Administrator rights.';
oSystemPanel.Enabled := False;
oSystemChoice.Enabled := False;
oSystemChoice.Checked := False;
oSystemText.Enabled := False;
end else if (IsUserInstallPresent()) then begin
oSystemWarningText := TLabel.Create(oSystemPanel);
oSystemWarningText.Parent := oSystemPanel;
oSystemWarningText.AutoSize := False;
oSystemWarningText.Left := ScaleX(5);
oSystemWarningText.Top := oSystemPanel.Height - ScaleY(5) - ScaleY(15);
oSystemWarningText.Width := oSystemPanel.Width - ScaleX(10);
oSystemWarningText.Height := ScaleY(15);
oSystemWarningText.Anchors := [akLeft, akBottom, akRight];
oSystemWarningText.WordWrap := True
oSystemWarningText.Font.Color := $007EFF;
oSystemWarningText.Font.Style := [fsBold];
oSystemWarningText.Caption := 'A conflicting installation was detected which may cause issues.';
end;
end;
2022-09-17 07:48:26 +00:00
2022-09-15 02:37:22 +00:00
// Local-User installation
if (True) then begin
oUserPanel := TPanel.Create(oPage);
oUserPanel.Parent := oPage.Surface;
oUserPanel.ParentBackground := False;
oUserPanel.Left := ScaleX(5);
oUserPanel.Top := ScaleY(5) + oSystemPanel.Top + oSystemPanel.Height;
oUserPanel.Width := oPage.SurfaceWidth - ScaleX(10);
oUserPanel.Height := oFractionalHeight;
oUserPanel.Anchors := [akLeft, akTop, akRight];
oUserPanel.Color := clWindow;
oUserPanel.BevelKind := bkTile;
oUserPanel.BevelInner := bvNone;
oUserPanel.BevelOuter := bvRaised;
oUserPanel.BevelWidth := 1;
oUserPanel.OnClick := @OnModePageUserChoiceClick;
oUserChoice := TNewRadioButton.Create(oUserPanel);
oModePageUserChoice := oUserChoice;
oUserChoice.Parent := oUserPanel;
oUserChoice.ParentBackground := False;
oUserChoice.Left := ScaleX(5);
oUserChoice.Top := ScaleY(5);
oUserChoice.Width := oUserPanel.Width - ScaleX(10);
oUserChoice.Height := ScaleY(20);
oUserChoice.Anchors := [akLeft, akTop, akRight];
oUserChoice.Caption := 'Current User';
oUserChoice.Font.Style := [fsBold];
oUserChoice.OnClick := @OnModePageUserChoiceClick;
oUserText := TLabel.Create(oUserPanel);
oUserText.Parent := oUserPanel;
oUserText.AutoSize := False;
oUserText.Left := ScaleX(5);
oUserText.Top := ScaleY(5) + oUserChoice.Top + oUserChoice.Height;
oUserText.Width := oUserPanel.Width - ScaleX(10);
oUserText.Height := oUserPanel.Height - ScaleX(5) - oUserText.Top;
oUserText.Anchors := [akLeft, akTop, akRight];
oUserText.WordWrap := True
oUserText.Caption := 'Install for the current user only, which will allow you to use @PROJECT_NAME@. Updating will not require Administrator rights.';
oUserText.OnClick := @OnModePageUserChoiceClick;
// Not available with Administrator rights.
if (IsAdmin()) then begin
oUserWarningText := TLabel.Create(oUserPanel);
oUserWarningText.Parent := oUserPanel;
oUserWarningText.AutoSize := False;
oUserWarningText.Left := ScaleX(5);
oUserWarningText.Top := oUserPanel.Height - ScaleY(5) - ScaleY(15);
oUserWarningText.Width := oUserPanel.Width - ScaleX(10);
oUserWarningText.Height := ScaleY(15);
oUserWarningText.Anchors := [akLeft, akBottom, akRight];
oUserWarningText.WordWrap := True
oUserWarningText.Font.Color := clRed;
oUserWarningText.Font.Style := [fsBold];
oUserWarningText.Caption := 'Please launch the Installer without Administrator rights.';
oUserPanel.Enabled := False;
oUserChoice.Enabled := False;
oUserChoice.Checked := False;
oUserText.Enabled := False;
end else if (IsSystemInstallPresent()) then begin
oUserWarningText := TLabel.Create(oUserPanel);
oUserWarningText.Parent := oUserPanel;
oUserWarningText.AutoSize := False;
oUserWarningText.Left := ScaleX(5);
oUserWarningText.Top := oUserPanel.Height - ScaleY(5) - ScaleY(15);
oUserWarningText.Width := oUserPanel.Width - ScaleX(10);
oUserWarningText.Height := ScaleY(15);
oUserWarningText.Anchors := [akLeft, akBottom, akRight];
oUserWarningText.WordWrap := True
oUserWarningText.Font.Color := $007EFF;
oUserWarningText.Font.Style := [fsBold];
oUserWarningText.Caption := 'A conflicting system wide installation was detected.';
oUserPanel.Enabled := False;
oUserChoice.Enabled := False;
oUserChoice.Checked := False;
oUserText.Enabled := False;
end;
end;
// Portable
if (True) then begin
oPortablePanel := TPanel.Create(oPage);
oPortablePanel.Parent := oPage.Surface;
oPortablePanel.ParentBackground := False;
oPortablePanel.Left := ScaleX(5);
oPortablePanel.Top := ScaleY(5) + oUserPanel.Top + oUserPanel.Height;
oPortablePanel.Width := oPage.SurfaceWidth - ScaleX(10);
oPortablePanel.Height := oFractionalHeight;
oPortablePanel.Anchors := [akLeft, akTop, akRight];
oPortablePanel.Color := clWindow;
oPortablePanel.BevelKind := bkTile;
oPortablePanel.BevelInner := bvNone;
oPortablePanel.BevelOuter := bvRaised;
oPortablePanel.BevelWidth := 1;
oPortablePanel.OnClick := @OnModePagePortableChoiceClick;
oPortableChoice := TNewRadioButton.Create(oPortablePanel);
oModePagePortableChoice := 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 := @OnModePagePortableChoiceClick;
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 a portable OBS Studio environment.';
oPortableText.OnClick := @OnModePagePortableChoiceClick;
// Warn about Administrator rights
if (IsAdmin()) then begin
oPortableWarningText := TLabel.Create(oPortablePanel);
oPortableWarningText.Parent := oPortablePanel;
oPortableWarningText.AutoSize := False;
oPortableWarningText.Left := ScaleX(5);
oPortableWarningText.Top := oPortablePanel.Height - ScaleY(5) - ScaleY(15);
oPortableWarningText.Width := oPortablePanel.Width - ScaleX(10);
oPortableWarningText.Height := ScaleY(15);
oPortableWarningText.Anchors := [akLeft, akBottom, akRight];
oPortableWarningText.WordWrap := True
oPortableWarningText.Font.Color := $007EFF;
oPortableWarningText.Font.Style := [fsBold];
oPortableWarningText.Caption := 'Portable installation with Administrator rights may cause unforeseen consequences. Proceed with caution.';
end;
2020-12-04 05:46:31 +00:00
end;
2022-09-15 02:37:22 +00:00
oSystemChoice.Checked := bIsSystemMode;
oUserChoice.Checked := bIsUserMode;
oPortableChoice.Checked := bIsPortableMode;
2022-09-17 07:48:26 +00:00
Result := oPage;
2019-10-13 03:43:45 +00:00
end;