Added pre-install dialog, updated build instructions, fix RegKey in uninstaller, automatically backup old configuration folder, misc. changes.

Automatically backup old configuration folder to avoid conflicts, misc. changes.

Added reviewed changes
This commit is contained in:
Christian Kenny 2017-03-16 19:01:45 -04:00 committed by Gregory Hainaut
parent b896eed5d4
commit e043822a93
5 changed files with 112 additions and 132 deletions

View File

@ -10,80 +10,60 @@ Function UninstallPrevious
; Search for 1.0.0
ReadRegStr $R7 HKLM "${INSTDIR_REG_KEY}" "Uninst-pcsx2Directory"
${StrContains} "$4" "1.0.0" "$R7"
StrCmp $4 "" +1
${If} $R7 == ""
${EndIf}
; This will become the primary version check once more stable builds
; This will become the primary version check for 1.6.0 and later
ReadRegStr $R1 HKLM "${INSTDIR_REG_KEY}" "DisplayVersion"
${If} $R1 == ""
${EndIf}
; Search for 1.4.0
ReadRegStr $R2 HKLM "${INSTDIR_REG_KEY}" "Uninst-pcsx2 1.4.0Directory"
${StrContains} "$2" "1.4.0" "$R2"
StrCmp $2 "" +1
${If} $R2 == ""
${EndIf}
; Search for 1.2.1
ReadRegStr $R3 HKLM "${INSTDIR_REG_KEY}-r5875" "Uninst-pcsx2-r5875Directory"
${StrContains} "$3" "1.2.1" "$R3"
StrCmp $3 "" +1
${If} $R3 == ""
${EndIf}
; Search for 0.9.8
ReadRegStr $R5 HKLM "${INSTDIR_REG_KEY}-r4600" "Uninst-pcsx2-r4600Directory"
${StrContains} "$5" "0.9.8" "$R5"
StrCmp $5 "" +1
${If} $R5 == ""
${EndIf}
; If all cases return null, our work here is done.
;${If} $R1 == ""
${If} $R2 == ""
${AndIf} $R3 == ""
${AndIf} $R5 == ""
${AndIf} $R7 == ""
Goto Done
Return
${EndIf}
; Installing another version
MessageBox MB_ICONEXCLAMATION|MB_OKCANCEL "Another version of PCSX2 is already installed. Please back up your files and click OK to uninstall PCSX2; or Cancel to abort the setup." IDOK true IDCANCEL false
true:
Goto SetUninstPath
false:
Quit
MessageBox MB_ICONEXCLAMATION|MB_OKCANCEL "Another version of PCSX2 is already installed. The current configuration folder in Documents will be duplicated and renamed as PCSX2_backup. Click OK to uninstall PCSX2 or Cancel to abort the setup." IDOK SetUninstPath IDCANCEL false
false:
Quit
SetUninstPath:
SetOutPath "$DOCUMENTS"
CopyFiles /SILENT "$DOCUMENTS\PCSX2" "$DOCUMENTS\PCSX2_backup"
RMDir /r "$DOCUMENTS\PCSX2"
${If} $R7 != ""
${AndIf} $R1 != ""
${OrIf} $4 == "1.0.0"
Goto ExecNormal
${Else}
Goto +1
${EndIf}
${If} $R2 != ""
${AndIf} $2 == "1.4.0"
Goto Exec1.4.0
${Else}
Goto +1
${EndIf}
${If} $R3 != ""
${AndIf} $3 == "1.2.1"
Goto Exec1.2.1
${Else}
Goto +1
${EndIf}
${If} $R5 != ""
${AndIf} $5 == "0.9.8"
Goto Exec0.9.8
${Else}
Goto +1
${EndIf}
ExecNormal:
@ -91,31 +71,28 @@ ExecNormal:
CopyFiles /SILENT /FILESONLY "$R7\Uninst-pcsx2.exe" "$TEMP"
ExecWait '"$TEMP\Uninst-pcsx2.exe" /S _?=$R7'
Delete "$TEMP\Uninst-pcsx2.exe"
Goto Done
Return
Exec1.4.0:
Exec1.4.0:
SetOutPath "$TEMP"
CopyFiles /SILENT /FILESONLY "$R2\Uninst-pcsx2 1.4.0.exe" "$TEMP"
ExecWait '"$TEMP\Uninst-pcsx2 1.4.0.exe" /S _?=$R2'
RMDir /r "$DOCUMENTS\PCSX2\inis_1.4.0"
Delete "$TEMP\Uninst-pcsx2 1.4.0.exe"
DeleteRegKey HKLM Software\PCSX2
Goto Done
Return
Exec1.2.1:
SetOutPath "$TEMP"
CopyFiles /SILENT /FILESONLY "$R3\Uninst-pcsx2-r5875.exe" "$TEMP"
ExecWait '"$TEMP\Uninst-pcsx2-r5875.exe" /S _?=$R3'
Delete "$TEMP\Uninst-pcsx2-r5875.exe"
Goto Done
Return
Exec0.9.8:
SetOutPath "$TEMP"
CopyFiles /SILENT /FILESONLY "$R5\Uninst-pcsx2-r4600.exe" "$TEMP"
ExecWait '"$TEMP\Uninst-pcsx2-r4600.exe" /S _?=$R5'
Delete "$TEMP\Uninst-pcsx2-r4600.exe"
Goto Done
Done:
Return
FunctionEnd

