diff --git a/.codeql-prebuild-cpp-Windows.sh b/.codeql-prebuild-cpp-Windows.sh index 31ee6cd9..7bee4f65 100644 --- a/.codeql-prebuild-cpp-Windows.sh +++ b/.codeql-prebuild-cpp-Windows.sh @@ -2,43 +2,36 @@ set -e # update pacman -pacman --noconfirm -Suy - -# install wget -pacman --noconfirm -S \ - wget - -# download working curl -wget https://repo.msys2.org/mingw/ucrt64/mingw-w64-ucrt-x86_64-curl-8.8.0-1-any.pkg.tar.zst +pacman --noconfirm -Syu # install dependencies -pacman -U --noconfirm mingw-w64-ucrt-x86_64-curl-8.8.0-1-any.pkg.tar.zst -pacman -Syu --noconfirm --ignore=mingw-w64-ucrt-x86_64-curl \ - base-devel \ - diffutils \ - gcc \ - git \ - make \ - mingw-w64-ucrt-x86_64-cmake \ - mingw-w64-ucrt-x86_64-cppwinrt \ - mingw-w64-ucrt-x86_64-graphviz \ - mingw-w64-ucrt-x86_64-miniupnpc \ - mingw-w64-ucrt-x86_64-nlohmann-json \ - mingw-w64-ucrt-x86_64-nodejs \ - mingw-w64-ucrt-x86_64-nsis \ - mingw-w64-ucrt-x86_64-onevpl \ - mingw-w64-ucrt-x86_64-openssl \ - mingw-w64-ucrt-x86_64-opus \ - mingw-w64-ucrt-x86_64-rust \ - mingw-w64-ucrt-x86_64-toolchain +dependencies=( + "git" + "mingw-w64-ucrt-x86_64-boost" + "mingw-w64-ucrt-x86_64-cmake" + "mingw-w64-ucrt-x86_64-cppwinrt" + "mingw-w64-ucrt-x86_64-curl-winssl" + "mingw-w64-ucrt-x86_64-MinHook" + "mingw-w64-ucrt-x86_64-miniupnpc" + "mingw-w64-ucrt-x86_64-nlohmann-json" + "mingw-w64-ucrt-x86_64-nodejs" + "mingw-w64-ucrt-x86_64-nsis" + "mingw-w64-ucrt-x86_64-onevpl" + "mingw-w64-ucrt-x86_64-openssl" + "mingw-w64-ucrt-x86_64-opus" + "mingw-w64-ucrt-x86_64-toolchain" +) +pacman -S --noconfirm "${dependencies[@]}" # build mkdir -p build -cd build || exit 1 cmake \ + -B build \ + -G Ninja \ + -S . \ -DBUILD_DOCS=OFF \ - -G "MinGW Makefiles" .. -mingw32-make -j"$(nproc)" + -DBUILD_WERROR=ON +ninja -C build # skip autobuild echo "skip_autobuild=true" >> "$GITHUB_OUTPUT" diff --git a/cmake/dependencies/common.cmake b/cmake/dependencies/common.cmake index b6ca8447..8d8eb88f 100644 --- a/cmake/dependencies/common.cmake +++ b/cmake/dependencies/common.cmake @@ -28,7 +28,7 @@ include_directories(SYSTEM ${MINIUPNP_INCLUDE_DIRS}) # ffmpeg pre-compiled binaries if(NOT DEFINED FFMPEG_PREPARED_BINARIES) if(WIN32) - set(FFMPEG_PLATFORM_LIBRARIES mfplat ole32 strmiids mfuuid vpl) + set(FFMPEG_PLATFORM_LIBRARIES mfplat ole32 strmiids mfuuid vpl MinHook) elseif(UNIX AND NOT APPLE) set(FFMPEG_PLATFORM_LIBRARIES numa va va-drm va-x11 X11) endif() diff --git a/cmake/packaging/windows.cmake b/cmake/packaging/windows.cmake index f80f9cbd..5c1b77d0 100644 --- a/cmake/packaging/windows.cmake +++ b/cmake/packaging/windows.cmake @@ -11,7 +11,6 @@ install(TARGETS dxgi-info RUNTIME DESTINATION "tools" COMPONENT dxgi) install(TARGETS audio-info RUNTIME DESTINATION "tools" COMPONENT audio) # Mandatory tools -install(TARGETS ddprobe RUNTIME DESTINATION "tools" COMPONENT application) install(TARGETS sunshinesvc RUNTIME DESTINATION "tools" COMPONENT application) # Drivers @@ -68,7 +67,7 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} IfSilent +2 0 - # ExecShell 'open' 'https://sunshinestream.readthedocs.io/' + # ExecShell 'open' 'https://docs.lizardbyte.dev/projects/sunshine' nsExec::ExecToLog 'icacls \\\"$INSTDIR\\\" /reset' nsExec::ExecToLog '\\\"$INSTDIR\\\\drivers\\\\sudovda\\\\install.bat\\\"' nsExec::ExecToLog '\\\"$INSTDIR\\\\scripts\\\\migrate-config.bat\\\"' @@ -126,7 +125,7 @@ set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON") # set(CPACK_NSIS_CONTACT "${CMAKE_PROJECT_HOMEPAGE_URL}/support") # set(CPACK_NSIS_MENU_LINKS -# "https://sunshinestream.readthedocs.io" "Sunshine documentation" +# "https://docs.lizardbyte.dev/projects/sunshine" "Sunshine documentation" # "https://app.lizardbyte.dev" "LizardByte Web Site" # "https://app.lizardbyte.dev/support" "LizardByte Support") set(CPACK_NSIS_MANIFEST_DPI_AWARE true) diff --git a/cmake/prep/options.cmake b/cmake/prep/options.cmake index e3d0b19f..c7e71dc2 100644 --- a/cmake/prep/options.cmake +++ b/cmake/prep/options.cmake @@ -12,10 +12,6 @@ option(BUILD_TESTS "Build tests" ON) option(NPM_OFFLINE "Use offline npm packages. You must ensure packages are in your npm cache." OFF) option(TESTS_ENABLE_PYTHON_TESTS "Enable Python tests" ON) -# DirectX11 is not available in GitHub runners, so even software encoding fails -set(TESTS_SOFTWARE_ENCODER_UNAVAILABLE "fail" - CACHE STRING "How to handle unavailable software encoders in tests. 'fail/skip'") - option(BUILD_WERROR "Enable -Werror flag." OFF) # if this option is set, the build will exit after configuring special package configuration files diff --git a/docs/Doxyfile b/docs/Doxyfile index 7c08c4f0..5fa4ee6c 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = Sunshine # project specific settings DOT_GRAPH_MAX_NODES = 60 -IMAGE_PATH = ../docs/images +# IMAGE_PATH = ../docs/images PREDEFINED += SUNSHINE_BUILD_WAYLAND PREDEFINED += SUNSHINE_TRAY=1 @@ -62,4 +62,8 @@ INPUT = ../README.md \ HTML_EXTRA_STYLESHEET += doc-styles.css # extra js +HTML_EXTRA_FILES += api.js HTML_EXTRA_FILES += configuration.js + +# custom aliases +ALIASES += api_examples{3|}="@htmlonly@endhtmlonly" diff --git a/docs/api.js b/docs/api.js new file mode 100644 index 00000000..5f887e94 --- /dev/null +++ b/docs/api.js @@ -0,0 +1,130 @@ +function generateExamples(endpoint, method, body = null) { + let curlBodyString = ''; + let psBodyString = ''; + + if (body) { + const curlJsonString = JSON.stringify(body).replace(/"/g, '\\"'); + curlBodyString = ` -d "${curlJsonString}"`; + psBodyString = `-Body (ConvertTo-Json ${JSON.stringify(body)})`; + } + + return { + cURL: `curl -u user:pass -X ${method.trim()} -k https://localhost:47990${endpoint.trim()}${curlBodyString}`, + Python: `import json +import requests +from requests.auth import HTTPBasicAuth + +requests.${method.trim().toLowerCase()}( + auth=HTTPBasicAuth('user', 'pass'), + url='https://localhost:47990${endpoint.trim()}', + verify=False,${body ? `\n json=${JSON.stringify(body)},` : ''} +).json()`, + JavaScript: `fetch('https://localhost:47990${endpoint.trim()}', { + method: '${method.trim()}', + headers: { + 'Authorization': 'Basic ' + btoa('user:pass'), + 'Content-Type': 'application/json', + }${body ? `,\n body: JSON.stringify(${JSON.stringify(body)}),` : ''} +}) +.then(response => response.json()) +.then(data => console.log(data));`, + PowerShell: `Invoke-RestMethod \` + -SkipCertificateCheck \` + -Uri 'https://localhost:47990${endpoint.trim()}' \` + -Method ${method.trim()} \` + -Headers @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes('user:pass'))} + ${psBodyString}` + }; +} + +function hashString(str) { + let hash = 0; + for (let i = 0; i < str.length; i++) { + const char = str.charCodeAt(i); + hash = (hash << 5) - hash + char; + hash |= 0; // Convert to 32bit integer + } + return hash; +} + +function createTabs(examples) { + const languages = Object.keys(examples); + let tabs = '
| Description | ++ Perform mandatory verification and additional configuration for the display device. + @note{Applies to Windows only.} + | +|
| Default | +@code{}verify_only@endcode | +|
| Example | +@code{} + dd_configuration_option = ensure_only_display + @endcode | +|
| Choices | +disabled | +Perform no additional configuration (disables all `dd_` configuration options). | +
| verify_only | +Verify that display is active only (this is a mandatory step without any extra steps to verify display state). | +|
| ensure_active | +Activate the display if it's currently inactive. | +|
| ensure_primary | +Activate the display if it's currently inactive and make it primary. | +|
| ensure_only_display | +Activate the display if it's currently inactive and disable all others. | +|
| Description | ++ Perform additional resolution configuration for the display device. + @note{"Optimize game settings" must be enabled in Moonlight for this option to work.} + @note{Applies to Windows only.} + | +|
| Default | +@code{}auto@endcode | +|
| Example | +@code{} + dd_resolution_option = manual + @endcode | +|
| Choices | +disabled | +Perform no additional configuration. | +
| auto | +Change resolution to the requested resolution from the client. | +|
| manual | +Change resolution to the user specified one (set via [dd_manual_resolution](#dd_manual_resolution)). | +|
| Description | ++ Specify manual resolution to be used. + @note{[dd_resolution_option](#dd_resolution_option) must be set to `manual`} + @note{Applies to Windows only.} + | +|
| Default | +n/a | +|
| Example | +@code{} + dd_manual_resolution = 1920x1080 + @endcode | +|
| Description | ++ Perform additional refresh rate configuration for the display device. + @note{Applies to Windows only.} + | +|
| Default | +@code{}auto@endcode | +|
| Example | +@code{} + dd_refresh_rate_option = manual + @endcode | +|
| Choices | +disabled | +Perform no additional configuration. | +
| auto | +Change refresh rate to the requested FPS value from the client. | +|
| manual | +Change refresh rate to the user specified one (set via [dd_manual_refresh_rate](#dd_manual_refresh_rate)). | +|
| Description | ++ Specify manual refresh rate to be used. + @note{[dd_refresh_rate_option](#dd_refresh_rate_option) must be set to `manual`} + @note{Applies to Windows only.} + | +|
| Default | +n/a | +|
| Example | +@code{} + dd_manual_resolution = 120 + dd_manual_resolution = 59.95 + @endcode | +|
| Description | ++ Perform additional HDR configuration for the display device. + @note{Applies to Windows only.} + | +|
| Default | +@code{}auto@endcode | +|
| Example | +@code{} + dd_hdr_option = disabled + @endcode | +|
| Choices | +disabled | +Perform no additional configuration. | +
| auto | +Change HDR to the requested state from the client if the display supports it. | +|
| Description | ++ When using virtual display device as for streaming, it might display incorrect (high-contrast) color. + With this option enabled, Sunshine will try to mitigate this issue. + @note{This option works independently of [dd_hdr_option](#dd_hdr_option)} + @note{Applies to Windows only.} + | +|
| Default | +@code{} + disabled + @endcode | +|
| Example | +@code{} + dd_wa_hdr_toggle = enabled + @endcode | +|
| Description | ++ Additional delay in milliseconds to wait before reverting configuration when the app has been closed or the last session terminated. + Main purpose is to provide a smoother transition when quickly switching between apps. + @note{Applies to Windows only.} + | +|
| Default | +@code{}3000@endcode | +|
| Example | +@code{} + dd_config_revert_delay = 1500 + @endcode | +|
| Description | +
+ Remap the requested resolution and FPS to another display mode. + Depending on the [dd_resolution_option](#dd_resolution_option) and + [dd_refresh_rate_option](#dd_refresh_rate_option) values, the following mapping + groups are available: +
+ If `final_*` field is left empty, the original value will not be remapped and either a requested, manual + or current value is used. However, at least one `final_*` must be set, otherwise the entry is considered + invalid. + @note{"Optimize game settings" must be enabled on client side for ANY entry with `resolution` + field to be considered.} + @note{First entry to be matched in the list is the one that will be used.} + @tip{`requested_resolution` and `final_resolution` can be omitted for `refresh_rate_only` group.} + @tip{`requested_fps` and `final_refresh_rate` can be omitted for `resolution_only` group.} + @note{Applies to Windows only.} + |
+ |
| Default | +@code{} + dd_mode_remapping = { + "mixed": [], + "resolution_only": [], + "refresh_rate_only": [] + } + @endcode + | +|
| Example | +@code{} + dd_mode_remapping = { + "mixed": [ + { + "requested_fps": "60", + "final_refresh_rate": "119.95", + "requested_resolution": "1920x1080", + "final_resolution": "2560x1440" + }, + { + "requested_fps": "60", + "final_refresh_rate": "120", + "requested_resolution": "", + "final_resolution": "" + } + ], + "resolution_only": [ + { + "requested_resolution": "1920x1080", + "final_resolution": "2560x1440" + } + ], + "refresh_rate_only": [ + { + "requested_fps": "60", + "final_refresh_rate": "119.95" + } + ] + }@endcode + | +|
| - |
-
-
-
-
+ |
+ |