source: AE/Setup/Windows/AEI.iss@ 851

Last change on this file since 851 was 818, checked in by alloc, 12 years ago

AEI2 Setup Win

File size: 7.8 KB
Line 
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]
10AppId={#AppId}
11AppVersion={#AppVersion}
12AppName={#AppLongName}
13DefaultDirName={pf32}\Oni
14OutputBaseFilename={#AppShortName}-v{#AppVersion}
15DefaultGroupName=Oni AE
16
17DirExistsWarning=no
18AppendDefaultDirName=no
19
20ArchitecturesInstallIn64BitMode=x64
21ShowComponentSizes=no
22AppPublisher=
23AppPublisherURL=
24AppSupportURL=
25AppUpdatesURL=
26AllowNoIcons=yes
27OutputDir=.
28Compression=lzma2/max
29SolidCompression=yes
30
31[Languages]
32Name: "en"; MessagesFile: "compiler:Default.isl"
33
34[Messages]
35en.SelectDirBrowseLabel=Please select the installation directory of Oni.
36
37[CustomMessages]
38en.wrongDir=This doesn't seem to be your Oni installation; I don't see a file here named "Oni.exe".
39en.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]
42Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
43
44[Components]
45Name: "JRE"; Description: "JRE"
46Name: "AEI"; Description: "AEI"
47
48[Dirs]
49Name: "{app}\AE"; Permissions: users-modify
50
51[Files]
52Source: "AEInstaller2Updater.jar"; DestDir: "{app}\AE\AEInstaller"; Components: AEI
53Source: "JRE\*"; DestDir: "{app}\AE\AEInstaller\JRE"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist; Components: JRE
54Source: "AElogo.ico"; DestDir: "{app}\AE\AEInstaller"; Components: AEI
55
56[Icons]
57Name: "{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
58Name: "{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
59Name: "{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
60Name: "{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
61Name: "{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
62Name: "{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
63Name: "{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
64Name: "{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]
67Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2Updater.jar"; Flags: runasoriginaluser; Check: not IsJavaInstalled
68Filename: "{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]
72var
73 javaPath: String;
74
75procedure DecodeVersion (verstr: String; var verint: array of Integer);
76var
77 i,p: Integer; s: string;
78begin
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
99end;
100
101function CompareVersion (ver1, ver2: String) : Integer;
102var
103 verint1, verint2: array of Integer;
104 i: integer;
105begin
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
123end;
124
125procedure CheckJavaRuntime();
126var
127 W6432: Boolean;
128 Res: Boolean;
129 JavaVer: String;
130begin
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;
151end;
152
153function IsJavaInstalled(): Boolean;
154begin
155 Result := Length(javaPath) > 0;
156end;
157
158function GetJavaPath(Param: String): String;
159begin
160 Result := javaPath;
161end;
162
163function InitializeSetup(): Boolean;
164begin
165 CheckJavaRuntime();
166 Result := True;
167end;
168
169procedure InitializeWizard();
170var
171 Components : TNewCheckListbox;
172 i : integer;
173begin
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;
187end;
188
189function DirOk(Path: String): boolean;
190begin
191 Result := DirExists(Path+'\GameDataFolder') and FileExists(Path+'\Oni.exe');
192end;
193
194function NextButtonClick(CurPageID: Integer): boolean;
195begin
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;
206end;
207
208
209function ShouldSkipPage(PageID: Integer): Boolean;
210begin
211 Result := PageID = wpSelectComponents;
212end;
213
214function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
215begin
216 Result := MemoUserInfoInfo + NewLine;
217 Result := Result + MemoDirInfo + NewLine;
218 Result := Result + MemoGroupInfo + NewLine;
219 Result := Result + MemoTasksInfo + NewLine;
220end;
221
Note: See TracBrowser for help on using the repository browser.