2009-08-30 01:48:08 +00:00
|
|
|
; PCSX2 NSIS installer script
|
|
|
|
; loosely based on a collection of examples and on information from the wikipedia
|
|
|
|
|
|
|
|
; Application version, changed for each release to match the verision
|
|
|
|
|
|
|
|
; ----------------------------------------
|
|
|
|
; Determine the revision numbers of the various components
|
|
|
|
|
|
|
|
!system 'SubWCRev.exe ..\pcsx2 templates\svnrev_pcsx2.nsh svnrev_pcsx2.nsh'
|
|
|
|
|
|
|
|
!ifdef INC_PLUGINS
|
|
|
|
!system 'SubWCRev.exe ..\plugins\gsdx templates\svnrev_gsdx.nsh svnrev_gsdx.nsh'
|
|
|
|
!system 'SubWCRev.exe ..\plugins\spu2-x templates\svnrev_spu2x.nsh svnrev_spu2x.nsh'
|
|
|
|
!system 'SubWCRev.exe ..\plugins\cdvdiso templates\svnrev_cdvdiso.nsh svnrev_cdvdiso.nsh'
|
|
|
|
!system 'SubWCRev.exe ..\plugins\lilypad templates\svnrev_lilypad.nsh svnrev_lilypad.nsh'
|
|
|
|
!system 'SubWCRev.exe ..\plugins\zerogs\dx templates\svnrev_zerogs.nsh svnrev_zerogs.nsh'
|
|
|
|
!system 'SubWCRev.exe ..\plugins\zerospu2 templates\svnrev_zerospu2.nsh svnrev_zerospu2.nsh'
|
|
|
|
!endif
|
|
|
|
|
|
|
|
!include "svnrev_pcsx2.nsh"
|
|
|
|
|
|
|
|
!ifdef INC_PLUGINS
|
|
|
|
!include "svnrev_gsdx.nsh"
|
|
|
|
!include "svnrev_spu2x.nsh"
|
|
|
|
!include "svnrev_cdvdiso.nsh"
|
|
|
|
!include "svnrev_lilypad.nsh"
|
|
|
|
!include "svnrev_zerogs.nsh"
|
|
|
|
!include "svnrev_zerospu2.nsh"
|
|
|
|
!endif
|
|
|
|
|
|
|
|
; ----------------------------------------
|
|
|
|
|
2009-09-20 20:54:45 +00:00
|
|
|
!define APP_NAME "PCSX2 0.9.7.r${SVNREV}"
|
|
|
|
!define APP_FILENAME "pcsx2-0.9.7.r${SVNREV}"
|
2009-08-30 01:48:08 +00:00
|
|
|
|
|
|
|
!define INSTDIR_REG_ROOT "HKLM"
|
2009-09-20 20:54:45 +00:00
|
|
|
!define INSTDIR_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
|
2009-08-30 01:48:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
; ----------------------------------------
|
|
|
|
; Include Modern UI 2 and advanced log uninstaller.
|
|
|
|
|
|
|
|
!include "MUI2.nsh"
|
|
|
|
!include "AdvUninstLog.nsh"
|
|
|
|
|
|
|
|
; -------------------------------------
|
|
|
|
; Test if Visual Studio Redistributables 2008 SP1 installed
|
|
|
|
; Returns -1 if there is no VC redistributables intstalled
|
|
|
|
;
|
|
|
|
Function CheckVCRedist
|
|
|
|
|
|
|
|
Push $R0
|
|
|
|
ClearErrors
|
|
|
|
ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9A25302D-30C0-39D9-BD6F-21E6EC160475}" "Version"
|
|
|
|
|
2009-09-20 20:54:45 +00:00
|
|
|
; if VS 2008+ redist SP1 not installed, install it
|
2009-08-30 01:48:08 +00:00
|
|
|
IfErrors 0 VSRedistInstalled
|
|
|
|
StrCpy $R0 "-1"
|
|
|
|
|
|
|
|
VSRedistInstalled:
|
|
|
|
Exch $R0
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
2009-09-20 20:54:45 +00:00
|
|
|
; -------------------------------------
|
|
|
|
; Safe directory deletion code. :)
|
|
|
|
;
|
|
|
|
Function un.DeleteDirIfEmpty
|
|
|
|
FindFirst $R0 $R1 "$0\*.*"
|
|
|
|
strcmp $R1 "." 0 NoDelete
|
|
|
|
FindNext $R0 $R1
|
|
|
|
strcmp $R1 ".." 0 NoDelete
|
|
|
|
ClearErrors
|
|
|
|
FindNext $R0 $R1
|
|
|
|
IfErrors 0 NoDelete
|
|
|
|
FindClose $R0
|
|
|
|
Sleep 1000
|
|
|
|
RMDir "$0"
|
|
|
|
NoDelete:
|
|
|
|
FindClose $R0
|
|
|
|
FunctionEnd
|
|
|
|
|
2009-08-30 01:48:08 +00:00
|
|
|
; ----------------------------------------
|
|
|
|
; The name of the installer
|
2009-09-20 20:54:45 +00:00
|
|
|
Name "${APP_NAME}"
|
2009-08-30 01:48:08 +00:00
|
|
|
|
2009-09-20 20:54:45 +00:00
|
|
|
OutFile "${APP_FILENAME}-setup.exe"
|
2009-08-30 01:48:08 +00:00
|
|
|
|
|
|
|
; The default installation directory
|
2009-09-20 20:54:45 +00:00
|
|
|
InstallDir "$PROGRAMFILES\PCSX2 0.9.7 beta"
|
2009-08-30 01:48:08 +00:00
|
|
|
|
|
|
|
; Registry key to check for directory (so if you install again, it will
|
|
|
|
; overwrite the old one automatically)
|
|
|
|
InstallDirRegKey HKLM "Software\pcsx2" "Install_Dir"
|
|
|
|
|
2009-09-20 20:54:45 +00:00
|
|
|
; Request application privileges for Windows Vista (shouldn't be needed anymore! -- air)
|
|
|
|
;RequestExecutionLevel admin
|
2009-08-30 01:48:08 +00:00
|
|
|
|
|
|
|
; Pages
|
|
|
|
|
|
|
|
!insertmacro UNATTENDED_UNINSTALL
|
|
|
|
!define MUI_COMPONENTSPAGE_NODESC ;no decription is really necessary at this stage...
|
|
|
|
!insertmacro MUI_PAGE_COMPONENTS
|
|
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
|
|
|
|
|
|
!insertmacro MUI_UNPAGE_CONFIRM
|
|
|
|
!insertmacro MUI_UNPAGE_COMPONENTS
|
|
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
|
|
|
|
|
|
|
|
|
; ----------------------------------------
|
|
|
|
; Basic section (emulation proper)
|
2009-09-20 20:54:45 +00:00
|
|
|
Section "${APP_NAME} (required)"
|
2009-08-30 01:48:08 +00:00
|
|
|
|
|
|
|
SectionIn RO
|
|
|
|
|
|
|
|
; Put file there. It's catched by the uninstaller script
|
|
|
|
SetOutPath $INSTDIR
|
|
|
|
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
|
2009-09-20 20:54:45 +00:00
|
|
|
File /oname=pcsx2-r${SVNREV}.exe ..\bin\pcsx2.exe
|
2009-08-30 01:48:08 +00:00
|
|
|
File /nonfatal /oname=pcsx2-dev-r${SVNREV}.exe ..\bin\pcsx2-dev.exe
|
2010-05-12 18:34:31 +00:00
|
|
|
File ..\bin\w32pthreads.v4.dll
|
2009-09-20 20:54:45 +00:00
|
|
|
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
|
|
|
|
|
|
|
|
; -- Languages and Patches --
|
2009-08-30 01:48:08 +00:00
|
|
|
|
|
|
|
SetOutPath $INSTDIR\Langs
|
2009-09-20 20:54:45 +00:00
|
|
|
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
|
|
|
|
File /nonfatal /r ..\bin\Langs\*.mo
|
|
|
|
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
|
2009-08-30 01:48:08 +00:00
|
|
|
|
|
|
|
SetOutPath $INSTDIR\Patches
|
2009-09-20 20:54:45 +00:00
|
|
|
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
|
2009-08-30 01:48:08 +00:00
|
|
|
File /r ..\bin\Patches\*.pnach
|
2009-09-20 20:54:45 +00:00
|
|
|
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
|
|
|
|
|
2009-08-30 01:48:08 +00:00
|
|
|
|
|
|
|
; NULL plugins are required, and really there should be more but we don't have working
|
2009-09-20 20:54:45 +00:00
|
|
|
; SPU2 or GS null plugins right now. (note: no install logging performed here -- nulls
|
|
|
|
; are removed manually by name)
|
2009-08-30 01:48:08 +00:00
|
|
|
|
2009-09-20 20:54:45 +00:00
|
|
|
SetOutPath $INSTDIR\Plugins
|
2009-08-30 01:48:08 +00:00
|
|
|
File ..\bin\Plugins\USBnull.dll
|
|
|
|
File ..\bin\Plugins\DEV9null.dll
|
|
|
|
File ..\bin\Plugins\FWnull.dll
|
|
|
|
File ..\bin\Plugins\CDVDnull.dll
|
|
|
|
|
2009-09-20 20:54:45 +00:00
|
|
|
; -- Other plugins --
|
|
|
|
|
2009-08-30 01:48:08 +00:00
|
|
|
!ifdef INC_PLUGINS
|
2009-09-20 20:54:45 +00:00
|
|
|
|
2009-08-30 01:48:08 +00:00
|
|
|
SetOutPath $INSTDIR\Plugins
|
2009-09-20 20:54:45 +00:00
|
|
|
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
|
|
|
|
|
2009-08-30 01:48:08 +00:00
|
|
|
File /nonfatal /oname=gsdx-sse2-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-sse2.dll
|
|
|
|
File /nonfatal /oname=gsdx-ssse3-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-ssse3.dll
|
|
|
|
File /nonfatal /oname=gsdx-sse4-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-sse4.dll
|
|
|
|
File /nonfatal /oname=spu2-x-r${SVNREV_SPU2X}.dll ..\bin\Plugins\spu2-x.dll
|
|
|
|
File /nonfatal /oname=cdvdiso-r${SVNREV_CDVDISO}.dll ..\bin\Plugins\cdvdiso.dll
|
|
|
|
File /nonfatal /oname=lilypad-r${SVNREV_LILYPAD}.dll ..\bin\Plugins\lilypad.dll
|
|
|
|
|
|
|
|
File /nonfatal /oname=zerogs-r${SVNREV_ZEROGS}.dll ..\bin\Plugins\zerogs.dll
|
|
|
|
File /nonfatal /oname=zerospu2-r${SVNREV_ZEROSPU2}.dll ..\bin\Plugins\zerospu2.dll
|
|
|
|
|
|
|
|
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
|
2009-09-20 20:54:45 +00:00
|
|
|
!endif
|
|
|
|
|
2009-08-30 01:48:08 +00:00
|
|
|
; Write the installation path into the registry
|
|
|
|
WriteRegStr HKLM Software\pcsx2 "Install_Dir" "$INSTDIR"
|
|
|
|
|
|
|
|
; Write the uninstall keys for Windows
|
|
|
|
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "DisplayName" "PCSX2 - Playstation 2 Emulator"
|
2009-09-20 20:54:45 +00:00
|
|
|
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "UninstallString" '"$INSTDIR\${UNINST_EXE}-r${SVNREV}.exe"'
|
2009-08-30 01:48:08 +00:00
|
|
|
WriteRegDWORD HKLM "${INSTDIR_REG_KEY}" "NoModify" 1
|
|
|
|
WriteRegDWORD HKLM "${INSTDIR_REG_KEY}" "NoRepair" 1
|
2009-09-20 20:54:45 +00:00
|
|
|
WriteUninstaller "${UNINST_EXE}-r${SVNREV}.exe"
|
2009-08-30 01:48:08 +00:00
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
; ----------------------------------------
|
|
|
|
; MSVC Redistributable - required if the user des not already have it
|
|
|
|
; Note: if your NSIS generates an error here it means you need to download the latest
|
|
|
|
; visual studio redist package from microsoft. Any redist 2008/SP1 or newer will do.
|
|
|
|
Section "Microsoft Visual C++ 2008 SP1 Redist (required)"
|
|
|
|
|
|
|
|
SectionIn RO
|
|
|
|
SetOutPath $TEMP
|
|
|
|
File "vcredist_x86.exe"
|
|
|
|
Call CheckVCRedist
|
|
|
|
StrCmp $R0 "-1" installRedist
|
|
|
|
DetailPrint "Visual C++ 2008 SP1 Redistributable already installed, skipping..."
|
|
|
|
Goto skipRedist
|
|
|
|
|
|
|
|
installRedist:
|
|
|
|
ExecWait "$TEMP\vcredist_x86.exe"
|
|
|
|
|
|
|
|
SkipRedist:
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
; ----------------------------------------
|
|
|
|
; Optional sections (can be disabled by the user)
|
|
|
|
Section "Start Menu Shortcuts"
|
|
|
|
|
|
|
|
SetOutPath $INSTDIR
|
|
|
|
|
|
|
|
CreateDirectory "$SMPROGRAMS\pcsx2"
|
2009-09-20 20:54:45 +00:00
|
|
|
CreateShortCut "$SMPROGRAMS\pcsx2\${UNINST_EXE}-r${SVNREV}.lnk" "$INSTDIR\${UNINST_EXE}-r${SVNREV}.exe" "" "$INSTDIR\${UNINST_EXE}-r${SVNREV}.exe" 0
|
|
|
|
CreateShortCut "$SMPROGRAMS\pcsx2\pcsx2-r${SVNREV}.lnk" "$INSTDIR\pcsx2-r${SVNREV}.exe" "" "$INSTDIR\pcsx2-r${SVNREV}.exe" 0
|
|
|
|
|
|
|
|
IfFileExists ..\bin\pcsx2-dev.exe 0 +2
|
|
|
|
CreateShortCut "$SMPROGRAMS\pcsx2\pcsx2-dev-r${SVNREV}.lnk" "$INSTDIR\pcsx2-dev-r${SVNREV}.exe" "" "$INSTDIR\pcsx2-dev-r${SVNREV}.exe" 0 "" "" \
|
|
|
|
"PCSX2 Devel (has additional logging support)"
|
2009-08-30 01:48:08 +00:00
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
|
|
|
|
Function .onInit
|
|
|
|
|
|
|
|
;prepare log always within .onInit function
|
|
|
|
!insertmacro UNINSTALL.LOG_PREPARE_INSTALL
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
|
|
|
|
Function .onInstSuccess
|
|
|
|
|
|
|
|
;create/update log always within .onInstSuccess function
|
|
|
|
!insertmacro UNINSTALL.LOG_UPDATE_INSTALL
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
|
|
|
|
; --------------------------------------
|
|
|
|
; Uninstaller
|
|
|
|
|
2010-05-12 18:34:31 +00:00
|
|
|
Function un.removeShorties
|
2009-09-20 20:54:45 +00:00
|
|
|
|
|
|
|
; Remove shortcuts, if any
|
|
|
|
Delete "$SMPROGRAMS\pcsx2\${UNINST_EXE}-r${SVNREV}.lnk"
|
|
|
|
Delete "$SMPROGRAMS\pcsx2\pcsx2-r${SVNREV}.lnk"
|
|
|
|
Delete "$SMPROGRAMS\pcsx2\pcsx2-dev-r${SVNREV}.lnk"
|
|
|
|
|
|
|
|
StrCpy $0 "$SMPROGRAMS\pcsx2"
|
|
|
|
Call un.DeleteDirIfEmpty
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
; Languages, patches, and null plugins should only be removed if all previous versions of
|
|
|
|
; PCSX2 have been uninstalled. And we know that's happened when the pcsx2\versions registry
|
|
|
|
; key is empty.
|
2010-05-12 18:34:31 +00:00
|
|
|
Function un.removeSharedJunk
|
2009-09-20 20:54:45 +00:00
|
|
|
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Langs"
|
|
|
|
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Patches"
|
|
|
|
|
|
|
|
Delete "$INSTDIR\Plugins\USBnull.dll"
|
|
|
|
Delete "$INSTDIR\Plugins\DEV9null.dll"
|
|
|
|
Delete "$INSTDIR\Plugins\FWnull.dll"
|
|
|
|
Delete "$INSTDIR\Plugins\CDVDnull.dll"
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
|
|
|
|
Section "Un.Basic Removal (removes only files installed by this package) ${APP_NAME}"
|
|
|
|
|
|
|
|
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR"
|
|
|
|
|
|
|
|
MessageBox MB_YESNO "Also remove plugins that were installed with this package?" IDYES true IDNO false
|
|
|
|
true:
|
|
|
|
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Plugins"
|
|
|
|
false:
|
|
|
|
|
|
|
|
!insertmacro UNINSTALL.LOG_END_UNINSTALL
|
2009-08-30 01:48:08 +00:00
|
|
|
|
|
|
|
; Remove registry keys
|
2010-05-12 18:34:31 +00:00
|
|
|
DeleteRegKey HKLM "${INSTDIR_REG_KEY}"
|
2009-08-30 01:48:08 +00:00
|
|
|
|
2010-05-12 18:34:31 +00:00
|
|
|
Call un.removeShorties
|
2009-08-30 01:48:08 +00:00
|
|
|
|
|
|
|
DeleteRegKey ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}"
|
|
|
|
|
2009-09-20 20:54:45 +00:00
|
|
|
; And remove the install dir but only if it's clean of user content:
|
|
|
|
StrCpy $0 "$INSTDIR"
|
|
|
|
Call un.DeleteDirIfEmpty
|
|
|
|
|
2009-08-30 01:48:08 +00:00
|
|
|
SectionEnd
|
|
|
|
|
2010-05-12 18:34:31 +00:00
|
|
|
Section "Un.Full Removal (completely removes all PCSX2 program files and folders)"
|
2009-08-30 01:48:08 +00:00
|
|
|
|
2009-09-20 20:54:45 +00:00
|
|
|
MessageBox MB_YESNO "WARNING! This will remove *all* files in $INSTDIR -- are you sure you want to proceed?" IDYES true IDNO false
|
2009-08-30 01:48:08 +00:00
|
|
|
true:
|
2009-09-20 20:54:45 +00:00
|
|
|
|
2009-08-30 01:48:08 +00:00
|
|
|
RMDir /r "$INSTDIR"
|
2010-05-12 18:34:31 +00:00
|
|
|
Call un.removeShorties
|
2009-09-20 20:54:45 +00:00
|
|
|
|
2009-08-30 01:48:08 +00:00
|
|
|
DeleteRegKey ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}"
|
2009-09-20 20:54:45 +00:00
|
|
|
DeleteRegKey HKLM Software\pcsx2
|
2009-08-30 01:48:08 +00:00
|
|
|
|
2009-09-20 20:54:45 +00:00
|
|
|
false:
|
2009-08-30 01:48:08 +00:00
|
|
|
SectionEnd
|
|
|
|
|
2009-09-20 20:54:45 +00:00
|
|
|
; --------------------------------------
|
2009-08-30 01:48:08 +00:00
|
|
|
Function UN.onInit
|
|
|
|
|
|
|
|
;begin uninstall, could be added on top of uninstall section instead
|
|
|
|
!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|