NSIS: Initial changes for testing. Currently non-functional as portable installer is crashing at the end.

This commit is contained in:
MrCK1
2024-07-11 21:51:02 -04:00
parent e1799b243e
commit e05dd0b289
5 changed files with 61 additions and 43 deletions

View File

@@ -28,11 +28,11 @@ SectionIn RO
; 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 HKLM Software\PCSX2
DeleteRegKey HKLM Software\WOW6432Node\PCSX2
; This key is generated by PCSX2 and *not* NSIS!
; Failure to delete this key can result in configuration errors after a fresh install.
DeleteRegKey HKCU Software\PCSX2
DeleteRegKey HKCU Software\WOW6432Node\PCSX2
; Remove regkey generated by NSIS for uninstall functions
DeleteRegKey HKLM "${INSTDIR_REG_KEY}"
@@ -41,13 +41,14 @@ SectionIn RO
Delete "$DESKTOP\${APP_NAME}.lnk"
Delete "$SMPROGRAMS\${APP_NAME}.lnk"
Delete "$INSTDIR\GameIndex.yaml"
Delete "$INSTDIR\cheats_ws.zip"
Delete "$INSTDIR\PCSX2_keys.ini.default"
Delete "$INSTDIR\pcsx2.exe"
RMDir /r "$INSTDIR\Langs"
Delete "$INSTDIR\pcsx2-qt.exe"
Delete "$INSTDIR\updater.exe"
Delete "$INSTDIR\qt.conf"
Delete "$INSTDIR\*.dll"
RMDir /r "$INSTDIR\QtPlugins"
RMDir /r "$INSTDIR\translations"
RMDir /r "$INSTDIR\Docs"
RMDir /r "$INSTDIR\Shaders"
RMDir /r "$INSTDIR\resources"
; FIXME: PCSX2 currently does not account for non-default file paths in the uninstaller

View File

@@ -17,16 +17,25 @@ Function RedistInstallation
!include WinVer.nsh
; Check if the VC runtimes are installed
ReadRegDword $R5 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Installed"
ReadRegDword $R5 HKLM "SOFTWARE\Microsoft\VisualStudio\17.0\VC\Runtimes\x64" "Installed"
; Skip VC Redist install if they're not an admin
Call IsUserAdmin
${If} $IsAdmin == 0
${NSD_CreateLabel} 0 45 100% 10u "Skipping VC Redist install, no admin rights"
Goto +11
${EndIf}
${If} $R5 == "1"
Return
${EndIf}
; Download and install the VC redistributable from the internet
inetc::get /CONNECTTIMEOUT 30 /RECEIVETIMEOUT 30 "https://aka.ms/vs/16/release/VC_redist.x86.exe" "$TEMP\VC_redist.x86.exe" /END
ExecShellWait open "$TEMP\VC_redist.x86.exe" "/INSTALL /Q /NORESTART"
Delete "$TEMP\VC_redist.x86.exe"
${NSD_CreateLabel} 0 45 50% 10u "Installing VC Redistributables"
inetc::get /CONNECTTIMEOUT 30 /RECEIVETIMEOUT 30 "https://aka.ms/vs/17/release/vc_redist.x64.exe" "$TEMP\VC_redist.x64.exe" /END
ExecShellWait open "$TEMP\VC_redist.x64.exe" "/INSTALL /Q /NORESTART"
Delete "$TEMP\VC_redist.x64.exe"
FunctionEnd
Section "" SEC_REDIST

View File

