Repository navigation
MgbaLink: GRANT pacer and mGBA Pro Controller (slice 2b) - #506
Merged
Merged
Conversation
The mGBA video source now publishes its connection in a registry keyed by its address, so a controller for the same mGBA shares it (the bridge holds one client). KeySender anchors a frame clock with "GRANT 0", runs the pacer (GRANT about every 8 ms, two frames ahead of app time, on a thread pool task) and sends each key state as KEYS at most five frames ahead, so a cancel can still release the keys at once. Every KEYS goes into the input log at the frame it landed on. ProController_MgbaLink plays scheduled states through the key map and KeySender. It registers as the Developer-only "TCP: mGBA Link" controller interface, with the video source's address.
…ib, not CoreLib The selector widget header includes <QLineEdit>, which CoreLib (Qt-free) cannot compile. The descriptor depends on VideoSource_MgbaLink, which is not in CoreLib either. Both now sit in the main source list, like SysbotBase's.
Ends are placed from app time: three 80 ms states are 14.33 frames, so the release lands on frame +14. The old expectation rounded each state to 5 frames separately, the drift KeySchedule avoids.
dayfine
marked this pull request as ready for review
November 15, 2026 03:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Base:
lab/tooling; the diff shows only this change (#503 has merged).Slice 2b of the mGBA design: mGBA can now be driven by a Pro Controller, paced by the app's clock.
MgbaLink::link_registry()under its address; the controller for the same address sends on it (the bridge holds one client).MgbaLink::KeySenderanchors a frame clock withGRANT 0, runs thePacer(GRANT about every 8 ms, two frames ahead, on a thread pool task), and sends each key state asKEYSat most five frames ahead, so a cancel releases the keys at once. EveryKEYSlands in theInputLog. On stop it releases held keys and grants a frame it never reaches, so mGBA runs on.ProController_MgbaLinkplays scheduled states through MgbaLink slice 2a: key schedule, input log, Pro Controller key map #503's key map. Developer mode adds a "TCP: mGBA Link" controller interface with an address box (default127.0.0.1:47801, the video source's).Testing
Controllers::MgbaLink - link registry / pacer / key sender) run against a fake bridge on 127.0.0.1; Fork Draft CI runs them.