[818] | 1 | #define AppId "{{B67333BB-1CF9-4EFD-A40B-E25B5CB4C8A7}}"
|
---|
[855] | 2 | #define AppVersion "1.1"
|
---|
[818] | 3 | #define AppLongName "Anniversary Edition of Oni"
|
---|
| 4 | #define AppShortName "Anniversary-Edition-Setup"
|
---|
| 5 |
|
---|
| 6 | #define MinJavaVersion "1.6"
|
---|
| 7 | #define JavaDownloadPage "http://www.java.com/en/download/manual.jsp#win"
|
---|
| 8 |
|
---|
| 9 | [Setup]
|
---|
| 10 | AppId={#AppId}
|
---|
| 11 | AppVersion={#AppVersion}
|
---|
| 12 | AppName={#AppLongName}
|
---|
| 13 | DefaultDirName={pf32}\Oni
|
---|
| 14 | OutputBaseFilename={#AppShortName}-v{#AppVersion}
|
---|
| 15 | DefaultGroupName=Oni AE
|
---|
| 16 |
|
---|
| 17 | DirExistsWarning=no
|
---|
| 18 | AppendDefaultDirName=no
|
---|
| 19 |
|
---|
| 20 | ArchitecturesInstallIn64BitMode=x64
|
---|
| 21 | ShowComponentSizes=no
|
---|
| 22 | AppPublisher=
|
---|
| 23 | AppPublisherURL=
|
---|
| 24 | AppSupportURL=
|
---|
| 25 | AppUpdatesURL=
|
---|
| 26 | AllowNoIcons=yes
|
---|
| 27 | OutputDir=.
|
---|
| 28 | Compression=lzma2/max
|
---|
| 29 | SolidCompression=yes
|
---|
| 30 |
|
---|
| 31 | [Languages]
|
---|
| 32 | Name: "en"; MessagesFile: "compiler:Default.isl"
|
---|
| 33 |
|
---|
| 34 | [Messages]
|
---|
| 35 | en.SelectDirBrowseLabel=Please select the installation directory of Oni.
|
---|
| 36 |
|
---|
| 37 | [CustomMessages]
|
---|
| 38 | en.wrongDir=This doesn't seem to be your Oni installation; I don't see a file here named "Oni.exe".
|
---|
| 39 | en.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]
|
---|
| 42 | Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
---|
| 43 |
|
---|
| 44 | [Components]
|
---|
| 45 | Name: "JRE"; Description: "JRE"
|
---|
| 46 | Name: "AEI"; Description: "AEI"
|
---|
| 47 |
|
---|
| 48 | [Dirs]
|
---|
| 49 | Name: "{app}\AE"; Permissions: users-modify
|
---|
| 50 |
|
---|
| 51 | [Files]
|
---|
| 52 | Source: "AEInstaller2Updater.jar"; DestDir: "{app}\AE\AEInstaller"; Components: AEI
|
---|
| 53 | Source: "JRE\*"; DestDir: "{app}\AE\AEInstaller\JRE"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist; Components: JRE
|
---|
| 54 | Source: "AElogo.ico"; DestDir: "{app}\AE\AEInstaller"; Components: AEI
|
---|
| 55 |
|
---|
| 56 | [Icons]
|
---|
| 57 | Name: "{app}\AE\AEInstaller2"; Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Check: not IsJavaInstalled
|
---|
| 58 | Name: "{app}\AE\AEInstaller2Updater"; Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2Updater.jar"; Check: not IsJavaInstalled
|
---|
| 59 | Name: "{group}\AEInstaller 2"; Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Check: not IsJavaInstalled
|
---|
| 60 | Name: "{commondesktop}\AEInstaller 2"; Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Tasks: desktopicon; Check: not IsJavaInstalled
|
---|
| 61 | Name: "{app}\AE\AEInstaller2"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Check: IsJavaInstalled
|
---|
| 62 | Name: "{app}\AE\AEInstaller2Updater"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2Updater.jar"; Check: IsJavaInstalled
|
---|
| 63 | Name: "{group}\AEInstaller 2"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Check: IsJavaInstalled
|
---|
| 64 | Name: "{commondesktop}\AEInstaller 2"; Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; IconFilename: "{app}\AE\AEInstaller\AElogo.ico"; Parameters: "-Dsun.java2d.d3d=false -jar bin\AEInstaller2.jar"; Tasks: desktopicon; Check: IsJavaInstalled
|
---|
| 65 |
|
---|
| 66 | [Run]
|
---|
[855] | 67 | Filename: "{app}\AE\AEInstaller\JRE\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2Updater.jar"; Flags: runasoriginaluser; Check: not IsJavaInstalled; BeforeInstall: WriteProxyData
|
---|
| 68 | Filename: "{code:GetJavaPath}\bin\javaw.exe"; WorkingDir: "{app}\AE\AEInstaller"; Parameters: "-Dsun.java2d.d3d=false -jar AEInstaller2Updater.jar"; Flags: runasoriginaluser; Check: IsJavaInstalled; BeforeInstall: WriteProxyData
|
---|
[818] | 69 |
|
---|
| 70 |
|
---|
| 71 | [Code]
|
---|
| 72 | var
|
---|
[855] | 73 | PageUseProxy: TInputOptionWizardPage;
|
---|
| 74 | PageProxyData: TInputQueryWizardPage;
|
---|
[818] | 75 | javaPath: String;
|
---|
| 76 |
|
---|
| 77 | procedure DecodeVersion (verstr: String; var verint: array of Integer);
|
---|
| 78 | var
|
---|
| 79 | i,p: Integer; s: string;
|
---|
| 80 | begin
|
---|
| 81 | // initialize array
|
---|
| 82 | verint := [0,0,0,0];
|
---|
| 83 | i := 0;
|
---|
| 84 | while ((Length(verstr) > 0) and (i < 4)) do
|
---|
| 85 | begin
|
---|
| 86 | p := pos ('.', verstr);
|
---|
| 87 | if p > 0 then
|
---|
| 88 | begin
|
---|
| 89 | if p = 1 then s:= '0' else s:= Copy (verstr, 1, p - 1);
|
---|
| 90 | verint[i] := StrToInt(s);
|
---|
| 91 | i := i + 1;
|
---|
| 92 | verstr := Copy (verstr, p+1, Length(verstr));
|
---|
| 93 | end
|
---|
| 94 | else
|
---|
| 95 | begin
|
---|
| 96 | verint[i] := StrToInt (verstr);
|
---|
| 97 | verstr := '';
|
---|
| 98 | end;
|
---|
| 99 | end;
|
---|
| 100 |
|
---|
| 101 | end;
|
---|
| 102 |
|
---|
| 103 | function CompareVersion (ver1, ver2: String) : Integer;
|
---|
| 104 | var
|
---|
| 105 | verint1, verint2: array of Integer;
|
---|
| 106 | i: integer;
|
---|
| 107 | begin
|
---|
| 108 | SetArrayLength (verint1, 4);
|
---|
| 109 | DecodeVersion (ver1, verint1);
|
---|
| 110 |
|
---|
| 111 | SetArrayLength (verint2, 4);
|
---|
| 112 | DecodeVersion (ver2, verint2);
|
---|
| 113 |
|
---|
| 114 | Result := 0; i := 0;
|
---|
| 115 | while ((Result = 0) and ( i < 4 )) do
|
---|
| 116 | begin
|
---|
| 117 | if verint1[i] > verint2[i] then
|
---|
| 118 | Result := 1
|
---|
| 119 | else
|
---|
| 120 | if verint1[i] < verint2[i] then
|
---|
| 121 | Result := -1;
|
---|
| 122 | i := i + 1;
|
---|
| 123 | end;
|
---|
| 124 |
|
---|
| 125 | end;
|
---|
| 126 |
|
---|
| 127 | procedure CheckJavaRuntime();
|
---|
| 128 | var
|
---|
| 129 | W6432: Boolean;
|
---|
| 130 | Res: Boolean;
|
---|
| 131 | JavaVer: String;
|
---|
| 132 | begin
|
---|
| 133 | W6432 := False;
|
---|
| 134 | Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
|
---|
| 135 | if (Res = False) and IsWin64() then
|
---|
| 136 | begin
|
---|
| 137 | Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
|
---|
| 138 | W6432 := Res;
|
---|
| 139 | end;
|
---|
| 140 | if Res = True then
|
---|
| 141 | begin
|
---|
| 142 | if Length( JavaVer ) > 0 then
|
---|
| 143 | begin
|
---|
| 144 | if CompareVersion(JavaVer, '{#MinJavaVersion}') >= 0 then
|
---|
| 145 | begin
|
---|
| 146 | if W6432 then
|
---|
| 147 | Res := RegQueryStringValue(HKLM32, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath)
|
---|
| 148 | else
|
---|
| 149 | Res := RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment\'+JavaVer, 'JavaHome', javaPath);
|
---|
| 150 | end;
|
---|
| 151 | end;
|
---|
| 152 | end;
|
---|
| 153 | end;
|
---|
| 154 |
|
---|
| 155 | function IsJavaInstalled(): Boolean;
|
---|
| 156 | begin
|
---|
| 157 | Result := Length(javaPath) > 0;
|
---|
| 158 | end;
|
---|
| 159 |
|
---|
| 160 | function GetJavaPath(Param: String): String;
|
---|
| 161 | begin
|
---|
| 162 | Result := javaPath;
|
---|
| 163 | end;
|
---|
| 164 |
|
---|
| 165 | function InitializeSetup(): Boolean;
|
---|
| 166 | begin
|
---|
| 167 | CheckJavaRuntime();
|
---|
| 168 | Result := True;
|
---|
| 169 | end;
|
---|
| 170 |
|
---|
| 171 | procedure InitializeWizard();
|
---|
| 172 | var
|
---|
| 173 | Components : TNewCheckListbox;
|
---|
| 174 | i : integer;
|
---|
| 175 | begin
|
---|
| 176 | Components := WizardForm.ComponentsList;
|
---|
| 177 | i := Components.Items.IndexOf('JRE');
|
---|
| 178 | if i <> -1 then
|
---|
| 179 | begin
|
---|
| 180 | Components.ItemEnabled[i] := false;
|
---|
| 181 | Components.Checked[i] := not IsJavaInstalled();
|
---|
| 182 | end;
|
---|
| 183 | i := Components.Items.IndexOf('AEI');
|
---|
| 184 | if i <> -1 then
|
---|
| 185 | begin
|
---|
| 186 | Components.ItemEnabled[i] := false;
|
---|
| 187 | Components.Checked[i] := true;
|
---|
| 188 | end;
|
---|
[855] | 189 |
|
---|
| 190 | PageUseProxy := CreateInputOptionPage(wpSelectTasks, 'Internet connection type', '', 'Do you require to use a proxy to connect to the internet?', true, false);
|
---|
| 191 | PageUseProxy.Add('Direct connection');
|
---|
| 192 | PageUseProxy.Add('Use proxy');
|
---|
| 193 | PageUseProxy.Values[0] := true;
|
---|
| 194 |
|
---|
| 195 | PageProxyData := CreateInputQueryPage(PageUseProxy.ID, 'Proxy data', '', 'Please enter the data required to connect to your proxy.');
|
---|
| 196 | PageProxyData.Add('Hostname or IP:', False);
|
---|
| 197 | PageProxyData.Add('Port:', False);
|
---|
[818] | 198 | end;
|
---|
| 199 |
|
---|
| 200 | function DirOk(Path: String): boolean;
|
---|
| 201 | begin
|
---|
| 202 | Result := DirExists(Path+'\GameDataFolder') and FileExists(Path+'\Oni.exe');
|
---|
| 203 | end;
|
---|
| 204 |
|
---|
| 205 | function NextButtonClick(CurPageID: Integer): boolean;
|
---|
| 206 | begin
|
---|
| 207 | Result := True;
|
---|
| 208 |
|
---|
| 209 | if CurPageID = wpSelectDir then
|
---|
| 210 | begin
|
---|
| 211 | if (not DirOk(WizardDirValue)) then
|
---|
| 212 | begin
|
---|
| 213 | MsgBox(CustomMessage('wrongDir'), mbError, MB_OK);
|
---|
| 214 | Result := False;
|
---|
| 215 | end;
|
---|
| 216 | end;
|
---|
| 217 | end;
|
---|
| 218 |
|
---|
| 219 |
|
---|
[855] | 220 | function EnterProxyData(): Boolean;
|
---|
| 221 | begin
|
---|
| 222 | Result := PageUseProxy.SelectedValueIndex = 1;
|
---|
| 223 | end;
|
---|
| 224 |
|
---|
[818] | 225 | function ShouldSkipPage(PageID: Integer): Boolean;
|
---|
| 226 | begin
|
---|
[855] | 227 | Result := false;
|
---|
| 228 | if (PageID = wpSelectComponents) then
|
---|
| 229 | Result := true;
|
---|
| 230 | if (PageID = PageProxyData.ID) then
|
---|
| 231 | Result := not EnterProxyData();
|
---|
[818] | 232 | end;
|
---|
| 233 |
|
---|
[855] | 234 |
|
---|
[818] | 235 | function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
|
---|
| 236 | begin
|
---|
| 237 | Result := MemoUserInfoInfo + NewLine;
|
---|
| 238 | Result := Result + MemoDirInfo + NewLine;
|
---|
| 239 | Result := Result + MemoGroupInfo + NewLine;
|
---|
| 240 | Result := Result + MemoTasksInfo + NewLine;
|
---|
[855] | 241 |
|
---|
| 242 | if (EnterProxyData()) then
|
---|
| 243 | Result := Result + NewLine + 'Set proxy configuration';
|
---|
[818] | 244 | end;
|
---|
| 245 |
|
---|
[855] | 246 |
|
---|
| 247 | procedure WriteProxyData();
|
---|
| 248 | begin
|
---|
| 249 | if (EnterProxyData()) then
|
---|
| 250 | begin
|
---|
| 251 | SaveStringToFile(ExpandConstant('{app}') + '\AE\AEInstaller\AEI-ProxySettings.xml',
|
---|
| 252 | '<?xml version="1.0" ?><Proxy><useProxy>true</useProxy><hostOrIp>'+PageProxyData.Values[0]+'</hostOrIp><port>'+PageProxyData.Values[1]+'</port></Proxy>',
|
---|
| 253 | False);
|
---|
| 254 | end;
|
---|
| 255 | end;
|
---|