Implement version detection for previous installs, separate savestates/memcard categories in the uninstaller. Cleanup scripts and misc. tweaks.

Minor tweaks for SharedBase and SharedRedTape:

-Updated ${APP_VERSION} to 1.6.0 and tweaked uninstall_log for functionality with uninstall script in pcsx2_full_install.nsi

-Added !define for installer icon

-Replaced obsolete function with RMDir functionality, uninstaller speed improved marginally

-Added filepath for $DOCUMENTS to be removed if empty

Main installer tweaks/enhancements:

-Tested installer functions in NSIS 3.01

-Implemented uninstall script for future version detection. If an older or equivalent PCSX2 version is detected, the user is prompted to silently uninstall/overwrite or abort the installer. (The function is not compatible with any current stable releases because they lack the registry string required for version detection.)

-Added a new installer function so that we can launch PCSX2 directly from the installer.

-Supressed some errors related to unused plugins in MakeNSIS.

-Replaced File with CreateDirectory function (for Cheats only) because it can't be used on an empty folder and will cause MakeNSIS to fail.

-Removed unused /oname parameter that was leftover from SVN builds.

-Added option to install additional languages for those who desire to save 2MB of space.

-Condensed DirectX Packages into SectionGroup for neatness
This commit is contained in:
Christian Kenny 2016-12-14 22:02:06 -05:00 committed by Gregory Hainaut
parent 5986cbcfe6
commit b7659ea3a5
5 changed files with 145 additions and 130 deletions

View File

@ -18,8 +18,8 @@
SetOutPath "$INSTDIR"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File /oname=${APP_EXE} ..\bin\pcsx2.exe
;File /nonfatal /oname=pcsx2-dev.exe ..\bin\pcsx2-dev.exe
File ..\bin\pcsx2.exe
;File /nonfatal ..\bin\pcsx2-dev.exe
; ------------------------------------------
; -- Shared Core Components --
@ -31,11 +31,11 @@
File ..\bin\PCSX2_keys.ini.default
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
SetOutPath "$INSTDIR\Cheats"
;/bin/Cheats needs CreateDirectory to prevent MakeNSIS from failing due to the folder being empty
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File ..\bin\Cheats\*
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
CreateDirectory "$INSTDIR\Cheats"
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
SetOutPath "$INSTDIR\Docs"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
@ -53,20 +53,13 @@
; in order to run (including CDVD!) -- and really there should be more but we don't have working
; SPU2 null plugins right now.
File ..\bin\Plugins\GSnull.dll
;File ..\bin\Plugins\GSnull.dll
;File ..\bin\Plugins\SPU2null.dll
File ..\bin\Plugins\USBnull.dll
File ..\bin\Plugins\DEV9null.dll
File ..\bin\Plugins\FWnull.dll
File ..\bin\Plugins\CDVDnull.dll
;File ..\bin\Plugins\CDVDnull.dll
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
!if ${INC_LANGS} > 0
SetOutPath $INSTDIR\Langs
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File /nonfatal /r ..\bin\Langs\*.mo
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
!endif
; ------------------------------------------
@ -79,6 +72,7 @@
; Write the uninstall keys for Windows
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "DisplayName" "PCSX2 - Playstation 2 Emulator"
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "UninstallString" "${UNINST_EXE}"
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "InstalledVersion" "${APP_VERSION}"
WriteRegDWORD HKLM "${INSTDIR_REG_KEY}" "NoModify" 1
WriteRegDWORD HKLM "${INSTDIR_REG_KEY}" "NoRepair" 1
WriteUninstaller "${UNINST_EXE}"

View File

