Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 17 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
")

Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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
Expand Down
32 changes: 32 additions & 0 deletions src_assets/windows/misc/vigembus/install-vigembus.bat
Original file line number Diff line number Diff line change
@@ -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%"
4 changes: 4 additions & 0 deletions src_assets/windows/misc/vigembus/uninstall-vigembus.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off

rem Use wmic to get the uninstall ViGEmBus
wmic product where name="ViGEm Bus Driver" call uninstall