scriptable-client-installers/Project-BO4/BO4_Installer.nsi
2024-02-27 05:30:24 -05:00

98 lines
3.1 KiB
Plaintext

!include "MUI2.nsh"
!include "WinVer.nsh"
!include "nsDialogs.nsh"
; Constants
!define PRODUCT_NAME "Project-BO4"
!define PRODUCT_DESCRIPTION "Call of Duty Black Ops 4 Client"
!define COPYRIGHT "Created by Ahrimdon - Free and Open Source"
!define PRODUCT_VERSION "1.0.0.0"
!define SETUP_VERSION "1.0.0.0"
; Attributes
Name "${PRODUCT_NAME}"
OutFile "build\BO4Installer.exe"
InstallDir "$EXEDIR"
RequestExecutionLevel user ; Request user-level execution, not admin
; Version Info
VIProductVersion "${PRODUCT_VERSION}"
VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
VIAddVersionKey "FileDescription" "${PRODUCT_DESCRIPTION}"
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
VIAddVersionKey "FileVersion" "${SETUP_VERSION}"
; Modern UI Appearance
!define MUI_ICON "Contrib\Graphics\Icons\icon.ico"
!define MUI_UNICON "Contrib\Graphics\Icons\icon.ico"
!define MUI_HEADERIMAGE
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_TEXT "Setup has finished installing ${PRODUCT_NAME} on your computer.$\nClick Finish to close this wizard.$\n$\nRun the BlackOps4_boot.exe application from within your Call of Duty Black Ops 4 game folder or use the Desktop shortcut."
; Modern UI Settings
!define MUI_ABORTWARNING
!define MUI_UNABORTWARNING
!define MUI_FINISHPAGE_SHOWREADME ""
!define MUI_FINISHPAGE_SHOWREADME_CHECKED
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpageaction
; Show details by default
ShowInstDetails show
ShowUninstDetails show
; Installer Images
!define MUI_WELCOMEFINISHPAGE_BITMAP "Contrib\Graphics\Assets\logo-cropped.bmp"
!define MUI_HEADERIMAGE_BITMAP "Contrib\Graphics\Assets\banner-bo4-title.bmp" ; For installer header
; Uninstaller Images
!define MUI_UNHEADERIMAGE_BITMAP "Contrib\Graphics\Assets\banner-bo4-title.bmp" ; For uninstaller header
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "Contrib\Graphics\Assets\logo-cropped.bmp" ; For uninstaller finish page
; Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
; Languages
!insertmacro MUI_LANGUAGE "English"
Function .onInit
MessageBox MB_OKCANCEL|MB_ICONINFORMATION "Place the installer in your Call of Duty Black Ops 4 game folder. Click OK to continue or Cancel to exit." IDOK done
Abort
done:
FunctionEnd
; Sections
Section "Main Application" SecMain
SetOutPath $INSTDIR
File "game\d3d11.dll"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "LPC Files" SecLPCFiles
SetOutPath $INSTDIR\LPC
File /r "game\base_game_dir\LPC\*.*"
SectionEnd
Function finishpageaction
SetOutPath $INSTDIR
CreateShortcut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\BlackOps4_boot.exe" "" "$INSTDIR\BlackOps4_boot.exe"
FunctionEnd
; Uninstaller Sections
Section "Uninstall"
Delete "$INSTDIR\d3d11.dll"
Delete "$INSTDIR\project-bo4.json"
Delete "$INSTDIR\project-bo4.log"
RMDir /r $INSTDIR\project-bo4
RMDir /r $INSTDIR\LPC
Delete "$INSTDIR\Uninstall.exe"
RMDir $INSTDIR
SectionEnd