Skip to content

Commit

Permalink
Installer updates (#348)
Browse files Browse the repository at this point in the history
* Move installScript.vdf to \Backup folder

This means that when steam launches the game, it doesn't keep
re-applying compatiblity mode settings

* Custom welcome screen - and remove compat on game.exe, gamemd.exe
* Add important notice from CCHyper
  • Loading branch information
GrantBartlett committed Mar 10, 2024
1 parent aab020d commit 9ce25e5
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName = "")]
Binary file not shown.
71 changes: 67 additions & 4 deletions tools/build-installer/inno/installer.twig
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,19 @@ Type: filesandordirs; Name: "{app}\Client"
[Registry]
Root: HKLM; Subkey: SOFTWARE\Classes\CLSID\{{'{{1440AD10-6AA8-11D1-B6F9-00A024DDAFD1}'}}\InprocServer32; ValueType: string; ValueData: "blowfish.dll";

Root: HKCU; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\Ra2.exe; Flags: deletevalue
Root: HKLM; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\Ra2.exe; Flags: deletevalue
Root: HKCU64; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\Ra2.exe; Flags: deletevalue; Check: IsWin64
Root: HKCU; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\gamemd.exe; Flags: deletevalue
Root: HKLM; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\gamemd.exe; Flags: deletevalue
Root: HKCU64; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\gamemd.exe; Flags: deletevalue; Check: IsWin64
Root: HKLM64; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\gamemd.exe; Flags: deletevalue; Check: IsWin64

Root: HKCU; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\game.exe; Flags: deletevalue
Root: HKLM; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\game.exe; Flags: deletevalue
Root: HKCU64; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\game.exe; Flags: deletevalue; Check: IsWin64
Root: HKLM64; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\game.exe; Flags: deletevalue; Check: IsWin64

Root: HKCU; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\Ra2.exe; Flags: deletevalue
Root: HKLM; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\Ra2.exe; Flags: deletevalue
Root: HKCU64; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\Ra2.exe; Flags: deletevalue; Check: IsWin64
Root: HKLM64; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\Ra2.exe; Flags: deletevalue; Check: IsWin64

Root: HKCU; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueName: {app}\RA2MD.exe; Flags: deletevalue
Expand Down Expand Up @@ -140,7 +150,58 @@ Root: HKCU; Subkey: Software\Wine\AppDefaults\game.exe\DllOverrides; ValueType:
;Root: HKLM; Subkey: Software\Westwood\Yuri's Revenge; ValueType: String; ValueName: Serial; ValueData: "{code:RandomString}"; Flags: createvalueifdoesntexist
;Root: HKLM; Subkey: Software\Westwood\Red Alert 2; ValueType: String; ValueName: Serial; ValueData: "{code:RandomString}"; Flags: createvalueifdoesntexist

[Code]
[Code]
var
CustomPage: TWizardPage;

procedure InitializeWizard();
var
Memo: TRichEditViewer;
begin
CustomPage := CreateCustomPage(wpWelcome, 'Welcome to the CnCNet Red Alert 2 Yuri''s Revenge Setup', 'Need help? Join our Discord: cncnet.org/discord');

Memo := TRichEditViewer.Create(WizardForm);
Memo.Parent := CustomPage.Surface;
Memo.SetBounds(0, 0, CustomPage.SurfaceWidth, CustomPage.SurfaceHeight);
Memo.ReadOnly := True;
Memo.ScrollBars := ssVertical;
Memo.WordWrap := True;
Memo.Text := 'Important info, please read!'#13#10#13#10'If you have installed Red Alert 2 and Yuri''s Revenge via the C&C The Ultimate Collection on Steam, please launch the game once before running the CnCNet installer so Steam can write the correct registry keys.'#13#10#13#10'This installer will also move Steams "installScript.vdf" to "Backup\installScript.vdf", this is done to ensure the correct compatibility flags are set for the CnCNet Client to function correctly.';
end;

procedure CurStepChanged(CurStep: TSetupStep);
var
SteamInstallScript, SteamInstallScriptDest: String;
begin
if CurStep = ssInstall then
begin
// Define the paths for the source and destination files
SteamInstallScript := ExpandConstant('{app}\installScript.vdf');
SteamInstallScriptDest := ExpandConstant('{app}\Backup\installScript.vdf');

// Ensure the destination directory exists before attempting to move the file
if not DirExists(ExtractFilePath(SteamInstallScriptDest)) then
begin
// Try to create the backup directory if it doesn't exist
if not ForceDirectories(ExtractFilePath(SteamInstallScriptDest)) then
begin
MsgBox('Failed to create backup directory for Steam install script.', mbError, MB_OK);
Exit;
end;
end;

// Check if the source file exists and attempt to move it
if FileExists(SteamInstallScript) then
begin
if not RenameFile(SteamInstallScript, SteamInstallScriptDest) then
begin
MsgBox('Failed to move the file from ' + SteamInstallScript + ' to ' + SteamInstallScriptDest, mbError, MB_OK);
// Optionally, you can handle the failure here, for example, by logging the error
end;
end;
end;
end;

function GetModuleHandleA(lpLibFileName: PAnsiChar): THandle;
external '[email protected] stdcall';
function GetProcAddress(Module: THandle; ProcName: PAnsiChar): Longword;
Expand Down Expand Up @@ -201,6 +262,7 @@ begin
end
else Result:=true;
end

else result:=true;
end;

Expand All @@ -222,6 +284,7 @@ end;
function InitializeSetup(): Boolean;
var
Version: TWindowsVersion;

begin
// This will trigger net7 x64 to auto download and install - uncomment following line when net7 client is released
// Dependency_AddDotNet70Desktop
Expand Down

0 comments on commit 9ce25e5

Please sign in to comment.