-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathwiinusoft_installer.iss
288 lines (253 loc) · 10 KB
/
wiinusoft_installer.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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
;Inno Setup 6
#define MyAppName "WiinUSoft"
#define MyAppVersion "3.5"
#define MyAppPublisher "Justin Keys"
#define MyAppURL "https://github.com/KeyPuncher/WiinUPro/releases"
#define MyAppExeName "WiinUSoft.exe"
[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.)
AppId={{1BFC4F9F-BB85-4CE3-AC22-0CBFF78D5EE4}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableDirPage=auto
AllowNoIcons=yes
OutputDir=.\
OutputBaseFilename=wiinusoft_setup
Compression=lzma
SolidCompression=yes
ArchitecturesInstallIn64BitMode=x64
WizardStyle=modern
WizardSmallImageFile=WiinUSoft.bmp
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
;Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
;Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
;Name: "corsican"; MessagesFile: "compiler:Languages\Corsican.isl"
;Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
;Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
;Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
;Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
;Name: "french"; MessagesFile: "compiler:Languages\French.isl"
;Name: "german"; MessagesFile: "compiler:Languages\German.isl"
;Name: "greek"; MessagesFile: "compiler:Languages\Greek.isl"
;Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
;Name: "hungarian"; MessagesFile: "compiler:Languages\Hungarian.isl"
;Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
;Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
;Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
;Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
;Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
;Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
;Name: "scottishgaelic"; MessagesFile: "compiler:Languages\ScottishGaelic.isl"
;Name: "serbiancyrillic"; MessagesFile: "compiler:Languages\SerbianCyrillic.isl"
;Name: "serbianlatin"; MessagesFile: "compiler:Languages\SerbianLatin.isl"
;Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
;Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
;Name: "turkish"; MessagesFile: "compiler:Languages\Turkish.isl"
;Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"
[Types]
Name: "full"; Description: "Install Everything";
Name: "custom"; Description: "Pick and Choose"; Flags: iscustom
[Components]
Name: "main"; Description: "WiinUSoft"; Types: full custom; Flags: fixed;
Name: "scp"; Description: "Scarlet Crush Production Driver"; Types: full
Name: "xbox"; Description: "Xbox 360 Controller Driver (Required on Windows XP, Vista, and 7)"; Types: full
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
Source: "..\WiinUSoft\bin\Release\WiinUSoft.exe"; DestDir: "{app}"; Components: main; Flags: ignoreversion
Source: "..\WiinUSoft\bin\Release\Nintroller.dll"; DestDir: "{app}"; Components: main; Flags: ignoreversion
Source: "..\WiinUSoft\bin\Release\ScpControl.dll"; DestDir: "{app}"; Components: main; Flags: ignoreversion
Source: "..\WiinUSoft\bin\Release\Hardcodet.Wpf.TaskbarNotification.dll"; Components: main; DestDir: "{app}"; Flags: ignoreversion
Source: "..\WiinUSoft\ReadMe.txt"; DestDir: "{app}"; Components: main; Flags: ignoreversion isreadme
Source: "Drivers\SCP_Driver\*"; DestDir: "{app}\SCP_Driver"; Components: scp; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "Drivers\Xbox360_32Eng_7.exe"; DestDir: "{app}"; DestName: "Xbox360Driver.exe"; Components: xbox; Check: IsWindows7OrAbove and not Is64BitInstallMode; Flags: ignoreversion
Source: "Drivers\Xbox360_64Eng_7.exe"; DestDir: "{app}"; DestName: "Xbox360Driver.exe"; Components: xbox; Check: IsWindows7OrAbove and Is64BitInstallMode; Flags: ignoreversion
Source: "Drivers\Xbox360_32Eng_Vista.exe"; DestDir: "{app}"; DestName: "Xbox360Driver.exe"; Components: xbox; Check: IsWindowsVista and not Is64BitInstallMode; Flags: ignoreversion
Source: "Drivers\Xbox360_64Eng_Vista.exe"; DestDir: "{app}"; DestName: "Xbox360Driver.exe"; Components: xbox; Check: IsWindowsVista and Is64BitInstallMode; Flags: ignoreversion
Source: "Drivers\Xbox360_32Eng_XPSP2.exe"; DestDir: "{app}"; DestName: "Xbox360Driver.exe"; Components: xbox; Check: IsWindowsXpSp2 and not Is64BitInstallMode; Flags: ignoreversion
Source: "Drivers\Xbox360_64Eng_XP.exe"; DestDir: "{app}"; DestName: "Xbox360Driver.exe"; Components: xbox; Check: IsWindowsXp and Is64BitInstallMode; Flags: ignoreversion
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\ReadMe"; Filename: "{app}\ReadMe.txt"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Run]
Filename: "{app}\SCP_Driver\ScpDriver.exe"; Components: scp
Filename: "{app}\Xbox360Driver.exe"; Components: xbox;
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[UninstallRun]
Filename: "{app}\SCP_Driver\ScpDriver.exe"; Components: scp
[Code]
/////////////////////////////////////////////////////////////////////
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
FileName: String;
begin
if CurUninstallStep = usPostUninstall then
begin
FileName := ExpandConstant('{userappdata}') + '\WiinUSoft_prefs.config';
if FileExists(FileName) then
begin
if (GetUninstallString() = '') then
begin
if MsgBox('Do you want to delete your saved WiinUSoft preferences ?',
mbConfirmation, MB_YESNO) = IDYES
then
DeleteFile(FileName);
end
else
DeleteFile(FileName);
end;
end;
end;
function IsWindowsXp: Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
if Version.NTPlatform and
(Version.Major = 5) and
(Version.Minor > 0) then
begin
Result := True;
Exit;
end;
Result := False;
end;
function IsWindowsXpSp2: Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
if Version.NTPlatform and
(Version.Major = 5) and
(Version.Minor > 0) and
(Version.ServicePackMajor > 1) then
begin
Result := True;
Exit;
end;
Result := False;
end;
function IsWindowsVista: Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
if Version.NTPlatform and
(Version.Major = 6) and
(Version.Minor = 0) then
begin
Result := True;
Exit;
end;
Result := False;
end;
function IsWindows7OrAbove: Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
// Windows 7
if Version.NTPlatform and
(Version.Major = 6) and
(Version.Minor = 1) then
begin
Result := True;
Exit;
end;
// Windows 8
if Version.NTPlatform and
(Version.Major = 6) and
(Version.Minor = 2) then
begin
Result := True;
Exit;
end;
// Windows 8.1
if Version.NTPlatform and
(Version.Major = 6) and
(Version.Minor = 3) then
begin
Result := True;
Exit;
end;
// Windows 10
if Version.NTPlatform and
(Version.Major = 10) then
begin
Result := True;
Exit;
end;
Result := False;
end;
// code for uninstalling the previous version
/////////////////////////////////////////////////////////////////////
function IsUpgrade(): Boolean;
begin
Result := False;
if (GetUninstallString() <> '') then
begin
if MsgBox('There is another version of WiinUSoft installed. Uninstall it?',
mbConfirmation, MB_YESNO) = IDYES
then
Result := True;
end;
end;
/////////////////////////////////////////////////////////////////////
function UnInstallOldVersion(): Integer;
var
sUnInstallString: String;
iResultCode: Integer;
begin
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString
// default return value
Result := 0;
// get the uninstall string of the old app
sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then begin
sUnInstallString := RemoveQuotes(sUnInstallString);
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3
else
Result := 2;
end else
Result := 1;
end;
/////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssInstall) then
begin
if (IsUpgrade()) then
begin
UnInstallOldVersion();
end;
end;
end;