Skip to content

Expose automatic discovery and policy-only start through SDLHost - #74

Merged
jmonster merged 6 commits into
mainfrom
feature/cemu-sdlhost-auto-connect
Sep 19, 2026
Merged

jmonster merged 6 commits into
mainfrom
feature/cemu-sdlhost-auto-connect

Conversation

@jmonster

@jmonster jmonster commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Merge method and current CI status

Checked against current main d73cbec2018fda390f75b932951dd4bcc0f063ca and PR head 1e6eac15fd4d4c93f15244eb66d79021c92d29fc.

GitHub's full PR response reports mergeable: true, mergeable_state: clean, but rebaseable: false. The comparison has current main as its merge base, with zero commits behind. The combined source tree has no outstanding merge conflict; GitHub cannot use Rebase and merge for this history. The earlier unqualified statement that the PR could merge omitted this important distinction.

Repository settings permit Squash and merge and Rebase and merge, but disable Create a merge commit. After current-head validation passes, use Squash and merge from the merge-button dropdown. Do not rewrite/force-push the branch or change repository settings to work around the unavailable rebase method. This is a choice of allowed merge method, not a CI bypass.

Current-head CI is still unverified: the Actions query filtered by this exact head, without restricting the trigger type, returns zero runs. The PR is currently marked ready for review, but that metadata does not establish completed testing. Do not merge on the strength of older green checks. No merge or release has been performed by this update.

Purpose

Add the existing automatic-discovery C API to the application-owned SDLHost. This remains useful after merged #75: that PR supplies desktop transports and distribution, not these SDLHost lifecycle methods. This is the SDK prerequisite for jmonster/Cemu#4; it does not itself enable automatic connection in Cemu or change user consent.

  • setAutomaticDiscovery(bool) changes policy without starting a stopped source, draining input, or detaching ready controllers.
  • start() starts the selected policy without opening a finite discovery window. Manual discover() remains unchanged.
  • SDL's joystick lock remains before the host mutex. The first macOS call allocating a context, including policy selection, must run on the main thread. The application owns opt-in, persistence and the Disconnect fence.

Reconciliation with merged #75

Current head: 1e6eac15fd4d4c93f15244eb66d79021c92d29fc.
Exact source tree: 50e0685fc5503ebcf1bbdcb5dac1f08007d94f5a.
Current main incorporated: d73cbec2018fda390f75b932951dd4bcc0f063ca.

Merge commit 6575ac7f1fc11a041bceccda448f7f010258c87d combines the previously reviewed #74 head with current main, preserving both histories. Its tree matches the independently prepared resolution recorded in the prior review. The following 1e6eac1 commit changes no source; it was pushed to request CI after no runs appeared. The same PR was also closed/reopened once. Do not repeat empty commits or close/reopen cycles in place of diagnosing absent CI.

The net diff against main is four files: Integrations/Emulators/SDLHost.hpp, tests/emulator-host/main.cpp, tests/sdl-inprocess/Fixture.swift, and .github/workflows/sdlhost-autoconnect.yml. Package.swift is identical to main, including the Windows WinRT dependency, dynamic products, C++20 and fixture helper exclusions. All #75 transport/runtime/packaging repairs, SDL capacity and rumble fixes, and controller-first documentation remain unchanged. The merged editorial cleanup and material license/security checks remain intact.

No C ABI layout, protocol, mapping, rumble policy, calibration or default discovery policy is changed. No tests are disabled or safety limits relaxed.

Recorded validation of this source tree

The prior session recorded the following local validation on Linux with Swift 6.2.1 and SDL 3.4.16 for tree 50e0685fc5503ebcf1bbdcb5dac1f08007d94f5a:

  • All 101 Swift package tests passed with warnings as errors.
  • All six real native CTest consumers passed: emulator-host, emulator-motion-profile, emulator-motion-pair, sdl-version, sdl-inprocess and sdl-motion. Host code is built with exceptions disabled; the adapter retains its required target-local exception policy.
  • The production SDLHost consumer passed 100 consecutive executions, including default-off startup, idempotent policy selection/start, queued input across opt-out, two live controllers, concurrent settings/pumping, asynchronous-stop BUSY, explicit restart and reverse-order physical identity.
  • All 20 isolated BlueZ scenarios, four repository-integrity tests, five distribution-notice tests, fail-closed signing/application identity checks and whitespace checks passed.
  • Downloaded SDK source archive digests and reconstructed trees matched the recorded GitHub metadata; the published combined tree matched the tested resolution.

