-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProjectD2Installer.iss
More file actions
181 lines (149 loc) · 6.59 KB
/
ProjectD2Installer.iss
File metadata and controls
181 lines (149 loc) · 6.59 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
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
;Made with Inno Setup 5.5.9 Ansi - https://files.jrsoftware.org/is/5/innosetup-5.5.9.exe
#include <.\ISTheme\ISTheme.iss>
#define ProjectDiablo2RegisterUrl = "https://www.projectdiablo2.com/register"
[CustomMessages]
GameNotFound=Game files not found in %1 %n%nPlease select a valid Diablo II: Lord of Destruction folder.%n%n%nNote: Project Diablo 2 is a mod for Diablo II: LoD, you must have Diablo II: LoD installed before you can install Project Diablo 2.%n%nIf you don't own Diablo II: LoD yet, you can buy a copy of the game here: https://shop.battle.net/ (Download the English version).
LodNotFound=Diablo II was found in the selected folder but you are missing the Lord of Destruction expansion.%n%nPlease install the Lord of Destruction expansion and then retry.
InstallingApp=Installing %1, this may take several minutes...
SelectDiablo2Folder=Please select a valid Diablo II: Lord of Destruction folder.
WantToRegisterAccount=You must create an in-game account on the Project Diablo 2 website to be able to play online games.%n%nWould you like to visit the website now?
CheckFile=d2exp.mpq
CheckFileClassic=d2data.mpq
GameRegEng=SOFTWARE\Blizzard Entertainment\Diablo II
[Setup]
AppId={{822B3055-5F16-4934-A1FC-378AB0181A66}
AppName=Project Diablo 2
AppVersion=1.0
AppVerName=Project Diablo 2
AppPublisher=projectdiablo2.com
VersionInfoVersion=1.0.0.0
VersionInfoTextVersion=1.0.0.0
VersionInfoProductName=Project Diablo 2
VersionInfoDescription=Project Diablo 2
AppPublisherURL=https://www.projectdiablo2.com/
AppSupportURL=https://www.projectdiablo2.com/
AppUpdatesURL=https://www.projectdiablo2.com/
DirExistsWarning=no
DefaultDirName={code:DefaultDir}
DisableProgramGroupPage=yes
DisableReadyPage=yes
DisableWelcomePage=yes
DisableFinishedPage=yes
AllowNoIcons=yes
OutputBaseFilename=ProjectD2Installer
Compression=lzma2/max
SolidCompression=no
UsePreviouslanguage=no
CreateUninstallRegKey=yes
UsePreviousAppDir=no
SourceDir=.
OutputDir=.
SetupIconFile=Resources\PD2_Icon.ico
AppendDefaultDirName=no
ShowLanguageDialog=no
RestartIfNeededByRun=no
UninstallFilesDir={app}\ProjectD2
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[InstallDelete]
Type: files; Name: "{app}\ProjectD2\UI.ini"
Type: files; Name: "{app}\ProjectD2\ddraw.ini"
Type: files; Name: "{app}\ProjectD2\D2HD.ini"
Type: files; Name: "{app}\ProjectD2\ProjectDiablo.cfg"
Type: files; Name: "{app}\ProjectD2\bncache.dat"
Type: files; Name: "{app}\ProjectD2\BnetLog.txt"
Type: files; Name: "{app}\ProjectD2\settings.db"
[Files]
Source: Files\*; DestDir: "{app}\ProjectD2"; Flags: ignoreversion
Source: Resources\VC_redist.x86.exe; Flags: dontcopy
[Icons]
Name: "{commondesktop}\Project Diablo 2"; Filename: "{app}\ProjectD2\PD2Launcher.exe"; WorkingDir: "{app}\ProjectD2"; Check: not RunsOnWine
Name: "{group}\Project Diablo 2"; Filename: "{app}\ProjectD2\PD2Launcher.exe"; WorkingDir: "{app}\ProjectD2"; Check: RunsOnWine
Name: "{app}\ProjectD2\Uninstall Project Diablo 2"; Filename: "{uninstallexe}"; WorkingDir: "{app}\ProjectD2"
[Run]
Filename: "{tmp}\VC_redist.x86.exe"; Parameters: "/install /passive /norestart"; Flags: runascurrentuser; Check: FileExists(ExpandConstant('{tmp}\VC_redist.x86.exe')) and ChangeStatusLabel('Visual C++ Redistributable 2019 (x86)')
Filename: "{app}\ProjectD2\PD2Launcher.exe"; WorkingDir: "{app}\ProjectD2"; Description: "{cm:LaunchProgram,Project Diablo 2}"; Flags: nowait postinstall runascurrentuser skipifsilent; Check: not OpenRegisterAccountUrl
[UninstallDelete]
Type: filesandordirs; Name: "{app}\ProjectD2"
[Registry]
Root: HKLM; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueType: String; ValueName: {app}\ProjectD2\PD2Launcher.exe; ValueData: "RUNASADMIN"; Check: not IsWin64
Root: HKLM64; Subkey: Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers; ValueType: String; ValueName: {app}\ProjectD2\PD2Launcher.exe; ValueData: "RUNASADMIN"; Check: IsWin64
Root: HKCU; Subkey: Software\Wine\AppDefaults\game.exe\DllOverrides; ValueType: string; ValueName: "ddraw"; ValueData: "native, builtin"; Check: RunsOnWine
Root: HKCU; Subkey: Software\Blizzard Entertainment\Diablo II; ValueType: string; ValueName: "InstallPath"; ValueData: {app}
[Code]
function GetModuleHandleA(lpLibFileName: PAnsiChar): THandle;
external 'GetModuleHandleA@kernel32.dll stdcall';
function GetProcAddress(Module: THandle; ProcName: PAnsiChar): Longword;
external 'GetProcAddress@kernel32.dll stdcall';
function RunsOnWine(): boolean;
begin
Result := GetProcAddress(GetModuleHandleA('ntdll.dll'), 'wine_get_version')<> 0;
end;
function DefaultDir(Param: String): String;
var
gamepath: String;
begin
gamepath:=RemoveBackslashUnlessRoot(ExpandConstant('{reg:HKCU\{cm:GameRegEng},InstallPath|{pf}\Diablo II}'));
if (not FileExists(gamepath+ExpandConstant('\{cm:CheckFile}'))) then
gamepath:=RemoveBackslashUnlessRoot(ExtractFilePath(gamepath));
if (not FileExists(gamepath+ExpandConstant('\{cm:CheckFile}'))) then
gamepath:=ExpandConstant('{pf}\Diablo II');
Result := gamepath;
end;
function NextButtonClick(CurPage: Integer): Boolean;
var
ErrorCode: Integer;
begin
if (CurPage = wpSelectDir) then
begin
if (not FileExists(ExpandConstant('{app}\{cm:CheckFile}'))) then
begin
if (FileExists(ExpandConstant('{app}\{cm:CheckFileClassic}'))) then
begin
MsgBox(ExpandConstant('{cm:LodNotFound}'), mbError, MB_OK);
end
else
begin
MsgBox(FmtMessage(ExpandConstant('{cm:GameNotFound}'), [WizardForm.DirEdit.Text]), mbError, MB_OK);
end
Result := false;
end
else Result := true;
end
else Result := true;
end;
function OpenRegisterAccountUrl(): Boolean;
var
ErrorCode: Integer;
begin
Result := false;
if MsgBox(ExpandConstant('{cm:WantToRegisterAccount}'), mbConfirmation, MB_YESNO) = IDYES then
begin
ShellExecAsOriginalUser('open', '{#ProjectDiablo2RegisterUrl}', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
Result:=true;
end
end;
function ChangeStatusLabel(AppName: String): Boolean;
begin
WizardForm.FilenameLabel.Caption := FmtMessage(ExpandConstant('{cm:InstallingApp}'), [AppName]);
Result := true;
end;
procedure InitializeWizard();
begin
WizardForm.SelectDirBrowseLabel.Visible := false;
WizardForm.SelectDirLabel.Caption := ExpandConstant('{cm:SelectDiablo2Folder}');
ISTheme();
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if (CurPageID = wpSelectDir) then
begin
WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall);
WizardForm.BackButton.Visible := false;
end;
end;
function InitializeSetup(): Boolean;
begin
Result := true;
ExtractTemporaryFile('VC_redist.x86.exe');
end;