Play-/installer_win32/installer64.nsi

161 lines
4.2 KiB
NSIS
Raw Permalink Normal View History

2015-03-28 23:13:36 -04:00
!include "MUI2.nsh"
!include "x64.nsh"
2020-08-10 18:55:41 -04:00
!define BINARY_INPUT_PATH "..\build\Source\ui_qt\Release"
; Get version info from git repo
!tempfile GitDescribeOut
!system '"git" describe > "${GitDescribeOut}"'
!searchparse /file "${GitDescribeOut}" "" APP_VERSION
!undef GitDescribeOut
2015-03-28 23:13:36 -04:00
; The name of the installer
Name "Play! v${APP_VERSION}"
; The file to write
OutFile "Play-x86-64.exe"
2015-03-28 23:13:36 -04:00
; The default installation directory
InstallDir $PROGRAMFILES64\Play
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\NSIS_Play" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; Pages
;Page components
;Page directory
;Page instfiles
;UninstPage uninstConfirm
;UninstPage instfiles
;--------------------------------
!define REG_UNINSTALL "Software\Microsoft\Windows\CurrentVersion\Uninstall\Play"
; The stuff to install
Section "Play! (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
CreateDirectory $INSTDIR\platforms
CreateDirectory $INSTDIR\styles
CreateDirectory $INSTDIR\imageformats
2022-10-18 09:19:16 -04:00
CreateDirectory $INSTDIR\arcadedefs
2015-03-28 23:13:36 -04:00
; Put file there
2020-08-10 18:55:41 -04:00
File "${BINARY_INPUT_PATH}\Play.exe"
File "${BINARY_INPUT_PATH}\Qt5Core.dll"
File "${BINARY_INPUT_PATH}\Qt5Gui.dll"
File "${BINARY_INPUT_PATH}\Qt5Widgets.dll"
File /oname=platforms\qwindows.dll "${BINARY_INPUT_PATH}\platforms\qwindows.dll"
File /oname=styles\qwindowsvistastyle.dll "${BINARY_INPUT_PATH}\styles\qwindowsvistastyle.dll"
File /oname=imageformats\qjpeg.dll "${BINARY_INPUT_PATH}\imageformats\qjpeg.dll"
2025-01-13 18:15:07 -05:00
File "..\GameConfig.xml"
2022-02-18 23:11:41 +00:00
File "..\states.db"
2022-12-20 15:37:34 -05:00
2022-10-18 09:19:16 -04:00
SetOutPath $INSTDIR\arcadedefs
File "..\arcadedefs\*.arcadedef"
2022-12-20 15:37:34 -05:00
SetOutPath $INSTDIR
2015-03-28 23:13:36 -04:00
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\NSIS_Play "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "${REG_UNINSTALL}" "DisplayName" "Play!"
2015-03-28 23:13:36 -04:00
WriteRegStr HKLM "${REG_UNINSTALL}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "${REG_UNINSTALL}" "NoModify" 1
WriteRegDWORD HKLM "${REG_UNINSTALL}" "NoRepair" 1
WriteRegStr HKLM "${REG_UNINSTALL}" "DisplayIcon" '"$INSTDIR\Play.exe"'
WriteRegStr HKLM "${REG_UNINSTALL}" "DisplayVersion" "${APP_VERSION}"
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\Play!"
CreateShortCut "$SMPROGRAMS\Play!\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\Play!\Play!.lnk" "$INSTDIR\Play.exe" "" "$INSTDIR\Play.exe" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
SetRegView 64
; Remove registry keys
DeleteRegKey HKLM "${REG_UNINSTALL}"
DeleteRegKey HKLM SOFTWARE\NSIS_Play
2015-03-28 23:13:36 -04:00
; Remove shortcuts, if any
Delete "$SMPROGRAMS\Play!\*.*"
; Remove files and uninstaller
Delete $INSTDIR\Play.exe
Delete $INSTDIR\Qt5Core.dll
Delete $INSTDIR\Qt5Gui.dll
Delete $INSTDIR\Qt5Widgets.dll
Delete $INSTDIR\platforms\qwindows.dll
Delete $INSTDIR\styles\qwindowsvistastyle.dll
Delete $INSTDIR\imageformats\qjpeg.dll
2025-01-13 18:15:07 -05:00
Delete $INSTDIR\GameConfig.xml
2022-02-18 23:11:41 +00:00
Delete $INSTDIR\states.db
2022-10-18 09:19:16 -04:00
Delete $INSTDIR\arcadedefs\*
Delete $INSTDIR\uninstall.exe
2015-03-28 23:13:36 -04:00
; Remove directories used
RMDir $INSTDIR\platforms
RMDir $INSTDIR\styles
RMDir $INSTDIR\imageformats
2022-10-18 09:19:16 -04:00
RMDir $INSTDIR\arcadedefs
2015-03-28 23:13:36 -04:00
RMDir "$SMPROGRAMS\Play!"
RMDir "$INSTDIR"
SectionEnd
# Installer functions
Function .onInit
${If} ${RunningX64}
${Else}
MessageBox MB_OK "This installer is for the 64-bits version of Windows. Bailing out."
Abort
${EndIf}
SetRegView 64
FunctionEnd