-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFH2.iss
268 lines (233 loc) · 9.48 KB
/
FH2.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
[Setup]
AppName=Forgotten Hope 2
AppVername=Forgotten Hope 2.64
AppVersion=2.64
AppCopyright=FH2 Devs
AppPublisher=FH2 Devs
AppID={{2FE10CB1-887F-4AE0-AF87-34D5F4A5F6CF}
AppPublisherURL=http://forgottenhope.warumdarum.de
AppSupportURL=https://discord.gg/hU878P4
VersionInfoVersion=2.64
VersionInfoCopyright=FH2 Devs
VersionInfoCompany=FH2 Devs
VersionInfoDescription=Forgotten Hope 2.64
VersionInfoTextVersion=2.64
UninstallDisplayName=Forgotten Hope 2
DefaultDirName={commonpf32}\Forgotten Hope 2
DefaultGroupName=Forgotten Hope 2
SetupLogging=yes
DiskSpanning=true
DisableReadyPage=yes
DisableWelcomePage=yes
WizardImageFile=InstallFiles\GFX\modern-wizard.bmp
WizardSmallImageFile=InstallFiles\GFX\WizardSmallImage.bmp
SetupIconFile=InstallFiles\GFX\fh2.ico
LanguageDetectionMethod=uilanguage
InternalCompressLevel=ultra64
OutputDir=Output
OutputBaseFilename=fh2_setup
AppendDefaultDirName=true
UninstallDisplayIcon={app}\mods\fh2\fh2.ico
Compression=none
AllowRootDirectory=true
CompressionThreads=auto
[Types]
Name: "custom"; Description: "Custom installation"; Flags: iscustom
[Components]
Name: "main"; Description: "{cm:CompDescrFH2}"; Types: custom; Flags: fixed
Name: "vcpp2019"; Description: "{cm:CompDescrVCPP2019}"; Types: custom;
Name: "directx"; Description: "{cm:CompDescrDirectX}"; Types: custom;
Name: "dotnet"; Description: "{cm:CompDescrDotNet}"; Types: custom;
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
[Files]
DestName: "WizardForm.TopLogoImage.bmp"; Source: "InstallFiles\GFX\topbar.bmp"; Flags: dontcopy solidbreak;
DestName: "discord.ico"; Source: "InstallFiles\GFX\discord.ico"; Flags: dontcopy solidbreak;
Source: "Files\standalone\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: main;
Source: "Include\smartctl.exe"; Flags: dontcopy;
Source: "Include\BF2CDKeyCheck.exe"; DestDir: "{tmp}";
;Source: "Redist\*"; DestDir: "{tmp}\Redist"; Flags: ignoreversion recursesubdirs;
[Registry]
Root: HKLM32; Subkey: "SOFTWARE\Electronic Arts\EA Games\Battlefield 2"; ValueName: "InstallDir"; ValueType: String; ValueData: "{app}"; Flags: deletevalue uninsdeletekey;
Root: HKLM32; Subkey: "SOFTWARE\Electronic Arts\EA Games\Battlefield 2"; ValueName: "Locale"; ValueType: String; ValueData: "{code:SetLocale}"; Flags: deletevalue uninsdeletekey;
Root: HKLM32; Subkey: "SOFTWARE\Electronic Arts\EA Games\Battlefield 2"; ValueName: "Language"; ValueType: String; ValueData: "{code:SetLanguage}"; Flags: deletevalue uninsdeletekey;
Root: HKLM32; Subkey: "SOFTWARE\Electronic Arts\EA Games\Battlefield 2"; ValueName: "Version"; ValueType: String; ValueData: "1.5"; Flags: deletevalue uninsdeletekey;
Root: HKLM32; Subkey: "SOFTWARE\Electronic Arts\EA Games\Battlefield 2\ergc"; ValueName: ; ValueType: string; ValueData: "{code:GetKey}"; Flags: deletevalue uninsdeletekey;
Root: HKLM32; Subkey: "SOFTWARE\Electronic Arts\EA Games\Battlefield 2\wdc"; ValueName: ; ValueType: string; ValueData: "true"; Flags: deletevalue uninsdeletekey;
; FH2 URL Protocol
Root: HKCR; Subkey: "fh2"; ValueName: ; ValueType: string; ValueData: "URL:FH2 Protocol"; Flags: uninsdeletekey;
Root: HKCR; Subkey: "fh2"; ValueName: "URL Protocol"; ValueType: string; ValueData: ; Flags: uninsdeletekey;
Root: HKCR; Subkey: "fh2"; ValueName: "ShellFolder"; ValueType: string; ValueData: "{app}"; Flags: uninsdeletekey;
Root: HKCR; Subkey: "fh2\shell"; ValueName: ; ValueType: string; ValueData: "open"; Flags: uninsdeletekey;
Root: HKCR; Subkey: "fh2\shell\open"; Flags: uninsdeletekey;
Root: HKCR; Subkey: "fh2\shell\open\command"; ValueName:; ValueType: string; ValueData: "{app}\mods\fh2\bin\FH2Launcher.exe ""%1"""; Flags: uninsdeletekey;
[Icons]
Name: "{group}\Forgotten Hope 2"; Filename: "{app}\mods\fh2\bin\FH2Launcher.exe"; Comment: "{cm:LaunchProgram,Forgotten Hope 2}";
Name: "{group}\{cm:UninstallProgram, Forgotten Hope 2}"; Filename: "{uninstallexe}"; Comment: "{cm:UninstallProgram,Forgotten Hope 2}";
Name: "{commondesktop}\Forgotten Hope 2"; Filename: "{app}\mods\fh2\bin\FH2Launcher.exe"; Tasks: desktopicon; Comment: "{cm:LaunchProgram,Forgotten Hope 2}";
Name: "{group}\Forgotten Hope Homepage"; Filename: "http://fhmod.org";
[Languages]
Name: "Belarusian"; MessagesFile: "InstallFiles\LanguageFiles\Belarusian.isl";
Name: "English"; MessagesFile: "compiler:Default.isl,InstallFiles\LanguageFiles\English.isl";
Name: "Russian"; MessagesFile: "compiler:Languages\Russian.isl,InstallFiles\LanguageFiles\Russian.isl";
Name: "Dutch"; MessagesFile: "compiler:Languages\Dutch.isl,InstallFiles\LanguageFiles\Dutch.isl";
Name: "French"; MessagesFile: "compiler:Languages\French.isl,InstallFiles\LanguageFiles\French.isl";
Name: "German"; MessagesFile: "compiler:Languages\German.isl,InstallFiles\LanguageFiles\German.isl";
Name: "Polish"; MessagesFile: "compiler:Languages\Polish.isl,InstallFiles\LanguageFiles\Polish.isl";
Name: "Spanish"; MessagesFile: "compiler:Languages\Spanish.isl,InstallFiles\LanguageFiles\Spanish.isl";
Name: "Swedish"; MessagesFile: "InstallFiles\LanguageFiles\Swedish.isl";
Name: "Ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl,InstallFiles\LanguageFiles\Ukrainian.isl";
Name: "Vietnamese"; MessagesFile: "InstallFiles\LanguageFiles\Vietnamese.isl";
[Run]
Filename: "{tmp}\BF2CDKeyCheck.exe"; Flags: runascurrentuser
Filename: "{src}\Redist\VC++2019\VC_redist.x86.exe"; Description: "{cm:SetupTask,Visual C++ 2019}"; Parameters: "/quiet"; StatusMsg: "{cm:SetupTask,Visual C++ 2019}"; Flags: runascurrentuser; Components: vcpp2019
Filename: "{src}\Redist\Directx\DXSETUP.exe"; Description: "{cm:SetupTask,DirectX 9.0c}"; Parameters: "/silent"; StatusMsg: "{cm:SetupTask,DirectX 9.0c}"; Flags: runascurrentuser; Components: directx
Filename: "{src}\Redist\DotNet\dotNetFx40_Full_x86_x64.exe"; Description: "{cm:SetupTask,.NET Framework 4.0}"; Parameters: "/q /norestart"; StatusMsg: "{cm:SetupTask,.NET Framework 4.0}"; Flags: runascurrentuser; Components: dotnet
Filename: "{app}\mods\fh2\bin\FH2Launcher.exe"; Description: "{cm:LaunchProgram,Forgotten Hope 2}"; Flags: postinstall unchecked
[CustomMessages]
CompDescrFH2=Forgotten Hope 2
CompDescrVCPP2019=Visual C++ 2019
CompDescrDirectX=DirectX 9.0c
CompDescrDotNet=.NET Framework 4.0
[Code]
#include "Modules\FH2Utils.iss"
#include "Modules\Keygen.iss"
#include "Modules\Language.iss"
#include "Modules\OS.iss"
#include "Modules\Time.iss"
#include "Modules\WizardForm.iss"
var
Key: String;
TopLogoImage: TBitmapImage;
PercentLabel: TNewStaticText;
function GetKey(Param: String): String;
begin
Result := Key;
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
if CurPageID = wpInstalling then
begin
Cancel := False;
if ExitSetupMsgBox then
begin
Cancel := True;
Confirm := False;
PercentLabel.Visible := False;
end;
end;
end;
procedure CurInstallProgressChanged(CurProgress, MaxProgress: Integer);
var
CurTick: DWORD;
begin
CurTick := GetTickCount;
PercentLabel.Caption :=
Format('%.1f %%', [(CurProgress * 100.0) / MaxProgress]);
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
BackupBF2RegistryEntries;
end;
function InitializeSetup:Boolean;
begin
Result := false;
Key := GenerateKey;
Log(Key);
Result := true;
end;
// Make redesign of installer wizard form
procedure RedesignWizardForm;
begin
with WizardForm.Bevel do
begin
Top := ScaleY(292);
end;
with WizardForm.OuterNotebook do
begin
Height := ScaleY(292);
end;
with WizardForm.WizardBitmapImage do
begin
Height := ScaleY(284);
end;
with WizardForm.Bevel1 do
begin
Top := ScaleY(110);
end;
with WizardForm.InnerNotebook do
begin
Top := ScaleY(120);
Height := ScaleY(173);
end;
with WizardForm.DiskSpaceLabel do
begin
Top := ScaleY(112);
end;
with WizardForm.ProgressGauge do
begin
Height := ScaleY(37);
end;
with WizardForm.MainPanel do
begin
Height := ScaleY(110);
end;
{ TopLogoImage }
TopLogoImage := TBitmapImage.Create(WizardForm);
with TopLogoImage do
begin
Name := 'TopLogoImage';
Parent := WizardForm.MainPanel;
OnClick := @BannerClick;
Cursor:=crHand;
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(512);
Height := ScaleY(110);
ExtractTemporaryFile('WizardForm.TopLogoImage.bmp');
Bitmap.LoadFromFile(ExpandConstant('{tmp}\WizardForm.TopLogoImage.bmp'));
end;
with WizardForm.PageDescriptionLabel do
begin
Top := ScaleY(-526);
end;
with WizardForm.PageNameLabel do
begin
Top := ScaleY(-510);
end;
with WizardForm.RunList do
begin
Height := ScaleY(139);
end;
with WizardForm.BeveledLabel do
begin
Top := ScaleY(-306);
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
case CurPageID of
wpSelectComponents: begin
// Uncheck redist components when installer is running under Wine
if IsRunningUnderWine() then
begin
Log('Running under Wine');
WizardSelectComponents('!vcpp2019');
WizardSelectComponents('!directx');
WizardSelectComponents('!dotnet');
MsgBox(ExpandConstant('{cm:WinePrompt}'), mbInformation, MB_OK)
end;
end;
end;
end;
procedure InitializeWizard;
begin
RedesignWizardForm;
DiscordLogoInitializeWizard;
PercentLabel := TNewStaticText.Create(WizardForm);
PercentLabel.Parent := WizardForm.ProgressGauge.Parent;
PercentLabel.Left := WizardForm.ProgressGauge.Width div 2;
PercentLabel.Top := WizardForm.ProgressGauge.Top +
WizardForm.ProgressGauge.Height + 12;
end;