Add native Windows controller transport and cross-platform host distribution - #75
Conversation
Remove the line-count replacement that enforced links before code, along with exact license-index wording checks. Retain actual broken-link, public protocol value, binary exclusion, and distribution-notice integrity checks.
Use an asynchronous MTA-owned transport with GATT discovery, subscriptions, writes and connection-token fencing. Keep the Swift session engine unchanged while the Windows host integration is completed and validated.
Fix the native compile diagnostics rather than disabling STL compiler checks. C++/WinRT uses standard coroutines, and the private C++ header supplies HRESULT definitions without leaking Windows headers into Swift's C import.
Wire WinRT discovery, services, notification state and bounded writes into the existing session/protocol implementation. Fence callbacks by connection token, preserve physical identities and report unavailable radio states. Native C hosts now own the transport directly instead of an unused main-actor presentation observer.
Add x64 MSVC-compatible DLL/import-library integration and per-application embedding. Run existing C ABI and real SDL motion/rumble suites on Windows, and add bounded Windows adaptation lifecycle tests. Preserve Linux/macOS behavior and remove presentation-only test assertions without relaxing runtime checks.
The separate native consumer fixture exposed missing PE exports for the transitive Swift module. Declare the engine as part of the same DLL product so all consumers use the same type metadata; do not link a duplicate engine into test fixtures. The C ABI is unchanged.
…upport Native C tests now pass on Windows. Real SDL tests exposed the missing Windows continuous clock, which correctly failed closed for rumble and motion. Implement QueryInterruptTimePrecise with overflow-safe 100 ns conversion and link Mincore; keep all existing timing/rumble/motion assertions intact. Update the user-facing platform table and Linux/Windows native host setup, including runtime and hardware-validation limits.
…sumers Replace the POSIX-only implementation that broke Cemu's Windows build with UTF-8 Win32 handle-based regular-file reads. Preserve byte/path limits, bounded retries, special-file rejection and unchanged outputs on failure. Add native CTest coverage to the C consumer build; the Linux release regression passes. Windows CI must qualify the new platform path.
…ve consumers QueryPerformanceCounter replaces coarse Foundation uptime on Windows, consistently across input receive times, session/retry/rumble deadlines and s2k_monotonic_time. macOS and Linux keep their existing clock. Preserve all SDL motion freshness, sequence and suspension assertions; add executable monotonic/resolution coverage and include the shared clock in legacy production-source fixtures. Validated matching tree locally: 101 Swift tests, production engine and rumble regressions, real C consumer plus bounded host-file tests, and all three real SDL consumer tests pass. Native Windows CI remains required.
Native Windows job 35397494325 compiled the WinRT transport and exposed Swift's Bool import of QueryPerformanceCounter/Frequency. Use those Boolean results directly; keep finite/range validation and all motion tests unchanged.
…cations Bundle the actual Swift runtime dependency closure alongside the facade, with complete verified Swift/ICU licenses; retain OS graphics, Bluetooth and C++ runtime prerequisites. Remove compiler RPATHs from Linux package copies only. Exercise relocated C/SDL consumers on both maintained Windows toolchains and strengthen Linux loader tests with extraction and missing-runtime negative controls. Add shared Linux/X11 and Windows GUI archive qualification: isolated owned profiles, no developer PATH/library overrides, loaded-module location checks, stable application window, ordinary shutdown and relaunch. These do not claim hardware or pristine first-use acceptance. Fix Dolphin's MSVC /WX size conversion using the actual bounded event-capacity constant, without suppressing warnings or weakening motion tests. Include #73's documentation-index cleanup while retaining all license texts and attribution. Local reviewed tree matches 4f2876d. Linux deployment/loader inspection, all 3 real SDL consumers, 19 launch-supervisor regressions, 4 repository checks, 5 distribution-notice checks and application identity/signing checks pass. New native CI must qualify final packages.
Stop Windows runtime dependency traversal at files resolved within the OS installation, rather than following optional Windows internals or masking missing application DLLs by filename. Keep unresolved and ambiguous non-system dependencies fatal and report conflict paths. Repair the Linux install fixture for compiler-selected runtime staging. Build a real transitive native runtime, remove its original location before relocated launch, and retain missing-runtime and complete-notice checks. Add four native ELF/PE deployment regressions for the OS boundary, transitive runtime copies, source immutability, missing dependencies and compiler-directory protection. Register them in the existing portable runner and C consumer CTest suite. Validated the exact tree locally: 4 Linux build/relocation tests, 4 runtime staging tests (including red/green against the original traversal), 3 Linux build-helper tests, 4 repository tests, 5 distribution-notice tests, identity/signing configuration checks, and git diff --check. Native Windows C/SDL execution still requires the new CI run; no hardware qualification is claimed.
Remove the stale instruction to install Swift or add its runtime to PATH for staged applications. Distinguish a SwiftPM library build from CMake host packaging, keep full license requirements explicit, and distinguish configured native CI from successful final-revision and hardware qualification. Repository local-target and distribution-notice tests pass; no build or product behavior changes.
Remove obsolete Swift installation/LD_LIBRARY_PATH requirements for fully staged Linux hosts and the corresponding stale Windows statement in the C++ guide. Preserve system-library, BlueZ, driver and license prerequisites and distinguish actual application artifacts from source archives. Documentation only. Repository target and distribution-notice checks pass.
|
Pushed the runtime-staging and relocation repair to the existing branch, followed by aligned Windows/C++/Linux runtime instructions. Current head: The Windows failure was in post-link runtime dependency traversal into OS-internal DLLs, not in the C exports. The repair stops at resolved OS files while keeping missing or ambiguous application/runtime dependencies fatal. It includes executable ELF/PE negative controls. The Linux failure was the install fixture not supplying the new runtime helper's compiler metadata; it now exercises an actual transitive native runtime and verifies relocation after deleting original build/runtime paths, plus missing-runtime failure.
The preceding Windows run already demonstrated successful staging of 17 facade/runtime libraries, real C-consumer execution and the new native PE regressions on Swift 6.2.1. That run was superseded by the final documentation commit and is not being counted as final-head qualification. Final-head native runs:
These runs are still executing. The PR remains draft; downstream maintained-fork pins/application qualification and physical-controller/gameplay evidence are separate gates. Nothing has been merged or released. |
…evidence Invoke the relocation supervisor directly through Python instead of the failing PowerShell argument-binding entry point. Retain the PowerShell entry point as a thin compatibility wrapper with plain path defaults. Archive the actual C and SDL consumer binaries with the staged runtime and complete notices, extract into a new directory containing spaces, verify file identities, and execute all three consumers with OS-only PATH and isolated user/temp directories. Require loader failure when either the facade or Swift core is removed; arbitrary crashes cannot satisfy these negative controls. Persist a JSON report even on failure, including the archived file hashes and child results. Add nine executable supervisor regressions covering archive/extraction, missing binaries/notices, private environment, native-process invocation, timeout cleanup and negative-control failure semantics. These tests are separate from—and do not replace—the native C/SDL consumers. Local validation: nine supervisor regressions, repository tests, complete distribution-notice tests, and git diff --check pass. Native Windows execution remains required in the new CI run.
…ble regressions Scan the actual consumer executable and CMake-declared transitive runtime DLLs in addition to the facade. Separately compiled Swift clients require runtime imports (notably SwiftOnoneSupport) that an optimized facade does not, so facade-only staging can pass in-tree via the developer PATH yet fail extracted launch with STATUS_DLL_NOT_FOUND. Supply application DLL directories to the native dependency scanner and copy declared application libraries together with the compiler-owned runtime closure. Keep unresolved/ambiguous dependencies fatal, retain the resolved Windows system boundary and all license checks, and keep compiler-directory overwrite protection. Add native ELF/PE regressions for a runtime imported only by a linked fixture, missing fixture-only runtime, and missing executable/library roots. The new regressions fail on the previous staging script and pass with this repair. Also apply the previously unpublished deterministic rumble regression: verify the exact 200 ms renewal boundary, rejection after a 500 ms host stall, normal SDL duration expiry, and no effect revival using the existing clocked production adapter. Real SDL callbacks and Swift facade remain in use; production safety cutoffs are unchanged. Local validation: seven native dependency-graph tests, nine relocation supervisor tests, real C consumer CTest 3/3, real SDL CTest 3/3 and twenty consecutive runs of both SDL consumers pass on Linux with Swift 6.2.1 / SDL 3.4.16. Native Windows validation remains required. Tree 6199710 exactly matches the tested local tree.
… deployment The PE loader searches beside importing binaries before configured runtime directories. Scanning a previously staged executable directly can therefore select old application-local runtime copies, conflict with compiler originals, or hide a missing compiler dependency. The second SDL executable shares the same deployment directory, so repeatability is required even in a clean CI build. Inspect isolated copies of declared executable and application DLL roots, then resolve their complete dependency closure against the selected compiler and Windows system directories. Retain fatal unresolved/ambiguous dependency checks and reject duplicate application root names. Serialize scans and deployment for targets sharing an output directory without adding files to the distributed package. Add native re-staging and Windows stale-copy regressions. Keep the facade fixture in a separate source directory so re-staging does not mutate an ELF source binary's RPATH. Validation: the tested local tree exactly matches a0252bb. Eight Linux native dependency-graph tests pass (one new PE-specific test requires Windows). Real cross-built PE imports were inspected using CMake's Windows dependency scanner: initial staging, repeat staging, replacing stale copies, and three concurrent stages pass; removing a compiler dependency remains fatal despite a previously staged copy. Native Windows consumer execution is still required in CI.
…amps CMake file(COPY) skips existing files with equal timestamps even when bytes differ. The rapid native PE re-staging regression reproduced a stale DLL surviving an otherwise successful deployment. Use COPY_FILE ONLY_IF_DIFFERENT for PE DLLs; retain ELF symlink-chain copying and RPATH relocation unchanged. Strengthen the Windows stale-runtime regression to retain the original size and modification timestamp while replacing all bytes. Verify that staging restores the selected compiler's exact DLL, and that a stale staged DLL cannot rescue a missing compiler dependency. Local validation: real PE dependency inspection passes initial/repeat staging, a fixture originally beside the executable, equal-size/equal-timestamp corruption repair, missing compiler dependency rejection, and three concurrent deployment operations. Eight Linux native staging tests pass; the additional Windows-only test is retained for native CI. Tree 5d35ceb matches the tested local tree.
Native Windows 6.2.1 passed the complete C/SDL and extracted-package qualification at aac42ce. Windows 6.3.3 exposed a post-link deployment timeout: one SDL target held the shared-output lock while scanning its entire dependency graph, causing the other target to exhaust the 60-second lock wait. Perform isolated dependency inspection, input validation and license acquisition independently. Hold the output lock only while updating shared application-owned libraries and notices. Keep the existing deployment wait and all unresolved-dependency, compiler-ownership and content-validation checks. Enable normalized dependency paths with guarded CMP0207 support on newer CMake. Protect build-only license downloads with a separate per-license function-scoped lock so concurrent scans cannot hash a partially downloaded cache file. Downloads remain bounded at 60 seconds, and modified license contents remain fatal. Add executable regressions proving missing dependencies are diagnosed while another process holds the copy lock, concurrent acquisition cannot consume a partial license, and changed cached licenses still fail verification. Both held-lock and partial-license failures were reproduced against the previous implementation. Local validation: 10 Linux native staging/notice tests pass, with two additional Windows-only tests retained for native CI; nine relocation supervisor tests pass. Real PE dependency inspection passes initial/repeated staging, same-size/same-timestamp corruption repair, three concurrent deployments, and missing-runtime validation while the copy lock is held. Tree 7b19949 exactly matches the tested local tree. Final native Windows validation is required. Windows artifact comparison identifies swiftSynchronization.dll as the previously omitted consumer dependency; the Linux SwiftOnoneSupport observation was an analogous fixture-only import, not the missing DLL in the Windows failure.
|
Verified the published repair at https://github.com/jmonster/Switch2Kit/actions/runs/35409604917 Both Windows 6.2.1 (job 105806387003) and 6.3.3 (job 105806386858) passed native WinRT/package tests, real C/SDL consumers, and extracted-package execution with OS-only PATH and isolated profiles. I downloaded and inspected both diagnostic ZIPs: all three extracted consumers exited 0 on each toolchain; each of the six missing-facade/missing-swiftCore controls returned The same head has passed Linux BlueZ/native hosts, macOS build/regressions, packaged macOS qualification, Swift concurrency, C distribution, SDL regressions and in-process SDL consumers. The separate emulator-integration workflow still has its Intel macOS Cemu build running; I am not counting that pending job as passed. No physical-controller or maintained-fork gameplay qualification is inferred from these SDK results. The older unpublished lock patch must not be reapplied: the published head already contains the refined lock-scope repair and separate license-cache locking. No merge or release has been performed. |
…ion GUIs Cemu's complete Linux application and controller policies passed at ef6fdfe, but extracted launch failed before observing a window: Openbox had published its identity while wmctrl -lp still reported no client-list property. The SDK supervisor only waited for wmctrl -m, racing the first real application observation. Wait for both EWMH identity and the possibly empty client list before starting the application. Keep this prerequisite bounded to five seconds including probe timeouts. Preserve every subsequent observer, window, runtime-location, normal-exit and relaunch assertion; no observer error becomes a successful GUI and no application startup timeout is increased. Add seven portable failure-oriented readiness tests to the retained launch suite, plus a native Xvfb/Openbox/Xlib regression run in Linux CI. The native test owns a separate display and uses a pipe-controlled window to reproduce the exact old identity-only readiness failure, then verifies real normal-window observation, normal close and relaunch. It is explicitly an observer fixture, not an emulator, controller or hardware qualification substitute. Validation: all 19 retained launch tests and seven new readiness tests pass. The real isolated X11 reproduction and both normal-close cycles pass locally. YAML parses, the six-file diff passes git diff --check, and published tree 888cb88 exactly matches the locally tested tree. SDK product sources, protocol, transport, packaging and Windows paths are unchanged. Final native CI and affected maintained-fork pin validation are still required.
…paration Rename the launch supervisor's local $home variable: PowerShell variable names are case-insensitive and HOME is read-only. The exact Dolphin Windows diagnostic archive showed this failure after a successful complete application build, before any GUI process was started. Keep private profiles, OS-only PATH, packaged DLL/runtime inspection, normal close and relaunch mandatory. Add structured failure-stage and startup-exit-code evidence instead of freezing diagnostic prose. Add executable native Windows supervisor regressions for both emulator profiles. A compiled console fixture validates its private environment and exits with a known nonzero code; it must never satisfy GUI qualification. Missing notices and pre-existing packaged Cemu settings remain rejected. Run this regression on both Windows toolchains alongside, not instead of, the real C/SDL and extracted consumer checks. Local validation: 19 launch policy tests, 7 Linux observer tests, 4 repository integrity tests, 5 distribution notice tests, Python compilation and changed-tree whitespace validation pass. Native Windows fixture and real maintained-fork GUI validation are required in CI. Published tree 494185d matches the locally inspected tree.
Review reproduced a functional reconnect defect: a ready controller can advertise during continuous discovery, enter the per-scan duplicate filter, then disconnect without stopping that scan. Its subsequent advertisements were permanently suppressed until some unrelated scan restart. Remove only the retiring peripheral's duplicate-admission entry in finish. Retain stable physical identity, fresh monotonically increasing connection tokens, bounded scan storage and all shared retry/consent/explicit-stop policy. This does not restart scanning, fabricate an advertisement or initiate a connection. Add three executable adaptation regressions covering continuous-scan reconnect with stale-token rejection, failure/cancellation followed by a fresh advertisement, and explicit stop/shutdown remaining stopped. Two new tests fail on the old production adapter (three assertions), and all ten pass with this repair. Local reproduction compiled the actual Swift adapter, production advertisement parser/identity/types and existing OS-boundary test double under Swift 6.2.1 on Linux. The Windows source guard was removed only in a temporary proof package; unused native entry points abort rather than pretend to implement WinRT. No such shim is distributed or committed. This is adaptation evidence, not native radio or physical-controller qualification; the real Windows Swift/WinRT CI matrix must pass on this revision. Tested tree c6d6435 matches the published tree exactly.
… merge The fork default-branch READMEs still have macOS-only Quick start headings, so the SDK's #quick-start, #linux and #windows links did not reach the advertised desktop setup. Link the reviewed immutable Dolphin and Cemu README revisions instead, and explain how to select the feature-branch development application artifacts while those PRs remain unmerged. Preserve the user-first controller/app route, exact platform package names and executable paths, source-build fallback, Joy-Con distinctions, normal Bluetooth/security requirements, runtime and hardware limitations. No documentation prose/order/length assertion is introduced. The three changed files contain only navigation and artifact-selection guidance. Retained repository/local-target tests (4), complete distribution-notice tests (5), and changed-tree whitespace checks pass. The full SDK source tree 6bcfe6e matches the local audited tree. Final native builds remain required; this commit does not relabel prior-head results.
Scope and reviewed revisions
Native Windows Bluetooth LE support feeds the shared Switch2Kit controller/session engine, C ABI and in-process SDL3 integration. Linux uses the existing BlueZ backend; macOS and optional backend-disabled builds remain supported. Maintained application PRs: jmonster/dolphin#5 and jmonster/Cemu#3. No separate dashboard, network bridge, system SDL override or virtual-controller driver is required, and unmodified upstream applications do not gain support merely by installing this library.
SDK head:
13abafebd5c4b950bdbb6e1517b71899ec717b52.Tree:
6bcfe6e2ee94f32b8ff1c498ea7e88d0899aee82.Both maintained forks deliberately pin production revision
3d3ce3a605733c47db061af687168ad5914cbf0c. It contains every code/build/test fix and is the direct parent of13abafe; the latter changes only README/Linux/Windows guide navigation to reviewed desktop instructions. This is an intentional immutable pin, not the old divergent dependencies.Implementation and repairs
swiftSynchronization.dll, protects compiler originals, rejects missing/ambiguous dependencies, compares DLL bytes, and resolves Windows system libraries without descending into optional OS internals.$HOMEvariable. Native executable regressions exercise private environments and both emulator profile paths, reject missing notices/pre-existing packaged settings, and require a console fixture to fail rather than pass GUI qualification. Real maintained-fork GUI checks remain separate.Current-head validation
Confirmed for
13abafe:tests/run.shsuite, including private-D-Bus BlueZ integration, native consumers, protocol/input/rumble/calibration/lifecycle and distribution checks. Controlled BlueZ/transport fixtures are not physical Bluetooth evidence.Other final-head runs are being checked, not assumed green:
The SDK's upstream-patch matrix is not the maintained-fork build. Source/diagnostic archives are not application downloads. The fork PRs retain full enabled applications, representative disabled builds and exact extracted application checks on their selected SDK pin.
Editorial cleanup and documentation
#73 is already merged (reviewed head
aaa3747, resulting mainbdabcce); this session did not perform the merge. README length/order, branding/English UI prose, license-index prose and redundant navigation-file hashes are removed. Local documentation targets, documented protocol constants, executable identity, complete licenses/attribution, signing and runtime checks remain. Cemu additionally tests CMake admission outcomes rather than diagnostic wording; Dolphin retains executable mapping/rollback/identity/shutdown policies. No suite or safety requirement is disabled to obtain green CI.The main README leads with controller-enabled applications and links directly to reviewed desktop setup guides. Platform guides describe correct development-artifact selection, extraction/runtime requirements, normal Bluetooth access and source fallbacks. Fork guides cover physical device and player/port selection, independent GameCube trigger travel/clicks, rumble, saved mappings and Joy-Con setup. Cemu does not claim Dolphin's opt-in automatic startup policy; measured motion calibration remains explicit.
Merge gate and hardware boundary
Keep this PR draft until final native/application validation and review are complete. No physical-controller, pristine first-use, production signing/notarization or production-release qualification is claimed. GUI checks seed private noninteractive settings, never erase user configuration, and do not prove gameplay.
Hardware acceptance must record model/firmware, OS, adapter/driver and revisions: discovery/pairing and denied-access retry; every button/stick; independent GameCube analog travel/digital clicks; model-appropriate rumble and stop; two identical controllers reconnecting in reverse order; saved assignments; adapter loss; explicit disconnect; shutdown; measured motion where applicable; and gameplay. Also test Dolphin opt-in reconnection after a controller is off longer than 60 seconds and Cemu's complementary Joy-Con sources.
Merge order: #73 is complete; merge this PR next while retaining
3d3ce3ain reachable history, then both maintained-fork PRs after their final pinned application checks and review pass. A squash/rebase that changes the selected SDK commit requires repinning and revalidating both forks. Do not remove the only ref keeping an unmerged gitlink commit reachable. No further merge or release is authorized or performed here.