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

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

AEI2 0.99f:

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