2010-05-13 04:15:32 +00:00
2010-05-26 19:46:37 +00:00
; PCSX2 Full/Complete Install Package!
; (a NSIS installer script)
;
2010-05-15 13:13:55 +00:00
; Copyright 2009-2010 PCSX2 Dev Team
2010-05-26 19:46:37 +00:00
;
2009-08-30 01:48:08 +00:00
2010-05-13 20:22:00 +00:00
2010-05-17 04:52:31 +00:00
!ifndef INC_PLUGINS
2010-05-26 19:46:37 +00:00
; Set to 0 to include the core binaries only (no plugins)
2010-05-17 04:52:31 +00:00
!define INC_PLUGINS 1
!endif
2010-05-15 13:13:55 +00:00
2010-05-17 04:52:31 +00:00
!ifndef INC_CRT_2008
2010-05-26 19:46:37 +00:00
; Set to 0 to disable inclusion of Visual Studio 2008 SP1 CRT Redists
!define INC_CRT_2008 1
2010-05-17 04:52:31 +00:00
!endif
2010-05-15 13:13:55 +00:00
2010-05-17 04:52:31 +00:00
!ifndef INC_CRT_2010
2010-05-26 19:46:37 +00:00
; Set to 0 to disable inclusion of Visual Studio 2010 CRT Redists
2010-05-17 04:52:31 +00:00
!define INC_CRT_2010 1
!endif
2010-05-15 13:13:55 +00:00
2010-05-17 04:52:31 +00:00
!ifndef INC_LANGS
2010-05-26 19:46:37 +00:00
; Set to 1 to enable inclusion of Languages folders (which are currently missing in 0.9.7)
2010-05-17 04:52:31 +00:00
!define INC_LANGS 0
!endif
2010-05-15 13:13:55 +00:00
2010-05-17 04:52:31 +00:00
!include "SharedSettings.nsh"
2010-05-15 13:13:55 +00:00
; The name of the installer
Name "${APP_NAME}"
OutFile "${APP_FILENAME}-setup.exe"
; The default installation directory
InstallDir "$PROGRAMFILES\PCSX2 ${APP_VERSION}"
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey ${INSTDIR_REG_ROOT} "Software\PCSX2" "Install_Dir"
; These defines are dependent on NSIS vars assigned above.
!define APP_EXE "$INSTDIR\${APP_FILENAME}.exe"
!define INSTDIR_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_FILENAME}"
Var DirectXSetupError
2009-08-30 01:48:08 +00:00
2010-05-15 13:13:55 +00:00
!include "MUI2.nsh"
!include "AdvUninstLog.nsh"
2009-08-30 01:48:08 +00:00
2010-05-17 04:52:31 +00:00
; UNINSTALL.LOG_OPEN_INSTALL_SECTION {section_name}
; UNINSTALL.LOG_CLOSE_INSTALL_SECTION {section_name}
;
; Advanced Uninstaller Extension: This allows us to safely log to arbitrary "sections" of
; installation of our choosing, without having to rely on $OUTDIR (which is how the default
; provided LOG_OPEN_INSTALL works). In other words, different files in the same folder can
; be added to different install lists. :)
;
!macro UNINSTALL.LOG_OPEN_INSTALL_SECTION SectionName
!verbose push
!verbose ${UNINST_LOG_VERBOSE}
StrCmp $unlog_error "error" +2
${uninstall.log_install} "${EXCLU_LIST}" "${UNINST_DAT}" "${SectionName}"
!verbose pop
!macroend
!macro UNINSTALL.LOG_CLOSE_INSTALL_SECTION SectionName
!verbose push
!verbose ${UNINST_LOG_VERBOSE}
!define ID ${__LINE__}
${uninstall.log_install} "${UNLOG_PART}${ID}" "${EXCLU_LIST}" "${SectionName}"
${uninstall.log_mergeID} "${UNLOG_PART}${ID}"
!undef ID ${__LINE__}
!verbose pop
!macroend
2010-05-15 13:13:55 +00:00
; =======================================================================
; Vista/Win7 UAC Stuff
; =======================================================================
2010-05-13 04:15:32 +00:00
2010-05-15 13:13:55 +00:00
!include "IsUserAdmin.nsi"
2009-08-30 01:48:08 +00:00
2010-05-15 13:13:55 +00:00
; Allow admin-rights PCSX2 users to be hardcore!
AllowRootDirInstall true
2009-08-30 01:48:08 +00:00
2010-05-15 13:13:55 +00:00
; FIXME !!
; Request application privileges for Windows Vista/7; I'd love for this to be sensible about which
; execution level it requests, but UAC is breaking my mind. I included some code for User type
; detection in function IsUserAdmin, but not really using it constructively yet. (see also our
; uses of SetShellVarContext in the installer sections)
RequestExecutionLevel admin
2009-08-30 01:48:08 +00:00
2010-05-15 13:13:55 +00:00
; This defines the Advanced Uninstaller mode of operation...
!insertmacro UNATTENDED_UNINSTALL
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "banner.bmp"
2010-05-17 04:52:31 +00:00
;!define MUI_COMPONENTSPAGE_NODESC
!define MUI_COMPONENTSPAGE_SMALLDESC
2010-05-15 13:13:55 +00:00
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_COMPONENTS
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
2010-05-17 04:52:31 +00:00
!include "ApplyExeProps.nsh"
!include "SharedRedtape.nsh"
2010-05-15 13:13:55 +00:00
; =======================================================================
; Installer Sections
; =======================================================================
2009-08-30 01:48:08 +00:00
2010-05-15 13:13:55 +00:00
; -----------------------------------------------------------------------
2009-08-30 01:48:08 +00:00
; Basic section (emulation proper)
2010-05-17 04:52:31 +00:00
Section "!${APP_NAME} (required)" SEC_CORE
2009-08-30 01:48:08 +00:00
SectionIn RO
2010-05-15 13:13:55 +00:00
2010-05-17 04:52:31 +00:00
!include "SectionCoreReqs.nsh"
2009-09-20 20:54:45 +00:00
2010-05-15 13:13:55 +00:00
; ------------------------------------------
; -- Plugins Section --
; ------------------------------------------
2009-08-30 01:48:08 +00:00
2010-05-17 04:52:31 +00:00
!if ${INC_PLUGINS} > 0
2009-09-20 20:54:45 +00:00
2010-05-17 04:52:31 +00:00
SetOutPath "$INSTDIR\Plugins"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
2009-09-20 20:54:45 +00:00
2010-05-17 04:52:31 +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=zerogs-r${SVNREV_ZEROGS}.dll ..\bin\Plugins\zerogs.dll
2010-05-15 16:37:21 +00:00
2010-05-17 04:52:31 +00:00
File /nonfatal /oname=spu2-x-r${SVNREV_SPU2X}.dll ..\bin\Plugins\spu2-x.dll
File /nonfatal /oname=zerospu2-r${SVNREV_ZEROSPU2}.dll ..\bin\Plugins\zerospu2.dll
2010-05-15 16:37:21 +00:00
2010-05-17 04:52:31 +00:00
File /nonfatal /oname=cdvdiso-r${SVNREV_CDVDISO}.dll ..\bin\Plugins\cdvdiso.dll
File ..\bin\Plugins\cdvdGigaherz.dll
2010-05-15 16:37:21 +00:00
2010-05-17 04:52:31 +00:00
File /nonfatal /oname=lilypad-r${SVNREV_LILYPAD}.dll ..\bin\Plugins\lilypad.dll
File ..\bin\Plugins\PadSSSPSX.dll
2010-05-15 16:37:21 +00:00
;File ..\bin\Plugins\FWlinuz.dll
2009-08-30 01:48:08 +00:00
2010-05-15 13:13:55 +00:00
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
2010-05-17 04:52:31 +00:00
!endif
2009-08-30 01:48:08 +00:00
SectionEnd
2010-05-15 13:13:55 +00:00
; -----------------------------------------------------------------------
2010-05-13 13:21:45 +00:00
; Start Menu - Optional section (can be disabled by the user)
2010-05-17 04:52:31 +00:00
Section "Start Menu Shortcuts" SEC_STARTMENU
2009-08-30 01:48:08 +00:00
2010-05-17 04:52:31 +00:00
; CreateShortCut gets the working directory from OutPath
2010-05-13 20:22:00 +00:00
SetOutPath "$INSTDIR"
CreateDirectory "$SMPROGRAMS\PCSX2"
2010-05-15 13:13:55 +00:00
CreateShortCut "$SMPROGRAMS\PCSX2\Uninstall ${APP_NAME}.lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
CreateShortCut "$SMPROGRAMS\PCSX2\${APP_NAME}.lnk" "${APP_EXE}" "" "${APP_EXE}" 0
2009-09-20 20:54:45 +00:00
2010-05-13 04:15:32 +00:00
;IfFileExists ..\bin\pcsx2-dev.exe 0 +2
2010-05-13 13:21:45 +00:00
; CreateShortCut "PCSX2\pcsx2-dev-r${SVNREV}.lnk" "$INSTDIR\pcsx2-dev-r${SVNREV}.exe" "" "$INSTDIR\pcsx2-dev-r${SVNREV}.exe" 0 "" "" \
2010-05-13 04:15:32 +00:00
; "PCSX2 Devel (has additional logging support)"
2009-08-30 01:48:08 +00:00
SectionEnd
2010-05-15 13:13:55 +00:00
; -----------------------------------------------------------------------
2010-05-13 13:21:45 +00:00
; Desktop Icon - Optional section (can be disabled by the user)
2010-05-17 04:52:31 +00:00
Section "Desktop Shortcut" SEC_DESKTOP
2010-05-13 13:21:45 +00:00
2010-05-13 20:22:00 +00:00
; CreateShortCut gets the working directory from OutPath
SetOutPath "$INSTDIR"
2010-05-15 14:26:13 +00:00
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "${APP_EXE}" "" "${APP_EXE}" 0 "" "" "A Playstation 2 Emulator"
2010-05-13 13:21:45 +00:00
SectionEnd
2010-05-15 13:13:55 +00:00
; -----------------------------------------------------------------------
; MSVC Redistributable - required if the user does 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.
2010-05-17 04:52:31 +00:00
;
; IMPORTANT: Online references for how to detect the presence of the VS2008 redists LIE.
; None of the methods are reliable, because the registry keys placed by the MSI installer
; vary depending on operating system *and* MSI installer version (youch).
;
!if ${INC_CRT_2008} > 0
Section "Microsoft Visual C++ 2008 SP1 Redist (required)" SEC_CRT2008
2010-05-15 13:13:55 +00:00
SectionIn RO
2010-05-17 04:52:31 +00:00
; Downloaded from:
; http://download.microsoft.com/download/d/d/9/dd9a82d0-52ef-40db-8dab-795376989c03/vcredist_x86.exe
2010-05-15 13:13:55 +00:00
SetOutPath "$TEMP"
2010-05-17 04:52:31 +00:00
File "vcredist_2008_sp1_x86.exe"
2010-05-15 17:43:44 +00:00
DetailPrint "Running Visual C++ 2008 SP1 Redistributable Setup..."
2010-05-17 04:52:31 +00:00
ExecWait '"$TEMP\vcredist_2008_sp1_x86.exe" /qb'
2010-05-15 17:43:44 +00:00
DetailPrint "Finished Visual C++ 2008 SP1 Redistributable Setup"
2010-05-17 04:52:31 +00:00
Delete "$TEMP\vcredist_2008_sp1_x86.exe"
2010-05-15 14:26:13 +00:00
2010-05-15 13:13:55 +00:00
SectionEnd
2010-05-17 04:52:31 +00:00
!endif
!if ${INC_CRT_2010} > 0
Section "Microsoft Visual C++ 2010 Redist (recommended)" SEC_CRT2010
;SectionIn RO
; Detection made easy: Unlike previous redists, VC2010 now generates a platform
; independent key for checking availability.
; Downloaded from:
; http://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe
ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" "Installed"
IfErrors done
StrCmp $R0 "1" done
SetOutPath "$TEMP"
File "vcredist_2010_x86.exe"
DetailPrint "Running Visual C++ 2010 SP1 Redistributable Setup..."
ExecWait '"$TEMP\vcredist_2010_x86.exe" /qb'
DetailPrint "Finished Visual C++ 2010 SP1 Redistributable Setup"
Delete "$TEMP\vcredist_2010_x86.exe"
done:
SectionEnd
!endif
2010-05-15 13:13:55 +00:00
; -----------------------------------------------------------------------
2010-05-13 04:15:32 +00:00
; This section needs to be last, so that in case it fails, the rest of the program will
2010-05-15 13:13:55 +00:00
; be installed cleanly.
;
; This section could be optional, but why not? It's pretty painless to double-check that
; all the libraries are up-to-date.
;
2010-05-17 04:52:31 +00:00
Section "DirectX Web Setup (recommended)" SEC_DIRECTX
2010-05-13 04:15:32 +00:00
2010-05-17 04:52:31 +00:00
;SectionIn RO
2010-05-15 13:13:55 +00:00
2010-05-14 18:15:27 +00:00
SetOutPath "$TEMP"
File "dxwebsetup.exe"
DetailPrint "Running DirectX Web Setup..."
ExecWait '"$TEMP\dxwebsetup.exe" /Q' $DirectXSetupError
2010-05-13 04:15:32 +00:00
DetailPrint "Finished DirectX Web Setup"
2010-05-14 18:15:27 +00:00
Delete "$TEMP\dxwebsetup.exe"
SectionEnd
2010-05-13 04:15:32 +00:00
2010-05-15 13:13:55 +00:00
; =======================================================================
; Un.Installer Sections
; =======================================================================
2010-05-13 13:21:45 +00:00
2010-05-15 13:13:55 +00:00
; -----------------------------------------------------------------------
Section "Un.Core Executables ${APP_NAME}"
2009-09-20 20:54:45 +00:00
2010-05-15 13:13:55 +00:00
SetShellVarContext all
2009-09-20 20:54:45 +00:00
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR"
2010-05-13 13:21:45 +00:00
; Remove registry keys (but only the ones related to the installer -- user options remain)
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
2010-05-15 13:13:55 +00:00
SectionEnd
2010-05-14 18:15:27 +00:00
2010-05-15 13:13:55 +00:00
; -----------------------------------------------------------------------
Section "Un.Shared Components (DLLs, Languages, etc)"
2010-05-14 18:15:27 +00:00
2010-05-15 13:13:55 +00:00
MessageBox MB_YESNO "WARNING! If you have multiple versions of PCSX2 installed, removing all shared files will probably break them. Are you sure you want to proceed?" \
IDYES true IDNO false
2010-05-13 13:21:45 +00:00
2010-05-15 13:13:55 +00:00
true:
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Langs"
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Plugins"
2010-05-13 13:21:45 +00:00
2010-05-15 13:13:55 +00:00
; Kill the entire PCSX2 registry key.
2010-05-15 14:26:13 +00:00
DeleteRegKey ${INSTDIR_REG_ROOT} Software\PCSX2
2009-08-30 01:48:08 +00:00
2010-05-15 13:13:55 +00:00
false:
; User cancelled -- do nothing!!
2009-09-20 20:54:45 +00:00
2009-08-30 01:48:08 +00:00
SectionEnd
2010-05-17 04:52:31 +00:00
LangString DESC_CORE ${LANG_ENGLISH} "Core components (binaries, plugins, languages, etc)."
2009-09-20 20:54:45 +00:00
2010-05-17 04:52:31 +00:00
LangString DESC_STARTMENU ${LANG_ENGLISH} "Adds shortcuts for PCSX2 to the start menu (all users)."
LangString DESC_DESKTOP ${LANG_ENGLISH} "Adds a shortcut for PCSX2 to the desktop (all users)."
2009-08-30 01:48:08 +00:00
2010-05-17 04:52:31 +00:00
LangString DESC_CRT2008 ${LANG_ENGLISH} "The 2008 Redist is required by the PCSX2 binaries packaged in this installer."
LangString DESC_CRT2010 ${LANG_ENGLISH} "The 2010 Redist will be used by future PCSX2 plugins and updates, but is not (yet) necessary."
LangString DESC_DIRECTX ${LANG_ENGLISH} "Only uncheck this if you are quite certain your Direct3D runtimes are up to date."
2009-08-30 01:48:08 +00:00
2010-05-17 04:52:31 +00:00
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CORE} $(DESC_CORE)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_STARTMENU} $(DESC_STARTMENU)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} $(DESC_DESKTOP)
2009-08-30 01:48:08 +00:00
2010-05-23 15:20:52 +00:00
!if ${INC_CRT_2008} > 0
2010-05-17 04:52:31 +00:00
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CRT2008} $(DESC_CRT2008)
2010-05-23 15:20:52 +00:00
!endif
!if ${INC_CRT_2010} > 0
2010-05-17 04:52:31 +00:00
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CRT2010} $(DESC_CRT2010)
2010-05-23 15:20:52 +00:00
!endif
2010-05-17 04:52:31 +00:00
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DIRECTX} $(DESC_DIRECTX)
!insertmacro MUI_FUNCTION_DESCRIPTION_END