Skip to content

Commit 9e09804

Browse files
authored
installer: Download sound files from github
Updated to download the latest sound files package from Github.
1 parent 75405b7 commit 9e09804

2 files changed

Lines changed: 44 additions & 2 deletions

File tree

res/swars-config.nsh.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@
1212
!define GFX_VERSION "1.0.1.23"
1313
!define GFX_PACKAGE "swars-gfx-1_0_1_23"
1414
!define GFX_PKG_MD5 "2f940fe9bdf2e2d65307da1e6d0a270b"
15+
16+
; Version number and file name for sfx package
17+
!define SFX_VERSION "1.0.0.21"
18+
!define SFX_PACKAGE "swars-sfx-1_0_0_21"
19+
!define SFX_PKG_MD5 "dfcb50c273582884537ebf0f1db5518d"

res/swars-setup.nsi

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LangString STR_CHOOSE_DRIVE 1033 "Choose the CD-ROM drive"
3131
LangString STR_CHOOSE_LANG 1033 "Choose the language"
3232

3333
; --------------------
34-
; VARIABLES: 12
34+
; VARIABLES: 13
3535

3636
Var selected_lang_text
3737
Var selected_lang_abbr
@@ -45,6 +45,7 @@ Var RadioSelected
4545
Var inst_src_root_dir
4646
Var levels_md5
4747
Var gfx_md5
48+
Var sfx_md5
4849

4950
InstallDir "$PROGRAMFILES\Syndicate Wars\"
5051

@@ -70,7 +71,7 @@ InstallDir "$PROGRAMFILES\Syndicate Wars\"
7071
!define MUI_ICON "swars_icon.ico"
7172
!define MUI_WELCOMEFINISHPAGE_BITMAP "${BUILDENV_UTIL_DIR}\win.bmp"
7273
!define MUI_WELCOMEPAGE_TITLE "Welcome To The Syndicate Wars Port Setup"
73-
!define MUI_WELCOMEPAGE_TEXT "This fan port requires the original Syndicate Wars game files. Installation is supported from the following versions of Syndicate Wars:$\r$\n$\r$\n * GOG Download version$\r$\n * Original European/USA DOS release CD$\r$\n * German DOS release CD$\r$\n * Korean DOS release CD$\r$\n * Japanese Windows release CD$\r$\n$\r$\nNote: While the Japanese version is supported, only English and French languages from this release are supported, Japanese text is not yet supported.$\r$\n$\r$\nBuild ${PRODUCT_VERSION}$\nLevels ${LEVELS_VERSION} Graphics ${GFX_VERSION}"
74+
!define MUI_WELCOMEPAGE_TEXT "This fan port requires the original Syndicate Wars game files. Installation is supported from the following versions of Syndicate Wars:$\r$\n$\r$\n * GOG Download version$\r$\n * Original European/USA DOS release CD$\r$\n * German DOS release CD$\r$\n * Korean DOS release CD$\r$\n * Japanese Windows release CD$\r$\n$\r$\nNote: While the Japanese version is supported, only English and French languages from this release are supported, Japanese text is not yet supported.$\r$\n$\r$\nBuild ${PRODUCT_VERSION} Graphics ${GFX_VERSION}$\nLevels ${LEVELS_VERSION} Sound ${SFX_VERSION}"
7475

7576

7677
; --------------------
@@ -631,6 +632,36 @@ extract_gfx_files:
631632
nsisunz::Unzip "$PLUGINSDIR\${GFX_PACKAGE}.zip" "$PLUGINSDIR\"
632633
CopyFiles /SILENT $PLUGINSDIR\SWARS\data\* $INSTDIR\data
633634

635+
;Update sound files from swars-sfx repository
636+
637+
StrCpy $sfx_md5 "${SFX_PKG_MD5}"
638+
639+
!if /FileExists "$PLUGINSDIR\${SFX_PACKAGE}.zip"
640+
!else
641+
Call DownloadSfx
642+
!endif
643+
644+
;Check MD5 of downloaded file to see if it's intact
645+
646+
md5dll::GetMD5File "$PLUGINSDIR\${SFX_PACKAGE}.zip"
647+
Pop $0
648+
StrCmp $0 $sfx_md5 extract_sfx_files retry_sfx_download
649+
650+
retry_sfx_download:
651+
DetailPrint "Error detected with sound files zip, retrying download"
652+
Call DownloadSFX
653+
md5dll::GetMD5File "$PLUGINSDIR\${SFX_PACKAGE}.zip"
654+
Pop $0
655+
StrCmp $0 $sfx_md5 extract_sfx_files 0
656+
SetErrors
657+
DetailPrint "Error downloading sound files from swars-sfx repository, please check the source file."
658+
DetailPrint "Aborting install"
659+
Abort
660+
661+
extract_sfx_files:
662+
DetailPrint "Extracting updated sound files..."
663+
nsisunz::Unzip "$PLUGINSDIR\${SFX_PACKAGE}.zip" "$PLUGINSDIR\"
664+
CopyFiles /SILENT $PLUGINSDIR\SWARS\sound\* $INSTDIR\sound
634665
Return
635666

636667
copy_files_fail:
@@ -655,6 +686,12 @@ Function DownloadGfx
655686
inetc::get "https://github.com/swfans/swars-gfx/releases/download/${GFX_VERSION}/${GFX_PACKAGE}.zip" "$PLUGINSDIR\${GFX_PACKAGE}.zip"
656687
FunctionEnd
657688

689+
Function DownloadSfx
690+
DetailPrint "Downloading latest game sound files from Github..."
691+
DetailPrint "https://github.com/swfans/swars-sfx/releases/download/${SFX_VERSION}/${SFX_PACKAGE}.zip"
692+
inetc::get "https://github.com/swfans/swars-sfx/releases/download/${SFX_VERSION}/${SFX_PACKAGE}.zip" "$PLUGINSDIR\${SFX_PACKAGE}.zip"
693+
FunctionEnd
694+
658695

659696
Function RemoveSound
660697
RMDir /r $INSTDIR\qdata\sound

0 commit comments

Comments
 (0)