Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for installing GC drivers on app install #210

Merged
merged 5 commits into from
Aug 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions build/installer.nsh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
4 changes: 3 additions & 1 deletion electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
Binary file added resources/gc-driver-install.exe
Binary file not shown.