diff --git a/build/installer.nsh b/build/installer.nsh index b04e2c372..f4a4deaef 100644 --- a/build/installer.nsh +++ b/build/installer.nsh @@ -1,4 +1,49 @@ +!include MUI2.nsh +!include nsDialogs.nsh + +!define GC_INSTALLER "gc-driver-install.exe" + +; The result of whether we should install drivers or not +var InstallType + +Page custom InstTypePageCreate InstTypePageLeave + +Function InstTypePageCreate +!insertmacro MUI_HEADER_TEXT "Select components to install" "" +nsDialogs::Create 1018 +Pop $0 +${NSD_CreateRadioButton} 0 50u 100% 10u "Also install GameCube adapter drivers (optional)" +pop $1 +${NSD_CreateRadioButton} 0 70u 100% 10u "Only install Slippi Launcher" +pop $2 +${If} $InstallType == SKIP + ${NSD_Check} $2 ; Select skip +${Else} + ${NSD_Check} $1 ; Select install drivers by default +${EndIf} +${NSD_CreateLabel} 0 0 100% 30u "Would you like to also install GameCube adapter drivers? This would allow you to use GameCube controllers with a compatible adapter (in Switch/Wii U mode) on your PC. Skip this if you already have GameCube adapter drivers installed." +pop $3 +nsDialogs::Show +FunctionEnd + +Function InstTypePageLeave +${NSD_GetState} $1 $0 +${If} $0 = ${BST_CHECKED} + ; Install was selected + StrCpy $InstallType INSTALL +${Else} + ${NSD_GetState} $2 $0 + ${If} $0 = ${BST_CHECKED} + ; Skip was selected + StrCpy $InstallType SKIP + ${Else} + ; Nothing was selected + ${EndIf} +${EndIf} +FunctionEnd + !macro customInstall + ; Add slippi URI Handling DetailPrint "Register slippi URI Handler" DeleteRegKey HKCR "slippi" WriteRegStr HKCR "slippi" "" "URL:slippi" @@ -7,4 +52,11 @@ WriteRegStr HKCR "slippi\shell" "" "" WriteRegStr HKCR "slippi\shell\Open" "" "" WriteRegStr HKCR "slippi\shell\Open\command" "" "$\"$INSTDIR\${APP_EXECUTABLE_FILENAME}$\" $\"%1$\"" + + ; Check if we should also install the GC drivers + ${If} $InstallType == INSTALL + ; Automatically run gamecube adapter driver installer + File /oname=$PLUGINSDIR\${GC_INSTALLER} "${BUILD_RESOURCES_DIR}\${GC_INSTALLER}" + ExecShellWait "" "$PLUGINSDIR\${GC_INSTALLER}" SW_HIDE + ${EndIf} !macroend \ No newline at end of file diff --git a/electron-builder.json b/electron-builder.json index 2a50e0ccf..76b86f47a 100644 --- a/electron-builder.json +++ b/electron-builder.json @@ -58,7 +58,9 @@ "nsis": { "artifactName": "Slippi-Launcher-Setup-${version}.${ext}", "perMachine": true, - "include": "./build/installer.nsh" + "include": "./build/installer.nsh", + "warningsAsErrors": false, + "allowElevation": true }, "linux": { "target": ["AppImage"], diff --git a/resources/gc-driver-install.exe b/resources/gc-driver-install.exe new file mode 100644 index 000000000..48bc1e076 Binary files /dev/null and b/resources/gc-driver-install.exe differ