Skip to content

Commit d6ea0e4

Browse files
committed
Update installer scripts.
1 parent 9461ffd commit d6ea0e4

File tree

2 files changed

+128
-44
lines changed

2 files changed

+128
-44
lines changed

player/NymphCastPlayer/installer/Setup-NymphCastPlayer-dynamic.iss

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,7 @@
5151

5252
#define VcRedistFile "vc_redist.x64.exe"
5353
#define VcRedistUrl "https://aka.ms/vs/17/release/" + VcRedistFile
54-
#define VcRedistMsgDl "Downloading Microsoft Visual C++ 14.1 RunTime..."
55-
#define VcRedistMsgIn "Installing Microsoft Visual C++ 14.1 RunTime..."
56-
57-
; Tools 7z, wget Expected in {NymphCast}/tools/
58-
; wget.exe: https://eternallybored.org/misc/wget/
59-
; Expected in {NymphCast}/tools/
60-
61-
#define ToolPath "../../../tools/"
62-
63-
#define Wget "wget.exe"
64-
#define WgetPath ToolPath + Wget
54+
#define VcRedistMsg "Installing Microsoft Visual C++ 14.1 RunTime..."
6555

6656
; Workaround for vcpkg Qt5 not ready:
6757

@@ -144,8 +134,8 @@ Name: "{app}/bin"
144134
[Files]
145135
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
146136

147-
; Tools:
148-
Source: "{#WgetPath}"; DestDir: "{tmp}"; Flags: deleteafterinstall;
137+
; Visual C++ runtime:
138+
Source: "{tmp}/{#VcRedistFile}"; DestDir: "{tmp}"; Flags: external; Check: not VCinstalled
149139

150140
; Program and DLLs of dependencies:
151141

@@ -195,9 +185,8 @@ Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Fil
195185

196186
[Run]
197187

198-
; If needed, download and install the Visual C++ runtime:
199-
Filename: "{tmp}/{#Wget}" ; Parameters: """{#VcRedistUrl}"""; WorkingDir: "{tmp}"; StatusMsg: "{#VcRedistMsgDl}"; Check: IsWin64 and not VCinstalled
200-
Filename: "{tmp}/{#VcRedistFile}"; Parameters: "/install /passive" ; WorkingDir: "{tmp}"; StatusMsg: "{#VcRedistMsgIn}"; Check: IsWin64 and not VCinstalled
188+
; If needed, download (see TDownloadWizardPage) and install the Visual C++ runtime:
189+
Filename: "{tmp}/{#VcRedistFile}"; Parameters: "/install /passive" ; WorkingDir: "{tmp}"; StatusMsg: "{#VcRedistMsg}"; Check: not VCinstalled
201190

202191
; If requested, run NymphCast Player:
203192
Filename: "{app}\bin\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
@@ -234,4 +223,43 @@ function VCinstalled: Boolean;
234223
end;
235224
end;
236225
226+
var
227+
DownloadPage: TDownloadWizardPage;
228+
229+
function OnDownloadProgress(const Url, FileName: String; const Progress, ProgressMax: Int64): Boolean;
230+
begin
231+
if Progress = ProgressMax then
232+
Log(Format('Successfully downloaded file to {tmp}: %s', [FileName]));
233+
Result := True;
234+
end;
235+
236+
procedure InitializeWizard;
237+
begin
238+
DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), @OnDownloadProgress);
239+
end;
240+
241+
function NextButtonClick(CurPageID: Integer): Boolean;
242+
begin
243+
if (CurPageID = wpReady) and (not VCinstalled) then begin
244+
DownloadPage.Clear;
245+
DownloadPage.Add('{#VcRedistUrl}', '{#VcRedistFile}', '');
246+
DownloadPage.Show;
247+
try
248+
try
249+
DownloadPage.Download; // This downloads the files to {tmp}
250+
Result := True;
251+
except
252+
if DownloadPage.AbortedByUser then
253+
Log('Aborted by user.')
254+
else
255+
SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);
256+
Result := False;
257+
end;
258+
finally
259+
DownloadPage.Hide;
260+
end;
261+
end else
262+
Result := True;
263+
end;
264+
237265
(* End of file *)

src/server/installer/Setup-NymphCastServer-dynamic.iss

Lines changed: 84 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050

5151
#define NcWallPrTaskGroup "Screen saver Wallpaper Downloads"
5252

53-
#define NcScenicFile "wallpapers.7z"
53+
#define NcScenicFile "wallpapers.zip"
5454
#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/...'.
5757

5858
; Paths for DLLs of dependencies to include:
5959

@@ -64,21 +64,7 @@
6464

6565
#define VcRedistFile "vc_redist.x64.exe"
6666
#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..."
8268

8369
[Setup]
8470

@@ -180,8 +166,8 @@ Name: "{%HOMEPATH}/.emulationstation/tmp"
180166
[Files]
181167
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
182168

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
185171

186172
Source: "../apps/*.*" ; DestDir: "{app}/apps" ; Flags: ignoreversion
187173
Source: "../apps/hellocast/*.*" ; DestDir: "{app}/apps/hellocast" ; Flags: ignoreversion
@@ -281,15 +267,11 @@ Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Fil
281267

282268
[Run]
283269

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
287272

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
293275

294276
; If requested, run NymphCast Server with default configuration:
295277
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;
341323
end;
342324
end;
343325
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+
344400
(* End of file *)

0 commit comments

Comments
 (0)