Skip to content
Draft
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
14 changes: 10 additions & 4 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ jobs:
libwayland-dev \
libx11-xcb-dev \
libxcb-dri3-dev \
libxfixes-dev
libxfixes-dev \
libxtst-dev

- name: Build latest libva
env:
Expand Down Expand Up @@ -178,9 +179,14 @@ jobs:

- name: Sync Python tools
run: |
uv sync --locked \
--python "${PYTHON_VERSION}" \
--no-python-downloads --no-install-project
uv_sync_args=(
--locked
--python "${PYTHON_VERSION}"
--no-python-downloads
--no-install-project
)
# uv.lock pins external artifacts; reviewed local build hooks are required for gcovr.
uv sync "${uv_sync_args[@]}" # NOSONAR(githubactions:S8541)
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed

- name: Run tests
id: test
Expand Down
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
[submodule "third-party/glad"]
path = third-party/glad
url = https://github.com/Dav1dde/glad.git
[submodule "third-party/inputtino"]
path = third-party/inputtino
url = https://github.com/games-on-whales/inputtino.git
branch = stable
[submodule "third-party/libdisplaydevice"]
path = third-party/libdisplaydevice
url = https://github.com/LizardByte/libdisplaydevice.git
branch = master
[submodule "third-party/libvirtualhid"]
path = third-party/libvirtualhid
url = https://github.com/LizardByte/libvirtualhid.git
branch = master
[submodule "third-party/lizardbyte-common"]
path = third-party/lizardbyte-common
url = https://github.com/LizardByte/lizardbyte-common.git
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.24)
# `CMAKE_CUDA_ARCHITECTURES` requires 3.18
# `set_source_files_properties` requires 3.18
# `cmake_path(CONVERT ... TO_NATIVE_PATH_LIST ...)` requires 3.20
# `third-party/libvirtualhid` requires 3.24
# todo - set this conditionally