This merge-method check does not claim new test executions. Older sanitizer/full-suite results remain in the earlier review and are not relabeled as current-head CI. Controlled radio fixtures do not establish physical Bluetooth or gameplay qualification.

Remaining validation and downstream pins

Require successful current-head runs for SDLHost automatic discovery, Windows native controllers (both Swift toolchains and extracted C/SDL consumers), Linux BlueZ/native hosts, macOS build/regressions, packaged macOS runtime, Swift concurrency, Swift/native C distribution, SDL input, in-process SDL consumers and emulator integration. Check all applicable matrix jobs and blocking reviews. Missing runs are not passes; no new test failure is inferred solely from their absence.

After an eventual squash merge, update the separate Cemu consumer to the resulting reachable SDK commit on main and validate that application's own builds and packaged launch before merging it. Do not assume a pre-squash feature-branch SHA is preserved in main's ancestry or rely on an automatically deleted branch to retain it.

Hardware acceptance remains separately documented: opt-in/persistence, reconnect, opt-out preserving input, Disconnect preventing unsolicited restart, multiplayer identity and normal shutdown, with exact model/firmware/OS/adapter evidence. This API-only PR has no new physical-controller qualification claim. No PR merge, auto-merge or production release is performed here.

Add two forwarding methods for emulator-owned consent and lifecycle control.
Keep the default policy, finite discover behavior and SDL/host lock order unchanged.

Copy link
Copy Markdown
Owner Author

Cemu integration is now open at jmonster/Cemu#4 and pins this PR's 731bd5f97c806e15277c9cd120d55515cef57940 commit.

Validation update: Cemu's standalone production session/INI-policy tests were rerun successfully with Clang and GCC, warnings as errors, ASan and UBSan. These remain controlled SDK-host/atomic-writer boundary tests, not physical controller acceptance.

This SDK revision is not CI-green: the linux job in https://github.com/jmonster/Switch2Kit/actions/runs/35372274174 failed at Package, Linux radio and retained portable regressions; later relocated-facade/SDL steps were skipped. The precise failure was not diagnosed because this connector does not expose job logs or check annotations. Do not assume the failure is unrelated to this PR. The Linux Dolphin host build passed in that run; the Cemu host build was still in progress at inspection.

Both PRs remain draft pending review of the SDK failure and complete native Cemu/SDK checks. No merge performed.

…ation

Exercise the real SDL host and C context with controlled radio fixture counters,
queued input, opt-out, busy stop/restart and physical identity regressions.
Keep the README below the existing layout bound by linking its complete library
example, and exclude non-Swift fixture tools from the SwiftPM test target.
…rrent policy

Integrate main bdabcce without rewriting the existing PR history. Retain the merged editorial-test cleanup, required license/attribution verification and signing guards. Restore main's controller-first README instead of retaining the unrelated line-limit workaround.

Clarify that initial policy selection can allocate the macOS context and therefore shares initialize/start/discover's main-thread requirement. Extend the real SDLHost/C facade/SDL adapter consumer with default-off policy-only startup, BUSY manual discovery during asynchronous stop, policy changes while stopped, and concurrent policy toggles with two live controllers and input pumping. Preserve manual discovery, queued releases, physical identity, restart and shutdown tests.

Validated tree 9fe4980: 100 Swift package tests with warnings as errors; all six native emulator/SDL CTest consumers using Swift 6.2.1 and SDL 3.4.16; four repository integrity tests, five distribution notice tests, fail-closed signing/application identity checks, and whitespace checks. Final-head CI must be revalidated. No physical Bluetooth/gameplay qualification or PR merge is claimed.

@jmonster jmonster left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed published revision 7134dab (tree 9fe4980f92ede054ef9af8ef08c06af83cac96a5).