@ -9,7 +9,7 @@ Section "Un.Program and Plugins ${APP_NAME}"
SetShellVarContext all
; First thing, remove the registry entry in case uninstall doesn't complete successfully
; otherwise, pcsx2 will be "confused" if it's re-installed later.
DeleteRegKey HKCU Software\PCSX2
DeleteRegKey HKLM Software\PCSX2
!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR"
@ -30,24 +30,28 @@ Section "Un.Program and Plugins ${APP_NAME}"
SectionEnd
; /o for optional and unticked by default
Section /o "Un.Configuration files (Program and Plugins)"
Section /o "Un.Configuration files (PCSX2, GSdx, SPU2-X, ect.)"
SetShellVarContext current
RMDir /r "$DOCUMENTS\PCSX2\inis\"
SectionEnd
Section /o "Un.Memory cards/savestates"
SetShellVarContext current
RMDir /r "$DOCUMENTS\PCSX2\memcards"
RMDir /r "$DOCUMENTS\PCSX2\sstates"
SectionEnd
; /o for optional and unticked by default
Section /o "Un.User files (Memory Cards, Savestates, etc)"
Section /o "Un.User files (Cheats, logs, snaps, etc)"
SetShellVarContext current
RMDir /r "$DOCUMENTS\PCSX2\Cheats_ws\"
RMDir /r "$DOCUMENTS\PCSX2\cheats\"
RMDir /r "$DOCUMENTS\PCSX2\inis\"
RMDir /r "$DOCUMENTS\PCSX2\logs\"
RMDir /r "$DOCUMENTS\PCSX2\memcards\"
RMDir /r "$DOCUMENTS\PCSX2\snaps\"
RMDir /r "$DOCUMENTS\PCSX2\sstates\"
SectionEnd
@ -56,5 +60,5 @@ Section /o "Un.BIOS files"
SetShellVarContext current
RMDir /r "$DOCUMENTS\PCSX2\bios\"
SectionEnd

View File

@ -12,11 +12,6 @@
!define INC_PLUGINS 1
!endif
!ifndef INC_LANGS
; Set to 1 to enable inclusion of Languages folders
!define INC_LANGS 1
!endif
!ifndef USE_PACKAGE_REV
; When enabled, all exe and plugins use a single revision based ont he trunk/HEAD svn revision.
; When disabled, each plugin and the main exe get their own revision number based on the actual
@ -30,12 +25,12 @@
; uninstall folders.
!ifndef APP_VERSION
!define APP_VERSION "1.4.0"
!define APP_VERSION "1.6.0"
!endif
!define APP_NAME "PCSX2 ${APP_VERSION}"
!define APP_FILENAME "pcsx2"
!define UNINSTALL_LOG "Uninst-pcsx2 ${APP_VERSION}"
!define UNINSTALL_LOG "Uninst-pcsx2"
!define INSTDIR_REG_ROOT "HKLM"
@ -95,4 +90,4 @@ RequestExecutionLevel admin
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "banner.bmp"
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_ICON "AppIcon.ico"

View File

@ -26,30 +26,6 @@ FunctionEnd
; Shared Uninstall Functions
; =======================================================================
; Safe directory deletion code. :)
;
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\*.*"
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
; ==================================================================================
Function un.removeShorties
; Remove shortcuts, if any
@ -63,35 +39,24 @@ Function un.removeShorties
Delete "$SMPROGRAMS\PCSX2\Readme.lnk"
Delete "$SMPROGRAMS\PCSX2\Frequently Asked Questions.lnk"
StrCpy $0 "$SMPROGRAMS\PCSX2"
Call un.DeleteDirIfEmpty
RMDir "$SMPROGRAMS\PCSX2"
FunctionEnd
; begin uninstall, could be added on top of uninstall section instead
Function un.onInit
!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
FunctionEnd
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:
StrCpy $0 "$INSTDIR\langs"
Call un.DeleteDirIfEmpty
StrCpy $0 "$INSTDIR\plugins"
Call un.DeleteDirIfEmpty
StrCpy $0 "$INSTDIR\docs"
Call un.DeleteDirIfEmpty
StrCpy $0 "$INSTDIR\Cheats"
Call un.DeleteDirIfEmpty
StrCpy $0 "$INSTDIR"
Call un.DeleteDirIfEmpty
FunctionEnd
RMDir "$DOCUMENTS\PCSX2"
RMDir "$INSTDIR\langs"
RMDir "$INSTDIR\plugins"
RMDir "$INSTDIR\docs"
RMDir "$INSTDIR\Cheats"
RMDir "$INSTDIR"
FunctionEnd

View File

