Skip to content

Pr/keep alive update - #14937

Closed
verbst wants to merge 10 commits into
PCSX2:masterfrom
verbst:pr/keep-alive-update
Closed

Pr/keep alive update#14937
verbst wants to merge 10 commits into
PCSX2:masterfrom
verbst:pr/keep-alive-update

Conversation

@verbst

@verbst verbst commented Sep 10, 2026

Copy link
Copy Markdown

keep alive update
latest groovy nlc api
nlc limited to rgb888

verbst added 10 commits July 26, 2026 13:43
    10: Bug fixing (needs testing)
    9 (82): Revendored API input
    9 (81): Revendored API input
    9: input label fix
    9 (76): rumble stop fix
    8: Interlaced support
    7: rumble fix, stage a
    6 & 71: Input API and integration
    5: Adding support for virtual mister controllers into PCSX2
    4: Bug fix on connection
    3: Fix to switchres presets
    2: Groovy settings added
    compile error fix
    1: Initial implmentation
What changed

Vendored client (3rdparty/groovymister/) — re-synced to upstream 6cce1ac. Delta vs pristine upstream is now exactly one logical patch: rioServiceQueues() in groovymister.{h,cpp} (34 lines, 3 call sites). Every other file is byte-identical. Upstream api/ turned out to already ship CRLF, so the re-sync is a straight cp — I corrected PROVENANCE.md, which told the next person to convert.

The keepalive — GroovyMiSTerKeepAlive.h holds the timing decision (2000 ms threshold / 250 ms poll, static_asserted against the core's 5 s timeout), and SenderLoop()'s queue wait became a wait_for. Because PCSX2 streams from a dedicated thread nothing can stall, that single change covers pause, savestate loads, disc swaps and modal dialogs — no timer or host plumbing.

Frame counter — realigned on gmw_reconnect_epoch() change and in TryConnect(), with the unbounded forward jump kept deliberately and the reasoning in a comment.

Three things worth your attention

1. A hole I found while wiring it up, not in the plan. The oversized-frame drop path continues with have_frame still true, so a pathological run of oversized frames would look busy while sending nothing — and starve the core's idle timer. The keepalive check therefore runs on every iteration, not just idle ticks.
2. gmw_reconnect_epoch() is not monotonic. gmw_close() deletes the wrapper's singleton, so the epoch is per-object and restarts at 0 on every TryConnect(). The comparison is !=, never >. My first comment on this was weaker than the truth; it's corrected in the code and recorded in memory.
3. Verification is partial, deliberately. The five keepalive tests pass — I ran them under a minimal gtest shim since gtest isn't built in WSL, so the assertions genuinely executed rather than just compiling. Both changed TUs and the whole vendored client pass -fsyntax-only. The MSVC build and every hardware drill are unrun, and the drills need the cab flashed with MiSTer_groovy_nlc_idletimeout + Groovy_idletimeout.rbf — against your current 3738621a… binary the keepalive is inert and unverifiable.

Upstream feedback
- 3rdparty/groovymister/groovymister.h — CmdSwitchres now returns int.
- 3rdparty/groovymister/groovymister.cpp — CmdSwitchres retries the send up to 3x waiting for a getACK(60) ACK before giving up; CmdBlit's internal reconnect watchdog checks that return and only logs "modeline replayed" when it actually succeeded.
- 3rdparty/groovymister/groovymister_wrapper.h/.cpp — gmw_switchres() propagates the new return value.
- pcsx2/GroovyMiSTer/GroovyMiSTerOutput.cpp — SenderLoop()'s switchres call site logs a Console.Warning on failure.
- PROVENANCE.md — documents this as a manual cherry-pick from the (still-uncommitted) canonical repo, so a future full re-sync reconciles rather than double-applies or drops it.

All three touched .cpp files pass g++ -fsyntax-only with the project's established WSL verification flags. This doesn't cover the actual Windows build/link — that still needs to happen on your end, and testing the fix requires the rebuilt MiSTer core binary (with the matching sendACK(0,0) change) deployed to hardware, since the PCSX2 side is inert without it.
Keepalive & reconnection
keep alive fix
nlc limited to rgb888
@verbst verbst closed this Sep 10, 2026
@verbst

verbst commented Sep 10, 2026

Copy link
Copy Markdown
Author

wrong fork sorry

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for submitting a contribution to PCSX2

As this is your first pull request, please be aware of the contributing guidelines.

Additionally, as per recent changes in GitHub Actions, your pull request will need to be approved by a maintainer before GitHub Actions can run against it. You can find more information about this change here.

Please be patient until this happens. In the meantime if you'd like to confirm the builds are passing, you have the option of opening a PR on your own fork, just make sure your fork's master branch is up to date!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant