mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:40:52 +01:00
[PR #46] [CLOSED] gameinput: StopCallback and UnregisterCallback take the current-callback token #99
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#99
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/46
Author: @Andretuta
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:old-pr/9769📝 Commits (1)
84dde3fgameinput: StopCallback and UnregisterCallback take the current-callback token📊 Changes
3 files changed (+56 additions, -0 deletions)
View changed files
📝
runtime/shims/gameinput.cpp(+16 -0)📝
runtime/shims/gameinput_abi.h(+3 -0)📝
runtime/test/gameinput_test.cpp(+37 -0)📄 Description
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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.