diff --git a/CHANGELOG.md b/CHANGELOG.md index ea192b369e2..6b09212d6e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - (Linux/Windows) Add system tray icon - (Windows) Added ability to safely elevate commands that fail due to insufficient permissions when running as a service - (Config) Added global prep commands, and ability to exclude an app from using global prep commands +- (Installer/Windows) Automatically install ViGEmBus if selected **Changed** - (Logging) Changed client verified messages to debug to prevent spamming the log diff --git a/CMakeLists.txt b/CMakeLists.txt index c463d1822cf..77901a1f7e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -705,6 +705,9 @@ if(WIN32) # see options at: https://cmake.org/cmake/help/latest/cpack_gen/nsis.h install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/misc/service/" DESTINATION "scripts" COMPONENT service) + install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/misc/vigembus/" + DESTINATION "scripts" + COMPONENT vigembus) install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/misc/migration/" DESTINATION "scripts" COMPONENT assets) @@ -737,11 +740,7 @@ if(WIN32) # see options at: https://cmake.org/cmake/help/latest/cpack_gen/nsis.h nsExec::ExecToLog 'icacls \\\"$INSTDIR\\\\config\\\" /grant:r Users:\\\(OI\\\)\\\(CI\\\)\\\(F\\\)' nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\add-firewall-rule.bat\\\"' nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\install-service.bat\\\"' - MessageBox MB_YESNO|MB_ICONQUESTION \ - 'Do you want to install ViGEmBus? This is REQUIRED for gamepad support while streaming.' \ - /SD IDNO IDNO NoController - ExecShell 'open' 'https://github.com/ViGEm/ViGEmBus/releases/latest'; \ - skipped if no + nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\install-vigembus.bat\\\"' NoController: ") @@ -751,6 +750,11 @@ if(WIN32) # see options at: https://cmake.org/cmake/help/latest/cpack_gen/nsis.h "${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS} nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\delete-firewall-rule.bat\\\"' nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\uninstall-service.bat\\\"' + MessageBox MB_YESNO|MB_ICONQUESTION \ + 'Do you want to remove ViGEmBus)?' \ + /SD IDNO IDNO NoVigem + nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\uninstall-vigembus.bat\\\"'; skipped if no + NoVigem: MessageBox MB_YESNO|MB_ICONQUESTION \ 'Do you want to remove $INSTDIR (this includes the configuration, cover images, and settings)?' \ /SD IDNO IDNO NoDelete @@ -806,10 +810,10 @@ if(WIN32) # see options at: https://cmake.org/cmake/help/latest/cpack_gen/nsis.h set(CPACK_COMPONENT_AUDIO_GROUP "tools") # elevation tool - set(CPACK_COMPONENT_ELEVATION_DISPLAY_NAME "elevator") - set(CPACK_COMPONENT_ELEVATION_DESCRIPTION "CLI tool that assists with elevating \ + set(CPACK_COMPONENT_ELEVATOR_DISPLAY_NAME "elevator") + set(CPACK_COMPONENT_ELEVATOR_DESCRIPTION "CLI tool that assists with elevating \ commands when permissions have been denied.") - set(CPACK_COMPONENT_ELEVATION_GROUP "tools") + set(CPACK_COMPONENT_ELEVATOR_GROUP "tools") # display tool set(CPACK_COMPONENT_DXGI_DISPLAY_NAME "dxgi-info") @@ -831,6 +835,11 @@ if(WIN32) # see options at: https://cmake.org/cmake/help/latest/cpack_gen/nsis.h set(CPACK_COMPONENT_FIREWALL_DISPLAY_NAME "firewall-scripts") set(CPACK_COMPONENT_FIREWALL_DESCRIPTION "Scripts to enable or disable firewall rules.") set(CPACK_COMPONENT_FIREWALL_GROUP "scripts") + + # vigembus scripts + set(CPACK_COMPONENT_VIGEMBUS_DISPLAY_NAME "vigembus-scripts") + set(CPACK_COMPONENT_VIGEMBUS_DESCRIPTION "Scripts to install and uninstall ViGEmBus for virtual gamepad support.") + set(CPACK_COMPONENT_VIGEMBUS_GROUP "scripts") endif() if(APPLE) # TODO: bundle doesn't produce a valid .app use cpack -G DragNDrop diff --git a/src_assets/windows/misc/vigembus/install-vigembus.bat b/src_assets/windows/misc/vigembus/install-vigembus.bat new file mode 100644 index 00000000000..c4c4e67f4c9 --- /dev/null +++ b/src_assets/windows/misc/vigembus/install-vigembus.bat @@ -0,0 +1,32 @@ +@echo off + +rem Get temp directory +set temp_dir=%temp%/Sunshine + +rem Create temp directory if it doesn't exist +if not exist "%temp_dir%" mkdir "%temp_dir%" + +rem get browser_download_url from asset 0 of https://api.github.com/repos/vigem/vigembus/releases/latest +set latest_release_url=https://api.github.com/repos/vigem/vigembus/releases/latest + +rem Use curl to get the api response, and find the browser_download_url +for /F "tokens=* USEBACKQ" %%F in (`curl -s -L %latest_release_url% ^| findstr browser_download_url`) do ( + set browser_download_url=%%F +) + +rem Strip quotes +set browser_download_url=%browser_download_url:"=% + +rem Remove the browser_download_url key +set browser_download_url=%browser_download_url:browser_download_url: =% + +echo %browser_download_url% + +rem Download the exe +curl -s -L -o "%temp_dir%\vigembus.exe" %browser_download_url% + +rem Install vigembus +%temp_dir%\vigembus.exe /passive /promptrestart + +rem Delete temp directory +rmdir /S /Q "%temp_dir%" diff --git a/src_assets/windows/misc/vigembus/uninstall-vigembus.bat b/src_assets/windows/misc/vigembus/uninstall-vigembus.bat new file mode 100644 index 00000000000..27fde2e6832 --- /dev/null +++ b/src_assets/windows/misc/vigembus/uninstall-vigembus.bat @@ -0,0 +1,4 @@ +@echo off + +rem Use wmic to get the uninstall ViGEmBus +wmic product where name="ViGEm Bus Driver" call uninstall