@ -2,12 +2,11 @@
; PCSX2 Full/Complete Install Package!
; (a NSIS installer script)
;
; Copyright 2009-2015 PCSX2 Dev Team
; Copyright 2009-2016 PCSX2 Dev Team
;
!ifndef INC_CRT_2013
; Set to 0 to disable inclusion of Visual Studio 2013 SP1 CRT Redists
!define INC_CRT_2013 0
!ifndef INC_LANGS
!define INC_LANGS 1
!endif
!ifndef INC_CRT_2015
@ -30,7 +29,16 @@ ShowUninstDetails nevershow
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; This hack is required to launch pcsx2.exe from the FINISHPAGE of the installer.
; RequestExecutionLevel defaults to admin as of NSIS 3.0; and UAC behavior is defined
; as such that any elevation rights are transferred to child processes
!define MUI_FINISHPAGE_RUN "$WINDIR\explorer.exe"
!define MUI_FINISHPAGE_RUN_PARAMETERS "$INSTDIR\pcsx2.exe"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ModifyRunCheckbox
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_COMPONENTS
!insertmacro MUI_UNPAGE_INSTFILES
@ -45,6 +53,69 @@ ShowUninstDetails nevershow
; =======================================================================
; -----------------------------------------------------------------------
; The "" makes the section hidden.
Section "" SecUninstallPrevious
Call UninstallPrevious
SectionEnd
Function UninstallPrevious
;Check for uninstaller.
ReadRegStr $R0 HKLM "${INSTDIR_REG_KEY}" "UninstallString"
${If} $R0 == ""
Goto Done
${EndIf}
;Check if any other version is installed
ReadRegStr $R1 HKLM "${INSTDIR_REG_KEY}" "InstalledVersion"
;This check for older versions (pre 1.6.0) without InstalledVersion string will bypass this section
${If} $R1 == ""
DetailPrint "InstalledVersion string not found, skipping version check"
Goto Done
${EndIf}
;Installing same version
${If} $R1 S== ${APP_VERSION}
MessageBox MB_ICONEXCLAMATION|MB_OKCANCEL "This version of PCSX2 is already installed. Do you want to continue?" IDOK true IDCANCEL false
true:
DetailPrint "Overwriting current install"
Goto Done
false:
Quit
${Else}
DetailPrint "Not the same version"
${EndIf}
;Installing newer version (and old version is detected)
${If} $R1 S< ${APP_VERSION}
MessageBox MB_ICONEXCLAMATION|MB_OKCANCEL "An older version of PCSX2 is installed. Do you want to uninstall it?" IDOK true2 IDCANCEL false2
true2:
DetailPrint "Uninstalling old PCSX2 version"
Goto Next
false2:
Quit
${Else}
DetailPrint "Not installing a new version"
${EndIf}
;Run the uninstaller silently.
Next:
DetailPrint "Running silent uninstall"
;Copy files to a temp dir to prevent conflicts when removing $INSTDIR/uninstaller
ReadRegStr $R2 HKLM Software\PCSX2 "Install_Dir"
CreateDirectory "$TEMP\pcsx2_uninst_temp"
CopyFiles /SILENT /FILESONLY "$R2\uninst-pcsx2.exe" "$TEMP\pcsx2_uninst_temp"
ExecWait '"$TEMP\pcsx2_uninst_temp\uninst-pcsx2.exe" /S _?=$R2'
RMDir /r $TEMP\pcsx2_uninst_temp
Done:
FunctionEnd
; Basic section (emulation proper)
Section "!${APP_NAME} (required)" SEC_CORE
@ -61,20 +132,20 @@ Section "!${APP_NAME} (required)" SEC_CORE
SetOutPath "$INSTDIR\Plugins"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File /nonfatal /oname=gsdx32-sse2.dll ..\bin\Plugins\gsdx32-sse2.dll
File /nonfatal /oname=gsdx32-ssse3.dll ..\bin\Plugins\gsdx32-ssse3.dll
File /nonfatal /oname=gsdx32-sse4.dll ..\bin\Plugins\gsdx32-sse4.dll
File /nonfatal /oname=gsdx32-avx.dll ..\bin\Plugins\gsdx32-avx.dll
File /nonfatal /oname=gsdx32-avx2.dll ..\bin\Plugins\gsdx32-avx2.dll
File /nonfatal /oname=zerogs.dll ..\bin\Plugins\zerogs.dll
File /nonfatal ..\bin\Plugins\gsdx32-sse2.dll
File /nonfatal ..\bin\Plugins\gsdx32-ssse3.dll
File /nonfatal ..\bin\Plugins\gsdx32-sse4.dll
File /nonfatal ..\bin\Plugins\gsdx32-avx.dll
File /nonfatal ..\bin\Plugins\gsdx32-avx2.dll
;File /nonfatal ..\bin\Plugins\zerogs.dll
File /nonfatal /oname=spu2-x.dll ..\bin\Plugins\spu2-x.dll
File /nonfatal /oname=zerospu2.dll ..\bin\Plugins\zerospu2.dll
File /nonfatal ..\bin\Plugins\spu2-x.dll
;File /nonfatal ..\bin\Plugins\zerospu2.dll
File /nonfatal /oname=cdvdiso.dll ..\bin\Plugins\cdvdiso.dll
;File /nonfatal ..\bin\Plugins\cdvdiso.dll
File ..\bin\Plugins\cdvdGigaherz.dll
File /nonfatal /oname=lilypad.dll ..\bin\Plugins\lilypad.dll
File /nonfatal ..\bin\Plugins\lilypad.dll
File /nonfatal ..\bin\Plugins\padPokopom.dll
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
@ -85,45 +156,17 @@ SectionEnd
!include "SectionShortcuts.nsh"
!if ${INC_CRT_2013} > 0
Section "Microsoft Visual C++ 2013 Redist" SEC_CRT2013
;SectionIn RO
; Detection made easy: Unlike previous redists, VC2013 now generates a platform
; independent key for checking availability.
; HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\VC\Runtimes\x86 for x64 Windows
; HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\12.0\VC\Runtimes\x86 for x86 Windows
; Downloaded from:
; http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe
ClearErrors
${If} ${RunningX64}
ReadRegDword $R0 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\VC\Runtimes\x86" "Installed"
${Else}
ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\VisualStudio\12.0\VC\Runtimes\x86" "Installed"
${EndIf}
Section "Additional Languages" SEC_LANGS
!if ${INC_LANGS} > 0
SetOutPath $INSTDIR\Langs
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File /nonfatal /r ..\bin\Langs\*.mo
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
IfErrors 0 +2
DetailPrint "Visual C++ 2013 Redistributable registry key was not found; assumed to be uninstalled."
StrCmp $R0 "1" 0 +3
DetailPrint "Visual C++ 2013 Redistributable is already installed; skipping!"
Goto done
SetOutPath "$TEMP"
File "vcredist_2013_x86.exe"
DetailPrint "Running Visual C++ 2013 Redistributable Setup..."
ExecWait '"$TEMP\vcredist_2013_x86.exe" /qb'
DetailPrint "Finished Visual C++ 2013 Redistributable Setup"
Delete "$TEMP\vcredist_2013_x86.exe"
done:
SectionEnd
!endif
SectionEnd
SectionGroup "DirectX Packages (required for PCSX2)" SEC_DXPACKS
!if ${INC_CRT_2015} > 0
Section "Microsoft Visual C++ 2015 Redist" SEC_CRT2015
@ -183,15 +226,17 @@ Section "DirectX Web Setup" SEC_DIRECTX
Delete "$TEMP\dxwebsetup.exe"
SectionEnd
SectionGroupEnd
!include "SectionUninstaller.nsh"
LangString DESC_CORE ${LANG_ENGLISH} "Core components (binaries, plugins, languages, etc)."
LangString DESC_CORE ${LANG_ENGLISH} "Core components (binaries, plugins, documentation, etc)."
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)."
LangString DESC_LANGS ${LANG_ENGLISH} "Adds additional languages other than the system default to PCSX2."
LangString DESC_CRT2013 ${LANG_ENGLISH} "Required by the PCSX2 binaries packaged in this installer."
LangString DESC_DXPACKS ${LANG_ENGLISH} "Installs the Visual C++ Redistributable and DirectX SDK"
LangString DESC_CRT2015 ${LANG_ENGLISH} "Required by the PCSX2 binaries packaged in this installer."
LangString DESC_DIRECTX ${LANG_ENGLISH} "Only uncheck this if you are quite certain your Direct3D runtimes are up to date."
@ -200,10 +245,12 @@ LangString DESC_DIRECTX ${LANG_ENGLISH} "Only uncheck this if you are quite c
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_STARTMENU} $(DESC_STARTMENU)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} $(DESC_DESKTOP)
!if ${INC_CRT_2013} > 0
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CRT2013} $(DESC_CRT2013)
!if ${INC_LANGS} > 0
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_LANGS} $(DESC_LANGS)
!endif
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DXPACKS} $(DESC_DXPACKS)
!if ${INC_CRT_2015} > 0
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CRT2015} $(DESC_CRT2015)
!endif
@ -211,3 +258,13 @@ LangString DESC_DIRECTX ${LANG_ENGLISH} "Only uncheck this if you are quite c
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DIRECTX} $(DESC_DIRECTX)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Section "" SID_PCSX2
SectionEnd
Function ModifyRunCheckbox
${IfNot} ${SectionIsSelected} ${SID_PCSX2}
SendMessage $MUI.FINISHPAGE.RUN ${BM_SETCHECK} ${BST_UNCHECKED} 0
EnableWindow $MUI.FINISHPAGE.RUN 0
${EndIf}
FunctionEnd