ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/AE/installer2/setup_win/AEI_no_jre.iss
Revision: 697
Committed: Tue Mar 12 18:08:36 2013 UTC (12 years, 7 months ago) by alloc
File size: 5666 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}-noJRE-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 [Dirs]
45 Name: "{app}\Edition"; Permissions: users-modify
46
47 [Files]
48 Source: "AEInstaller2.jar"; DestDir: "{app}\Edition\AEInstaller"
49 Source: "AElogo.ico"; DestDir: "{app}\Edition\AEInstaller"
50 Source: "..\locales\*"; DestDir: "{app}\Edition\AEInstaller\locales"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist
51
52 [Icons]
53 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
54 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
55
56
57 [Code]
58 var
59 javaPath: String;
60
61 procedure DecodeVersion (verstr: String; var verint: array of Integer);
62 var
63 i,p: Integer; s: string;
64 begin
65 // initialize array
66 verint := [0,0,0,0];
67 i := 0;
68 while ((Length(verstr) > 0) and (i < 4)) do
69 begin
70 p := pos ('.', verstr);
71 if p > 0 then
72 begin
73 if p = 1 then s:= '0' else s:= Copy (verstr, 1, p - 1);
74 verint[i] := StrToInt(s);
75 i := i + 1;
76 verstr := Copy (verstr, p+1, Length(verstr));
77 end
78 else
79 begin
80 verint[i] := StrToInt (verstr);
81 verstr := '';
82 end;
83 end;
84
85 end;
86
87 function CompareVersion (ver1, ver2: String) : Integer;
88 var
89 verint1, verint2: array of Integer;
90 i: integer;
91 begin
92 SetArrayLength (verint1, 4);
93 DecodeVersion (ver1, verint1);
94
95 SetArrayLength (verint2, 4);
96 DecodeVersion (ver2, verint2);
97
98 Result := 0; i := 0;
99 while ((Result = 0) and ( i < 4 )) do
100 begin
101 if verint1[i] > verint2[i] then
102 Result := 1
103 else
104 if verint1[i] < verint2[i] then
105 Result := -1;
106 i := i + 1;
107 end;
108
109 end;
110
111 procedure CheckJavaRuntime();
112 var
113 W6432: Boolean;
114 Res: Boolean;
115 JavaVer: String;
116 begin
117 W6432 := False;
118 Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
119 if (Res = False) and IsWin64() then
120 begin
121 Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
122 W6432 := Res;
123 end;
124 if Res = True then
125 begin
126 if Length( JavaVer ) > 0 then
127 begin
128 if CompareVersion(JavaVer, '{#MinJavaVersion}') >= 0 then
129 begin
130 if W6432 then
131 Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath)
132 else
133 Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath);
134 end;
135 end;
136 end;
137 end;
138
139 function IsJavaInstalled(): Boolean;
140 begin
141 Result := Length(javaPath) > 0;
142 end;
143
144 function GetJavaPath(Param: String): String;
145 begin
146 Result := javaPath;
147 end;
148
149 function InitializeSetup(): Boolean;
150 var
151 ErrorCode: Integer;
152 begin
153 CheckJavaRuntime();
154 Result := IsJavaInstalled();
155 if not Result then
156 begin
157 if MsgBox(FmtMessage(CustomMessage('JavaNotFound'), ['{#MinJavaVersion}']), mbConfirmation, MB_YESNO) = idYes then
158 begin
159 ShellExecAsOriginalUser('open', '{#JavaDownloadPage}', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
160 end;
161 end;
162 end;
163
164 function DirOk(Path: String): boolean;
165 begin
166 Result := DirExists(Path+'\GameDataFolder') and FileExists(Path+'\Oni.exe');
167 end;
168
169 function NextButtonClick(CurPageID: Integer): boolean;
170 begin
171 Result := True;
172
173 if CurPageID = wpSelectDir then
174 begin
175 if (not DirOk(WizardDirValue)) then
176 begin
177 MsgBox(CustomMessage('wrongDir'), mbError, MB_OK);
178 Result := False;
179 end;
180 end;
181 end;
182
183
184 function ShouldSkipPage(PageID: Integer): Boolean;
185 begin
186 Result := PageID = wpSelectComponents;
187 end;
188
189 function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
190 begin
191 Result := MemoUserInfoInfo + NewLine;
192 Result := Result + MemoDirInfo + NewLine;
193 Result := Result + MemoGroupInfo + NewLine;
194 Result := Result + MemoTasksInfo + NewLine;
195 end;
196