[613] | 1 | #define AppId "{{B67333BB-1CF9-4EFD-A40B-E25B5CB4C8A7}}"
|
---|
[644] | 2 | #define AppVersion "0.99"
|
---|
[613] | 3 | #define AppLongName "Anniversary Edition of Oni"
|
---|
| 4 | #define AppShortName "AEInstaller"
|
---|
| 5 |
|
---|
| 6 | #define MinJavaVersion "1.6"
|
---|
| 7 |
|
---|
| 8 | [Setup]
|
---|
| 9 | AppId={#AppId}
|
---|
| 10 | AppVersion={#AppVersion}
|
---|
| 11 | AppName={#AppLongName}
|
---|
| 12 | DefaultDirName={pf32}\Oni
|
---|
| 13 | OutputBaseFilename={#AppShortName}-v{#AppVersion}-Setup
|
---|
| 14 | DefaultGroupName=Oni AE
|
---|
| 15 |
|
---|
| 16 | DirExistsWarning=no
|
---|
| 17 | AppendDefaultDirName=no
|
---|
| 18 |
|
---|
| 19 | ShowComponentSizes=no
|
---|
| 20 | AppPublisher=
|
---|
| 21 | AppPublisherURL=
|
---|
| 22 | AppSupportURL=
|
---|
| 23 | AppUpdatesURL=
|
---|
| 24 | AllowNoIcons=yes
|
---|
| 25 | OutputDir=.
|
---|
| 26 | Compression=lzma2/max
|
---|
| 27 | SolidCompression=yes
|
---|
| 28 |
|
---|
| 29 | [Languages]
|
---|
| 30 | Name: "en"; MessagesFile: "compiler:Default.isl"
|
---|
| 31 |
|
---|
| 32 | [Messages]
|
---|
| 33 | en.SelectDirBrowseLabel=Please select the installation directory of Oni.
|
---|
| 34 |
|
---|
| 35 | [CustomMessages]
|
---|
| 36 | en.wrongDir=This doesn't seem to be your Oni installation; I don't see a file here named "Oni.exe".
|
---|
| 37 |
|
---|
| 38 | [Tasks]
|
---|
| 39 | Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
---|
| 40 |
|
---|
| 41 | [Components]
|
---|
| 42 | Name: "JRE"; Description: "JRE"
|
---|
| 43 | Name: "AEI"; Description: "AEI"
|
---|
| 44 |
|
---|
| 45 | [Dirs]
|
---|
| 46 | Name: "{app}\Edition"; Permissions: users-modify
|
---|
| 47 |
|
---|
| 48 | [Files]
|
---|
| 49 | Source: "AEInstaller2.jar"; DestDir: "{app}\Edition\AEInstaller"; Components: AEI
|
---|
[620] | 50 | Source: "JRE\*"; DestDir: "{app}\Edition\AEInstaller\JRE"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist; Components: JRE
|
---|
[613] | 51 | Source: "AElogo.ico"; DestDir: "{app}\Edition\AEInstaller"; Components: AEI
|
---|
[651] | 52 | Source: "..\locales\*"; DestDir: "{app}\Edition\AEInstaller\locales"; Excludes: ".svn"; Flags: createallsubdirs recursesubdirs onlyifdoesntexist; Components: AEI
|
---|
[613] | 53 |
|
---|
| 54 | [Icons]
|
---|
| 55 | Name: "{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
|
---|
| 56 | Name: "{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
|
---|
| 57 | Name: "{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
|
---|
| 58 | Name: "{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]
|
---|
| 62 | var
|
---|
| 63 | javaPath: String;
|
---|
| 64 |
|
---|
| 65 | procedure DecodeVersion (verstr: String; var verint: array of Integer);
|
---|
| 66 | var
|
---|
| 67 | i,p: Integer; s: string;
|
---|
| 68 | begin
|
---|
| 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 |
|
---|
| 89 | end;
|
---|
| 90 |
|
---|
| 91 | function CompareVersion (ver1, ver2: String) : Integer;
|
---|
| 92 | var
|
---|
| 93 | verint1, verint2: array of Integer;
|
---|
| 94 | i: integer;
|
---|
| 95 | begin
|
---|
| 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 |
|
---|
| 113 | end;
|
---|
| 114 |
|
---|
| 115 | procedure CheckJavaRuntime();
|
---|
| 116 | var
|
---|
| 117 | Res: Boolean;
|
---|
| 118 | JavaVer: String;
|
---|
| 119 | begin
|
---|
| 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;
|
---|
| 131 | end;
|
---|
| 132 |
|
---|
| 133 | function IsJavaInstalled(): Boolean;
|
---|
| 134 | begin
|
---|
| 135 | Result := Length(javaPath) > 0;
|
---|
| 136 | end;
|
---|
| 137 |
|
---|
| 138 | function GetJavaPath(Param: String): String;
|
---|
| 139 | begin
|
---|
| 140 | Result := javaPath;
|
---|
| 141 | end;
|
---|
| 142 |
|
---|
| 143 | function InitializeSetup(): Boolean;
|
---|
| 144 | begin
|
---|
| 145 | CheckJavaRuntime();
|
---|
| 146 | Result := True;
|
---|
| 147 | end;
|
---|
| 148 |
|
---|
| 149 | procedure InitializeWizard();
|
---|
| 150 | var
|
---|
| 151 | Components : TNewCheckListbox;
|
---|
| 152 | i : integer;
|
---|
| 153 | begin
|
---|
| 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;
|
---|
| 167 | end;
|
---|
| 168 |
|
---|
| 169 | function DirOk(Path: String): boolean;
|
---|
| 170 | begin
|
---|
| 171 | Result := DirExists(Path+'\GameDataFolder') and FileExists(Path+'\Oni.exe');
|
---|
| 172 | end;
|
---|
| 173 |
|
---|
| 174 | function NextButtonClick(CurPageID: Integer): boolean;
|
---|
| 175 | begin
|
---|
| 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;
|
---|
| 186 | end;
|
---|
| 187 |
|
---|
| 188 |
|
---|
| 189 | function ShouldSkipPage(PageID: Integer): Boolean;
|
---|
| 190 | begin
|
---|
| 191 | Result := PageID = wpSelectComponents;
|
---|
| 192 | end;
|
---|
| 193 |
|
---|
| 194 | function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
|
---|
| 195 | begin
|
---|
| 196 | Result := MemoUserInfoInfo + NewLine;
|
---|
| 197 | Result := Result + MemoDirInfo + NewLine;
|
---|
| 198 | Result := Result + MemoGroupInfo + NewLine;
|
---|
| 199 | Result := Result + MemoTasksInfo + NewLine;
|
---|
| 200 | end;
|
---|
| 201 |
|
---|