Checked the SDLHost forwarding methods against the existing C context lifecycle and source boundary: policy selection is configuration-only, start retains the selected default-off policy without a finite scan, existing manual discover is unchanged, asynchronous-stop BUSY is preserved, and SDL's joystick lock is acquired before the host mutex. Initial macOS policy selection can allocate the context; the header now explicitly documents its main-thread requirement. No new production worker, callback, C ABI layout, or transport logic is introduced.

Reconciled current main without rewriting history, removed the unrelated README truncation, and preserved the merged editorial cleanup and material license/signing checks. The PR is narrowed to five relevant files. No remaining code blocker was identified in this review.

Validation on this exact published tree: 100 Swift tests with warnings as errors; complete retained tests/run.sh; six native host/SDL consumers; 100 consecutive emulator-host executions; and six C/C++ ASan/UBSan consumers. Swift was not sanitizer-instrumented. The final-head native SDLHost workflow also independently passed all six real CTest consumers (run 35460054649, job 105942176068). This is not physical-controller or gameplay evidence.

Remaining merge gate: finish the pending final-head Linux/macOS/emulator workflow matrix and recheck mergeability/reviews. Keep draft until those checks complete. This review does not authorize merging or releasing and does not approve the separate emulator PRs.

Preserve the reviewed SDLHost API/test changes while incorporating current main d73cbec, including the merged Windows/runtime work and the already-present SwiftPM fixture exclusions. No force-push or behavior relaxation.
The synchronized branch at 6575ac7 incorporates main d73cbec but has no workflow runs associated with its head. Advance the existing PR branch with an identical source tree to request the complete pull-request validation matrix; no implementation, workflow, test or safety check is changed.

Independently verified tree 50e0685 against the published merge. Linux/Swift 6.2.1: all 101 package tests with warnings as errors, all six real SDLHost/SDL consumers using SDL 3.4.16, four repository integrity tests, five distribution-notice tests and fail-closed signing/application identity checks passed. Keep native Windows/macOS and complete final-head CI as merge gates. No physical-controller or gameplay qualification is claimed.
@jmonster jmonster closed this Sep 19, 2026
@jmonster jmonster reopened this Sep 19, 2026

@jmonster jmonster left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the reconciled head 1e6eac1, exact tree 50e0685fc5503ebcf1bbdcb5dac1f08007d94f5a, against merged main d73cbec.

#74 is not superseded by #75: main still needs the SDLHost policy setter and policy-only start methods. The net change is four API/test/workflow files. The manifest and all merged Windows transport, runtime staging, SDL capacity/rumble and documentation changes remain identical to main. Existing SDL-before-host lock ordering, default-off policy, manual discovery, asynchronous-stop BUSY, live opt-out and physical-identity behavior are retained. No remaining code blocker was identified in this focused reconciliation review.

The synchronized commit 6575ac7 appeared during this session and exactly matches the independently prepared combined tree; no competing resolution was written over it. I pushed 1e6eac1 with the identical tree to request missing CI and reopened this same draft PR once when no runs appeared. No force-push, main update, PR merge or release was performed.

New local validation of this exact source tree, Linux / Swift 6.2.1 / SDL 3.4.16: 101 Swift tests with warnings as errors; all six real CTest host/SDL/motion consumers; 100 consecutive production host consumer executions including concurrent settings/input; all 20 isolated BlueZ scenarios; four repository-integrity tests; five distribution-notice tests; fail-closed signing/application identity checks. The BlueZ tests use a private controlled D-Bus service, not physical hardware. The existing no-exceptions host build and target-local adapter exception settings are retained. Prior-head ASan/UBSan results were not rerun or reclassified as this head's sanitizer evidence.

Merge gate: GitHub had not created any workflow runs for the new head at inspection. Missing checks are not passing checks. Require the full current-head native matrix, now including both Windows toolchains inherited from merged #75, plus the SDLHost regression workflow and all existing applicable Linux/macOS/distribution/integration jobs. Keep draft until those runs and any real blocking review are resolved. Hardware/gameplay qualification remains separate and is not inferred from fixtures.

@jmonster
jmonster marked this pull request as ready for review September 19, 2026 21:59
@jmonster
jmonster merged commit d9129e3 into main Sep 19, 2026
@jmonster
jmonster deleted the feature/cemu-sdlhost-auto-connect branch September 19, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant