NSIS Installer:

* Added banner image
 * (UAC) Re-enabled forced-admin mode for now
 * Fixed a bug in the vc redist installer.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3016 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-05-15 13:13:55 +00:00
parent be28c5a745
commit 5ec274ca0a
4 changed files with 281 additions and 243 deletions

View File

@ -1,53 +1,60 @@
; Author: Lilla (lilla@earthlink.net) 2003-06-13
; function IsUserAdmin uses plugin \NSIS\PlusgIns\UserInfo.dll
; This function is based upon code in \NSIS\Contrib\UserInfo\UserInfo.nsi
; This function was tested under NSIS 2 beta 4 (latest CVS as of this writing).
;
; Usage:
; Call IsUserAdmin
; Pop $R0 ; at this point $R0 is "true" or "false"
;
Function IsUserAdmin Function IsUserAdmin
Push $R0
Push $R1
Push $R2
ClearErrors ClearErrors
UserInfo::GetName UserInfo::GetName
IfErrors Win9x IfErrors Win9x
Pop $R1
UserInfo::GetAccountType
Pop $R2
StrCmp $R2 "Admin" 0 Continue
; Observation: I get here when running Win98SE. (Lilla) Pop $0
; The functions UserInfo.dll looks for are there on Win98 too, UserInfo::GetAccountType
; but just don't work. So UserInfo.dll, knowing that admin isn't required Pop $1
; on Win98, returns admin anyway. (per kichik)
; MessageBox MB_OK 'User "$R1" is in the Administrators group'
StrCpy $R0 "true"
Goto Done
Continue: # GetOriginalAccountType will check the tokens of the original user of the
; You should still check for an empty string because the functions # current thread/process. If the user tokens were elevated or limited for
; UserInfo.dll looks for may not be present on Windows 95. (per kichik) # this process, GetOriginalAccountType will return the non-restricted
StrCmp $R2 "" Win9x # account type.
StrCpy $R0 "false" # On Vista with UAC, for example, this is not the same value when running
;MessageBox MB_OK 'User "$R1" is in the "$R2" group' # with `RequestExecutionLevel user`. GetOriginalAccountType will return
Goto Done # "admin" while GetAccountType will return "user".
UserInfo::GetOriginalAccountType
Pop $2
; Windows9x can sometimes return empty strings...
StrCmp $1 "" 0 +2
Goto Win9x
StrCmp $1 "Admin" 0 +3
DetailPrint '(UAC) User "$0" is in the Administrators group'
Goto done
StrCmp $1 "Power" 0 +3
DetailPrint '(UAC) User "$0" is in the Power Users group'
Goto done
StrCmp $1 "User" 0 +3
DetailPrint '(UAC) User "$0" is just a regular user'
Goto done
StrCmp $1 "Guest" 0 +3
; Guest account? Probably doomed to failure, but might as well try, just in case some shit
; is being mis-reported.
DetailPrint '(UAC) User "$0" is a guest -- this installer is probably going to fail. Good luck.'
Goto done
;MessageBox MB_OK "Unknown error while trying to detect "
DetailPrint "(UAC) Unknown error while trying to detect account type; assuming USER mode."
StrCpy $1 "User"
Goto done
Win9x:
# This one means you don't need to care about admin or
# not admin because Windows 9x doesn't either
MessageBox MB_OK "Error! PCSX2 requires Windows 2000 or newer to install and run!"
Quit
done:
; How to return the admin modeas a variable? NSIS confuses me -- air
;Exch $R0
Win9x:
; comment/message below is by UserInfo.nsi author:
; This one means you don't need to care about admin or
; not admin because Windows 9x doesn't either
;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
StrCpy $R0 "true"
Done:
;MessageBox MB_OK 'User= "$R1" AccountType= "$R2" IsUserAdmin= "$R0"'
Pop $R2
Pop $R1
Exch $R0
FunctionEnd FunctionEnd

