-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstreamnesia.iss
More file actions
123 lines (109 loc) · 3.52 KB
/
streamnesia.iss
File metadata and controls
123 lines (109 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
; Streamnesia Installer Script - Full Professional Version
[Setup]
AppName=Streamnesia
AppVersion=3.2.0
AppPublisher=Spelos
DefaultDirName={code:GetCustomInstallDir}
DefaultGroupName=Streamnesia
OutputDir=output
OutputBaseFilename=StreamnesiaInstaller
Compression=lzma
SolidCompression=yes
LicenseFile=LICENSE
AppPublisherURL=https://github.com/amnesia-spelos/streamnesia
AppSupportURL=https://github.com/amnesia-spelos/streamnesia
AppUpdatesURL=https://github.com/amnesia-spelos/streamnesia
WizardImageFile=installer/wizard.bmp
WizardSmallImageFile=installer/smalllogo.bmp
SetupIconFile=src/Streamnesia.Client/Lux.ico
DisableProgramGroupPage=yes
DisableWelcomePage=no
DisableFinishedPage=no
DirExistsWarning=no
UsePreviousAppDir=no
DisableDirPage=no
AppendDefaultDirName=no
[Files]
Source: "deployment\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs overwritereadonly
[Icons]
Name: "{group}\Streamnesia"; Filename: "{app}\Amnesia.exe"
[Code]
var
WarningPage: TOutputMsgWizardPage;
function FindAmnesiaInstallPath(): String;
var
SteamPath: String;
Installed: Cardinal;
begin
Result := ''; // Default to blank
// Check if Amnesia is registered as installed
if RegQueryDWordValue(HKEY_CURRENT_USER, 'Software\Valve\Steam\Apps\57300', 'Installed', Installed) then
begin
if Installed = 1 then
begin
// Find Steam installation path
if RegQueryStringValue(HKEY_CURRENT_USER, 'Software\Valve\Steam', 'SteamPath', SteamPath) then
begin
// Expected install path
Result := SteamPath + '\steamapps\common\Amnesia The Dark Descent';
end;
end;
end;
// Fallback default path
if (Result = '') or (not DirExists(Result)) then
begin
if DirExists('C:\Program Files (x86)\Steam\steamapps\common\Amnesia The Dark Descent') then
Result := 'C:\Program Files (x86)\Steam\steamapps\common\Amnesia The Dark Descent';
end;
end;
function GetCustomInstallDir(Default: string): string;
var
Path: string;
begin
Path := FindAmnesiaInstallPath();
if Path <> '' then
Result := Path
else
Result := Default;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
TargetFile, BackupFile, SelectedDir: string;
begin
Result := True;
SelectedDir := WizardForm.DirEdit.Text;
TargetFile := AddBackslash(SelectedDir) + 'Amnesia.exe';
// Check selected directory
if CurPageID = wpSelectDir then
begin
if not FileExists(TargetFile) then
begin
MsgBox('The selected folder does not contain Amnesia.exe.'#13#10'Please select your Amnesia installation directory.', mbError, MB_OK);
Result := False;
exit;
end;
end;
// After custom warning page
if CurPageID = WarningPage.ID then
begin
BackupFile := AddBackslash(SelectedDir) + 'Amnesia_backup_before_streamnesia.exe';
if not FileExists(BackupFile) then
begin
try
FileCopy(TargetFile, BackupFile, False);
except
MsgBox('Failed to create backup of Amnesia.exe.'#13#10'Installation cannot continue.', mbError, MB_OK);
Result := False;
exit;
end;
end;
end;
end;
procedure InitializeWizard;
begin
// Insert custom warning page after directory selection
WarningPage := CreateOutputMsgPage(wpSelectDir, 'Warning: Overwriting Amnesia.exe',
'Streamnesia will replace the existing Amnesia.exe file.',
'A backup named "Amnesia_backup_before_streamnesia.exe" will be created automatically before replacement.'#13#10#13#10 +
'If you want to revert to the original Amnesia, rename the backup to Amnesia.exe after uninstalling Streamnesia.');
end;