ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/AE/installer2/setup_win/AEI.iss
Revision: 697
Committed: Tue Mar 12 18:08:36 2013 UTC (12 years, 7 months ago) by alloc
File size: 6710 byte(s)
Log Message:
AEI2: SVN Cleanups

File Contents

# Content
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]
10 AppId={#AppId}
11 AppVersion={#AppVersion}
12 AppName={#AppLongName}
13 DefaultDirName={pf32}\Oni
14 OutputBaseFilename={#AppShortName}-v{#AppVersion}-Setup
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}\Edition"; Permissions: users-modify
50
51 [Files]
52 Source: "AEInstaller2.jar"; DestDir: "{app}\Edition\AEInstaller"; Components: AEI
53 Source: "JRE\*"; DestDir: "{app}\Edition\AEInstaller\JRE"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist; Components: JRE
54 Source: "AElogo.ico"; DestDir: "{app}\Edition\AEInstaller"; Components: AEI
55 Source: "..\locales\*"; DestDir: "{app}\Edition\AEInstaller\locales"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist; Components: AEI
56
57 [Icons]
58 Name: "{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
59 Name: "{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
60 Name: "{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
61 Name: "{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]
65 var
66 javaPath: String;
67
68 procedure DecodeVersion (verstr: String; var verint: array of Integer);
69 var
70 i,p: Integer; s: string;
71 begin
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
92 end;
93
94 function CompareVersion (ver1, ver2: String) : Integer;
95 var
96 verint1, verint2: array of Integer;
97 i: integer;
98 begin
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
116 end;
117
118 procedure CheckJavaRuntime();
119 var
120 W6432: Boolean;
121 Res: Boolean;
122 JavaVer: String;
123 begin
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;
144 end;
145
146 function IsJavaInstalled(): Boolean;
147 begin
148 Result := Length(javaPath) > 0;
149 end;
150
151 function GetJavaPath(Param: String): String;
152 begin
153 Result := javaPath;
154 end;
155
156 function InitializeSetup(): Boolean;
157 begin
158 CheckJavaRuntime();
159 Result := True;
160 end;
161
162 procedure InitializeWizard();
163 var
164 Components : TNewCheckListbox;
165 i : integer;
166 begin
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;
180 end;
181
182 function DirOk(Path: String): boolean;
183 begin
184 Result := DirExists(Path+'\GameDataFolder') and FileExists(Path+'\Oni.exe');
185 end;
186
187 function NextButtonClick(CurPageID: Integer): boolean;
188 begin
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;
199 end;
200
201
202 function ShouldSkipPage(PageID: Integer): Boolean;
203 begin
204 Result := PageID = wpSelectComponents;
205 end;
206
207 function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
208 begin
209 Result := MemoUserInfoInfo + NewLine;
210 Result := Result + MemoDirInfo + NewLine;
211 Result := Result + MemoGroupInfo + NewLine;
212 Result := Result + MemoTasksInfo + NewLine;
213 end;
214