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

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

AEI2 0.99d:

  • Description top-margin fixed
  • Only show published nodes
  • Win-Installer: Added no-JRE-config
File size: 5.4 KB
Line 
1#define AppId "{{B67333BB-1CF9-4EFD-A40B-E25B5CB4C8A7}}"
2#define AppVersion "0.99"
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
20ShowComponentSizes=no
21AppPublisher=
22AppPublisherURL=
23AppSupportURL=
24AppUpdatesURL=
25AllowNoIcons=yes
26OutputDir=.
27Compression=lzma2/max
28SolidCompression=yes
29
30[Languages]
31Name: "en"; MessagesFile: "compiler:Default.isl"
32
33[Messages]
34en.SelectDirBrowseLabel=Please select the installation directory of Oni.
35
36[CustomMessages]
37en.wrongDir=This doesn't seem to be your Oni installation; I don't see a file here named "Oni.exe".
38en.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?
39
40[Tasks]
41Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
42
43[Dirs]
44Name: "{app}\Edition"; Permissions: users-modify
45
46[Files]
47Source: "AEInstaller2.jar"; DestDir: "{app}\Edition\AEInstaller"
48Source: "AElogo.ico"; DestDir: "{app}\Edition\AEInstaller"
49
50[Icons]
51Name: "{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
52Name: "{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
53
54
55[Code]
56var
57 javaPath: String;
58
59procedure DecodeVersion (verstr: String; var verint: array of Integer);
60var
61 i,p: Integer; s: string;
62begin
63 // initialize array
64 verint := [0,0,0,0];
65 i := 0;
66 while ((Length(verstr) > 0) and (i < 4)) do
67 begin
68 p := pos ('.', verstr);
69 if p > 0 then
70 begin
71 if p = 1 then s:= '0' else s:= Copy (verstr, 1, p - 1);
72 verint[i] := StrToInt(s);
73 i := i + 1;
74 verstr := Copy (verstr, p+1, Length(verstr));
75 end
76 else
77 begin
78 verint[i] := StrToInt (verstr);
79 verstr := '';
80 end;
81 end;
82
83end;
84
85function CompareVersion (ver1, ver2: String) : Integer;
86var
87 verint1, verint2: array of Integer;
88 i: integer;
89begin
90 SetArrayLength (verint1, 4);
91 DecodeVersion (ver1, verint1);
92
93 SetArrayLength (verint2, 4);
94 DecodeVersion (ver2, verint2);
95
96 Result := 0; i := 0;
97 while ((Result = 0) and ( i < 4 )) do
98 begin
99 if verint1[i] > verint2[i] then
100 Result := 1
101 else
102 if verint1[i] < verint2[i] then
103 Result := -1;
104 i := i + 1;
105 end;
106
107end;
108
109procedure CheckJavaRuntime();
110var
111 W6432: Boolean;
112 Res: Boolean;
113 JavaVer: String;
114begin
115 W6432 := False;
116 Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
117 if (Res = False) and IsWin64() then
118 begin
119 Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
120 W6432 := Res;
121 end;
122 if Res = True then
123 begin
124 if Length( JavaVer ) > 0 then
125 begin
126 if CompareVersion(JavaVer, '{#MinJavaVersion}') >= 0 then
127 begin
128 if W6432 then
129 Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath)
130 else
131 Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath);
132 end;
133 end;
134 end;
135end;
136
137function IsJavaInstalled(): Boolean;
138begin
139 Result := Length(javaPath) > 0;
140end;
141
142function GetJavaPath(Param: String): String;
143begin
144 Result := javaPath;
145end;
146
147function InitializeSetup(): Boolean;
148var
149 ErrorCode: Integer;
150begin
151 CheckJavaRuntime();
152 Result := IsJavaInstalled();
153 if not Result then
154 begin
155 if MsgBox(FmtMessage(CustomMessage('JavaNotFound'), ['{#MinJavaVersion}']), mbConfirmation, MB_YESNO) = idYes then
156 begin
157 ShellExecAsOriginalUser('open', '{#JavaDownloadPage}', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
158 end;
159 end;
160end;
161
162function DirOk(Path: String): boolean;
163begin
164 Result := DirExists(Path+'\GameDataFolder') and FileExists(Path+'\Oni.exe');
165end;
166
167function NextButtonClick(CurPageID: Integer): boolean;
168begin
169 Result := True;
170
171 if CurPageID = wpSelectDir then
172 begin
173 if (not DirOk(WizardDirValue)) then
174 begin
175 MsgBox(CustomMessage('wrongDir'), mbError, MB_OK);
176 Result := False;
177 end;
178 end;
179end;
180
181
182function ShouldSkipPage(PageID: Integer): Boolean;
183begin
184 Result := PageID = wpSelectComponents;
185end;
186
187function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
188begin
189 Result := MemoUserInfoInfo + NewLine;
190 Result := Result + MemoDirInfo + NewLine;
191 Result := Result + MemoGroupInfo + NewLine;
192 Result := Result + MemoTasksInfo + NewLine;
193end;
194
Note: See TracBrowser for help on using the repository browser.