From 732dc881e49a14d37d121d084ae97112eea7e7b2 Mon Sep 17 00:00:00 2001 From: Christian Kenny Date: Thu, 29 Dec 2016 15:20:52 -0500 Subject: [PATCH] Block installation on XP/fix an uninstaller regression and add ManifestDPIAware to the installer. Remove NSIS dirs from .gitignore. Typo ;) Remove XPStyle parameter. It isn't needed anymore Updated copyright, added ManifestDPIAware for rich folks, removed IDOK true and Cheats folder from $INSTDIR as Turtleli suggested, formatting adjustments. Gitignore: remove now unused NSIS directories Fixed a nasty regression I introduced after a registry pointer was assumed to be incorrect. It contained UserMode data generated by the First Time Wizard. This was causing conflicts and the FTW to fail randomly when running PCSX2 after a reinstall due to old configuration data being read. I added clarifcation below the original comment to reduce confusion in the future. --- .gitignore | 8 -- nsis/ApplyExeProps.nsh | 2 +- nsis/SectionCoreReqs.nsh | 41 ++++----- nsis/SectionUninstaller.nsh | 14 ++- nsis/SharedBase.nsh | 2 - nsis/pcsx2_full_install.nsi | 173 ++++++++++++++++-------------------- 6 files changed, 105 insertions(+), 135 deletions(-) diff --git a/.gitignore b/.gitignore index ebae5d2583..6199dbac77 100644 --- a/.gitignore +++ b/.gitignore @@ -76,7 +76,6 @@ oprofile_data/ /bin/sstates /deps /ipch -/nsis/output/ !/3rdparty/libjpeg/change.log /3rdparty/portaudio/portaudio-2.0.pc @@ -95,13 +94,6 @@ oprofile_data/ /3rdparty/portaudio/src/hostapi/wasapi/mingw-include /3rdparty/**/include/wx/setup.h /3rdparty/**/wx/msw/rcdefs.h -/nsis/svnrev_cdvdiso.nsh -/nsis/svnrev_gsdx.nsh -/nsis/svnrev_lilypad.nsh -/nsis/svnrev_pcsx2.nsh -/nsis/svnrev_spu2x.nsh -/nsis/svnrev_zerogs.nsh -/nsis/svnrev_zerospu2.nsh /pcsx2/gui/Resources/*.h !/pcsx2/gui/Resources/EmbeddedImage.h /plugins/CDVDolio/Template diff --git a/nsis/ApplyExeProps.nsh b/nsis/ApplyExeProps.nsh index 335c4952b1..9be26a3d74 100644 --- a/nsis/ApplyExeProps.nsh +++ b/nsis/ApplyExeProps.nsh @@ -6,7 +6,7 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${APP_NAME}" ;VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "A test comment" -VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© 2016 PCSX2 Dev Team" +VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© 2017 PCSX2 Dev Team" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Installs PCSX2, a Playstation 2 Emulator for the PC." VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${APP_VERSION}" diff --git a/nsis/SectionCoreReqs.nsh b/nsis/SectionCoreReqs.nsh index 730384c4c9..c9d8dee32d 100644 --- a/nsis/SectionCoreReqs.nsh +++ b/nsis/SectionCoreReqs.nsh @@ -15,10 +15,10 @@ SetShellVarContext all ;SetShellVarContext current - + SetOutPath "$INSTDIR" !insertmacro UNINSTALL.LOG_OPEN_INSTALL - File ..\bin\pcsx2.exe + File ..\bin\pcsx2.exe ;File /nonfatal ..\bin\pcsx2-dev.exe ; ------------------------------------------ @@ -26,39 +26,30 @@ ; ------------------------------------------ ; (Binaries, shared DLLs, null plugins, game database, languages, etc) - File ..\bin\GameIndex.dbf - File ..\bin\cheats_ws.zip - File ..\bin\PCSX2_keys.ini.default + File ..\bin\GameIndex.dbf + File ..\bin\cheats_ws.zip + File ..\bin\PCSX2_keys.ini.default + + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL - !insertmacro UNINSTALL.LOG_CLOSE_INSTALL - - ;/bin/Cheats needs CreateDirectory to prevent MakeNSIS from failing due to the folder being empty - !insertmacro UNINSTALL.LOG_OPEN_INSTALL - CreateDirectory "$INSTDIR\Cheats" - !insertmacro UNINSTALL.LOG_CLOSE_INSTALL - SetOutPath "$INSTDIR\Docs" !insertmacro UNINSTALL.LOG_OPEN_INSTALL - File ..\bin\docs\* + File ..\bin\docs\* !insertmacro UNINSTALL.LOG_CLOSE_INSTALL - - SetOutPath "$INSTDIR\Shaders" + + SetOutPath "$INSTDIR\Shaders" !insertmacro UNINSTALL.LOG_OPEN_INSTALL - File ..\bin\shaders\* + File ..\bin\shaders\* !insertmacro UNINSTALL.LOG_CLOSE_INSTALL - + SetOutPath "$INSTDIR\Plugins" - !insertmacro UNINSTALL.LOG_OPEN_INSTALL + !insertmacro UNINSTALL.LOG_OPEN_INSTALL ; NULL plugins are required, because the PCSX2 plugin selector needs a dummy plugin in every slot - ; 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\SPU2null.dll + ; in order to run (including CDVD!) + File ..\bin\Plugins\USBnull.dll File ..\bin\Plugins\DEV9null.dll File ..\bin\Plugins\FWnull.dll - ;File ..\bin\Plugins\CDVDnull.dll !insertmacro UNINSTALL.LOG_CLOSE_INSTALL @@ -68,7 +59,7 @@ ; 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" WriteRegStr HKLM "${INSTDIR_REG_KEY}" "UninstallString" "${UNINST_EXE}" diff --git a/nsis/SectionUninstaller.nsh b/nsis/SectionUninstaller.nsh index 786aad2e29..44167181e1 100644 --- a/nsis/SectionUninstaller.nsh +++ b/nsis/SectionUninstaller.nsh @@ -7,9 +7,11 @@ Function .onInit ;prepare Advanced Uninstall log always within .onInit function !insertmacro UNINSTALL.LOG_PREPARE_INSTALL - ; MORE UAC HELL ---------- > - ;call IsUserAdmin - +!include WinVer.nsh + ${IfNot} ${AtLeastWinVista} + MessageBox MB_OK "Your operating system is unsupported by PCSX2. Please upgrade your operating system or install PCSX2 1.4.0." + Quit + ${EndIf} FunctionEnd Function .onInstSuccess @@ -69,6 +71,11 @@ Section "Un.Program and Plugins ${APP_NAME}" ; otherwise, pcsx2 will be "confused" if it's re-installed later. DeleteRegKey HKLM Software\PCSX2 + ; Please note that pointing to HKCU here is intentional. It is the only key generated by PCSX2 and *not* NSIS! + ; The key stores configuration data used by the First Time Wizard (check AppConfig.cpp for details) such as DocumentsFolderMode, ect. + ; Failure to delete this key can result in configuration errors + DeleteRegKey HKCU Software\PCSX2 + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR" ; Remove uninstaller info reg key ( Wow6432Node on 64bit Windows! ) @@ -79,7 +86,6 @@ Section "Un.Program and Plugins ${APP_NAME}" !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Langs" !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Plugins" !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Docs" - !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Cheats" !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Shaders" ; Remove files and registry key that store PCSX2 paths configurations SetShellVarContext current diff --git a/nsis/SharedBase.nsh b/nsis/SharedBase.nsh index 019f2c2145..8cb93c121e 100644 --- a/nsis/SharedBase.nsh +++ b/nsis/SharedBase.nsh @@ -27,8 +27,6 @@ !define INSTDIR_REG_ROOT "HKLM" -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 diff --git a/nsis/pcsx2_full_install.nsi b/nsis/pcsx2_full_install.nsi index 42845abeb2..3521d8d578 100644 --- a/nsis/pcsx2_full_install.nsi +++ b/nsis/pcsx2_full_install.nsi @@ -5,15 +5,13 @@ ; Copyright 2009-2016 PCSX2 Dev Team ; -!ifndef INC_LANGS - !define INC_LANGS 1 -!endif !ifndef INC_CRT_2015 ; Set to 0 to disable inclusion of Visual Studio 2013 SP1 CRT Redists !define INC_CRT_2015 1 !endif +ManifestDPIAware true ShowInstDetails nevershow ShowUninstDetails nevershow @@ -26,10 +24,10 @@ ShowUninstDetails nevershow ;!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;!insertmacro MUI_RESERVEFILE_LANGDLL -!insertmacro MUI_PAGE_COMPONENTS +!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 @@ -46,7 +44,6 @@ ShowUninstDetails nevershow !insertmacro MUI_LANGUAGE "English" !include "ApplyExeProps.nsh" -!include "SharedRedtape.nsh" ; ======================================================================= ; Installer Sections @@ -57,63 +54,62 @@ ShowUninstDetails nevershow ; The "" makes the section hidden. Section "" SecUninstallPrevious - Call UninstallPrevious - + 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} + ;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?" IDCANCEL false + 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: - ;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) @@ -136,17 +132,11 @@ Section "!${APP_NAME} (required)" SEC_CORE 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 ..\bin\Plugins\gsdx32-avx2.dll File /nonfatal ..\bin\Plugins\spu2-x.dll - ;File /nonfatal ..\bin\Plugins\zerospu2.dll - - ;File /nonfatal ..\bin\Plugins\cdvdiso.dll - File ..\bin\Plugins\cdvdGigaherz.dll - + File /nonfatal ..\bin\Plugins\cdvdGigaherz.dll File /nonfatal ..\bin\Plugins\lilypad.dll - File /nonfatal ..\bin\Plugins\padPokopom.dll + File /nonfatal ..\bin\Plugins\padPokopom.dll !insertmacro UNINSTALL.LOG_CLOSE_INSTALL @@ -157,15 +147,12 @@ SectionEnd !include "SectionShortcuts.nsh" 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 - -!endif - SectionEnd - + SetOutPath $INSTDIR\Langs + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /nonfatal /r ..\bin\Langs\*.mo + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL +SectionEnd + SectionGroup "DirectX Packages (required for PCSX2)" SEC_DXPACKS !if ${INC_CRT_2015} > 0 Section "Microsoft Visual C++ 2015 Redist" SEC_CRT2015 @@ -176,18 +163,18 @@ Section "Microsoft Visual C++ 2015 Redist" SEC_CRT2015 ; independent key for checking availability. ; HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86 for x64 Windows ; HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86 for x86 Windows - + ; Downloaded from: ; https://www.microsoft.com/en-us/download/details.aspx?id=49984 ClearErrors - + ${If} ${RunningX64} ReadRegDword $R0 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Installed" ${Else} ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Installed" ${EndIf} - + IfErrors 0 +2 DetailPrint "Visual C++ 2015 Redistributable registry key was not found; assumed to be uninstalled." StrCmp $R0 "1" 0 +3 @@ -199,7 +186,7 @@ Section "Microsoft Visual C++ 2015 Redist" SEC_CRT2015 DetailPrint "Running Visual C++ 2015 Redistributable Setup..." ExecWait '"$TEMP\vcredist_2015_Update_1_x86.exe" /qb' DetailPrint "Finished Visual C++ 2015 Redistributable Setup" - + Delete "$TEMP\vcredist_2015_Update_1_x86.exe" done: @@ -214,15 +201,15 @@ SectionEnd ; all the libraries are up-to-date. ; Section "DirectX Web Setup" SEC_DIRECTX - + ;SectionIn RO SetOutPath "$TEMP" File "dxwebsetup.exe" DetailPrint "Running DirectX Web Setup..." ExecWait '"$TEMP\dxwebsetup.exe" /Q' $DirectXSetupError - DetailPrint "Finished DirectX Web Setup" - + DetailPrint "Finished DirectX Web Setup" + Delete "$TEMP\dxwebsetup.exe" SectionEnd @@ -234,9 +221,9 @@ LangString DESC_CORE ${LANG_ENGLISH} "Core components (binaries, plugins, 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_LANGS ${LANG_ENGLISH} "Adds additional languages other than the system default to PCSX2." -LangString DESC_DXPACKS ${LANG_ENGLISH} "Installs the Visual C++ Redistributable and DirectX SDK" +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." @@ -244,13 +231,9 @@ LangString DESC_DIRECTX ${LANG_ENGLISH} "Only uncheck this if you are quite c !insertmacro MUI_DESCRIPTION_TEXT ${SEC_CORE} $(DESC_CORE) !insertmacro MUI_DESCRIPTION_TEXT ${SEC_STARTMENU} $(DESC_STARTMENU) !insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} $(DESC_DESKTOP) - -!if ${INC_LANGS} > 0 - !insertmacro MUI_DESCRIPTION_TEXT ${SEC_LANGS} $(DESC_LANGS) -!endif - -!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DXPACKS} $(DESC_DXPACKS) - + !insertmacro MUI_DESCRIPTION_TEXT ${SEC_LANGS} $(DESC_LANGS) + !insertmacro MUI_DESCRIPTION_TEXT ${SEC_DXPACKS} $(DESC_DXPACKS) + !if ${INC_CRT_2015} > 0 !insertmacro MUI_DESCRIPTION_TEXT ${SEC_CRT2015} $(DESC_CRT2015) !endif @@ -264,7 +247,7 @@ SectionEnd Function ModifyRunCheckbox ${IfNot} ${SectionIsSelected} ${SID_PCSX2} - SendMessage $MUI.FINISHPAGE.RUN ${BM_SETCHECK} ${BST_UNCHECKED} 0 - EnableWindow $MUI.FINISHPAGE.RUN 0 + SendMessage $MUI.FINISHPAGE.RUN ${BM_SETCHECK} ${BST_UNCHECKED} 0 + EnableWindow $MUI.FINISHPAGE.RUN 0 ${EndIf} FunctionEnd