source: AE/installer2/setup_win/AEI_no_jre.iss@ 697

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

AEI2: SVN Cleanups

File size: 5.5 KB
RevLine 
[647]1#define AppId "{{B67333BB-1CF9-4EFD-A40B-E25B5CB4C8A7}}"
[697]2#define AppVersion "0.99p"
[647]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}-noJRE-Setup
15DefaultGroupName=Oni AE
16
17DirExistsWarning=no
18AppendDefaultDirName=no
19
[697]20ArchitecturesInstallIn64BitMode=x64
[647]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[Dirs]
45Name: "{app}\Edition"; Permissions: users-modify
46
47[Files]
48Source: "AEInstaller2.jar"; DestDir: "{app}\Edition\AEInstaller"
49Source: "AElogo.ico"; DestDir: "{app}\Edition\AEInstaller"
[651]50Source: "..\locales\*"; DestDir: "{app}\Edition\AEInstaller\locales"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist
[647]51
52[Icons]
53Name: "{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
54Name: "{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]
58var
59 javaPath: String;
60
61procedure DecodeVersion (verstr: String; var verint: array of Integer);
62var
63 i,p: Integer; s: string;
64begin
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
85end;
86
87function CompareVersion (ver1, ver2: String) : Integer;
88var
89 verint1, verint2: array of Integer;
90 i: integer;
91begin
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
109end;
110
111procedure CheckJavaRuntime();
112var
113 W6432: Boolean;
114 Res: Boolean;
115 JavaVer: String;
116begin
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;
137end;
138
139function IsJavaInstalled(): Boolean;
140begin
141 Result := Length(javaPath) > 0;
142end;
143
144function GetJavaPath(Param: String): String;
145begin
146 Result := javaPath;
147end;
148
149function InitializeSetup(): Boolean;
150var
151 ErrorCode: Integer;
152begin
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;
162end;
163
164function DirOk(Path: String): boolean;
165begin
166 Result := DirExists(Path+'\GameDataFolder') and FileExists(Path+'\Oni.exe');
167end;
168
169function NextButtonClick(CurPageID: Integer): boolean;
170begin
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;
181end;
182
183
184function ShouldSkipPage(PageID: Integer): Boolean;
185begin
186 Result := PageID = wpSelectComponents;
187end;
188
189function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
190begin
191 Result := MemoUserInfoInfo + NewLine;
192 Result := Result + MemoDirInfo + NewLine;
193 Result := Result + MemoGroupInfo + NewLine;
194 Result := Result + MemoTasksInfo + NewLine;
195end;
196
Note: See TracBrowser for help on using the repository browser.