Repository navigation
MgbaLink slice 2a: key schedule, input log, Pro Controller key map - #503
Merged
Merged
Conversation
KeySchedule turns controller states held for a duration into KEYS commands on frames (at least one frame per state, no drift over many states, a lead of 2 frames after idle); grant_frame() is the paced-mode GRANT; InputLog keeps the frame each change landed on. The key map turns a SwitchControllerState into GBA keys (Plus = Start, Minus = Select, left stick past half tilt = D-pad) and reports buttons with no GBA key.
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(slice 1, #493, is merged there). The diff shows only this change. Fork-only lab tooling.Slice 2 of
docs/design/Lab-mGBA-Console.md(agents branch), first part: the input logic the mGBA Pro Controller will sit on, all testable without mGBA or a ROM.Controllers/MgbaLink/MgbaLink_Keys: GBA key bits; ms to frames (max(1, round(d * 59.7275 / 1000)));frame_at(KEYS) andgrant_frame(paced GRANT, floor + lead 2);KeyScheduleturns the scheduler's states-with-durations intoKEYS <frame> <mask>commands: states follow each other, each holds at least one frame, ends are placed from app time so rounding does not add up, and after idle the next state starts 2 frames after now;InputLogkeeps the frame each change landed on (frame + LATE) as<frame> <mask>lines for replay.NintendoSwitch/Controllers/MgbaLink/NintendoSwitch_MgbaLink_KeyMap:SwitchControllerStateto GBA keys (A, B, L, R; Plus = Start, Minus = Select; D-pad and split D-pad buttons; left stick past half tilt per axis), and reports buttons and the right stick that have no GBA key so the controller can log them once.bridge.luaalready serves GRANT/KEYS/FRAME/SAVE/LOAD, so there is no agents-branch PR.Left for slice 2b: the pacer thread (GRANT every ~8 ms on the shared connection),
ProController_MgbaLinkonControllerWithSchedulerusing this schedule and map, and its Developer-only controller entry sharing the video source's connection.Testing: new unit suites
Controllers::MgbaLink - frames for duration / frame at time / key schedule / input logandNintendoSwitch::MgbaLink - key map; expectations cross-checked with a Python model of the same math. Local compile was skipped (a console run held the heavy gate); Fork Draft CI builds and runs them.Step 0 (user, real mGBA 0.10.5 + local ROM, not part of this PR) still has to confirm what slice 2b relies on:
KEYSat frame F reads back from F (emu:getKeys), aGRANTstall holdscurrentFramewith the window responsive, and theFRAMEcost per call. Live acceptance for slice 2 (start menu opens and closes) needs slice 2b.