@@ -2,13 +2,13 @@
; These definitions are shared between the 2 installers (pre-install/portable and full)
; This reduces duplicate code throughout both installers.
!define ENABLE_LOGGING
!include "FileFunc.nsh"
ManifestDPIAware true
Unicode true
ShowInstDetails nevershow
ShowUninstDetails nevershow
ShowInstDetails show
ShowUninstDetails show
SetCompressor /SOLID lzma
SetCompressorDictSize 24
@@ -17,7 +17,7 @@ Var UserPrivileges
Var IsAdmin
!ifndef APP_VERSION
!define APP_VERSION "1.8.0"
!define APP_VERSION "2.0.0"
!endif
!define APP_NAME "PCSX2 ${APP_VERSION}"
@@ -25,7 +25,7 @@ Var IsAdmin
; The name of the installer
Name "${APP_NAME}"
!define APP_FILENAME "pcsx2"
!define APP_FILENAME "pcsx2-qt"
!define APP_EXE "$INSTDIR\${APP_FILENAME}.exe"
;===============================
@@ -41,10 +41,7 @@ Name "${APP_NAME}"
Function IsUserAdmin
!include WinVer.nsh
# No user should ever have to experience this pain ;)
${IfNot} ${AtLeastWinVista}
MessageBox MB_OK "Your operating system is unsupported by PCSX2. Please upgrade your operating system or install PCSX2 1.4.0."
Quit
${ElseIfNot} ${AtLeastWin8.1}
${IfNot} ${AtLeastWin8.1}
MessageBox MB_OK "Your operating system is unsupported by PCSX2. Please upgrade your operating system or install PCSX2 1.6.0."
Quit
${EndIf}

View File

@@ -15,7 +15,7 @@ RequestExecutionLevel admin
OutFile "pcsx2-${APP_VERSION}-${OUTFILE_POSTFIX}.exe"
; The default installation directory for the full installer
InstallDir "$PROGRAMFILES\PCSX2"
InstallDir "$PROGRAMFILES64\PCSX2"
!define INSTDIR_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_FILENAME}"
@@ -28,7 +28,7 @@ InstallDir "$PROGRAMFILES\PCSX2"
; RequestExecutionLevel is admin for the full install, so we need to avoid transferring the elevated rights to PCSX2
; if the user chooses to run from the installer upon completion.
!define MUI_FINISHPAGE_RUN "$WINDIR\explorer.exe"
!define MUI_FINISHPAGE_RUN_PARAMETERS "$INSTDIR\pcsx2.exe"
!define MUI_FINISHPAGE_RUN_PARAMETERS "$INSTDIR\pcsx2-qt.exe"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ModifyRunCheckbox
!insertmacro MUI_PAGE_FINISH
@@ -51,11 +51,11 @@ SectionEnd
Section ""
; Write the installation path into the registry
WriteRegStr HKLM Software\PCSX2 "Install_Dir" "$INSTDIR"
WriteRegStr HKLM Software\WOW6432Node\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}" "Publisher" "PCSX2 Team"
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "DisplayIcon" "$INSTDIR\pcsx2.exe"
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "DisplayIcon" "$INSTDIR\pcsx2-qt.exe"
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "DisplayVersion" "${APP_VERSION}"
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "HelpLink" "https://forums.pcsx2.net"
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "UninstallString" "$INSTDIR\Uninst-pcsx2.exe"

View File

