1 | #define AppId "{{B67333BB-1CF9-4EFD-A40B-E25B5CB4C8A7}}"
|
---|
2 | #define AppVersion "1"
|
---|
3 | #define AppLongName "Anniversary Edition of Oni"
|
---|
4 | #define AppShortName "Anniversary-Edition-Setup"
|
---|
5 |
|
---|
6 | #define MinJavaVersion "1.6"
|
---|
7 | #define JavaDownloadPage "http://www.java.com/en/download/manual.jsp#win"
|
---|
8 |
|
---|
9 | [Setup]
|
---|
10 | AppId={#AppId}
|
---|
11 | AppVersion={#AppVersion}
|
---|
12 | AppName={#AppLongName}
|
---|
13 | DefaultDirName={pf32}\Oni
|
---|
14 | OutputBaseFilename={#AppShortName}-v{#AppVersion}
|
---|
15 | DefaultGroupName=Oni AE
|
---|
16 |
|
---|
17 | DirExistsWarning=no
|
---|
18 | AppendDefaultDirName=no
|
---|
19 |
|
---|
20 | ArchitecturesInstallIn64BitMode=x64
|
---|
21 | ShowComponentSizes=no
|
---|
22 | AppPublisher=
|
---|
23 | AppPublisherURL=
|
---|
24 | AppSupportURL=
|
---|
25 | AppUpdatesURL=
|
---|
26 | AllowNoIcons=yes
|
---|
27 | OutputDir=.
|
---|
28 | Compression=lzma2/max
|
---|
29 | SolidCompression=yes
|
---|
30 |
|
---|
31 | [Languages]
|
---|
32 | Name: "en"; MessagesFile: "compiler:Default.isl"
|
---|
33 |
|
---|
34 | [Messages]
|
---|
35 | en.SelectDirBrowseLabel=Please select the installation directory of Oni.
|
---|
36 |
|
---|
37 | [CustomMessages]
|
---|
38 | en.wrongDir=This doesn't seem to be your Oni installation; I don't see a file here named "Oni.exe".
|
---|
39 | en.JavaNotFound=This program needs a Java Runtime (JRE) with version being at least %1.%nPlease download and install a suitable JRE.%nDo you want do download a JRE now?
|
---|
40 |
|
---|
41 | [Tasks]
|
---|
42 | Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
---|
43 |
|
---|
44 | [Components]
|
---|
45 | Name: "JRE"; Description: "JRE"
|
---|
46 | Name: "AEI"; Description: "AEI"
|
---|
47 |
|
---|
48 | [Dirs]
|
---|
49 | Name: "{app}\AE"; Permissions: users-modify
|
---|
50 |
|
---|
51 | [Files]
|
---|
52 | Source: "AEInstaller2Updater.jar"; DestDir: "{app}\AE\AEInstaller"; Components: AEI
|
---|
53 | Source: "JRE\*"; DestDir: "{app}\AE\AEInstaller\JRE"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist; Components: JRE
|
---|
54 | Source: "AElogo.ico"; DestDir: "{app}\AE\AEInstaller"; Components: AEI
|
---|
55 |
|
---|
56 | [Icons]
|
---|
57 | Name: "{app}\AE\AEInstaller2"; Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Check: not IsJavaInstalled
|
---|
58 | Name: "{app}\AE\AEInstaller2Updater"; Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2Updater.jar"; Check: not IsJavaInstalled
|
---|
59 | Name: "{group}\AEInstaller 2"; Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Check: not IsJavaInstalled
|
---|
60 | Name: "{commondesktop}\AEInstaller 2"; Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Tasks: desktopicon; Check: not IsJavaInstalled
|
---|
61 | Name: "{app}\AE\AEInstaller2"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Check: IsJavaInstalled
|
---|
62 | Name: "{app}\AE\AEInstaller2Updater"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2Updater.jar"; Check: IsJavaInstalled
|
---|
63 | Name: "{group}\AEInstaller 2"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Check: IsJavaInstalled
|
---|
64 | Name: "{commondesktop}\AEInstaller 2"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Tasks: desktopicon; Check: IsJavaInstalled
|
---|
65 |
|
---|
66 | [Run]
|
---|
67 | Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2Updater.jar"; Flags: runasoriginaluser; Check: not IsJavaInstalled
|
---|
68 | Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2Updater.jar"; Flags: runasoriginaluser; Check: IsJavaInstalled
|
---|
69 |
|
---|
70 |
|
---|
71 | [Code]
|
---|
72 | var
|
---|
73 | javaPath: String;
|
---|
74 |
|
---|
75 | procedure DecodeVersion (verstr: String; var verint: array of Integer);
|
---|
76 | var
|
---|
77 | i,p: Integer; s: string;
|
---|
78 | begin
|
---|
79 | // initialize array
|
---|
80 | verint := [0,0,0,0];
|
---|
81 | i := 0;
|
---|
82 | while ((Length(verstr) > 0) and (i < 4)) do
|
---|
83 | begin
|
---|
84 | p := pos ('.', verstr);
|
---|
85 | if p > 0 then
|
---|
86 | begin
|
---|
87 | if p = 1 then s:= '0' else s:= Copy (verstr, 1, p - 1);
|
---|
88 | verint[i] := StrToInt(s);
|
---|
89 | i := i + 1;
|
---|
90 | verstr := Copy (verstr, p+1, Length(verstr));
|
---|
91 | end
|
---|
92 | else
|
---|
93 | begin
|
---|
94 | verint[i] := StrToInt (verstr);
|
---|
95 | verstr := '';
|
---|
96 | end;
|
---|
97 | end;
|
---|
98 |
|
---|
99 | end;
|
---|
100 |
|
---|
101 | function CompareVersion (ver1, ver2: String) : Integer;
|
---|
102 | var
|
---|
103 | verint1, verint2: array of Integer;
|
---|
104 | i: integer;
|
---|
105 | begin
|
---|
106 | SetArrayLength (verint1, 4);
|
---|
107 | DecodeVersion (ver1, verint1);
|
---|
108 |
|
---|
109 | SetArrayLength (verint2, 4);
|
---|
110 | DecodeVersion (ver2, verint2);
|
---|
111 |
|
---|
112 | Result := 0; i := 0;
|
---|
113 | while ((Result = 0) and ( i < 4 )) do
|
---|
114 | begin
|
---|
115 | if verint1[i] > verint2[i] then
|
---|
116 | Result := 1
|
---|
117 | else
|
---|
118 | if verint1[i] < verint2[i] then
|
---|
119 | Result := -1;
|
---|
120 | i := i + 1;
|
---|
121 | end;
|
---|
122 |
|
---|
123 | end;
|
---|
124 |
|
---|
125 | procedure CheckJavaRuntime();
|
---|
126 | var
|
---|
127 | W6432: Boolean;
|
---|
128 | Res: Boolean;
|
---|
129 | JavaVer: String;
|
---|
130 | begin
|
---|
131 | W6432 := False;
|
---|
132 | Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
|
---|
133 | if (Res = False) and IsWin64() then
|
---|
134 | begin
|
---|
135 | Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
|
---|
136 | W6432 := Res;
|
---|
137 | end;
|
---|
138 | if Res = True then
|
---|
139 | begin
|
---|
140 | if Length( JavaVer ) > 0 then
|
---|
141 | begin
|
---|
142 | if CompareVersion(JavaVer, '{#MinJavaVersion}') >= 0 then
|
---|
143 | begin
|
---|
144 | if W6432 then
|
---|
145 | Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath)
|
---|
146 | else
|
---|
147 | Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath);
|
---|
148 | end;
|
---|
149 | end;
|
---|
150 | end;
|
---|
151 | end;
|
---|
152 |
|
---|
153 | function IsJavaInstalled(): Boolean;
|
---|
154 | begin
|
---|
155 | Result := Length(javaPath) > 0;
|
---|
156 | end;
|
---|
157 |
|
---|
158 | function GetJavaPath(Param: String): String;
|
---|
159 | begin
|
---|
160 | Result := javaPath;
|
---|
161 | end;
|
---|
162 |
|
---|
163 | function InitializeSetup(): Boolean;
|
---|
164 | begin
|
---|
165 | CheckJavaRuntime();
|
---|
166 | Result := True;
|
---|
167 | end;
|
---|
168 |
|
---|
169 | procedure InitializeWizard();
|
---|
170 | var
|
---|
171 | Components : TNewCheckListbox;
|
---|
172 | i : integer;
|
---|
173 | begin
|
---|
174 | Components := WizardForm.ComponentsList;
|
---|
175 | i := Components.Items.IndexOf('JRE');
|
---|
176 | if i <> -1 then
|
---|
177 | begin
|
---|
178 | Components.ItemEnabled[i] := false;
|
---|
179 | Components.Checked[i] := not IsJavaInstalled();
|
---|
180 | end;
|
---|
181 | i := Components.Items.IndexOf('AEI');
|
---|
182 | if i <> -1 then
|
---|
183 | begin
|
---|
184 | Components.ItemEnabled[i] := false;
|
---|
185 | Components.Checked[i] := true;
|
---|
186 | end;
|
---|
187 | end;
|
---|
188 |
|
---|
189 | function DirOk(Path: String): boolean;
|
---|
190 | begin
|
---|
191 | Result := DirExists(Path+'\GameDataFolder') and FileExists(Path+'\Oni.exe');
|
---|
192 | end;
|
---|
193 |
|
---|
194 | function NextButtonClick(CurPageID: Integer): boolean;
|
---|
195 | begin
|
---|
196 | Result := True;
|
---|
197 |
|
---|
198 | if CurPageID = wpSelectDir then
|
---|
199 | begin
|
---|
200 | if (not DirOk(WizardDirValue)) then
|
---|
201 | begin
|
---|
202 | MsgBox(CustomMessage('wrongDir'), mbError, MB_OK);
|
---|
203 | Result := False;
|
---|
204 | end;
|
---|
205 | end;
|
---|
206 | end;
|
---|
207 |
|
---|
208 |
|
---|
209 | function ShouldSkipPage(PageID: Integer): Boolean;
|
---|
210 | begin
|
---|
211 | Result := PageID = wpSelectComponents;
|
---|
212 | end;
|
---|
213 |
|
---|
214 | function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
|
---|
215 | begin
|
---|
216 | Result := MemoUserInfoInfo + NewLine;
|
---|
217 | Result := Result + MemoDirInfo + NewLine;
|
---|
218 | Result := Result + MemoGroupInfo + NewLine;
|
---|
219 | Result := Result + MemoTasksInfo + NewLine;
|
---|
220 | end;
|
---|
221 |
|
---|