2020-08-16 00:39:58 +02:00
Unicode True
2020-11-01 00:52:27 +01:00
SetCompressor /SOLID zlib ; LZMA compresses about 20% better but is more likely to trigger AV false positives
2020-08-10 07:26:15 +02:00
!define PRODUCT_NAME "Giants: Citizen Kabuto"
2020-11-04 04:49:04 +01:00
!define PRODUCT_VERSION "1.499"
2020-08-10 07:26:15 +02:00
; MUI 1.67 compatible ------
2020-08-16 00:39:58 +02:00
!include "MUI2.nsh"
2020-08-11 08:38:26 +02:00
!include "DotNetChecker.nsh"
2020-08-10 07:26:15 +02:00
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "GPatch.ico"
; Welcome page
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
;!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\readme.txt
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!insertmacro MUI_PAGE_FINISH
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\PlanetMoon\Giants"
!define MUI_LANGDLL_REGISTRY_VALUENAME "SetupLanguage"
; Language files
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Spanish"
; Language selection settings
!define MUI_LANGDLL_WINDOWTITLE "Setup Language"
!include LogicLib.nsh
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
2020-11-13 06:42:31 +01:00
OutFile "Output\GPatch1_499_1_0.exe"
2020-08-10 07:26:15 +02:00
InstallDir "$PROGRAMFILES\Giants\"
InstallDirRegKey HKCU "SOFTWARE\PlanetMoon\Giants" "DestDir"
ShowInstDetails hide
;Request application privileges for Windows Vista+
RequestExecutionLevel admin
Section
SetDetailsView hide
SectionIn RO
SetOverwrite on
2020-09-11 07:50:39 +02:00
nsExec::Exec "taskkill /F /IM Giants.exe"
nsExec::Exec "taskkill /F /IM GiantsMain.exe"
2020-08-10 07:26:15 +02:00
; Install DX redist for DX9 renderer
SetOutPath "$INSTDIR\Redist"
File /r "Files\Redist\*.*"
ExecWait "$INSTDIR\Redist\dxsetup.exe /silent" $0
${If} $0 != 0
2020-08-27 08:10:21 +02:00
MessageBox MB_OK "Setup failed to update DirectX ($0). Please visit www.microsoft.com and download the latest version of the DirectX end user redistributable."
2020-08-10 07:26:15 +02:00
${EndIf}
2020-11-01 00:52:27 +01:00
ExecWait "$INSTDIR\Redist\VC_redist.x86.exe /install /quiet /norestart /log $\"$Temp\GPatch_VCRedist.txt$\"" $0
2020-08-27 08:10:21 +02:00
${If} $0 != 0
2020-10-18 08:40:57 +02:00
${AndIf} $0 != 1638 ;0x666 - Newer version installed
MessageBox MB_OK "Setup failed to install the Visual C++ Runtime. Please visit www.microsoft.com and download the latest version of the Visual C++ 2019 redistributable."
2020-08-27 08:10:21 +02:00
${EndIf}
RMDir /r "$INSTDIR\Redist" ; Delete temporary files
2020-08-10 07:26:15 +02:00
; Delete old files
Delete $INSTDIR\bin\Shaders\*.*
Delete $INSTDIR\gg_dx7r.dll
Delete $INSTDIR\gg_dx8r.dll
2020-08-27 08:10:21 +02:00
Delete $INSTDIR\gg_dx9r.dll
2020-09-11 07:50:39 +02:00
Delete $INSTDIR\gg_null.dll
2020-08-10 07:26:15 +02:00
Delete $INSTDIR\Giants.exe
2020-09-06 01:47:00 +02:00
Delete $INSTDIR\BugTrap.dll
2020-08-11 10:38:49 +02:00
Delete $INSTDIR\GiantsMain.exe
2020-08-10 07:26:15 +02:00
Delete $INSTDIR\*.vso
Delete $INSTDIR\*.pso
SetOutPath "$INSTDIR"
File /r "Files\*.*"
; remove old mods (may have compatibility issues)
Delete $INSTDIR\bin\worldlist2.bin
Delete $INSTDIR\bin\worldlist3.bin
Delete $INSTDIR\bin\worldlist4.bin
Delete $INSTDIR\bin\worldlist5.bin
Delete $INSTDIR\bin\mappack1.gzp
Delete $INSTDIR\bin\A-GRM1.gzp
SectionEnd
2020-08-11 08:38:26 +02:00
!define NETVersion "4.7.2"
!define NETInstallerFileName "NDP472-KB4054531-Web.exe"
!define NETInstallerPath "Files\Redist\NDP472-KB4054531-Web.exe"
2020-08-10 07:26:15 +02:00
Section "MS .NET Framework v${NETVersion}" SecFramework
IfFileExists "$WINDIR\Microsoft.NET\Framework\v${NETVersion}" NETFrameworkInstalled 0
2020-08-11 08:38:26 +02:00
File /oname=$TEMP\${NETInstallerFileName} "${NETInstallerPath}"
!insertmacro CheckNetFramework 472
2020-08-10 07:26:15 +02:00
Return
NETFrameworkInstalled:
DetailPrint "Microsoft .NET Framework is already installed!"
SectionEnd
2020-08-11 08:38:26 +02:00
2020-08-10 07:26:15 +02:00
;--------------------------------
;Installer Functions
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
;--------------------------------