View File

@ -49,26 +49,12 @@ SectionEnd
!include "SharedShortcuts.nsh"
SectionGroup "Tools & Utilities" SEC_UTILS
Section "SCP Toolkit" SEC_SCPTK
inetc::get "https://github.com/nefarius/ScpToolkit/releases/download/v1.7.277.16103-BETA/ScpToolkit_Setup.exe" "$TEMP\ScpToolkit_Setup.exe" /END
ExecWait "$TEMP\ScpToolkit_Setup.exe"
Delete "$TEMP\ScpToolkit_Setup.exe"
SectionEnd
SectionGroupEnd
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_SCPTK ${LANG_ENGLISH} "Download and install nefarius's SCPToolkit that allows Dualshock Controllers to be used with Windows."
LangString DESC_UTILS ${LANG_ENGLISH} "Additional utilities that are available for PCSX2 such as legacy plugins and debugging tools."
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_UTILS} $(DESC_UTILS)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_SCPTK} $(DESC_SCPTK)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CORE} $(DESC_CORE)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_STARTMENU} $(DESC_STARTMENU)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} $(DESC_DESKTOP)

View File

@ -4,7 +4,7 @@
; This reduces duplicate code throughout both installers.
ManifestDPIAware true
ShowInstDetails show
ShowInstDetails nevershow
ShowUninstDetails nevershow
SetCompressor /SOLID lzma

View File

