t7x/installer/t7x_Installer.nsi

142 lines
4.3 KiB
Plaintext
Raw Normal View History

2024-03-11 05:03:16 -04:00
!include "MUI2.nsh"
!include "WinVer.nsh"
!include "nsDialogs.nsh"
; Constants
!define PRODUCT_NAME "T7x"
2024-03-11 05:03:16 -04:00
!define PRODUCT_DESCRIPTION "Call of Duty Black Ops III Client"
!define COPYRIGHT "Created by Ahrimdon (FOSS)"
2024-03-11 05:03:16 -04:00
!define PRODUCT_VERSION "1.0.0.0"
!define SETUP_VERSION "1.0.0.0"
; Attributes
Name "${PRODUCT_NAME}"
OutFile "build\t7xInstaller.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 "assets\graphics\icons\icon.ico"
!define MUI_UNICON "assets\graphics\icons\icon.ico"
2024-03-11 05:03:16 -04:00
!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.$\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 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 "assets\graphics\assets\logo-cropped.bmp"
!define MUI_HEADERIMAGE_BITMAP "assets\graphics\assets\banner-t7x-title.bmp" ; For installer header
2024-03-11 05:03:16 -04:00
; Uninstaller Images
!define MUI_UNHEADERIMAGE_BITMAP "assets\graphics\assets\banner-t7x-title.bmp" ; For uninstaller header
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "assets\graphics\assets\logo-cropped.bmp" ; For uninstaller finish page
2024-03-11 05:03:16 -04:00
; Pages
!insertmacro MUI_PAGE_WELCOME
; !insertmacro MUI_PAGE_LICENSE "assets\text\readme.txt"
2024-03-11 05:03:16 -04:00
!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 III game folder. Click OK to continue or Cancel to exit." IDOK done
Abort
done:
FunctionEnd
; Sections
Section "Main Application" SecMain
SetOutPath $INSTDIR
File "..\build\bin\x64\Release\t7x.exe"
File "..\cfg\README.md"
File "..\cfg\T7x_CP_Server.bat"
File "..\cfg\T7x_MP_Server.bat"
File "..\cfg\T7x_ZM_Server.bat"
2024-03-11 05:03:16 -04:00
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Game Directory T7x Files" SecT7xData
2024-03-11 05:03:16 -04:00
SetOutPath $INSTDIR\t7x
File /r "..\cfg\t7x\*.*"
2024-03-11 05:03:16 -04:00
SectionEnd
Section "Game Directory T7x Player Files" SecT7xPlayerData
SetOutPath $INSTDIR\t7x\players
File /r "assets\game\t7x\players\*.*"
SectionEnd
Section "Game Directory Zone Files" SecZoneData
2024-03-11 05:03:16 -04:00
SetOutPath $INSTDIR\zone
File /r "..\cfg\zone\*.*"
2024-03-11 05:03:16 -04:00
SectionEnd
Section "LocalAppData Extension File" SecExt
2024-03-11 05:03:16 -04:00
SetOutPath $LOCALAPPDATA\t7x
File "..\ext.dll"
SectionEnd
Section "LocalAppData Data Files" SecData
SetOutPath $LOCALAPPDATA\t7x\data
File /r "..\data\*.*"
2024-03-11 05:03:16 -04:00
SectionEnd
Section "LocalAppData Cache Files" SecCache
SetOutPath $LOCALAPPDATA\cache
File "..\cache\cache.bin"
File "..\cache\data.bin"
2024-03-11 05:03:16 -04:00
SectionEnd
Function finishpageaction
SetOutPath $INSTDIR
CreateShortcut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\t7x.exe" "" "$INSTDIR\t7x.exe"
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"
Delete $LOCALAPPDATA\cache\cache.bin
Delete $LOCALAPPDATA\cache\data.bin
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
; FunctionEnd