scriptable-client-installers/T7x/t7x_Installer.nsi
2023-12-16 17:48:54 -05:00

116 lines
3.4 KiB
Plaintext

!include "MUI2.nsh"
!include "WinVer.nsh"
!include "nsDialogs.nsh"
; Constants
!define PRODUCT_NAME "t7x"
!define PRODUCT_DESCRIPTION "Call of Duty Black Ops III 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\t7xInstaller.exe"
InstallDir "C:\Program Files (x86)\Steam\common\Call of Duty Black Ops III"
RequestExecutionLevel admin ; 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_RUN "$INSTDIR\t7x.exe"
!define MUI_FINISHPAGE_TEXT "Setup has finished installing ${PRODUCT_NAME} on your computer.$\n$\nClick Finish to close this wizard.$\n$\nRun the t7x.exe application from within your Call of Duty Black Ops 3 game folder or use the shortcut created on your Desktop."
; Modern UI Settings
!define MUI_ABORTWARNING
!define MUI_UNABORTWARNING
; Show details by default
ShowInstDetails show
ShowInstDetails show
; Installer Images
!define MUI_WELCOMEFINISHPAGE_BITMAP "assets\logo-cropped.bmp"
!define MUI_HEADERIMAGE_BITMAP "assets\banner-t7x-title.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "assets\logo-cropped.bmp" ; For uninstaller
; Pages
!insertmacro MUI_PAGE_WELCOME
;!insertmacro MUI_PAGE_LICENSE "Readme.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
; Languages
!insertmacro MUI_LANGUAGE "English"
; Sections
Section "Main Application" SecMain
SetOutPath $INSTDIR
File "game\t7x.exe"
File "game\base_game_dir\README.md"
File "game\base_game_dir\T7x_CP_Server.bat"
File "game\base_game_dir\T7x_MP_Server.bat"
File "game\base_game_dir\T7x_ZM_Server.bat"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Game Directory t7x Files" SecT7xData
SetOutPath $INSTDIR\t7x
File /r "game\base_game_dir\t7x\*.*"
SectionEnd
Section "Game Directory zone Files" SecZoneData
SetOutPath $INSTDIR\zone
File /r "game\base_game_dir\zone\*.*"
SectionEnd
Section "LocalAppData Files" SecData
SetOutPath $LOCALAPPDATA\t7x
File /r "game\localappdata\t7x\*.*"
SectionEnd
Var Checkbox
Function .onInit
; Initialize the checkbox value
StrCpy $Checkbox 1
FunctionEnd
; Uninstaller Sections
Section "Uninstall"
Delete $INSTDIR\t7x.exe
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
Delete "$INSTDIR\README.md"
Delete "$INSTDIR\T7x_CP_Server.bat"
Delete "$INSTDIR\T7x_MP_Server.bat"
Delete "$INSTDIR\T7x_ZM_Server.bat"
Delete "$INSTDIR\zone\server.cfg"
Delete "$INSTDIR\zone\server_cp.cfg"
Delete "$INSTDIR\zone\server_zm.cfg"
RMDir /r $INSTDIR\t7x
RMDir /r $LOCALAPPDATA\t7x
Delete "$INSTDIR\Uninstall.exe"
RMDir $INSTDIR
SectionEnd
; Create the desktop shortcut based on the checkbox state
Function .onInstSuccess
${If} $Checkbox == 1
SetOutPath "$INSTDIR"
CreateShortcut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\t7x.exe" "" "$INSTDIR\t7x.exe"
${EndIf}
FunctionEnd