Repository navigation
Conversation
…ack token GAMEINPUT_CURRENT_CALLBACK_TOKEN_VALUE (all ones) names the callback that is running on the calling thread, as the host's GameInput does (measured by @Maraco91 on GameInput 0.2309): inside a callback, UnregisterCallback(CURRENT) removes it and returns true and StopCallback(CURRENT) stops it; outside one the token names nothing and UnregisterCallback returns false. The shim compared it with registered tokens, matched none, and the callback kept firing. call() records the running token in a thread_local, restored on return, and both methods resolve the constant through it. gameinput_test drives a self-cancelling reading callback through four button changes on the virtual Xbox pad, once per method. Finding: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7115359105 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 24, 2026
4 tasks done
Collaborator
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.
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Claim: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7115375665 (from
@Maraco91's finding: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7115359105)Depends on: none. Overlaps:
#9264and#5109also editUnregisterCallback/ the delivery path inruntime/shims/gameinput.cpp; this change adds two lines at the top ofStopCallbackandUnregisterCallbackand a guard incall(), so whichever lands second needs a small rebase.What and why
GAMEINPUT_CURRENT_CALLBACK_TOKEN_VALUE(0xFFFFFFFFFFFFFFFF) names the callback that is running on the calling thread. The host's GameInput (0.2309, Windows 11, measured in the finding) treats it that way: inside a callbackUnregisterCallback(CURRENT, 0)removes that callback and returns true, andStopCallback(CURRENT)stops it; outside a callback the token names nothing andUnregisterCallbackreturns false. The shim compared the constant with the registered tokens, matched none, and the callback kept firing, also after a title had freed its context.gameinput_abi.h:kCurrentCallbackToken.gameinput.cpp:call()records the running callback's token in athread_local, restored on return (so a callback that drives another delivery keeps its own);StopCallbackandUnregisterCallbackresolve the constant through it, and with no running callback do nothing / return false.gameinput_test.cpp: a reading callback on the virtual Xbox pad that cancels itself with the constant on its first call must run once for four button changes, once withUnregisterCallback(which must return true, after which the real token is gone) and once withStopCallback(the callback stays registered); the constant outside a callback returns false.Tested
Windows 11, MSVC 19.44 (VS 2022 Build Tools), SDL3 fetched with
-DLEONIDA_SDL3_FETCH=ON, onmain5d74c2723:gameinput_test: 348 checks, 0 failures (7 new).gameinput.cpp(only the header constant added): 348 checks, 3 failures, exactly the three new behaviour checks.gameinput_probeandgta6rtbuild with the change.No game files, no controller (SDL virtual pads only). Whether the retail title passes the constant is not measured.
AI-assisted: yes (Claude).
🤖 Generated with Claude Code