@ -2,56 +2,40 @@
PCSX2 NSIS Installer Instructions
-------------------------------------
-------------------------------------
Required NSIS Components
-------------------------------------
* Install NSIS (tested with 3.01), make sure to include the "Modern User Interface"
*** Make sure "nsDialogs" is checked to be installed in the Plugins group of the NSIS installer.
* Install the Inetc plugin for NSIS (http://nsis.sourceforge.net/Inetc_plug-in)
( Use the Winamp forum link on that page to find the most recent release )
* Install NSIS Script: Advanced Uninstall Log (you can find it on NSIS wiki)
( Currently at http://nsis.sourceforge.net/Advanced_Uninstall_Log_NSIS_Header )
* If using NSIS 3.0+ (at the current time, the AdvUninst.zip hosted at the NSIS wiki URL above is version 1.0, so please let me know if this changes!)
* Locate AdvUninstLog.nsh in "Program Files(x86)\NSIS\Include"
* On line 428, change "!undef ID ${__LINE__}" to "!undef ID"
* Info on why here (http://stackoverflow.com/questions/30306597/nsis-advanced-uninstall-log-incompatible-with-nsis-3-0b4)
--------------------------------------------
Preparing to compile the PCSX2 installer
--------------------------------------------
** Save these to your local git repo directory in pcsx2/nsis.
* Download the Visual C++ 2015 Redistributable
( https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe )
Rename the download to "vcredist_2015_Update_1_x86".
* Download the DirectX Web Installer (dxwebsetup.exe) (currently required, might be made optional later).
( http://download.microsoft.com/download/1/7/1/1718CCC4-6315-4D8E-9543-8E28A4E18C4C/dxwebsetup.exe )
No name change is required.
* If using NSIS 3.0+ (at the current time, the AdvUninst.zip hosted at the NSIS wiki URL above is version 1.0, so please let me know if this changes!)
* Locate AdvUninstLog.nsh in "Program Files(x86)\NSIS\Include"
* On line 428, change "!undef ID ${__LINE__}" to "!undef ID"
-----------------------------------------------
Building plugins to include in the installer
-----------------------------------------------
* Plugins must be built before running the NSIS script or they will not be included in the installer
* Load the PCSX2 Suite solution and rebuild all in the following targets:
* Release SSE2
* Release SSE4 (only needed if packaging plugins)
* Release AVX2 (only needed if packaging plugins)
* Devel (optional) /* not enabled in the installer either, so need to do that as well */
You may selectively unload plugins you do not wish to package prior to running the NSIS
script.
* Release SSE4
* Release AVX2
-----------------------------
Compiling the NSIS script
Compiling the NSIS scripts
-----------------------------
* Once you have downloaded both Microsoft packages and built the required plugins; you are ready to compile! :)
* Open MakeNSIS.exe and compile script (pcsx2_full_install.nsi)!
* Once you have built the required PCSX2 plugins and pcsx2.exe; you are ready to compile! :)
* Open MakeNSIS.exe and compile both nsi scripts in THIS order:
1. pcsx2_full_install.nsi
2. pcsx2_shared_init.nsi
Output executables will be generated to the local git repo; in the "pcsx2/nsis" folder.
--------------------------------------------
@ -64,13 +48,4 @@ Eclipse. This typically only takes me a few minutes (yes it's really that painl
Eclipse you can use F2 and F3 for online help and context help on NSIS commands, and the syntax
highlighting is very clean and NSIS-specific. Additionally it'll give you Visual Studio-style
hyperlinks for errors during compilation, so that you can simply click on an error and be taken
right to the offending line of code. Highly recommended! :)
--------------------------------------------
TODO / Wish List!!
--------------------------------------------
* pcsx2-dev should probably be an optional section, conditionally scripted only if the
file is present at compilation time, and packaged.
right to the offending line of code. Highly recommended! :)

View File

@ -14,7 +14,13 @@ Var IsAdmin
Var DirectXSetupError
; Dialog Vars
Var hwnd
Var PreInstall_Dialog
Var PreInstall_DlgBack
Var PreInstall_DlgNext
Var InstallMode_Dialog
Var InstallMode_DlgBack
Var InstallMode_DlgNext
Var InstallMode_Label
Var InstallMode_Full
@ -22,11 +28,10 @@ Var InstallMode_Portable
!include "nsDialogs.nsh"
Page Custom IsUserAdmin
Page Custom CheckDirectX
Page Custom PreInstallDialog
Page Custom InstallMode InstallModeLeave
Function 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."
@ -35,17 +40,11 @@ Function IsUserAdmin
ClearErrors
UserInfo::GetName
Pop $R8
Pop $R8
UserInfo::GetOriginalAccountType
Pop $UserPrivileges
;UserInfo::GetOriginalAccountType
;Pop $2
;MessageBox MB_OK "$2"
;${EndIf}
# GetOriginalAccountType will check the tokens of the original user of the
# current thread/process. If the user tokens were elevated or limited for
# this process, GetOriginalAccountType will return the non-restricted
@ -63,13 +62,36 @@ ${If} $UserPrivileges == "Admin"
${EndIf}
FunctionEnd
Function CheckDirectX
Function PreInstallDialog
nsDialogs::Create /NOUNLOAD 1018
Pop $PreInstall_Dialog
GetDlgItem $PreInstall_DlgBack $HWNDPARENT 3
EnableWindow $PreInstall_DlgBack ${SW_HIDE}
GetDlgItem $PreInstall_DlgNext $HWNDPARENT 1
EnableWindow $PreInstall_DlgNext 0
${NSD_CreateProgressBar} 0 75 100% 10% "Test"
Pop $hwnd
${NSD_CreateTimer} NSD_Timer.Callback 1
nsDialogs::Show
FunctionEnd
Function NSD_Timer.Callback
${NSD_KillTimer} NSD_Timer.Callback
SendMessage $hwnd ${PBM_SETRANGE32} 0 100
!include WinVer.nsh
!include "X64.nsh"
${If} ${AtLeastWin8.1}
${OrIf} $IsAdmin == 0
Goto SkipDx
Call PreInstall_UsrWait
SendMessage $HWNDPARENT ${WM_COMMAND} 1 0
${EndIf}
${If} ${RunningX64}
@ -83,16 +105,36 @@ ${If} $R0 == "1"
Goto ExecDxSetup
${EndIf}
inetc::get "https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe" "$TEMP\vcredist_2015_Update_1_x86.exe" /END
ExecWait "$TEMP\vcredist_2015_Update_1_x86.exe"
${NSD_CreateLabel} 0 45 100% 10u "Downloading Visual C++ 2015 package"
Pop $hwnd
inetc::get "https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe" "$TEMP\vcredist_2015_Update_1_x86.exe" /SILENT /CONNECTTIMEOUT 30 /RECEIVETIMEOUT 30 /END
${NSD_CreateLabel} 0 45 100% 10u "Installing Visual C++ 2015 package"
Pop $hwnd
ExecWait '"$TEMP\vcredist_2015_Update_1_x86.exe /S"'
SendMessage $hwnd ${PBM_SETPOS} 40 0
Delete "$TEMP\vcredist_2015_Update_1_x86.exe"
ExecDxSetup:
inetc::get "https://download.microsoft.com/download/1/7/1/1718CCC4-6315-4D8E-9543-8E28A4E18C4C/dxwebsetup.exe" "$TEMP\dxwebsetup.exe" /END
ExecWait '"$TEMP\dxwebsetup.exe" /Q' $DirectXSetupError
Delete "$TEMP\dxwebsetup.exe"
SkipDX:
${NSD_CreateLabel} 0 45 100% 10u "Installing DXWebSetup package"
Pop $hwnd
SendMessage $hwnd ${PBM_SETPOS} 80 0
SetOutPath "$TEMP"
File "dxwebsetup.exe"
ExecWait '"$TEMP\dxwebsetup.exe" /Q' $DirectXSetupError
SendMessage $hwnd ${PBM_SETPOS} 100 0
Delete "$TEMP\dxwebsetup.exe"
Sleep 20
Call PreInstall_UsrWait
SendMessage $HWNDPARENT ${WM_COMMAND} 1 0
FunctionEnd
Function PreInstall_UsrWait
GetDlgItem $PreInstall_DlgNext $HWNDPARENT 1
EnableWindow $PreInstall_DlgNext 1
FunctionEnd
Function InstallMode
@ -100,27 +142,29 @@ Function InstallMode
nsDialogs::Create /NOUNLOAD 1018
Pop $InstallMode_Dialog
GetDlgItem $InstallMode_DlgBack $HWNDPARENT 3
EnableWindow $InstallMode_DlgBack 0
GetDlgItem $InstallMode_DlgNext $HWNDPARENT 1
EnableWindow $InstallMode_DlgNext 0
${NSD_CreateLabel} 0 0 100% 10u "Select an installation mode for PCSX2."
Pop $InstallMode_Label
${NSD_CreateRadioButton} 10 35 100% 10u "Full Installation"
${NSD_CreateRadioButton} 0 35 100% 10u "Full Installation"
Pop $InstallMode_Full
${If} $IsAdmin == 0
EnableWindow $InstallMode_Full 0
${EndIf}
${NSD_OnClick} $InstallMode_Full InstallMode_UsrWait
${NSD_CreateLabel} 26 55 100% 20u " PCSX2 will be installed in Program Files; unless another directory is specified. In addition, User files are stored in the Documents/PCSX2 directory"
${NSD_CreateRadioButton} 10 95 100% 10u "Portable Installation"
${NSD_OnClick} $InstallMode_Full 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_CreateRadioButton} 0 95 100% 10u "Portable Installation"
Pop $InstallMode_Portable
${NSD_OnClick} $InstallMode_Portable InstallMode_UsrWait
${NSD_CreateLabel} 26 115 100% 20u "Install PCSX2 to whatever 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. Choose this option if you prefer to have all of your files in the same folder or frequently update PCSX2 through Orphis' Buildbot."
nsDialogs::Show
@ -136,12 +180,10 @@ ${NSD_GetState} $InstallMode_Full $0
${NSD_GetState} $InstallMode_Portable $1
${If} ${BST_CHECKED} == $0
SetOutPath "$TEMP"
File "pcsx2-${APP_VERSION}-include_standard.exe"
ExecShell open "$TEMP\pcsx2-${APP_VERSION}-include_standard.exe"
Quit
${Else}
Goto +2
SetOutPath "$TEMP"
File "pcsx2-${APP_VERSION}-include_standard.exe"
ExecShell open "$TEMP\pcsx2-${APP_VERSION}-include_standard.exe"
Quit
${EndIf}
FunctionEnd
@ -159,7 +201,7 @@ FunctionEnd
!include "ApplyExeProps.nsh"
; The default installation directory for the portable binary.
InstallDir "$DOCUMENTS\$R8\PCSX2${APP_VERSION}"
InstallDir "$DOCUMENTS\$R8\PCSX2 ${APP_VERSION}"
; Installed files are housed here
!include "SharedCore.nsh"