|
50 | 50 |
|
51 | 51 | #define NcWallPrTaskGroup "Screen saver Wallpaper Downloads" |
52 | 52 |
|
53 | | -#define NcScenicFile "wallpapers.7z" |
| 53 | +#define NcScenicFile "wallpapers.zip" |
54 | 54 | #define NcScenicUrl "https://github.com/MayaPosch/NymphCast/releases/download/v0.1-rc0/" + NcScenicFile |
55 | | -#define NcScenicMsgDl "Downloading scenic wallpapers" |
56 | | -#define NcScenicMsgEx "Extracting scenic wallpapers" |
| 55 | +#define NcScenicMsg "Extracting scenic wallpapers..." |
| 56 | +; Note: with non-pre-releases, above URL can be changed to use '.../releases/latest/download/...'. |
57 | 57 |
|
58 | 58 | ; Paths for DLLs of dependencies to include: |
59 | 59 |
|
|
64 | 64 |
|
65 | 65 | #define VcRedistFile "vc_redist.x64.exe" |
66 | 66 | #define VcRedistUrl "https://aka.ms/vs/17/release/" + VcRedistFile |
67 | | -#define VcRedistMsgDl "Downloading Microsoft Visual C++ 14.1 RunTime..." |
68 | | -#define VcRedistMsgIn "Installing Microsoft Visual C++ 14.1 RunTime..." |
69 | | - |
70 | | -; Tools 7z, wget Expected in {NymphCast}/tools/ |
71 | | -; 7z.exe: https://www.7-zip.org/ |
72 | | -; wget.exe: https://eternallybored.org/misc/wget/ |
73 | | -; Both expected in {NymphCast}/tools/ |
74 | | - |
75 | | -#define ToolPath "../../../tools/" |
76 | | - |
77 | | -#define Wget "wget.exe" |
78 | | -#define WgetPath ToolPath + Wget |
79 | | - |
80 | | -#define Sz "7z.exe" |
81 | | -#define SzPath ToolPath + Sz |
| 67 | +#define VcRedistMsg "Installing Microsoft Visual C++ 14.1 RunTime..." |
82 | 68 |
|
83 | 69 | [Setup] |
84 | 70 |
|
@@ -180,8 +166,8 @@ Name: "{%HOMEPATH}/.emulationstation/tmp" |
180 | 166 | [Files] |
181 | 167 | ; NOTE: Don't use "Flags: ignoreversion" on any shared system files |
182 | 168 |
|
183 | | -Source: "{#WgetPath}" ; DestDir: "{tmp}"; Flags: deleteafterinstall; |
184 | | -Source: "{#SzPath}" ; DestDir: "{tmp}"; Flags: deleteafterinstall; |
| 169 | +; Downloaded items: Visual C++ runtime, wallpapers: |
| 170 | +Source: "{tmp}/{#VcRedistFile}" ; DestDir: "{tmp}"; Flags: external; Check: not VCinstalled |
185 | 171 |
|
186 | 172 | Source: "../apps/*.*" ; DestDir: "{app}/apps" ; Flags: ignoreversion |
187 | 173 | Source: "../apps/hellocast/*.*" ; DestDir: "{app}/apps/hellocast" ; Flags: ignoreversion |
@@ -281,15 +267,11 @@ Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Fil |
281 | 267 |
|
282 | 268 | [Run] |
283 | 269 |
|
284 | | -; If needed, download wallpapers |
285 | | -; run wget, unzip |
286 | | -Filename: "{tmp}/{#Wget}"; Parameters: """{#NcScenicUrl}""" ; WorkingDir: "{tmp}"; StatusMsg: "{#NcScenicMsgDl}"; Tasks: Scenic |
| 270 | +; If needed, unzip the wallpaper archive to {app}/wallpapers; print.exe figures as a no-op here: |
| 271 | +Filename: "print.exe"; AfterInstall: UnzipScenicWallpapers; StatusMsg: "{#NcScenicMsg}"; Tasks: Scenic |
287 | 272 |
|
288 | | -Filename: "{tmp}/{#Sz}" ; Parameters: "x ""{tmp}\{#NcScenicFile}"" -o""{app}\wallpapers"" * -r -aoa"; StatusMsg: "{#NcScenicMsgEx}"; Tasks: Scenic; Flags: runhidden runascurrentuser |
289 | | - |
290 | | -; If needed, download and install the Visual C++ runtime: |
291 | | -Filename: "{tmp}/{#Wget}" ; Parameters: """{#VcRedistUrl}"""; WorkingDir: "{tmp}"; StatusMsg: "{#VcRedistMsgDl}"; Check: IsWin64 and not VCinstalled |
292 | | -Filename: "{tmp}/{#VcRedistFile}"; Parameters: "/install /passive" ; WorkingDir: "{tmp}"; StatusMsg: "{#VcRedistMsgIn}"; Check: IsWin64 and not VCinstalled |
| 273 | +; If needed, download (see TDownloadWizardPage) and install the Visual C++ runtime: |
| 274 | +Filename: "{tmp}/{#VcRedistFile}"; Parameters: "/install /passive" ; WorkingDir: "{tmp}"; StatusMsg: "{#VcRedistMsg}"; Check: not VCinstalled |
293 | 275 |
|
294 | 276 | ; If requested, run NymphCast Server with default configuration: |
295 | 277 | Filename: "{%COMSPEC}"; Parameters: "/k """"{app}\bin\{#MyAppExeDestName}"" -c ""{app}/config/{#NcDefaultConfig}"" -a ""{app}/apps"" -r ""{app}/assets"" -w ""{app}/wallpapers"""; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent |
@@ -341,4 +323,78 @@ function VCinstalled: Boolean; |
341 | 323 | end; |
342 | 324 | end; |
343 | 325 |
|
| 326 | +var |
| 327 | + DownloadPage: TDownloadWizardPage; |
| 328 | +
|
| 329 | +function OnDownloadProgress(const Url, FileName: String; const Progress, ProgressMax: Int64): Boolean; |
| 330 | +begin |
| 331 | + if Progress = ProgressMax then |
| 332 | + Log(Format('Successfully downloaded file to {tmp}: %s', [FileName])); |
| 333 | + Result := True; |
| 334 | +end; |
| 335 | +
|
| 336 | +procedure InitializeWizard; |
| 337 | +begin |
| 338 | + DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), @OnDownloadProgress); |
| 339 | +end; |
| 340 | +
|
| 341 | +function NextButtonClick(CurPageID: Integer): Boolean; |
| 342 | +begin |
| 343 | + if (CurPageID = wpReady) and ((not VCinstalled) or WizardIsTaskSelected('Scenic')) then begin |
| 344 | + DownloadPage.Clear; |
| 345 | + if not VCinstalled then begin |
| 346 | + DownloadPage.Add('{#VcRedistUrl}', '{#VcRedistFile}', ''); |
| 347 | + end; |
| 348 | + if WizardIsTaskSelected('Scenic') then begin |
| 349 | + DownloadPage.Add('{#NcScenicUrl}', '{#NcScenicFile}', ''); |
| 350 | + end; |
| 351 | + DownloadPage.Show; |
| 352 | + try |
| 353 | + try |
| 354 | + DownloadPage.Download; // This downloads the files to {tmp} |
| 355 | + Result := True; |
| 356 | + except |
| 357 | + if DownloadPage.AbortedByUser then |
| 358 | + Log('Aborted by user.') |
| 359 | + else |
| 360 | + SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK); |
| 361 | + Result := False; |
| 362 | + end; |
| 363 | + finally |
| 364 | + DownloadPage.Hide; |
| 365 | + end; |
| 366 | + end else |
| 367 | + Result := True; |
| 368 | +end; |
| 369 | +
|
| 370 | +const |
| 371 | + SHCONTCH_NOPROGRESSBOX = 4; |
| 372 | + SHCONTCH_RESPONDYESTOALL = 16; |
| 373 | +
|
| 374 | +procedure UnZip(ZipPath, TargetPath: string); |
| 375 | +var |
| 376 | + Shell: Variant; |
| 377 | + ZipFile: Variant; |
| 378 | + TargetFolder: Variant; |
| 379 | +begin |
| 380 | + Shell := CreateOleObject('Shell.Application'); |
| 381 | +
|
| 382 | + ZipFile := Shell.NameSpace(ZipPath); |
| 383 | + if VarIsClear(ZipFile) then |
| 384 | + RaiseException( |
| 385 | + Format('ZIP file "%s" does not exist or cannot be opened', [ZipPath])); |
| 386 | +
|
| 387 | + TargetFolder := Shell.NameSpace(TargetPath); |
| 388 | + if VarIsClear(TargetFolder) then |
| 389 | + RaiseException(Format('Target path "%s" does not exist', [TargetPath])); |
| 390 | +
|
| 391 | + TargetFolder.CopyHere( |
| 392 | + ZipFile.Items, SHCONTCH_NOPROGRESSBOX or SHCONTCH_RESPONDYESTOALL); |
| 393 | +end; |
| 394 | +
|
| 395 | +procedure UnzipScenicWallpapers; |
| 396 | +begin |
| 397 | + Unzip(ExpandConstant('{tmp}') + '\{#NcScenicFile}', ExpandConstant('{app}') + '\wallpapers'); |
| 398 | +end; |
| 399 | +
|
344 | 400 | (* End of file *) |
0 commit comments