Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
49d421a
test: check README navigation instead of an arbitrary line count
jmonster Sep 18, 2026
0482227
test: remove arbitrary README layout and prose assertions
jmonster Sep 18, 2026
a4bb0c5
Add bounded native Windows WinRT Bluetooth transport and compile gate
jmonster Sep 18, 2026
f714d79
Use supported Windows C++20 headers and the VS 2022 toolchain
jmonster Sep 18, 2026
5983f72
Connect native Windows Bluetooth to the shared controller engine
jmonster Sep 18, 2026
3a44906
Build Windows C/SDL hosts and exercise the real native adapters
jmonster Sep 18, 2026
3a66976
Export the shared Swift engine alongside the C facade on Windows
jmonster Sep 18, 2026
6ddfeb5
Provide Windows suspend-aware freshness timing and document desktop s…
jmonster Sep 18, 2026
ff045c4
Fix native Windows bounded host-file reads and exercise them in C con…
jmonster Sep 18, 2026
d41f8b1
Use one high-resolution Windows clock for controller reports and nati…
jmonster Sep 18, 2026
6217545
Fix WinSDK Boolean return handling in the high-resolution receive clock
jmonster Sep 18, 2026
184db23
Deploy compiler-selected desktop runtimes and qualify extracted appli…
jmonster Sep 18, 2026
251b708
Fix desktop runtime dependency traversal and Linux relocation regression
jmonster Sep 18, 2026
4cab283
Document bundled Windows Swift runtimes and remaining OS prerequisites
jmonster Sep 18, 2026
b108703
Align C++ and Linux guides with application-owned runtime staging
jmonster Sep 18, 2026
261b55f
Repair extracted Windows consumer qualification and preserve failure …
jmonster Sep 18, 2026
e90334e
Stage the complete Windows host runtime closure and stabilize SDL rum…
jmonster Sep 18, 2026
dc59615
Isolate Windows dependency scans from stale staged DLLs and serialize…
jmonster Sep 19, 2026
aac42ce
Compare deployed Windows DLL contents instead of trusting file timest…
jmonster Sep 19, 2026
06bc206
Keep slow dependency inspection outside the Windows deployment lock
jmonster Sep 19, 2026
5198ca5
Wait for the actual X11 observer before qualifying extracted applicat…
jmonster Sep 19, 2026
8a6ff6f
Repair isolated Windows emulator profiles and exercise supervisor pre…
jmonster Sep 19, 2026
3d3ce3a
Re-admit fresh Windows advertisements after a connection retires
jmonster Sep 19, 2026
13abafe
Link players to the reviewed desktop setup guides before the fork PRs…
jmonster Sep 19, 2026
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
4 changes: 3 additions & 1 deletion .github/workflows/linux-bluez.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install test dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends cmake ninja-build make g++ python3 dbus libsystemd0 nodejs
apt-get install -y --no-install-recommends cmake ninja-build make g++ python3 dbus libsystemd0 nodejs libx11-dev xvfb openbox wmctrl x11-utils
- name: Preserve the exact source under test
run: |
# The runner owns this bind-mounted checkout, but the Swift container
Expand All @@ -43,6 +43,8 @@ jobs:
swift test -Xswiftc -warnings-as-errors
bash tests/linux-bluez/run.sh
bash tests/run.sh
- name: Exercise the real isolated X11 observer and readiness regression
run: python3 tests/emulator-launch/test_linux_native.py
- name: Release package tests
run: swift test -c release -Xswiftc -warnings-as-errors
- name: Relocated native facade and real C++ consumers
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/windows-native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Windows native controllers
on:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: windows-native-${{ github.ref }}
cancel-in-progress: true
jobs:
windows:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
swift: 6.2.1
- os: windows-2025-vs2026
swift: 6.3.3
runs-on: ${{ matrix.os }}
timeout-minutes: 35
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: compnerd/gha-setup-swift@397094e75494a93fa8d81db0268dbc8f5d6cf7c6
with:
swift-version: swift-${{ matrix.swift }}-release
swift-build: ${{ matrix.swift }}-RELEASE
- name: Build native WinRT transport and run portable package tests
shell: pwsh
run: |
swift --version
swift test -Xswiftc -warnings-as-errors 2>&1 | Tee-Object windows-tests.log
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
swift build -c release --product Switch2KitC 2>&1 | Tee-Object windows-build.log
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
swiftc -print-target-info > windows-target-info.log
Get-ChildItem .build -Recurse -Include '*Switch2KitC*' | Select-Object FullName | Out-File windows-library-paths.log
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
repository: libsdl-org/SDL
ref: f87239e71e42da91ca317a12eefb82cfbf3393eb
path: test-sdl
persist-credentials: false
- name: Build and execute the real C and SDL consumers
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vs = & $vswhere -latest -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if (-not $vs) { throw 'Visual C++ x64 tools are required' }
cmd /c "`"$vs\Common7\Tools\VsDevCmd.bat`" -arch=x64 -host_arch=x64 >nul && set" | ForEach-Object {
if ($_ -match '^([^=]+)=(.*)$') { [Environment]::SetEnvironmentVariable($Matches[1], $Matches[2], 'Process') }
}
cmake -S tests/c-consumer -B build-c -G Ninja -DCMAKE_BUILD_TYPE=Release
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
cmake --build build-c --parallel 3 2>&1 | Tee-Object windows-c-build.log
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
ctest --test-dir build-c --output-on-failure 2>&1 | Tee-Object windows-c-tests.log
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
cmake -S tests/sdl-inprocess -B build-sdl -G Ninja -DCMAKE_BUILD_TYPE=Release "-DS2K_SDL_SOURCE=$PWD/test-sdl"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
cmake --build build-sdl --parallel 3 2>&1 | Tee-Object windows-sdl-build.log
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
ctest --test-dir build-sdl --output-on-failure 2>&1 | Tee-Object windows-sdl-tests.log
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
python tests/emulator-launch/test_windows.py 2>&1 | Tee-Object windows-host-supervisor-tests.log
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Execute extracted consumers without the compiler or developer PATH
shell: pwsh
run: |
python tests/windows-relocation/test_relocation.py
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
python tests/c-consumer/relocate-windows.py --c-build build-c --sdl-build build-sdl 2>&1 | Tee-Object windows-relocation.log
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Preserve native diagnostics
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: windows-native-diagnostics-${{ matrix.swift }}
path: |
windows-*.log
windows-relocation.json
if-no-files-found: warn
retention-days: 7
9 changes: 7 additions & 2 deletions Integrations/CMake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ file(GLOB_RECURSE _s2k_sources CONFIGURE_DEPENDS
"${SWITCH2KIT_SOURCE_ROOT}/Sources/Switch2Kit/*.swift"
"${SWITCH2KIT_SOURCE_ROOT}/Sources/Switch2KitC/*.swift"
"${SWITCH2KIT_SOURCE_ROOT}/Sources/Switch2KitCABI/*"
"${SWITCH2KIT_SOURCE_ROOT}/Sources/Switch2KitDBus/*")
"${SWITCH2KIT_SOURCE_ROOT}/Sources/Switch2KitDBus/*"
"${SWITCH2KIT_SOURCE_ROOT}/Sources/Switch2KitWinRT/*")
if(WIN32)
include("${CMAKE_CURRENT_LIST_DIR}/Windows.cmake")
return()
endif()
if(APPLE)
set(_s2k_archs "${CMAKE_OSX_ARCHITECTURES}")
if(NOT _s2k_archs)
Expand Down Expand Up @@ -70,7 +75,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
DEPENDS ${_s2k_sources} "${SWITCH2KIT_SOURCE_ROOT}/Package.swift"
"${CMAKE_CURRENT_LIST_FILE}" VERBATIM)
else()
message(FATAL_ERROR "Switch2Kit supports macOS and Linux hosts only")
message(FATAL_ERROR "Switch2Kit supports macOS, Linux and Windows desktop hosts")
endif()
add_custom_target(Switch2KitCBuild DEPENDS "${_s2k_library}")
add_library(Switch2Kit::C SHARED IMPORTED GLOBAL)
Expand Down
16 changes: 13 additions & 3 deletions Integrations/CMake/Linux.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Native Linux installation. Swift runtime libraries remain distribution/host
# dependencies; unlike a macOS bundle, this does not claim a self-contained app.
# Native Linux installation. Bundle the compiler-selected Swift runtime closure;
# libc, desktop libraries, graphics drivers and BlueZ remain OS prerequisites.
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
include("${CMAKE_CURRENT_LIST_DIR}/Runtime.cmake")
endif()
function(switch2kit_install_linux target)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(FATAL_ERROR "switch2kit_install_linux requires a Linux target")
Expand All @@ -8,7 +11,14 @@ function(switch2kit_install_linux target)
get_filename_component(_root "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../.." ABSOLUTE)
file(RELATIVE_PATH _library_from_bin "${CMAKE_INSTALL_FULL_BINDIR}" "${CMAKE_INSTALL_FULL_LIBDIR}")
set_property(TARGET "${target}" APPEND PROPERTY INSTALL_RPATH "$ORIGIN/${_library_from_bin}")
install(FILES "$<TARGET_FILE:Switch2Kit::C>" DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(CODE "
execute_process(COMMAND \"${CMAKE_COMMAND}\"
\"-DS2K_LIBRARY=$<TARGET_FILE:Switch2Kit::C>\"
\"-DS2K_DESTINATION=\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\"
\"-DS2K_NOTICES=\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/Switch2KitNotices\"
\"-DS2K_RUNTIME_CONFIG=${SWITCH2KIT_RUNTIME_CONFIG}\"
-P \"${SWITCH2KIT_RUNTIME_SCRIPT}\" COMMAND_ERROR_IS_FATAL ANY)
")
install(FILES "${_root}/CREDITS.md" DESTINATION "${CMAKE_INSTALL_DATADIR}/Switch2KitNotices")
install(DIRECTORY "${_root}/LICENSES" DESTINATION "${CMAKE_INSTALL_DATADIR}/Switch2KitNotices")
endfunction()
70 changes: 70 additions & 0 deletions Integrations/CMake/Runtime.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Build-time runtime discovery. Included only by enabled Linux/Windows hosts.
execute_process(COMMAND "${SWITCH2KIT_SWIFTC}" -print-target-info
OUTPUT_VARIABLE _s2k_runtime_info COMMAND_ERROR_IS_FATAL ANY)
string(JSON _s2k_count LENGTH "${_s2k_runtime_info}" paths runtimeLibraryPaths)
set(_s2k_runtime_paths)
if(_s2k_count GREATER 0)
math(EXPR _s2k_last "${_s2k_count} - 1")
foreach(_index RANGE 0 ${_s2k_last})
string(JSON _path GET "${_s2k_runtime_info}" paths runtimeLibraryPaths ${_index})
file(TO_CMAKE_PATH "${_path}" _path)
if(IS_DIRECTORY "${_path}")
list(APPEND _s2k_runtime_paths "${_path}")
endif()
endforeach()
endif()
if(NOT _s2k_runtime_paths)
message(FATAL_ERROR "The selected Swift compiler did not identify runtime library directories")
endif()
get_filename_component(_s2k_swift_bin "${SWITCH2KIT_SWIFTC}" DIRECTORY)
find_file(SWITCH2KIT_SWIFT_LICENSE LICENSE.txt
PATHS "${_s2k_swift_bin}/../share/swift" NO_DEFAULT_PATH)
find_program(_s2k_git git REQUIRED)
string(JSON _s2k_compiler_version GET "${_s2k_runtime_info}" compilerVersion)
if(_s2k_compiler_version MATCHES "Swift version 6\\.2\\.1([ (]|$)")
set(_s2k_swift_tag swift-6.2.1-RELEASE)
set(_s2k_icu_tag release-74-1)
set(_s2k_icu_blob 9f54372febca06e134bbc9d4700a1ebfeda13843)
elseif(_s2k_compiler_version MATCHES "Swift version 6\\.3\\.3([ (]|$)")
set(_s2k_swift_tag swift-6.3.3-RELEASE)
set(_s2k_icu_tag release-76-1)
set(_s2k_icu_blob 180db98fcc66ca7797940b7fad5a7f3987d9f145)
endif()
set(SWITCH2KIT_RUNTIME_ICU_LICENSE "" CACHE FILEPATH
"Explicit ICU license/third-party notices for a different Swift runtime distribution")
set(_s2k_system_paths)
if(WIN32)
# OS libraries are prerequisites, not part of the Swift redistribution.
file(TO_CMAKE_PATH "$ENV{SystemRoot}" _s2k_windows_root)
if(NOT IS_DIRECTORY "${_s2k_windows_root}/System32")
message(FATAL_ERROR "SystemRoot must identify the Windows installation")
endif()
set(_s2k_system_paths "${_s2k_windows_root}/System32" "${_s2k_windows_root}")
find_program(_s2k_inspector dumpbin REQUIRED)
set(_s2k_platform "windows+pe")
set(_s2k_inspector_kind dumpbin)
else()
find_program(_s2k_inspector objdump REQUIRED)
find_program(_s2k_readelf readelf REQUIRED)
set(_s2k_platform "linux+elf")
set(_s2k_inspector_kind objdump)
endif()
set(SWITCH2KIT_RUNTIME_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/Switch2KitRuntimePaths.cmake"
CACHE INTERNAL "Build-only Swift runtime deployment inputs")
file(CONFIGURE OUTPUT "${SWITCH2KIT_RUNTIME_CONFIG}" CONTENT [=[
set(S2K_RUNTIME_DIRS [==[@_s2k_runtime_paths@]==])
set(S2K_SYSTEM_RUNTIME_DIRS [==[@_s2k_system_paths@]==])
set(S2K_SWIFT_LICENSE [==[@SWITCH2KIT_SWIFT_LICENSE@]==])
set(CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM "@_s2k_platform@")
set(CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL "@_s2k_inspector_kind@")
set(CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND [==[@_s2k_inspector@]==])
set(S2K_READELF [==[@_s2k_readelf@]==])
set(S2K_GIT [==[@_s2k_git@]==])
set(S2K_SWIFT_TAG "@_s2k_swift_tag@")
set(S2K_ICU_TAG "@_s2k_icu_tag@")
set(S2K_ICU_BLOB "@_s2k_icu_blob@")
set(S2K_ICU_LICENSE [==[@SWITCH2KIT_RUNTIME_ICU_LICENSE@]==])
set(S2K_COMPILER_VERSION [==[@_s2k_compiler_version@]==])
]=] @ONLY)
set(SWITCH2KIT_RUNTIME_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/StageDesktopRuntime.cmake"
CACHE INTERNAL "Swift runtime deployment script")
47 changes: 47 additions & 0 deletions Integrations/CMake/RuntimeNotices.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Exact upstream license bytes may be preseeded in this build-only cache for
# offline builds. Never silently archive a runtime without its license texts.
function(_s2k_license name url blob output)
get_filename_component(_cache "${S2K_RUNTIME_CONFIG}" DIRECTORY)
set(_path "${_cache}/runtime-notices/${name}")
file(MAKE_DIRECTORY "${_cache}/runtime-notices")
# A concurrent deployment must not hash a partially downloaded cache file.
# This per-license lock is independent of the application copy lock and is
# released on function return. The download itself remains bounded at 60 s.
file(LOCK "${_path}.lock" GUARD FUNCTION TIMEOUT 120)
if(NOT EXISTS "${_path}")
file(DOWNLOAD "${url}" "${_path}" TLS_VERIFY ON STATUS _status TIMEOUT 60)
list(GET _status 0 _code)
if(NOT _code EQUAL 0)
file(REMOVE "${_path}")
message(FATAL_ERROR "Could not obtain ${name}: ${_status}; preseed ${_path} for offline packaging")
endif()
endif()
execute_process(COMMAND "${S2K_GIT}" hash-object --no-filters "${_path}"
OUTPUT_VARIABLE _actual OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY)
if(NOT _actual STREQUAL "${blob}")
message(FATAL_ERROR "Altered or incorrect upstream license: ${_path}")
endif()
set(${output} "${_path}" PARENT_SCOPE)
endfunction()

macro(switch2kit_runtime_notices)
if(NOT EXISTS "${S2K_SWIFT_LICENSE}")
if(NOT S2K_SWIFT_TAG)
message(FATAL_ERROR "Set SWITCH2KIT_SWIFT_LICENSE to the selected Swift distribution's LICENSE.txt")
endif()
_s2k_license(Swift-${S2K_SWIFT_TAG}.txt
"https://raw.githubusercontent.com/swiftlang/swift/${S2K_SWIFT_TAG}/LICENSE.txt"
"61b0c78195f2d00acaf658000eeca6ad406a3a29" S2K_SWIFT_LICENSE)
endif()
if(NOT S2K_ICU_LICENSE)
if(NOT S2K_ICU_TAG OR NOT S2K_ICU_BLOB)
message(FATAL_ERROR "Supply SWITCH2KIT_RUNTIME_ICU_LICENSE for this Swift distribution; automated deployment is qualified with 6.2.1 and 6.3.3")
endif()
_s2k_license(ICU-${S2K_ICU_TAG}.txt
"https://raw.githubusercontent.com/unicode-org/icu/${S2K_ICU_TAG}/LICENSE"
"${S2K_ICU_BLOB}" S2K_ICU_LICENSE)
endif()
if(NOT EXISTS "${S2K_ICU_LICENSE}")
message(FATAL_ERROR "The runtime ICU license and third-party notices are required")
endif()
endmacro()
Loading
Loading