project(Sunshine VERSION 0.0.0
Expand Down
37 changes: 27 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,17 @@ LizardByte has the full documentation hosted on [Read the Docs](https://docs.liz
Clients may support other gamepads.
</td>
</tr>
<tr>
<td>Generic</td>
<td>❌</td>
<td>✅</td>
<td>❌</td>
<td>✅</td>
</tr>
<tr>
<td>DualShock / DS4 (PlayStation 4)</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>❌</td>
<td>✅</td>
</tr>
Expand All @@ -64,31 +71,41 @@ LizardByte has the full documentation hosted on [Read the Docs](https://docs.liz
<td>❌</td>
<td>✅</td>
<td>❌</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Nintendo Switch Pro</td>
<td>✅</td>
<td>✅</td>
<td>❌</td>
<td>✅</td>
<td>❌</td>
<td>✅</td>
</tr>
<tr>
<td>Xbox 360</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>❌</td>
<td>✅</td>
</tr>
<tr>
<td>Xbox One/Series</td>
<td>Xbox One</td>
<td>❌</td>
<td>✅</td>
<td>❌</td>
<td>✅</td>
</tr>
<tr>
<td>Xbox Series</td>
<td>❌</td>
<td>✅</td>
<td>❌</td>
<td>✅</td>
</tr>
</table>

FreeBSD virtual gamepad emulation is currently unavailable because libvirtualhid does not yet provide a FreeBSD
backend.

<table>
<caption id="encoding_api">Encoding API</caption>
<tr>
Expand Down Expand Up @@ -381,7 +398,7 @@ LizardByte has the full documentation hosted on [Read the Docs](https://docs.liz
</tr>
<tr>
<td rowspan="6">OS</td>
<td>FreeBSD: 14.4+</td>
<td>FreeBSD: 15.1+</td>
</tr>
<tr>
<td>Linux/Debian: 13+ (trixie)</td>
Expand All @@ -396,7 +413,7 @@ LizardByte has the full documentation hosted on [Read the Docs](https://docs.liz
<td>macOS: 14.2+</td>
</tr>
<tr>
<td>Windows: 11+ (Windows Server does not support virtual gamepads)</td>
<td>Windows: 11+</td>
</tr>
<tr>
<td rowspan="2">Network</td>
Expand Down
12 changes: 12 additions & 0 deletions cmake/compile_definitions/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ elseif(UNIX)
endif()
endif()

# libvirtualhid
add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/libvirtualhid")
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES libvirtualhid::libvirtualhid)
list(APPEND PLATFORM_TARGET_FILES
"${CMAKE_SOURCE_DIR}/src/platform/virtualhid_input.h"
"${CMAKE_SOURCE_DIR}/src/platform/virtualhid_input.cpp")

# build libevdev before the libvirtualhid target when using the ExternalProject fallback
if(EXTERNAL_PROJECT_LIBEVDEV_USED AND TARGET libvirtualhid)
add_dependencies(libvirtualhid libevdev)
endif()

set(NVENC_PUBLIC_SOURCES
"${CMAKE_SOURCE_DIR}/src/nvenc/nvenc_config.h"
"${CMAKE_SOURCE_DIR}/src/nvenc/nvenc_d3d11_interface.h"
Expand Down
18 changes: 3 additions & 15 deletions cmake/compile_definitions/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -296,24 +296,12 @@ if(NOT ${CUDA_FOUND}
message(FATAL_ERROR "Couldn't find either cuda, libdrm, libva, kwin, pipewire, portal, wayland or x11")
endif()

# These need to be set before adding the inputtino subdirectory in order for them to be picked up
# These need to be set before common.cmake adds the libvirtualhid subdirectory in order for them to be picked up
set(LIBEVDEV_CUSTOM_INCLUDE_DIR "${EVDEV_INCLUDE_DIR}")
set(LIBEVDEV_CUSTOM_LIBRARY "${EVDEV_LIBRARY}")
if(FREEBSD)
set(USE_UHID OFF)
endif()

add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/inputtino")
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES inputtino::libinputtino)
file(GLOB_RECURSE INPUTTINO_SOURCES
${CMAKE_SOURCE_DIR}/src/platform/linux/input/inputtino*.h
${CMAKE_SOURCE_DIR}/src/platform/linux/input/inputtino*.cpp)
list(APPEND PLATFORM_TARGET_FILES ${INPUTTINO_SOURCES})

# build libevdev before the libinputtino target
if(EXTERNAL_PROJECT_LIBEVDEV_USED)
add_dependencies(libinputtino libevdev)
endif()
list(APPEND PLATFORM_TARGET_FILES
"${CMAKE_SOURCE_DIR}/src/platform/linux/input/virtualhid.cpp")

# AppImage and Flatpak
if (${SUNSHINE_BUILD_APPIMAGE})
Expand Down
5 changes: 0 additions & 5 deletions cmake/compile_definitions/windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ set_target_properties(sunshine_rc_object PROPERTIES
INCLUDE_DIRECTORIES ""
)

# ViGEmBus version
set(VIGEMBUS_PACKAGED_V "1.21.442")
set(VIGEMBUS_PACKAGED_V_2 "${VIGEMBUS_PACKAGED_V}.0")
list(APPEND SUNSHINE_DEFINITIONS VIGEMBUS_PACKAGED_VERSION="${VIGEMBUS_PACKAGED_V_2}")

set(PLATFORM_TARGET_FILES
"${CMAKE_SOURCE_DIR}/src/platform/windows/publish.cpp"
"${CMAKE_SOURCE_DIR}/src/platform/windows/misc.h"
Expand Down
8 changes: 8 additions & 0 deletions cmake/packaging/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/assets/web/images/logo-sunshine.svg"
COPYONLY)

# Copy the Virtual HID Driver icon for Windows tray notifications.
if(WIN32)
configure_file(
"${CMAKE_SOURCE_DIR}/third-party/libvirtualhid/libvirtualhid.svg"
"${CMAKE_CURRENT_BINARY_DIR}/assets/web/images/logo-libvirtualhid.svg"
COPYONLY)
endif()

# install built vite assets
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/assets/web"
DESTINATION "${SUNSHINE_ASSETS_DIR}")
Expand Down
25 changes: 0 additions & 25 deletions cmake/packaging/windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,6 @@ if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64" AND DEFINED _MINHOOK_DLL)
install(FILES "${_MINHOOK_DLL}" DESTINATION "." COMPONENT application)
endif()

# ViGEmBus installer
set(SUNSHINE_THIRD_PARTY_DIR "third-party")
set(VIGEMBUS_INSTALLER "${CMAKE_BINARY_DIR}/${SUNSHINE_THIRD_PARTY_DIR}/vigembus_installer.exe")
set(VIGEMBUS_DOWNLOAD_URL_1 "https://github.com/nefarius/ViGEmBus/releases/download")
set(VIGEMBUS_DOWNLOAD_URL_2 "v${VIGEMBUS_PACKAGED_V_2}/ViGEmBus_${VIGEMBUS_PACKAGED_V}_x64_x86_arm64.exe")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${SUNSHINE_THIRD_PARTY_DIR}")
file(DOWNLOAD
"${VIGEMBUS_DOWNLOAD_URL_1}/${VIGEMBUS_DOWNLOAD_URL_2}"
${VIGEMBUS_INSTALLER}
SHOW_PROGRESS
EXPECTED_HASH SHA256=155c50f1eec07bdc28d2f61a3e3c2c6c132fee7328412de224695f89143316bc
TIMEOUT 60
)
install(FILES ${VIGEMBUS_INSTALLER}
DESTINATION "${SUNSHINE_THIRD_PARTY_DIR}"
RENAME "vigembus_installer.exe"
COMPONENT gamepad)

# Adding tools
install(TARGETS dxgi-info RUNTIME DESTINATION "tools" COMPONENT dxgi)
install(TARGETS audio-info RUNTIME DESTINATION "tools" COMPONENT audio)
Expand Down Expand Up @@ -80,8 +62,6 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")

# Setting components groups and dependencies
set(CPACK_COMPONENT_GROUP_CORE_EXPANDED true)
set(CPACK_COMPONENT_GROUP_THIRDPARTY_DISPLAY_NAME "Third Party")
set(CPACK_COMPONENT_GROUP_THIRDPARTY_DESCRIPTION "Bundled third-party installers and optional components.")

# sunshine binary
set(CPACK_COMPONENT_APPLICATION_DISPLAY_NAME "${CMAKE_PROJECT_NAME}")
Expand Down Expand Up @@ -116,11 +96,6 @@ set(CPACK_COMPONENT_FIREWALL_DISPLAY_NAME "Add Firewall Exclusions")
set(CPACK_COMPONENT_FIREWALL_DESCRIPTION "Scripts to enable or disable firewall rules.")
set(CPACK_COMPONENT_FIREWALL_GROUP "Scripts")

# gamepad third-party installer
set(CPACK_COMPONENT_GAMEPAD_DISPLAY_NAME "Virtual Gamepad")
set(CPACK_COMPONENT_GAMEPAD_DESCRIPTION "ViGEmBus installer for virtual gamepad support.")
set(CPACK_COMPONENT_GAMEPAD_GROUP "ThirdParty")

# include specific packaging
include(${CMAKE_MODULE_PATH}/packaging/windows_nsis.cmake)
include(${CMAKE_MODULE_PATH}/packaging/windows_wix.cmake)
7 changes: 2 additions & 5 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,8 @@ curl -u user:pass -H "X-CSRF-Token: your_token_here" \
## POST /api/restart
@copydoc confighttp::restart()

## GET /api/vigembus/status
@copydoc confighttp::getViGEmBusStatus()

## POST /api/vigembus/install
@copydoc confighttp::installViGEmBus()
## GET /api/virtual-input/status
@copydoc confighttp::getVirtualInputStatus()

<div class="section_buttons">

Expand Down
45 changes: 24 additions & 21 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ editing the `conf` file in a text editor. Use the examples as reference.
<td>Description</td>
<td colspan="2">
The type of gamepad to emulate on the host.
@note{This option applies to FreeBSD, Linux, and Windows.}
</td>
</tr>
<tr>
Expand All @@ -332,30 +333,33 @@ editing the `conf` file in a text editor. Use the examples as reference.
@endcode</td>
</tr>
<tr>
<td rowspan="6">Choices</td>
<td rowspan="7">Choices</td>
<td>generic</td>
<td>Generic HID gamepad</td>
</tr>
<tr>
<td>ds4</td>
<td>DualShock 4 controller (PS4)
@note{This option applies to Windows only.}</td>
<td>DualShock 4 controller (PS4)</td>
</tr>
<tr>
<td>ds5</td>
<td>DualShock 5 controller (PS5)
@note{This option applies to FreeBSD and Linux only.}</td>
<td>DualShock 5 controller (PS5)</td>
</tr>
<tr>
<td>switch</td>
<td>Switch Pro controller
@note{This option applies to FreeBSD and Linux only.}</td>
<td>Switch Pro controller</td>
</tr>
<tr>
<td>x360</td>
<td>Xbox 360 controller
@note{This option applies to Windows only.}</td>
<td>Xbox 360 controller</td>
</tr>
<tr>
<td>xone</td>
<td>Xbox One controller
@note{This option applies to FreeBSD and Linux only.}</td>
<td>Xbox One controller</td>
</tr>
<tr>
<td>xseries</td>
<td>Xbox Series controller</td>
</tr>
</table>

Expand All @@ -365,9 +369,9 @@ editing the `conf` file in a text editor. Use the examples as reference.
<tr>
<td>Description</td>
<td colspan="2">
Allow Select/Back inputs to also trigger DS4 touchpad click. Useful for clients looking to
emulate touchpad click on Xinput devices.
@hint{Only applies when gamepad is set to ds4 manually. Unused in other gamepad modes.}
Allow Select/Back inputs to also trigger a PlayStation-style gamepad touchpad click. Useful
for clients looking to emulate touchpad click on XInput devices.
@hint{Applies to ds4, ds5, and automatically selected PlayStation-style gamepads.}
</td>
</tr>
<tr>
Expand All @@ -391,7 +395,7 @@ editing the `conf` file in a text editor. Use the examples as reference.
<td>Description</td>
<td colspan="2">
If a client reports that a connected gamepad has motion sensor support, emulate it on the
host as a DS4 controller.
host as a PlayStation-style controller.
<br>
<br>
When disabled, motion sensors will not be taken into account during gamepad type selection.
Expand All @@ -418,8 +422,8 @@ editing the `conf` file in a text editor. Use the examples as reference.
<tr>
<td>Description</td>
<td colspan="2">
If a client reports that a connected gamepad has a touchpad, emulate it on the host
as a DS4 controller.
If a client reports that a connected gamepad has a touchpad, emulate it on the host as a
PlayStation-style controller.
<br>
<br>
When disabled, touchpad presence will not be taken into account during gamepad type selection.
Expand All @@ -440,14 +444,13 @@ editing the `conf` file in a text editor. Use the examples as reference.
</tr>
</table>

### ds5_inputtino_randomize_mac
### virtualhid_randomize_mac

<table>
<tr>
<td>Description</td>
<td colspan="2">
Randomize the MAC-Address for the generated virtual controller.
@hint{Only applies on linux for gamepads created as PS5-style controllers}
Randomize the MAC address for PlayStation-style virtual controllers created by libvirtualhid.
</td>
</tr>
<tr>
Expand All @@ -459,7 +462,7 @@ editing the `conf` file in a text editor. Use the examples as reference.
<tr>
<td>Example</td>
<td colspan="2">@code{}
ds5_inputtino_randomize_mac = enabled
virtualhid_randomize_mac = enabled
@endcode</td>
</tr>
</table>
Expand Down
Loading
Loading