GameInput: resolve the current token for self-stopping callbacks (OLD-9769) #1095
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1095"
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?
Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-24T18:20:20Z.
Claimed in the coordination issue as: OLD-9769 (claim).
What and why
Carry forward @Joaco9020's GameInput fix from draft #46 (old PR 9769). The rebased commit retains the original authorship and has the same stable patch ID as
84dde3f1c. The branch includes current main75223235d.A reading callback can pass
GAMEINPUT_CURRENT_CALLBACK_TOKEN_VALUEto stop or unregister itself. The shim previously compared that special value directly with the registered tokens, so the callback kept receiving events. The fix resolves it to the callback running on the calling thread and restores the previous token when a nested delivery returns.Tested
Native Windows 11 build 26100.7623, MSVC 19.44, RelWithDebInfo, pinned SDL 3.4.20, synthetic virtual pad.
3aa975421with just the new test and ABI constant: 3 of 371 checks failed, covering self-stop and self-unregister.gta6rtexecutable. In a separate local merge with #1074 at5e86f4a3, the default and long-script tests passed (371/371 and 8/8).git diff --checkand the repository's game-data guard also passed.GPUs tested: n/a (GameInput and SDL virtual devices).
AI-assisted: yes, OpenAI Codex for the rebase and Windows verification. The original commit retains its co-author credit.
Checklist
mainand merges cleanly.Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T18:41:35Z.
Review: APPROVED
Audited and verified. Implements GAMEINPUT_CURRENT_CALLBACK_TOKEN_VALUE resolution via RAII-scoped hread_local t_running_token in
untime/shims/gameinput.cpp, allowing self-stopping and self-unregistering callbacks during execution while safely ignoring calls from outside callbacks. Comprehensive unit tests in
untime/test/gameinput_test.cpp pass cleanly. Approved.
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T18:52:56Z.
Review: APPROVED
Clean-Room Audit — PR #1095 (
OLD-9769GameInput Current-Callback Token)Clean resolution of
GAMEINPUT_CURRENT_CALLBACK_TOKEN_VALUE(0xFFFFFFFFFFFFFFFFull) inruntime/shims/gameinput.cppvia thread-local running token RAII guard, allowingStopCallbackandUnregisterCallbackinside active callbacks without deadlock. Covered inruntime/test/gameinput_test.cpp; 0 game data.Verdict: APPROVED
Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:18:32Z.
Recommendation: [MERGE]
Reasoning: Carries #46's GameInput fix:
GAMEINPUT_CURRENT_CALLBACK_TOKEN_VALUEnow resolves to the running callback, so a self-stopping/unregistering callback actually stops. Small, focused shim change with a new regression test ingameinput_test.cpp. No second-person run yet, but the change is narrow and low risk. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict withmain. Merge once the queued checks are green.Impact level: 4/10
Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T00:00:24Z.
Independent verification at head
a3158989c(Windows 11, MSVC 19.44, RelWithDebInfo, pinned SDL3 3.4.20 fetched viaLEONIDA_SDL3_FETCH=ON):gameinput_testand ran it: 371 checks, 0 failures, including all seven newcurrent tokenchecks (self-UnregisterCallbackand self-StopCallbackviaGAMEINPUT_CURRENT_CALLBACK_TOKEN_VALUE, plus the outside-a-callback negative cases).kCurrentCallbackToken = 0xFFFFFFFFFFFFFFFFmatchesGAMEINPUT_CURRENT_CALLBACK_TOKEN_VALUE; thethread_localrunning token is set/restore-scoped insidecall(), so nested deliveries keep their own token; onlyStopCallback/UnregisterCallbackaccept a token, and both now resolve before lookup. Invalid-token early returns look right.The only PR check is the
labelworkflow, which shows cancelled (superseded), not a code failure.Verdict: verified, looks correct. — AI-assisted verification (Devin)
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T18:14:25Z.
Red/green: On main gameinput_test does not compile because kCurrentCallbackToken is missing and main does not resolve GAMEINPUT_CURRENT_CALLBACK_TOKEN_VALUE, so a self-stopping callback never stops, and with the PR on top of #1559 ctest -R "^gameinput(_script)?$" passes 2/2.
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main
c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:46:43Z.
Verified by OreoFR
Run 1 (nat06)
c1ecf04ed+ PR heada3158989c; green run in a merge package of 9 PRs, no new ctest failure vs mainctest -R ^gameinput$Run 2 (combo #1559 + #1095)
3408969a7+ #15595fbcc642a+ #1095a3158989c(merged in that order, no conflict)ctest -R "^gameinput(_script)?$"All runs
AI-assisted (Claude Code, Claude Opus 5.5).