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

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

AEI2 0.99f:

  • Updated core-packages menu icon
File size: 5.5 KB
Line 
1#define AppId "{{B67333BB-1CF9-4EFD-A40B-E25B5CB4C8A7}}"
2#define AppVersion "0.99f"
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"
49Source: "..\locales\*"; DestDir: "{app}\Edition\AEInstaller\locales"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist
50
51[Icons]
52Name: "{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
53Name: "{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
54
55
56[Code]
57var
58 javaPath: String;
59
60procedure DecodeVersion (verstr: String; var verint: array of Integer);
61var
62 i,p: Integer; s: string;
63begin
64 // initialize array
65 verint := [0,0,0,0];
66 i := 0;
67 while ((Length(verstr) > 0) and (i < 4)) do
68 begin
69 p := pos ('.', verstr);
70 if p > 0 then
71 begin
72 if p = 1 then s:= '0' else s:= Copy (verstr, 1, p - 1);
73 verint[i] := StrToInt(s);
74 i := i + 1;
75 verstr := Copy (verstr, p+1, Length(verstr));
76 end
77 else
78 begin
79 verint[i] := StrToInt (verstr);
80 verstr := '';
81 end;
82 end;
83
84end;
85
86function CompareVersion (ver1, ver2: String) : Integer;
87var
88 verint1, verint2: array of Integer;
89 i: integer;
90begin
91 SetArrayLength (verint1, 4);
92 DecodeVersion (ver1, verint1);
93
94 SetArrayLength (verint2, 4);
95 DecodeVersion (ver2, verint2);
96
97 Result := 0; i := 0;
98 while ((Result = 0) and ( i < 4 )) do
99 begin
100 if verint1[i] > verint2[i] then
101 Result := 1
102 else
103 if verint1[i] < verint2[i] then
104 Result := -1;
105 i := i + 1;
106 end;
107
108end;
109
110procedure CheckJavaRuntime();
111var
112 W6432: Boolean;
113 Res: Boolean;
114 JavaVer: String;
115begin
116 W6432 := False;
117 Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
118 if (Res = False) and IsWin64() then
119 begin
120 Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
121 W6432 := Res;
122 end;
123 if Res = True then
124 begin
125 if Length( JavaVer ) > 0 then
126 begin
127 if CompareVersion(JavaVer, '{#MinJavaVersion}') >= 0 then
128 begin
129 if W6432 then
130 Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath)
131 else
132 Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath);
133 end;
134 end;
135 end;
136end;
137
138function IsJavaInstalled(): Boolean;
139begin
140 Result := Length(javaPath) > 0;
141end;
142
143function GetJavaPath(Param: String): String;
144begin
145 Result := javaPath;
146end;
147
148function InitializeSetup(): Boolean;
149var
150 ErrorCode: Integer;
151begin
152 CheckJavaRuntime();
153 Result := IsJavaInstalled();
154 if not Result then
155 begin
156 if MsgBox(FmtMessage(CustomMessage('JavaNotFound'), ['{#MinJavaVersion}']), mbConfirmation, MB_YESNO) = idYes then
157 begin
158 ShellExecAsOriginalUser('open', '{#JavaDownloadPage}', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
159 end;
160 end;
161end;
162
163function DirOk(Path: String): boolean;
164begin
165 Result := DirExists(Path+'\GameDataFolder') and FileExists(Path+'\Oni.exe');
166end;
167
168function NextButtonClick(CurPageID: Integer): boolean;
169begin
170 Result := True;
171
172 if CurPageID = wpSelectDir then
173 begin
174 if (not DirOk(WizardDirValue)) then
175 begin
176 MsgBox(CustomMessage('wrongDir'), mbError, MB_OK);
177 Result := False;
178 end;
179 end;
180end;
181
182
183function ShouldSkipPage(PageID: Integer): Boolean;
184begin
185 Result := PageID = wpSelectComponents;
186end;
187
188function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
189begin
190 Result := MemoUserInfoInfo + NewLine;
191 Result := Result + MemoDirInfo + NewLine;
192 Result := Result + MemoGroupInfo + NewLine;
193 Result := Result + MemoTasksInfo + NewLine;
194end;
195
Note: See TracBrowser for help on using the repository browser.