source: AE/installer2/setup_win/AEI.iss@ 623

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

AEI2 0.83:

  • Dependencies from Mods to Tools supported
  • Installed tools can get a menu entry to launch them
  • Mods can unlock levels in persist.dat through UnlockLevel-tag
File size: 5.7 KB
Line 
1#define AppId "{{B67333BB-1CF9-4EFD-A40B-E25B5CB4C8A7}}"
2#define AppVersion "0.81"
3#define AppLongName "Anniversary Edition of Oni"
4#define AppShortName "AEInstaller"
5
6#define MinJavaVersion "1.6"
7
8[Setup]
9AppId={#AppId}
10AppVersion={#AppVersion}
11AppName={#AppLongName}
12DefaultDirName={pf32}\Oni
13OutputBaseFilename={#AppShortName}-v{#AppVersion}-Setup
14DefaultGroupName=Oni AE
15
16DirExistsWarning=no
17AppendDefaultDirName=no
18
19ShowComponentSizes=no
20AppPublisher=
21AppPublisherURL=
22AppSupportURL=
23AppUpdatesURL=
24AllowNoIcons=yes
25OutputDir=.
26Compression=lzma2/max
27SolidCompression=yes
28
29[Languages]
30Name: "en"; MessagesFile: "compiler:Default.isl"
31
32[Messages]
33en.SelectDirBrowseLabel=Please select the installation directory of Oni.
34
35[CustomMessages]
36en.wrongDir=This doesn't seem to be your Oni installation; I don't see a file here named "Oni.exe".
37
38[Tasks]
39Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
40
41[Components]
42Name: "JRE"; Description: "JRE"
43Name: "AEI"; Description: "AEI"
44
45[Dirs]
46Name: "{app}\Edition"; Permissions: users-modify
47
48[Files]
49Source: "AEInstaller2.jar"; DestDir: "{app}\Edition\AEInstaller"; Components: AEI
50Source: "JRE\*"; DestDir: "{app}\Edition\AEInstaller\JRE"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist; Components: JRE
51Source: "AElogo.ico"; DestDir: "{app}\Edition\AEInstaller"; Components: AEI
52
53[Icons]
54Name: "{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
55Name: "{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
56Name: "{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
57Name: "{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
58
59
60[Code]
61var
62 javaPath: String;
63
64procedure DecodeVersion (verstr: String; var verint: array of Integer);
65var
66 i,p: Integer; s: string;
67begin
68 // initialize array
69 verint := [0,0,0,0];
70 i := 0;
71 while ((Length(verstr) > 0) and (i < 4)) do
72 begin
73 p := pos ('.', verstr);
74 if p > 0 then
75 begin
76 if p = 1 then s:= '0' else s:= Copy (verstr, 1, p - 1);
77 verint[i] := StrToInt(s);
78 i := i + 1;
79 verstr := Copy (verstr, p+1, Length(verstr));
80 end
81 else
82 begin
83 verint[i] := StrToInt (verstr);
84 verstr := '';
85 end;
86 end;
87
88end;
89
90function CompareVersion (ver1, ver2: String) : Integer;
91var
92 verint1, verint2: array of Integer;
93 i: integer;
94begin
95 SetArrayLength (verint1, 4);
96 DecodeVersion (ver1, verint1);
97
98 SetArrayLength (verint2, 4);
99 DecodeVersion (ver2, verint2);
100
101 Result := 0; i := 0;
102 while ((Result = 0) and ( i < 4 )) do
103 begin
104 if verint1[i] > verint2[i] then
105 Result := 1
106 else
107 if verint1[i] < verint2[i] then
108 Result := -1;
109 i := i + 1;
110 end;
111
112end;
113
114procedure CheckJavaRuntime();
115var
116 Res: Boolean;
117 JavaVer: String;
118begin
119 Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
120 if Res = True then
121 begin
122 if Length( JavaVer ) > 0 then
123 begin
124 if CompareVersion(JavaVer, '{#MinJavaVersion}') >= 0 then
125 begin
126 Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath);
127 end;
128 end;
129 end;
130end;
131
132function IsJavaInstalled(): Boolean;
133begin
134 Result := Length(javaPath) > 0;
135end;
136
137function GetJavaPath(Param: String): String;
138begin
139 Result := javaPath;
140end;
141
142function InitializeSetup(): Boolean;
143begin
144 CheckJavaRuntime();
145 Result := True;
146end;
147
148procedure InitializeWizard();
149var
150 Components : TNewCheckListbox;
151 i : integer;
152begin
153 Components := WizardForm.ComponentsList;
154 i := Components.Items.IndexOf('JRE');
155 if i <> -1 then
156 begin
157 Components.ItemEnabled[i] := false;
158 Components.Checked[i] := not IsJavaInstalled();
159 end;
160 i := Components.Items.IndexOf('AEI');
161 if i <> -1 then
162 begin
163 Components.ItemEnabled[i] := false;
164 Components.Checked[i] := true;
165 end;
166end;
167
168function DirOk(Path: String): boolean;
169begin
170 Result := DirExists(Path+'\GameDataFolder') and FileExists(Path+'\Oni.exe');
171end;
172
173function NextButtonClick(CurPageID: Integer): boolean;
174begin
175 Result := True;
176
177 if CurPageID = wpSelectDir then
178 begin
179 if (not DirOk(WizardDirValue)) then
180 begin
181 MsgBox(CustomMessage('wrongDir'), mbError, MB_OK);
182 Result := False;
183 end;
184 end;
185end;
186
187
188function ShouldSkipPage(PageID: Integer): Boolean;
189begin
190 Result := PageID = wpSelectComponents;
191end;
192
193function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
194begin
195 Result := MemoUserInfoInfo + NewLine;
196 Result := Result + MemoDirInfo + NewLine;
197 Result := Result + MemoGroupInfo + NewLine;
198 Result := Result + MemoTasksInfo + NewLine;
199end;
200
Note: See TracBrowser for help on using the repository browser.