@@ -61,30 +61,38 @@ ${NSD_KillTimer} NSD_Timer.Callback
;-----------------------------------------
; Copy installer files to a temp directory instead of repacking twice (for each installer)
${NSD_CreateLabel} 0 45 80% 10u "Unpacking files. Maybe it's time to upgrade that computer!"
${NSD_CreateLabel} 0 45 80% 10u "Unpacking files"
Call TempFilesOut
${NSD_CreateLabel} 0 45 100% 10u "Moving on"
${NSD_CreateLabel} 0 45 100% 10u "Finished unpacking files"
;-----------------------------------------
Call PreInstall_UsrWait
; Something here is crashing portable installer - CK1
SendMessage $HWNDPARENT ${WM_COMMAND} 1 0
FunctionEnd
; This also determines files to be included with the installer.
; Verify there are no custom DLLs in folder if you are compiling
Function TempFilesOut
SetOutPath "$TEMP\PCSX2 ${APP_VERSION}"
File ..\bin\pcsx2.exe
File ..\bin\GameIndex.yaml
File ..\bin\cheats_ws.zip
File ..\bin\PCSX2_keys.ini.default
File ..\bin\pcsx2-qt.exe
File ..\bin\updater.exe
File ..\bin\qt.conf
File ..\bin\*.dll
SetOutPath "$TEMP\PCSX2 ${APP_VERSION}\QtPlugins"
File /r ..\bin\QtPlugins\*
; GameIndex, Controller DB, shaders, etc
SetOutPath "$TEMP\PCSX2 ${APP_VERSION}\resources"
File /r ..\bin\resources\*
SetOutPath "$TEMP\PCSX2 ${APP_VERSION}\Docs"
File ..\bin\docs\*
SetOutPath "$TEMP\PCSX2 ${APP_VERSION}\Shaders"
File ..\bin\shaders\GS.fx
File ..\bin\shaders\GS_FX_Settings.ini
SetOutPath "$TEMP\PCSX2 ${APP_VERSION}\Langs"
File /nonfatal /r ..\bin\Langs\*.mo
SetOutPath "$TEMP\PCSX2 ${APP_VERSION}\translations"
File /r ..\bin\translations\*.qm
FunctionEnd
Function PreInstall_UsrWait
@@ -116,13 +124,13 @@ ${EndIf}
# Create labels/buttons for the normal installation
${NSD_OnClick} $InstallMode_Normal InstallMode_UsrWait
${NSD_CreateLabel} 10 55 100% 20u "PCSX2 will be installed in Program Files unless another directory is specified. User files are stored in the Documents/PCSX2 directory."
${NSD_CreateLabel} 10 55 100% 20u "PCSX2 will be installed in Program Files unless another directory is specified. User files are also stored here."
# Create labels/buttons for the portable installation
${NSD_CreateRadioButton} 0 95 100% 10u "Portable Installation"
Pop $InstallMode_Portable
${NSD_OnClick} $InstallMode_Portable InstallMode_UsrWait
${NSD_CreateLabel} 10 115 100% 20u "Install PCSX2 to any directory you want. Choose this option if you prefer to have all of your files in the same folder or frequently update PCSX2 through Orphis' Buildbot."
${NSD_CreateLabel} 10 115 100% 20u "Install PCSX2 to any directory you want."
nsDialogs::Show
@@ -160,7 +168,7 @@ FunctionEnd
Function StartFullInstaller
;Checks if install directory is changed from default with /D, and if not, changes to standard full install directory.
${If} $INSTDIR == "$DOCUMENTS\PCSX2 ${APP_VERSION}"
StrCpy $INSTDIR "$PROGRAMFILES\PCSX2"
StrCpy $INSTDIR "$PROGRAMFILES64\PCSX2"
${EndIf}
SetOutPath "$TEMP"
File "pcsx2-${APP_VERSION}-include_standard.exe"
@@ -171,11 +179,14 @@ FunctionEnd
; ----------------------------------
; Portable Install Section
; ----------------------------------
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
;!insertmacro MUI_PAGE_FINISH
!define MUI_FINISHPAGE_RUN "$INSTDIR\pcsx2.exe"
!define MUI_FINISHPAGE_RUN "$INSTDIR\pcsx2-qt.exe"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ModifyRunCheckbox
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
@@ -189,14 +200,14 @@ InstallDir "$DOCUMENTS\PCSX2 ${APP_VERSION}"
Section "" INST_PORTABLE
SetOutPath "$INSTDIR"
File portable.ini
File "portable.ini"
RMDir /r "$TEMP\PCSX2 ${APP_VERSION}"
SectionEnd
Section "" SID_PCSX2
SectionEnd
# Gives the user a fancy checkbox to run PCSX2 right from the installer!
; Gives the user a fancy checkbox to run PCSX2 right from the installer!
Function ModifyRunCheckbox
${IfNot} ${SectionIsSelected} ${SID_PCSX2}
SendMessage $MUI.FINISHPAGE.RUN ${BM_SETCHECK} ${BST_UNCHECKED} 0