BIN
nsis/banner.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -1,16 +1,60 @@
; PCSX2 NSIS installer script ; PCSX2 NSIS installer script
; loosely based on a collection of examples and on information from the wikipedia ; Copyright 2009-2010 PCSX2 Dev Team
; Application version, changed for each release to match the version ; Application version, changed for each release to match the version
; Always include plugins for now ; Uncomment this to create a package that includes binaries and binary dependencies only.
!define INC_PLUGINS !define INC_PLUGINS
; ----------------------------------------
; Determine the revision numbers of the various components
!system 'SubWCRev.exe ..\pcsx2 templates\svnrev_pcsx2.nsh svnrev_pcsx2.nsh' !system 'SubWCRev.exe ..\pcsx2 templates\svnrev_pcsx2.nsh svnrev_pcsx2.nsh'
!include "svnrev_pcsx2.nsh"
;LoadLanguageFile "${NSISDIR}\Contrib\Language files\english.nlf"
; =======================================================================
; Global Names and Such
; =======================================================================
!define APP_VERSION "0.9.7"
!define APP_NAME "PCSX2 ${APP_VERSION} (r${SVNREV})"
!define APP_FILENAME "pcsx2-r${SVNREV}"
!define UNINSTALL_LOG "Uninst-${APP_FILENAME}"
!define INSTDIR_REG_ROOT "HKLM"
; 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"
XPStyle on
; LZMA is the best, by far, so let's make sure it's always in use:
; (dictionaries larger than 24MB don't seem to help)
SetCompressor /SOLID lzma
SetCompressorDictSize 24
; 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
; =======================================================================
; Plugin Includes
; =======================================================================
; Note that zzOgl is disabled for now because it requires CG dependencies to be installed.
!ifdef INC_PLUGINS !ifdef INC_PLUGINS
!system 'SubWCRev.exe ..\plugins\gsdx templates\svnrev_gsdx.nsh svnrev_gsdx.nsh' !system 'SubWCRev.exe ..\plugins\gsdx templates\svnrev_gsdx.nsh svnrev_gsdx.nsh'
@ -18,38 +62,72 @@
!system 'SubWCRev.exe ..\plugins\cdvdiso templates\svnrev_cdvdiso.nsh svnrev_cdvdiso.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\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\zerogs\dx templates\svnrev_zerogs.nsh svnrev_zerogs.nsh'
;!system 'SubWCRev.exe ..\plugins\zzogl-pg templates\svnrev_zzogl.nsh svnrev_zzogl.nsh'
!system 'SubWCRev.exe ..\plugins\zerospu2 templates\svnrev_zerospu2.nsh svnrev_zerospu2.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_gsdx.nsh"
!include "svnrev_spu2x.nsh" !include "svnrev_spu2x.nsh"
!include "svnrev_cdvdiso.nsh" !include "svnrev_cdvdiso.nsh"
!include "svnrev_lilypad.nsh" !include "svnrev_lilypad.nsh"
!include "svnrev_zerogs.nsh" !include "svnrev_zerogs.nsh"
;!include "svnrev_zzogl.nsh"
!include "svnrev_zerospu2.nsh" !include "svnrev_zerospu2.nsh"
!endif !endif
; ----------------------------------------
!define APP_NAME "PCSX2 0.9.7 (r${SVNREV})"
!define APP_FILENAME "pcsx2-r${SVNREV}"
!define APP_EXE "${APP_FILENAME}.exe"
!define UNINSTALL_LOG "Uninst-${APP_FILENAME}"
!define INSTDIR_REG_ROOT "HKLM"
!define INSTDIR_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
; ----------------------------------------
; Include Modern UI 2 and advanced log uninstaller.
!include "MUI2.nsh" !include "MUI2.nsh"
!include "AdvUninstLog.nsh" !include "AdvUninstLog.nsh"
; =======================================================================
; Vista/Win7 UAC Stuff
; =======================================================================
!include "IsUserAdmin.nsi"
; Allow admin-rights PCSX2 users to be hardcore!
AllowRootDirInstall true
; 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
; This defines the Advanced Uninstaller mode of operation...
!insertmacro UNATTENDED_UNINSTALL
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "banner.bmp"
!define MUI_COMPONENTSPAGE_NODESC
!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"
; =======================================================================
; Setup.exe Properties
; =======================================================================
; (for the professionalism!!)
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${APP_NAME}"
;VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "A test comment"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© 2010 PCSX2 Dev Team"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Installs PCSX2, a Playstation 2 Emulator for the PC"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${APP_VERSION}.${SVNREV}"
VIProductVersion "${APP_VERSION}.${SVNREV}"
; =======================================================================
; Installer Sections
; =======================================================================
; ------------------------------------- ; -------------------------------------
; Test if Visual Studio Redistributables 2008 SP1 installed ; Test if Visual Studio Redistributables 2008 SP1 installed
; Returns -1 if there is no VC redistributables intstalled ; Returns -1 if there is no VC redistributables intstalled
@ -60,7 +138,6 @@ Function CheckVCRedist
ClearErrors ClearErrors
ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9A25302D-30C0-39D9-BD6F-21E6EC160475}" "Version" ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9A25302D-30C0-39D9-BD6F-21E6EC160475}" "Version"
; if VS 2008+ redist SP1 not installed, install it
IfErrors 0 VSRedistInstalled IfErrors 0 VSRedistInstalled
StrCpy $R0 "-1" StrCpy $R0 "-1"
@ -69,64 +146,28 @@ VSRedistInstalled:
FunctionEnd FunctionEnd
; ---------------------------------------- ; -----------------------------------------------------------------------
; The name of the installer
Name "${APP_NAME}"
OutFile "${APP_FILENAME}-setup.exe"
; The default installation directory
InstallDir "$PROGRAMFILES\PCSX2 0.9.7"
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\PCSX2" "Install_Dir"
; Allow PCSX2 users to be hardcore!
AllowRootDirInstall true
XPStyle on
; [TODO] / FIXME !!
; We need to detect the user's accessibility mode in order to select the right shell context. If the
; user is an admin, Windows7 and Vista will DEFAULT to an "all" shell context (installing shortcuts for all
; users), even if we don't want it to (which causes the uninstaller to fail!)
; If the user is not an admin, setting Shell Context to all will cause the installer to fail because the
; user won't have permission enough to install it at all (sigh).
;
; Solution! Detect the user's permission level, and install accordingly. I've included a script to do
; the detection in IsUserAdmin.nsh (untested, dunno if it compiles with latest NSIS). Now we just
; need to include it and call it, etc. :)
SetShellVarContext all
; Request application privileges for Windows Vista (shouldn't be needed anymore! -- air)
;RequestExecutionLevel admin
Var DirectXSetupError
; ----------------------------------------
; 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) ; Basic section (emulation proper)
Section "${APP_NAME} (required)" Section "${APP_NAME} (required)"
SectionIn RO SectionIn RO
; --- UAC NIGHTMARES ---
; Ideally this would default to 'current' for user-level installs and 'all' for admin-level installs.
; There are problems to be aware of, however!
;
; * If the user is an admin, Windows Vista/7 will DEFAULT to an "all" shell context (installing shortcuts
; for all users), even if we don't want it to (which causes the uninstaller to fail!)
; * If the user is not an admin, setting Shell Context to all will cause the installer to fail because the
; user won't have permission enough to install it at all (sigh).
;
; For now we just require Admin rights to install PCSX2. An ideal solution would be to use our IsUserAdmin
; function to auto-detect and modify nsis installer behavior accordingly.
;
; (note! the SetShellVarContext use in the uninstaller section must match this one!)
SetShellVarContext all
;SetShellVarContext current
; Note that v3 pthreads is compatible with v4 pthreads, so we just copy v4 oover both ; Note that v3 pthreads is compatible with v4 pthreads, so we just copy v4 oover both
; filenames. This allows many older plugin versions to continue to work. (note that ; filenames. This allows many older plugin versions to continue to work. (note that
@ -140,41 +181,41 @@ Section "${APP_NAME} (required)"
File /oname=w32pthreads.v3.dll ..\bin\w32pthreads.v4.dll File /oname=w32pthreads.v3.dll ..\bin\w32pthreads.v4.dll
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
; -- Languages and Patches -- ; ------------------------------------------
; -- Languages and Patches --
; ------------------------------------------
; In 0.9.7 there is only English, so including the other mo files (for now) is pointless. ; In 0.9.7 there is only English, so including the other mo files (for now) is pointless.
; This code will be re-enabled when the new GUI is translated. ; This code will be re-enabled when the new GUI is translated.
;SetOutPath $INSTDIR\Langs !ifdef INC_LANGS
;!insertmacro UNINSTALL.LOG_OPEN_INSTALL SetOutPath $INSTDIR\Langs
;File /nonfatal /r ..\bin\Langs\*.mo !insertmacro UNINSTALL.LOG_OPEN_INSTALL
;!insertmacro UNINSTALL.LOG_CLOSE_INSTALL File /nonfatal /r ..\bin\Langs\*.mo
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
SetOutPath $INSTDIR\Patches !endif
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File /r ..\bin\Patches\*.pnach
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
; ------------------------------------------
; -- Plugins Section --
; ------------------------------------------
SetOutPath $INSTDIR\Plugins
; NULL plugins are required, and really there should be more but we don't have working ; NULL plugins are required, and really there should be more but we don't have working
; SPU2 null plugins right now. (note: no install logging performed here -- nulls ; SPU2 null plugins right now.
; are removed manually by name)
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
SetOutPath $INSTDIR\Plugins
File ..\bin\Plugins\GSnull.dll File ..\bin\Plugins\GSnull.dll
;File ..\bin\Plugins\SPU2null.dll ;File ..\bin\Plugins\SPU2null.dll
File ..\bin\Plugins\USBnull.dll File ..\bin\Plugins\USBnull.dll
File ..\bin\Plugins\DEV9null.dll File ..\bin\Plugins\DEV9null.dll
File ..\bin\Plugins\FWnull.dll File ..\bin\Plugins\FWnull.dll
File ..\bin\Plugins\CDVDnull.dll File ..\bin\Plugins\CDVDnull.dll
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
; -- Other plugins -- ; -- Other plugins --
!ifdef INC_PLUGINS !ifdef INC_PLUGINS
SetOutPath "$INSTDIR\Plugins"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File /nonfatal /oname=gsdx-sse2-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-sse2.dll 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-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=gsdx-sse4-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-sse4.dll
@ -185,9 +226,14 @@ Section "${APP_NAME} (required)"
File /nonfatal /oname=zerogs-r${SVNREV_ZEROGS}.dll ..\bin\Plugins\zerogs.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 File /nonfatal /oname=zerospu2-r${SVNREV_ZEROSPU2}.dll ..\bin\Plugins\zerospu2.dll
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
!endif !endif
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
; ------------------------------------------
; -- Registry Section --
; ------------------------------------------
; Write the installation path into the registry ; Write the installation path into the registry
WriteRegStr HKLM Software\PCSX2 "Install_Dir" "$INSTDIR" WriteRegStr HKLM Software\PCSX2 "Install_Dir" "$INSTDIR"
@ -200,30 +246,7 @@ Section "${APP_NAME} (required)"
SectionEnd 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
; ----------------------------------------
; Start Menu - Optional section (can be disabled by the user) ; Start Menu - Optional section (can be disabled by the user)
Section "Start Menu Shortcuts" Section "Start Menu Shortcuts"
@ -231,8 +254,8 @@ Section "Start Menu Shortcuts"
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
CreateDirectory "$SMPROGRAMS\PCSX2" CreateDirectory "$SMPROGRAMS\PCSX2"
CreateShortCut "$SMPROGRAMS\PCSX2\Uninstall ${APP_NAME}.lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0 CreateShortCut "$SMPROGRAMS\PCSX2\Uninstall ${APP_NAME}.lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
CreateShortCut "$SMPROGRAMS\PCSX2\${APP_NAME}.lnk" "$INSTDIR\${APP_EXE}" "" "$INSTDIR\${APP_EXE}" 0 CreateShortCut "$SMPROGRAMS\PCSX2\${APP_NAME}.lnk" "${APP_EXE}" "" "${APP_EXE}" 0
;IfFileExists ..\bin\pcsx2-dev.exe 0 +2 ;IfFileExists ..\bin\pcsx2-dev.exe 0 +2
; CreateShortCut "PCSX2\pcsx2-dev-r${SVNREV}.lnk" "$INSTDIR\pcsx2-dev-r${SVNREV}.exe" "" "$INSTDIR\pcsx2-dev-r${SVNREV}.exe" 0 "" "" \ ; CreateShortCut "PCSX2\pcsx2-dev-r${SVNREV}.lnk" "$INSTDIR\pcsx2-dev-r${SVNREV}.exe" "" "$INSTDIR\pcsx2-dev-r${SVNREV}.exe" 0 "" "" \
@ -240,7 +263,7 @@ Section "Start Menu Shortcuts"
SectionEnd SectionEnd
; ---------------------------------------- ; -----------------------------------------------------------------------
; Desktop Icon - Optional section (can be disabled by the user) ; Desktop Icon - Optional section (can be disabled by the user)
Section "Desktop Shortcut" Section "Desktop Shortcut"
@ -251,14 +274,36 @@ Section "Desktop Shortcut"
SectionEnd SectionEnd
; ---------------------------------------- ; -----------------------------------------------------------------------
; 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.
Section "Microsoft Visual C++ 2008 SP1 Redist (required)"
SectionIn RO
SetOutPath "$TEMP"
File "vcredist_x86.exe"
Call CheckVCRedist
StrCmp $R0 "-1" skipRedist
ExecWait "$TEMP\vcredist_x86.exe"
skipRedist:
DetailPrint "Visual C++ 2008 SP1 Redistributable already installed, skipping..."
SectionEnd
; -----------------------------------------------------------------------
; This section needs to be last, so that in case it fails, the rest of the program will ; This section needs to be last, so that in case it fails, the rest of the program will
; be installed cleanly. It's also optional, just because (though highly recommended). ; be installed cleanly.
; ;
Section "DirectX Web Setup (recommended)" SEC_DIRECTX ; This section could be optional, but why not? It's pretty painless to double-check that
; all the libraries are up-to-date.
;SectionIn RO ;
Section "DirectX Web Setup (required)" SEC_DIRECTX
SectionIn RO
SetOutPath "$TEMP" SetOutPath "$TEMP"
File "dxwebsetup.exe" File "dxwebsetup.exe"
DetailPrint "Running DirectX Web Setup..." DetailPrint "Running DirectX Web Setup..."
@ -270,31 +315,37 @@ Section "DirectX Web Setup (recommended)" SEC_DIRECTX
SectionEnd SectionEnd
;-------------------------------- ;--------------------------------
Function .onInit Function .onInit
;prepare log always within .onInit function ;prepare Advanced Uninstall log always within .onInit function
!insertmacro UNINSTALL.LOG_PREPARE_INSTALL !insertmacro UNINSTALL.LOG_PREPARE_INSTALL
; MORE UAC HELL ---------- >
call IsUserAdmin
FunctionEnd FunctionEnd
Function .onInstSuccess Function .onInstSuccess
;create/update log always within .onInstSuccess function ;create/update log always within .onInstSuccess function
!insertmacro UNINSTALL.LOG_UPDATE_INSTALL !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
FunctionEnd FunctionEnd
; --------------------------------------------------- ; =======================================================================
; Uninstaller Section ; Un.Installer Sections
; --------------------------------------------------- ; =======================================================================
; -------------------------------------
; Safe directory deletion code. :) ; Safe directory deletion code. :)
; ;
Function un.DeleteDirIfEmpty Function un.DeleteDirIfEmpty
; Use $TEMP as the out dir when removing directories, since NSIS won't let us remove the
; "current" directory.
SetOutPath "$TEMP"
FindFirst $R0 $R1 "$0\*.*" FindFirst $R0 $R1 "$0\*.*"
strcmp $R1 "." 0 NoDelete strcmp $R1 "." 0 NoDelete
FindNext $R0 $R1 FindNext $R0 $R1
@ -311,60 +362,63 @@ FunctionEnd
Function un.removeShorties Function un.removeShorties
; Remove shortcuts, if any ; Remove shortcuts, if any
Delete "$DESKTOP\${APP_NAME}.lnk" Delete "$DESKTOP\${APP_NAME}.lnk"
Delete "$SMPROGRAMS\PCSX2\Uninstall ${APP_NAME}.lnk" Delete "$SMPROGRAMS\PCSX2\Uninstall ${APP_NAME}.lnk"
Delete "$SMPROGRAMS\PCSX2\${APP_NAME}.lnk" Delete "$SMPROGRAMS\PCSX2\${APP_NAME}.lnk"
;Delete "$SMPROGRAMS\PCSX2\pcsx2-dev-r${SVNREV}.lnk" ;Delete "$SMPROGRAMS\PCSX2\pcsx2-dev-r${SVNREV}.lnk"
StrCpy $0 "$SMPROGRAMS\PCSX2" StrCpy $0 "$SMPROGRAMS\PCSX2"
Call un.DeleteDirIfEmpty Call un.DeleteDirIfEmpty
FunctionEnd 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 Section "Un.Core Executables ${APP_NAME}"
; key is empty.
Function un.removeSharedJunk
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Langs"
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Patches"
Delete "$INSTDIR\Plugins\GSnull.dll" SetShellVarContext all
;Delete "$INSTDIR\Plugins\SPU2null.dll"
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" !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
; Remove registry keys (but only the ones related to the installer -- user options remain) ; Remove registry keys (but only the ones related to the installer -- user options remain)
DeleteRegKey HKLM "${INSTDIR_REG_KEY}" DeleteRegKey HKLM "${INSTDIR_REG_KEY}"
DeleteRegKey ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" DeleteRegKey ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}"
Call un.removeShorties Call un.removeShorties
; Use $TEMP as the out dir when removing directories, since NSIS won't let us remove the SectionEnd
; "current" directory.
SetOutPath "$TEMP" ; -----------------------------------------------------------------------
Section "Un.Shared Components (DLLs, Languages, etc)"
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
true:
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Langs"
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Plugins"
; Kill the entire PCSX2 registry key.
DeleteRegKey HKLM Software\PCSX2
false:
; User cancelled -- do nothing!!
SectionEnd
; begin uninstall, could be added on top of uninstall section instead
Function un.onInit
!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
FunctionEnd
Function un.onUninstSuccess
!insertmacro UNINSTALL.LOG_END_UNINSTALL
; And remove the various install dir(s) but only if they're clean of user content: ; And remove the various install dir(s) but only if they're clean of user content:
StrCpy $0 "$INSTDIR\patches"
Call un.DeleteDirIfEmpty
StrCpy $0 "$INSTDIR\langs" StrCpy $0 "$INSTDIR\langs"
Call un.DeleteDirIfEmpty Call un.DeleteDirIfEmpty
@ -373,29 +427,5 @@ Section "Un.Basic Removal (removes only files installed by this package) ${APP_N
StrCpy $0 "$INSTDIR" StrCpy $0 "$INSTDIR"
Call un.DeleteDirIfEmpty Call un.DeleteDirIfEmpty
SectionEnd
Section "Un.Full Removal (completely removes all PCSX2 program files and folders)"
MessageBox MB_YESNO "WARNING! This will remove *all* files in $INSTDIR. If you have multiple versions of PCSX2 installed, this *will* break them all! Are you sure you want to proceed?" IDYES true IDNO false
true:
RMDir /r "$INSTDIR"
Call un.removeShorties
; Kill the entire PCSX2 registry key, along with installer junk.
DeleteRegKey HKLM Software\PCSX2
DeleteRegKey ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}"
false:
SectionEnd
; --------------------------------------
Function un.onInit
;begin uninstall, could be added on top of uninstall section instead
!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
FunctionEnd FunctionEnd

View File

@ -0,0 +1 @@
!define SVNREV_ZZOGL $WCREV$