[PR #1095] GameInput: resolve the current token for self-stopping callbacks (OLD-9769) #1132

Open
opened 2026-11-26 20:20:11 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1095
Author: @sodove
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: restore/gameinput-current-callback-9769


📝 Commits (2)

  • 49f7133 gameinput: StopCallback and UnregisterCallback take the current-callback token
  • a315898 Merge remote-tracking branch 'upstream/main' into restore/gameinput-current-callback-9769

📊 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

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 main 75223235d.

A reading callback can pass GAMEINPUT_CURRENT_CALLBACK_TOKEN_VALUE to 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.

  • Control at 3aa975421 with just the new test and ABI constant: 3 of 371 checks failed, covering self-stop and self-unregister.
  • With the fix, all 371 checks passed. The test drives four button changes, and the callback fires once. A stopped callback can still be unregistered by its actual token. A self-unregistered callback is already gone. Three additional CTest runs also passed.
  • Built the production gta6rt executable. In a separate local merge with #1074 at 5e86f4a3, the default and long-script tests passed (371/371 and 8/8).
  • The translator semantic suite passed (6,168 tests in 470 files). git diff --check and the repository's game-data guard also passed.
  • Main advanced by one unrelated guest-scene test during verification. After integrating it I reran GameInput (371/371) and the updated guest-scene tests (6/6).

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

  • Includes current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • Translator-contract checklist item is inapplicable to this GameInput change.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1095 **Author:** [@sodove](https://github.com/sodove) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `restore/gameinput-current-callback-9769` --- ### 📝 Commits (2) - [`49f7133`](https://github.com/ubiquitarianism/leonida/commit/49f7133d96c8f9cbee2f5e04132a0f47ed728c4a) gameinput: StopCallback and UnregisterCallback take the current-callback token - [`a315898`](https://github.com/ubiquitarianism/leonida/commit/a3158989ca3f445d0bff353cd00630aca613d7b3) Merge remote-tracking branch 'upstream/main' into restore/gameinput-current-callback-9769 ### 📊 Changes **3 files changed** (+56 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/gameinput.cpp` (+16 -0) 📝 `runtime/shims/gameinput_abi.h` (+3 -0) 📝 `runtime/test/gameinput_test.cpp` (+37 -0) </details> ### 📄 Description Claimed in the coordination issue as: OLD-9769 ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140345943)). ### 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 main `75223235d`. A reading callback can pass `GAMEINPUT_CURRENT_CALLBACK_TOKEN_VALUE` to 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. - Control at `3aa975421` with just the new test and ABI constant: 3 of 371 checks failed, covering self-stop and self-unregister. - With the fix, all 371 checks passed. The test drives four button changes, and the callback fires once. A stopped callback can still be unregistered by its actual token. A self-unregistered callback is already gone. Three additional CTest runs also passed. - Built the production `gta6rt` executable. In a separate local merge with #1074 at `5e86f4a3`, the default and long-script tests passed (371/371 and 8/8). - The translator semantic suite passed (6,168 tests in 470 files). `git diff --check` and the repository's game-data guard also passed. - Main advanced by one unrelated guest-scene test during verification. After integrating it I reran GameInput (371/371) and the updated guest-scene tests (6/6). 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 - [x] Includes current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [x] Translator-contract checklist item is inapplicable to this GameInput change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1132
No description provided.