mirror of https://github.com/PCSX2/pcsx2.git
NSIS: Add support for command line flags and fix silent install (#3435)
This commit is contained in:
parent
2849776054
commit
e479bc923e
|
@ -27,7 +27,7 @@ ${EndIf}
|
||||||
|
|
||||||
UserPrompt:
|
UserPrompt:
|
||||||
; Installing another version
|
; Installing another version
|
||||||
MessageBox MB_ICONEXCLAMATION|MB_OKCANCEL "An existing version of PCSX2 has been detected and will be REMOVED. The config folder in Documents will be duplicated (if it exists) and renamed as PCSX2_backup. Backup any important files and click OK to uninstall PCSX2 or Cancel to abort the setup." IDOK SetUninstPath IDCANCEL false
|
MessageBox MB_ICONEXCLAMATION|MB_OKCANCEL "An existing version of PCSX2 has been detected and will be REMOVED. The config folder in Documents will be duplicated (if it exists) and renamed as PCSX2_backup. Backup any important files and click OK to uninstall PCSX2 or Cancel to abort the setup." /SD IDOK IDOK SetUninstPath IDCANCEL false
|
||||||
|
|
||||||
false:
|
false:
|
||||||
Quit
|
Quit
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
; These definitions are shared between the 2 installers (pre-install/portable and full)
|
; These definitions are shared between the 2 installers (pre-install/portable and full)
|
||||||
; This reduces duplicate code throughout both installers.
|
; This reduces duplicate code throughout both installers.
|
||||||
|
|
||||||
|
!include "FileFunc.nsh"
|
||||||
|
|
||||||
ManifestDPIAware true
|
ManifestDPIAware true
|
||||||
Unicode true
|
Unicode true
|
||||||
ShowInstDetails nevershow
|
ShowInstDetails nevershow
|
||||||
|
@ -62,4 +64,57 @@ ${If} $UserPrivileges == "Admin"
|
||||||
${ElseIf} $UserPrivileges == "User"
|
${ElseIf} $UserPrivileges == "User"
|
||||||
StrCpy $IsAdmin 0
|
StrCpy $IsAdmin 0
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function ShowHelpMessage
|
||||||
|
!define line1 "Command line options:$\r$\n$\r$\n"
|
||||||
|
!define line2 "/S - silent install (must be uppercase)$\r$\n"
|
||||||
|
!define line3 "/D=path\to\install\folder - Change install directory (Must be uppercase, the last option given and no quotes)$\r$\n"
|
||||||
|
!define line4 "/NoStart - Do not create start menu shortcut$\r$\n"
|
||||||
|
!define line5 "/NoDesktop - Do not create desktop shortcut$\r$\n"
|
||||||
|
!define line6 "/Portable- Install in portable mode instead of full install, no effect unless /S is passed as well"
|
||||||
|
MessageBox MB_OK "${line1}${line2}${line3}${line4}${line5}${line6}"
|
||||||
|
Abort
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function .onInit
|
||||||
|
Var /GLOBAL cmdLineParams
|
||||||
|
Push $R0
|
||||||
|
${GetParameters} $cmdLineParams
|
||||||
|
ClearErrors
|
||||||
|
|
||||||
|
${GetOptions} $cmdLineParams '/?' $R0
|
||||||
|
IfErrors +2 0
|
||||||
|
Call ShowHelpMessage
|
||||||
|
|
||||||
|
${GetOptions} $cmdLineParams '/H' $R0
|
||||||
|
IfErrors +2 0
|
||||||
|
Call ShowHelpMessage
|
||||||
|
|
||||||
|
Pop $R0
|
||||||
|
|
||||||
|
|
||||||
|
Var /GLOBAL option_startMenu
|
||||||
|
Var /GLOBAL option_desktop
|
||||||
|
Var /GLOBAL option_portable
|
||||||
|
StrCpy $option_startMenu 1
|
||||||
|
StrCpy $option_desktop 1
|
||||||
|
StrCpy $option_portable 0
|
||||||
|
|
||||||
|
Push $R0
|
||||||
|
|
||||||
|
${GetOptions} $cmdLineParams '/NoStart' $R0
|
||||||
|
IfErrors +2 0
|
||||||
|
StrCpy $option_startMenu 0
|
||||||
|
|
||||||
|
${GetOptions} $cmdLineParams '/NoDesktop' $R0
|
||||||
|
IfErrors +2 0
|
||||||
|
StrCpy $option_desktop 0
|
||||||
|
|
||||||
|
${GetOptions} $cmdLineParams '/Portable' $R0
|
||||||
|
IfErrors +2 0
|
||||||
|
StrCpy $option_portable 1
|
||||||
|
|
||||||
|
Pop $R0
|
||||||
|
|
||||||
FunctionEnd
|
FunctionEnd
|
|
@ -1,13 +1,15 @@
|
||||||
Section "Start Menu Shortcuts" SEC_STARTMENU
|
Section "Start Menu Shortcuts" SEC_STARTMENU
|
||||||
|
${If} $option_startMenu == 1
|
||||||
; CreateShortCut gets the working directory from OutPath
|
; CreateShortCut gets the working directory from OutPath
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
CreateShortCut "$SMPROGRAMS\${APP_NAME}.lnk" "${APP_EXE}" "" "${APP_EXE}" 0
|
CreateShortCut "$SMPROGRAMS\${APP_NAME}.lnk" "${APP_EXE}" "" "${APP_EXE}" 0
|
||||||
|
${EndIf}
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "Desktop Shortcut" SEC_DESKTOP
|
Section "Desktop Shortcut" SEC_DESKTOP
|
||||||
|
${If} $option_desktop == 1
|
||||||
; CreateShortCut gets the working directory from OutPath
|
; CreateShortCut gets the working directory from OutPath
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "${APP_EXE}" "" "${APP_EXE}" 0 "" "" "A Playstation 2 Emulator"
|
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "${APP_EXE}" "" "${APP_EXE}" 0 "" "" "A Playstation 2 Emulator"
|
||||||
|
${EndIf}
|
||||||
SectionEnd
|
SectionEnd
|
|
@ -33,6 +33,11 @@ Page Custom InstallMode InstallModeLeave
|
||||||
; Function located in SharedDefs
|
; Function located in SharedDefs
|
||||||
Section ""
|
Section ""
|
||||||
Call IsUserAdmin
|
Call IsUserAdmin
|
||||||
|
IfSilent 0 +5
|
||||||
|
Call TempFilesOut
|
||||||
|
${If} $option_portable == 0
|
||||||
|
Call StartFullInstaller
|
||||||
|
${EndIf}
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Function PreInstallDialog
|
Function PreInstallDialog
|
||||||
|
@ -57,6 +62,15 @@ ${NSD_KillTimer} NSD_Timer.Callback
|
||||||
;-----------------------------------------
|
;-----------------------------------------
|
||||||
; Copy installer files to a temp directory instead of repacking twice (for each installer)
|
; 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. Maybe it's time to upgrade that computer!"
|
||||||
|
Call TempFilesOut
|
||||||
|
${NSD_CreateLabel} 0 45 100% 10u "Moving on"
|
||||||
|
;-----------------------------------------
|
||||||
|
|
||||||
|
Call PreInstall_UsrWait
|
||||||
|
SendMessage $HWNDPARENT ${WM_COMMAND} 1 0
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function TempFilesOut
|
||||||
SetOutPath "$TEMP\PCSX2 ${APP_VERSION}"
|
SetOutPath "$TEMP\PCSX2 ${APP_VERSION}"
|
||||||
File ..\bin\pcsx2.exe
|
File ..\bin\pcsx2.exe
|
||||||
File ..\bin\GameIndex.dbf
|
File ..\bin\GameIndex.dbf
|
||||||
|
@ -80,13 +94,8 @@ ${NSD_KillTimer} NSD_Timer.Callback
|
||||||
File /nonfatal ..\bin\Plugins\DEV9null.dll
|
File /nonfatal ..\bin\Plugins\DEV9null.dll
|
||||||
File /nonfatal ..\bin\Plugins\FWnull.dll
|
File /nonfatal ..\bin\Plugins\FWnull.dll
|
||||||
|
|
||||||
SetOutPath "$TEMP\PCSX2 ${APP_VERSION}\Langs"
|
SetOutPath "$TEMP\PCSX2 ${APP_VERSION}\Langs"
|
||||||
File /nonfatal /r ..\bin\Langs\*.mo
|
File /nonfatal /r ..\bin\Langs\*.mo
|
||||||
${NSD_CreateLabel} 0 45 100% 10u "Moving on"
|
|
||||||
;-----------------------------------------
|
|
||||||
|
|
||||||
Call PreInstall_UsrWait
|
|
||||||
SendMessage $HWNDPARENT ${WM_COMMAND} 1 0
|
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function PreInstall_UsrWait
|
Function PreInstall_UsrWait
|
||||||
|
@ -155,13 +164,21 @@ ${NSD_GetState} $InstallMode_Normal $0
|
||||||
${NSD_GetState} $InstallMode_Portable $1
|
${NSD_GetState} $InstallMode_Portable $1
|
||||||
|
|
||||||
${If} ${BST_CHECKED} == $0
|
${If} ${BST_CHECKED} == $0
|
||||||
SetOutPath "$TEMP"
|
Call StartFullInstaller
|
||||||
File "pcsx2-${APP_VERSION}-include_standard.exe"
|
|
||||||
ExecShell open "$TEMP\pcsx2-${APP_VERSION}-include_standard.exe"
|
|
||||||
Quit
|
|
||||||
${EndIf}
|
${EndIf}
|
||||||
FunctionEnd
|
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"
|
||||||
|
${EndIf}
|
||||||
|
SetOutPath "$TEMP"
|
||||||
|
File "pcsx2-${APP_VERSION}-include_standard.exe"
|
||||||
|
ExecShell open "$TEMP\pcsx2-${APP_VERSION}-include_standard.exe" "$cmdLineParams /D=$INSTDIR"
|
||||||
|
Quit
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
; ----------------------------------
|
; ----------------------------------
|
||||||
; Portable Install Section
|
; Portable Install Section
|
||||||
; ----------------------------------
|
; ----------------------------------
|
||||||
|
|
Loading…
Reference in New Issue