source: AE/installer2/setup_win/AEI.iss@ 701

Last change on this file since 701 was 697, checked in by alloc, 12 years ago

AEI2: SVN Cleanups

File size: 6.6 KB
Line 
1#define AppId "{{B67333BB-1CF9-4EFD-A40B-E25B5CB4C8A7}}"
2#define AppVersion "0.99p"
3#define AppLongName "Anniversary Edition of Oni"
4#define AppShortName "AEInstaller"
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}-Setup
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}\Edition"; Permissions: users-modify
50
51[Files]
52Source: "AEInstaller2.jar"; DestDir: "{app}\Edition\AEInstaller"; Components: AEI
53Source: "JRE\*"; DestDir: "{app}\Edition\AEInstaller\JRE"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist; Components: JRE
54Source: "AElogo.ico"; DestDir: "{app}\Edition\AEInstaller"; Components: AEI
55Source: "..\locales\*"; DestDir: "{app}\Edition\AEInstaller\locales"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist; Components: AEI
56
57[Icons]
58Name: "{group}\AEInstaller 2"; Filename: "{app}\Edition\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\Edition\AEInstaller"; IconFilename: "{app}\Edition\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2.jar"; Check: not IsJavaInstalled
59Name: "{commondesktop}\AEInstaller 2"; Filename: "{app}\Edition\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\Edition\AEInstaller"; IconFilename: "{app}\Edition\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2.jar"; Tasks: desktopicon; Check: not IsJavaInstalled
60Name: "{group}\AEInstaller 2"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\Edition\AEInstaller"; IconFilename: "{app}\Edition\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2.jar"; Check: IsJavaInstalled
61Name: "{commondesktop}\AEInstaller 2"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\Edition\AEInstaller"; IconFilename: "{app}\Edition\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2.jar"; Tasks: desktopicon; Check: IsJavaInstalled
62
63
64[Code]
65var
66 javaPath: String;
67
68procedure DecodeVersion (verstr: String; var verint: array of Integer);
69var
70 i,p: Integer; s: string;
71begin
72 // initialize array
73 verint := [0,0,0,0];
74 i := 0;
75 while ((Length(verstr) > 0) and (i < 4)) do
76 begin
77 p := pos ('.', verstr);
78 if p > 0 then
79 begin
80 if p = 1 then s:= '0' else s:= Copy (verstr, 1, p - 1);
81 verint[i] := StrToInt(s);
82 i := i + 1;
83 verstr := Copy (verstr, p+1, Length(verstr));
84 end
85 else
86 begin
87 verint[i] := StrToInt (verstr);
88 verstr := '';
89 end;
90 end;
91
92end;
93
94function CompareVersion (ver1, ver2: String) : Integer;
95var
96 verint1, verint2: array of Integer;
97 i: integer;
98begin
99 SetArrayLength (verint1, 4);
100 DecodeVersion (ver1, verint1);
101
102 SetArrayLength (verint2, 4);
103 DecodeVersion (ver2, verint2);
104
105 Result := 0; i := 0;
106 while ((Result = 0) and ( i < 4 )) do
107 begin
108 if verint1[i] > verint2[i] then
109 Result := 1
110 else
111 if verint1[i] < verint2[i] then
112 Result := -1;
113 i := i + 1;
114 end;
115
116end;
117
118procedure CheckJavaRuntime();
119var
120 W6432: Boolean;
121 Res: Boolean;
122 JavaVer: String;
123begin
124 W6432 := False;
125 Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
126 if (Res = False) and IsWin64() then
127 begin
128 Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
129 W6432 := Res;
130 end;
131 if Res = True then
132 begin
133 if Length( JavaVer ) > 0 then
134 begin
135 if CompareVersion(JavaVer, '{#MinJavaVersion}') >= 0 then
136 begin
137 if W6432 then
138 Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath)
139 else
140 Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath);
141 end;
142 end;
143 end;
144end;
145
146function IsJavaInstalled(): Boolean;
147begin
148 Result := Length(javaPath) > 0;
149end;
150
151function GetJavaPath(Param: String): String;
152begin
153 Result := javaPath;
154end;
155
156function InitializeSetup(): Boolean;
157begin
158 CheckJavaRuntime();
159 Result := True;
160end;
161
162procedure InitializeWizard();
163var
164 Components : TNewCheckListbox;
165 i : integer;
166begin
167 Components := WizardForm.ComponentsList;
168 i := Components.Items.IndexOf('JRE');
169 if i <> -1 then
170 begin
171 Components.ItemEnabled[i] := false;
172 Components.Checked[i] := not IsJavaInstalled();
173 end;
174 i := Components.Items.IndexOf('AEI');
175 if i <> -1 then
176 begin
177 Components.ItemEnabled[i] := false;
178 Components.Checked[i] := true;
179 end;
180end;
181
182function DirOk(Path: String): boolean;
183begin
184 Result := DirExists(Path+'\GameDataFolder') and FileExists(Path+'\Oni.exe');
185end;
186
187function NextButtonClick(CurPageID: Integer): boolean;
188begin
189 Result := True;
190
191 if CurPageID = wpSelectDir then
192 begin
193 if (not DirOk(WizardDirValue)) then
194 begin
195 MsgBox(CustomMessage('wrongDir'), mbError, MB_OK);
196 Result := False;
197 end;
198 end;
199end;
200
201
202function ShouldSkipPage(PageID: Integer): Boolean;
203begin
204 Result := PageID = wpSelectComponents;
205end;
206
207function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
208begin
209 Result := MemoUserInfoInfo + NewLine;
210 Result := Result + MemoDirInfo + NewLine;
211 Result := Result + MemoGroupInfo + NewLine;
212 Result := Result + MemoTasksInfo + NewLine;
213end;
214
Note: See TracBrowser for help on using the repository browser.