-
Notifications
You must be signed in to change notification settings - Fork 2
/
Sonic R Updater.iss
234 lines (213 loc) · 9.07 KB
/
Sonic R Updater.iss
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#define AppName "Sonic R Updater"
#define AppVersion "1.0.10"
#define GameName "Sonic R"
#include <idp.iss>
[Setup]
AppId={{AD463876-A5A1-401D-B12F-44794F3803E7}
AppName={#AppName}
AppVersion={#AppVersion}
DefaultDirName={code:GetDefaultDir}
DisableProgramGroupPage=yes
DirExistsWarning=no
DisableDirPage=no
AppendDefaultDirName=no
DisableReadyPage=yes
AlwaysShowDirOnReadyPage=yes
CloseApplications=yes
OutputBaseFilename={#AppName} {#AppVersion}
SetupIconFile=srud.ico
WizardImageFile=SR_large.bmp
WizardImageStretch=no
WizardSmallImageFile=SR_small.bmp
Compression=lzma
SolidCompression=yes
Uninstallable=no
PrivilegesRequired=admin
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Messages]
SetupAppTitle={#AppName} {#AppVersion}
SetupWindowTitle={#AppName} {#AppVersion}
SelectDirLabel3={#AppName} will install an update for {#GameName} in the following folder.
FinishedLabel=Setup has completed update of {#GameName} on your computer. A Shortcut to {#GameName} Mod Manager has been added to the start menu.
ExitSetupMessage={#GameName} has not been updated.%nAre you sure you want to close the updater?
SelectDirDesc=Where should the update for {#GameName} be installed?
InstallingLabel=Please wait while Setup installs the {#GameName} update on your computer.
[CustomMessages]
IDP_FormCaption=Attempting Download of {#GameName} Mod Loader...
IDP_FormDescription=Please wait a moment...
[InstallDelete]
;files that need replaced in 1998 build
Type: files; Name: "{app}\SonicR.exe"
Type: files; Name: "{app}\BIN\credits\credit00.raw"
Type: files; Name: "{app}\BIN\demos\city.dem"
Type: files; Name: "{app}\BIN\demos\factory.dem"
Type: files; Name: "{app}\BIN\demos\island.dem"
Type: files; Name: "{app}\BIN\demos\ruin.dem"
Type: files; Name: "{app}\BIN\option\opt01.raw"
Type: files; Name: "{app}\SOUND\sfx\Amy.wav"
Type: files; Name: "{app}\SOUND\sfx\Tails.wav"
Type: filesandordirs; Name: "{app}\help"
;files from past SRUpdater runs that may need updated
Type: files; Name: "{app}\srud_fallback_used.txt"
Type: files; Name: "{app}\SonicRModManager.pdb"
Type: files; Name: "{app}\SonicRModManager.exe"
Type: files; Name: "{app}\sonicrmlver.txt"
Type: files; Name: "{app}\Newtonsoft.Jaon.xml"
Type: files; Name: "{app}\Newtonsoft.Json.dll"
Type: files; Name: "{app}\ModManagerCommon.pdb"
Type: files; Name: "{app}\ModManagerCommon.dll"
Type: files; Name: "{app}\loader.manifest"
Type: files; Name: "{app}\libvorbisfile.dll"
Type: files; Name: "{app}\libvorbis.dll"
Type: files; Name: "{app}\libogg.dll"
Type: files; Name: "{app}\libmpg123-0.dll"
Type: files; Name: "{app}\COPYING_VGMSTREAM"
Type: files; Name: "{app}\COPYING_BASS_VGMSTREAM"
Type: files; Name: "{app}\bass_vgmstream.dll"
Type: files; Name: "{app}\bass.dll"
Type: files; Name: "{app}\d3d9.dll"
Type: files; Name: "{app}\7z.exe"
Type: files; Name: "{app}\7z.dll"
Type: files; Name: "{app}\mods\SonicRModLoader.dll"
Type: files; Name: "{app}\mods\Codes.xml"
Type: files; Name: "{app}\mods\Codes.lst"
Type: files; Name: "{app}\mods\Border.png"
Type: files; Name: "{app}\mods\Border_Default.png"
Type: files; Name: "{app}\programming\SonicRModLoader.h"
Type: files; Name: "{app}\programming\MemAccess.h"
Type: filesandordirs; Name: "{app}\mods\ADXMusic"
Type: filesandordirs; Name: "{app}\mods\RemoveStrays"
[Dirs]
Name: "{app}"; Permissions: users-full
[Files]
Source: ".\2004_Files\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\New_Files\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\Replace_Files\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\Temp_Files\*"; DestDir: "{tmp}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{commonprograms}\Sega\SonicR\Sonic R Mod Manager"; Filename: "{app}\SonicRModManager.exe"; WorkingDir: "{app}"
Name: "{commonprograms}\Sega\SonicR\Sonic R"; Filename: "{app}\SonicR.exe"; WorkingDir: "{app}"
Name: "{commonprograms}\Sega\SonicR\Sonic R Help"; Filename: "{app}\help\eng_html\index.htm"; WorkingDir: "{app}"
[Code]
var ProgressPage: TOutputProgressWizardPage;
procedure InitializeWizard;
begin
idpSetOption('ErrorDialog', 'none');
idpAddFile('http://mm.reimuhakurei.net/misc/SonicRModLoader.7z', ExpandConstant('{tmp}\SonicRModLoader.7z'));
idpDownloadAfter(wpSelectDir);
ProgressPage := CreateOutputProgressPage('Finishing up...','');
end;
function GetDefaultDir(def: string): string;
var InstalledDir : string;
begin
//Check 32bit registry for Sonic R 1998
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sonic R',
'UninstallString', InstalledDir) then
begin
end
else if RegQueryStringValue(HKLM32, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sonic R',
'UninstallString', InstalledDir) then
begin
end
//Check 32bit registry for Sonic R 2004
else if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{520ED6C2-499D-48E7-A9E9-55E247622603}',
'InstallLocation', InstalledDir) then
begin
end
else if RegQueryStringValue(HKLM32, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{520ED6C2-499D-48E7-A9E9-55E247622603}',
'InstallLocation', InstalledDir) then
begin
end
//Check 64bit registry for Sonic R 1998
else if IsWin64 and RegQueryStringValue(HKLM64, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sonic R',
'UninstallString', InstalledDir) then
begin
end
//Check 64bit registry for Sonic R 2004
else if IsWin64 and RegQueryStringValue(HKLM64, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{520ED6C2-499D-48E7-A9E9-55E247622603}',
'InstallLocation', InstalledDir) then
begin
end
StringChangeEx(InstalledDir, 'directx\setup /r', '', True);
Result := InstalledDir;
end;
function NextButtonClick(PageId: Integer): Boolean;
begin
Result := True;
if (PageId = wpSelectDir) and (
not FileExists(ExpandConstant('{app}\sonicr.exe'))
) then
begin
MsgBox('The selected path does not contain a copy of {#GameName}, please browse to the correct path and try again or exit.', mbError, MB_OK);
Result := False;
exit;
end
end;
procedure CurStepChanged(CurStep: TSetupStep);
var ErrorCode: Integer;
begin
if CurStep = ssPostInstall then
begin
//Start Post Install
ProgressPage.Show;
//Install Sonic R Mod Loader
ProgressPage.SetText('Installing Sonic R Mod Loader...', '');
ProgressPage.SetProgress(10, 100);
begin
if FileExists(ExpandConstant('{tmp}\SonicRModLoader.7z')) then begin
Exec(ExpandConstant('{tmp}\7za.exe'), ExpandConstant('x -y {tmp}\SonicRModLoader.7z -o"{app}"'), '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
end else begin
Exec(ExpandConstant('{tmp}\7za.exe'), ExpandConstant('x -y {tmp}\SonicRModLoader_fallback.7z -o"{app}"'), '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
end
end
//Install Mod Loader DLL Into Game
Exec('cmd.exe', ExpandConstant('/c COPY /Y "{app}\mods\SonicRModLoader.dll" "{app}\d3d9.dll"'), '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
//Installing .NET Runtime...
ProgressPage.SetText('Installing Microsoft .NET...', '');
ProgressPage.SetProgress(40, 100);
Exec(ExpandConstant('{tmp}\redists\dotNetFx40_Full_x86_x64.exe'), '/q /norestart', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
//Install Visual C++ Runtimes...
ProgressPage.SetText('Installing Visual C++...', '');
ProgressPage.SetProgress(70, 100);
Exec(ExpandConstant('{tmp}\redists\vc_redist.x86.2017.exe'), '/q /norestart', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
//Delete extra shortcuts
ProgressPage.SetText('Cleaning up extra shortcuts...', '');
ProgressPage.SetProgress(90, 100);
DelTree(ExpandConstant('{userprograms}\Sega Sonic R'), True, True, True);
DelTree(ExpandConstant('{commonprograms}\Sega\SonicR\Sonic R Manual.lnk'), False, True, False);
DelTree(ExpandConstant('{commonprograms}\Sega\SonicR\Launch SonicR.lnk'), False, True, False);
DelTree(ExpandConstant('{commonprograms}\Sega\SonicR\Uninstall Sonic R.lnk'), False, True, False);
//End Post Install
ProgressPage.Hide;
end;
end;
function InitializeSetup(): Boolean;
var wnGame: longint;
classGame: longint;
classLauncher: longint;
strGame: string;
strLauncher: string;
errorRunning: string;
begin
strGame := 'Sonic R';
strLauncher := 'Direct3DWindowClass';
wnGame := FindWindowByWindowName(strGame);
classGame := FindWindowByClassName(strGame);
classLauncher:= FindWindowByClassName(strLauncher);
errorRunning:= 'Please make sure {#GameName} is not running and run the installer again.';
if classGame <> 0 then
begin
MsgBox(errorRunning, mbInformation, MB_OK);
end
else if (classLauncher and wnGame <> 0) then
begin
MsgBox(errorRunning, mbInformation, MB_OK);
end
else
begin
Result := True;
end
end;
[Run]
Filename: "{app}\SonicRModManager.exe"; Description: "Open Sonic R Mod Manager"; Flags: shellexec runasoriginaluser postinstall nowait