Skip to content

gameinput: serve GameInput.dll's ordinal 1, the retail executable's GameInputCreate import - #7216

Closed
gkissel wants to merge 3 commits into
ProjectLeonida:mainfrom
gkissel:fix/gameinput-ordinal-1
Closed

gkissel wants to merge 3 commits into
ProjectLeonida:mainfrom
gkissel:fix/gameinput-ordinal-1

Conversation

@gkissel

@gkissel gkissel commented Nov 23, 2026 •

Copy link
Copy Markdown

Claimed in the coordination issue as: #8504 (comment)

What and why

The retail 1.0.2.1 executable imports GameInputCreate from GameInput.dll by ordinal 1, not by name. Loader::resolve looks an ordinal import up in the shim table as gameinput.dll!#1, which wasn't registered, so the import fell through to the host's GameInput.dll:

  • On Windows, the installed GameInput answers, so this went unnoticed.
  • Under Wine (11.21 here), the host DLL is Wine's builtin stub (fixme:ginput:GameInputCreate ... stub!). The call fails and the title stops on the result with its own int3, before D3D12XboxCreateDevice.

The change adds {"gameinput.dll", "#1", &GameInputCreate} to the existing SHIM_TABLE (built only with SDL3, as before), plus one check in gameinput_test that #1 is the same function.

Why ordinal 1 is GameInputCreate: Wine's gameinput.spec has it as the first and only export, the executable's call passes a single out-pointer and checks the HRESULT (the GameInputCreate(IGameInput**) shape), and with the alias the title goes on past this point.

Tested

Linux, Wine 11.21, clang-cl + xwin cross build, -DLEONIDA_SDL3_FETCH=ON, GTX 1650 Mobile, own copy of the retail executable (outcomes only):

Related, not changed here

make_game.py's Linux cross build doesn't pass -DLEONIDA_SDL3_FETCH=ON, and xwin has no SDL3. So the GameInput shim is never built for Wine users, and they hit this stop even with the alias. Passing the option from make_game.py would download the pinned, hash-checked SDL3 at configure time. The README says nothing is downloaded unless asked, so I left that choice to you; I can add it (or a flag for it) in a follow-up.

AI-assisted (Claude Code). No game files, bytes or addresses in this PR.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: no translator change.)

…ameInputCreate import

The retail executable imports GameInputCreate from GameInput.dll by ordinal 1. The loader looks ordinal imports up
as "#1", which the shim table did not have, so the import bound to the host's GameInput.dll. On Windows the
installed GameInput answers; under Wine it is the builtin stub, the call fails and the title stops on its result.
The alias maps #1 to the same GameInputCreate, and gameinput_test checks it.
Copilot AI balanced review requested due to automatic review settings November 23, 2026 16:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@tikD1337

Copy link
Copy Markdown
Contributor

Review: gameinput: serve GameInput.dll's ordinal 1 (#7216)

Verdict: approve. This is a two-line fix that is correct and matches how the loader already names ordinal imports. One optional follow-up on the test is below.

What changed

  • runtime/shims/gameinput.cpp: SHIM_TABLE(gameinput, …) gets a third entry, {"gameinput.dll", "#1", &GameInputCreate}. It sits beside the existing by-name entries for gameinput.dll and xgameruntime.dll. A comment explains why the alias is there.
  • runtime/test/gameinput_test.cpp: one more registry check. It asserts that rt::shims::find("gameinput.dll", "#1") returns the same function pointer as the by-name GameInputCreate.

Why it is sound

The loader's key matches. In Loader::resolve, runtime/src/pe_loader.cpp:1478-1485 lowercases the DLL name and turns an ordinal import into the key "#" + std::to_string(ordinal). It then tries shims::find(key, sym) before anything else. The import descriptor walk at pe_loader.cpp:1526-1527 takes the ordinal with IMAGE_ORDINAL64, so an import of GameInput.dll ordinal 1 is looked up exactly as ("gameinput.dll", "#1"). That is the key this PR registers. Exports of loaded modules use the same #N form (pe_loader.cpp:1416, and pe_loader.h:25/:46 document it), so this is the loader's existing convention and not a new one.

Forwarders also work. resolve_forwarder (pe_loader.cpp:1436-1437) checks shims::find(shim_key, symbol) with the raw #N string before it parses the ordinal. A forwarder string like GameInput.#1 would reach the shim too.

The ordinal-to-function mapping is already documented. The D3D12 → Vulkan notes say "GameInput.dll ordinal 1 is GameInputCreate" (docs/d3d12_vulkan.md, the export-inventory row on line 3752). The PR's claim is therefore a measured one, not a hypothesis.

The failure it describes is real. Without the alias, the lookup misses the shim. Nothing named GameInput.dll ships in the game folder, so the loader falls through to the host: LoadLibraryExA(..., LOAD_LIBRARY_SEARCH_SYSTEM32) followed by GetProcAddress(h, MAKEINTRESOURCEA(1)) (pe_loader.cpp:1503-1509). On a host with a real or Wine-builtin GameInput, that binds the title to the host implementation and not to rt::gameinput. If it binds anywhere, the import is recorded as Binding::Host, so the miss would not even appear as an unimplemented import. Registering the alias fixes the problem at the lookup and adds no special case in the loader.

Same function, so no ABI or state concerns. The alias points at &GameInputCreate itself, not a wrapper. Calling convention, the IGameInput singleton and refcounting are the same whether the title imports by name or by ordinal.

Notes (none blocking)

  1. The test covers the registry but not the loader's key. The new check confirms the table entry. It would not catch a future change to the key Loader::resolve builds, for example zero-padding or a different prefix. If loader_test can already build a small PE with an ordinal import, which it does for other cases under %TEMP%\leonida_loader_test, one case importing gameinput.dll ordinal 1 and asserting Binding::Shim would cover the whole path. A follow-up is fine for this.
  2. The matching XAudio2 import may have the same gap. The same doc row says XAudio2_9.dll ordinal 1 is XAudio2Create, and runtime/shims has no xaudio2_9.dll entries at all. If the retail executable imports XAudio2 by ordinal too, it would also bind to the host today. I haven't looked into it further; it may be worth posting as a finding: in the coordination issue rather than adding it to this PR.
  3. A GetProcAddress call at run time is a separate path. This PR fixes the static import. If the title also calls GetProcAddress(hGameInput, MAKEINTRESOURCEA(1)) itself, that goes through the GetProcAddress shim, not Loader::resolve. It is out of scope here; I'm noting it only so nobody assumes this alias covers that case.

Test results (Windows 11, CPython 3.13, no game files)

Check Result
git diff --check PASS
python -m compileall -q make_game.py tools tests PASS
python -I scripts/check_no_game_data.py on the changed files PASS
python -I make_game.py --help PASS
Targeted tests None run. The harness found no matching Python test file. The changed test is the C++ gameinput_test, which runs under ctest, and it was not built or run in this verification. The new assertion is therefore checked by reading the code, not by a test run.

For reference, the command that runs it: cmake --build runtime/build --config RelWithDebInfo; ctest --test-dir runtime/build -C RelWithDebInfo -R gameinput --output-on-failure.

Project rules

  • No game data: the change is two table and test lines plus a comment. No executable bytes, import-table dumps, shaders or logs from the game. The ordinal is a public export number of a system DLL, and the project docs already record it.
  • No keys, decryption or protection workarounds: none involved.
  • Nothing online: none involved. GameInput is local input.
  • Fix, don't disable: the import is routed to the existing implementation. Nothing is stubbed, skipped or made to fail quietly.
  • Conventions: this is C++ runtime code, so the Python tool rules don't apply. The comment says why the alias exists, which future readers of the shim table will need.

AI-assisted.

@umnitus

umnitus commented Nov 23, 2026

Copy link
Copy Markdown

Independent native Windows check at 5e45c7da942d7ac08fc57561e9ed924bcfc76476, built with clang-cl/xwin and the PR's pinned SDL 3.4.20. ctest -R '^gameinput$' passed, with 342 checks and 0 failures, including ordinal #1 resolving to GameInputCreate. Synthetic virtual-controller test. AI-assisted testing.

@jtrudeau1530

Copy link
Copy Markdown

Linux/Wine confirmation from our local test setup, with raw logs kept private. Arch Linux, Wine 11.18, clang-cl 23.1.6 + xwin SDK 10.0.26100, RelWithDebInfo, SDL3 enabled; RX 7900 XT / RADV Mesa 26.2.3.

Pinned base: main 8575d36 + #6919 36936f3 + #4313 28ea6b971 + #6582 4224c53b1 + #4348 45c39cf6f.

The negative arm was run by me and the positive arms by a cooperating local tester, with two dedicated Wine prefixes using the same installed Wine. I reviewed the positive run records and matching executable/PDB hashes. Both runners disable networking, keep the original package read-only, and bound startup to 30 seconds. No extra local implementation patches are present in the positive checkpoint.

The cooperating tester's gameinput_test passes 342 checks, including the ordinal alias equality check. Its broader selected set is 27/31, not fully green: native-abort exit-code expectation, missing-TMP refusal, DirectStorage held-copy guard-page checks, and gameinput_host fail. The host test calls Wine's builtin GameInput stub and returns E_NOTIMPL; the DirectStorage failure's cause is undiagnosed. These failures are not being presented as successful validation of those paths.

Observed next failure: access violation in the device slot-26 forwarder, symbolized with the matching host PDB. Its correspondence to the struct-return ABI issue at boot-chain stop 7 is an inference; the existing device fixes are the next separate integration test. No game bytes, raw traces, addresses or dumps attached. AI-assisted.

@cdomergue

Copy link
Copy Markdown

Tested 5e45c7da942d7ac08fc57561e9ed924bcfc76476 against its parent 8575d36 with the retail Xbox 1.0.2.1 executable on native Windows 11 x64. Both builds used MSVC 19.44, Release, and SDL 3.4.20. The ordinal import switches from the Windows host to Leonida's GameInput shim.

Main executable, loader dry-run Parent PR
Bound to shims 54 55
Bound to host 432 431
Bound to packaged modules 72 72
Unimplemented 29 29

The PR's binding report identifies GameInput ordinal 1 as the additional shim binding. Both runs mapped five modules, exited 0 and had empty stderr. The native virtual-controller test also passed on each revision (341 checks on the parent, 342 on the PR).

This verifies import selection with the actual executable. The dry-run does not invoke the game's entry point or exercise physical controller input. GPU/driver not exercised. AI-assisted verification.

@tedin7

tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

checked: #7216 | with: clang-cl cross build via xwin (ccache, ninja) + gameinput_test, SDL3 3.4.20 fetched with -DLEONIDA_SDL3_FETCH=ON (the box had no SDL3 installed) | on: wine-9.0 (Ubuntu 9.0~repack-4build3), PRETTY_NAME="Ubuntu 24.04.2 LTS", NAME="Ubuntu", main@867d922f0 + #7216 (fast-forward, no conflicts) | result: gameinput_test: 342 checks, 0 failures, including the new "gameinput.dll!#1 (the ordinal import) is the same function". Negative control: with runtime/shims/gameinput.cpp put back to main's, the run gives 342 checks, 1 failure, exactly that check. The diff (one SHIM_TABLE line plus one check) is consistent with docs/gameinput.md and the way the loader looks up ordinals as "#N". No defect found. NOT tested: that the retail executable really imports GameInputCreate by ordinal 1 (I did not read the game files), and the Wine builtin GameInput.dll failure described in the comment; I only checked that the registry now resolves "#1".

agent: yes

@Cryptoteep

Copy link
Copy Markdown
Contributor

checked: #721608c1aa6 | with: clean merge onto main@867d922f0, check_no_game_data.py | on: Windows 11 24H2, no game files | result: pass (clean merge onto current main@867d922f0 without conflicts; diff review verifies gameinput.dll!#1 alias registered in SHIM_TABLE resolves to GameInputCreate matching ordinal 1 export imported by the retail executable; gameinput_test.cpp validates resolution; scripts/check_no_game_data.py clean).

Raxstreams added a commit to Raxstreams/Leonida that referenced this pull request Nov 23, 2026
gameinput: serve GameInput.dll's ordinal 1, the retail executable's GameInputCreate import

Fork integration. AI-assisted (Codex).
@pvfreis

pvfreis commented Nov 23, 2026

Copy link
Copy Markdown

checked: #7216cdfa520 | with: gta6rt gameinput_test (-DLEONIDA_SDL3=ON -DLEONIDA_SDL3_FETCH=ON), ctest -R "^gameinput$" | on: Windows 11 26H2 (26300), MSVC 19.44.35229 (v143) + Ninja, RelWithDebInfo, RTX 3060 617.14 | result: pass, 1/1 (gameinput_host not built: needs the SDK's gameinput.lib)
negative control: the {"gameinput.dll", "#1", ...} entry removed from gameinput.cpp | result: gameinput fails 1 of 342 checks (gameinput.dll!#1 (the ordinal import) is the same function), so the test catches the change

AI-assisted (Claude Code).

@isfcrctfs

Copy link
Copy Markdown

checked: #7216cdfa520 | with: the head is already a merge of current main@867d922f0 (main is an ancestor; git merge origin/main is a no-op), then the full cross build cmake -S runtime -B build --toolchain runtime/cmake/clang-cl-xwin.cmake -DXWIN_DIR=/mnt/disk-10tb/dsh/toolchain/xwin-sdk -DVulkan_INCLUDE_DIR=/mnt/disk-10tb/dsh/toolchain/vulkan-headers-1.4.363/include -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -g -DNDEBUG /Zc:threadSafeInit-" -DLEONIDA_SDL3=ON -DLEONIDA_SDL3_FETCH=ON -DSDL_HIDAPI_LIBUSB=OFF + cmake --build build -j16, then gameinput_test.exe under Wine | on: Linux x86_64 cross build — clang-cl 23.1.5 + lld-link against xwin SDK 10.0.26100, Wine 11.22-staging, SDL3 3.4.20 fetched and built; no GPU needed (llvmpipe only) | result: pass — build rc=0; gameinput_test 342 checks, 0 failures, including PASS gameinput.dll!#1 (the ordinal import) is the same function; negative control with runtime/shims/gameinput.cpp reverted to main's makes that check fail

What I ran and saw:

  • Build: configure rc=0, build rc=0 (full tree with BUILD_TESTING=ON; SDL3 3.4.20 downloaded and built, so the shim table is compiled).
  • Wine: 342 checks, 0 failures (run twice; both clean). The new registry check passes.
  • Negative control: replacing only runtime/shims/gameinput.cpp with origin/main's copy and rebuilding gameinput_test gives 342 checks, 2 failures, one of which is exactly FAIL gameinput.dll!#1 (the ordinal import) is the same function; the other is a timing-sensitive cadence check (motion: no new reading within the 8 ms cadence window) that passed in both positive runs on this loaded host. Restoring the PR's file gives 342/0 again.
  • Source audit: Loader::resolve builds sym = "#" + std::to_string(ordinal) and consults shims::find(key, sym) before the host (runtime/src/pe_loader.cpp:1566-1574), and resolve_forwarder does the same for #N; so {"gameinput.dll", "#1", &GameInputCreate} is exactly the key a GameInput.dll ordinal-1 import resolves to. The alias points at GameInputCreate itself, so ABI/state are unchanged.
  • python3 -I scripts/check_no_game_data.py on both changed files: clean.

Not run / limits:

  • Native Windows: not run. This is a cross-build + Wine data point, not a Windows check.
  • Retail executable / the title's actual GameInput.dll!#1 import: not run (no game copy used; I did not inspect the executable's import table).
  • gameinput_host_test / real controller HID path: not run; only the synthetic gameinput_test.
  • Not on origin/main: no — main has no "#1" row in SHIM_TABLE(gameinput, …).

@steyn2003

Copy link
Copy Markdown

checked: Wine 11.20, Arch-based Linux, hybrid Intel Arrow Lake iGPU + NVIDIA RTX 5070 Laptop (proprietary driver, 32-wide subgroups, LEONIDA_VK_DEVICE=5070), clang-cl + xwin cross build with -DLEONIDA_SDL3_FETCH=ON, own 1.0.2.1 copy, LEONIDA_D3D12=vulkan, network off. Outcomes and counts only.

Plain main at 6312c057f (no local PRs), gta6rt --run, 3/3 runs the same:

  • Stops 1-4 of docs/retail_boot_chain.md are cleared under Wine. The /GA TLS rewrite from b7a3fed28 reports 53,246 sites and the title's TLS callbacks and allocator run; XGameRuntimeInitialize succeeds offline with the XErrorReport export from 6312c057f. I had not seen a Wine confirmation of those two commits yet.
  • Five XMemVirtualAlloc calls succeed (attribute words 0x21, 0x3, 0x183, 0x283, 0x181).
  • First stop: the title's own int3 right after Wine's builtin GameInputCreate stub is called (fixme:ginput:GameInputCreate ... stub!), before any D3D12 call. This is the stop this PR describes. No unimplemented import is reached before it.

Same main + this PR, 5/5 runs the same:

  • The run no longer reaches the GameInput stub, but it ends earlier, inside Wine itself: ntdll/unix/virtual.c:1502: create_view: Assertion 'view->protect & VPROT_SYSTEM' failed (exception 0x80000101 in host code, exit code 1) after the third XMemVirtualAlloc; the fourth call (attribute word 0x283) does not return.
  • Reverting this PR and rebuilding restores the first behaviour, so with the shim active something changes before that fourth allocation on Wine 11.20. The PR was tested on Wine 11.21; I am checking newer Wine builds and Proton next and will report whether the assertion is specific to 11.20.

AI-assisted (Claude Code). No game files, bytes or addresses here.

@Yoshi-OOF

Copy link
Copy Markdown

Native Windows verification: the source lacked ordinal #1 despite a working SDL3 named factory. Added the exact alias and its registry test on my private rt5 integration; GameInput CTest passes on Windows 11 / MSVC 19.44 / SDL 3.4.20. The standalone probe with LEONIDA_KEYBOARD_PAD=always attaches the virtual pad and reports real mouse/right-stick and trigger/button changes. The actual title binding/control check is next; no physical gamepad is connected here.

@gkissel

gkissel commented Nov 23, 2026

Copy link
Copy Markdown
Author

@steyn2003 thanks, a Wine 11.21 data point for the same comparison: main@5d74c2723 + this PR (head b7c320b), clang-cl + xwin with SDL3, gta6rt --run, LEONIDA_D3D12=vulkan, GTX 1650 Mobile (32-wide subgroups), own copy, 1 run, 150 s cap.

  • All five XMemVirtualAlloc calls return, in the same order as yours: attribute words 0x21, 0x3, 0x183, 0x283, 0x181. The 0x283 one returns.
  • No create_view assertion. The GameInput shim is served ([rt] gameinput: SDL 3.4.20 gamepads), and the run stops later at a title int3 (0x80000003).

So on 11.21 the fourth allocation does not hit VPROT_SYSTEM. My guess is that the PR changes which host DLLs get loaded before that point: GameInput.dll!#1 now binds to the shim, not Wine's builtin gameinput.dll. That shifts the address-space layout, and the 0x283 window then lands where 11.20's create_view asserts. I haven't verified that guess. Your newer-Wine/Proton results will show whether it is 11.20-only. If you can, a WINEDEBUG=+virtual tail around the fourth call would show which view it collides with.

AI-assisted (Claude Code). No game files, bytes or addresses here.

@steyn2003

Copy link
Copy Markdown

Follow-up to my comment above: the create_view assertion is a Wine 11.20 regression, not this PR.

Same binary (main 6312c057f + this PR, SDL3 built in), same machine (RTX 5070 Laptop, hybrid with Intel ARL), fresh prefix per Wine build, network off:

Wine build Runs create_view assertion First stop
11.20 (distribution package) 6/6 fires after the third XMemVirtualAlloc, in host code
11.21 2/2 gone unimplemented xcrdapi.dll!DStorageGetFactory, then the title's own assert
11.22 2/2 gone same
Proton Experimental (wine 11.0 base) 2/2 gone same
11.22 + vkd3d-proton 3.1 / DXVK 3.1.1 with d3d12,d3d12core,dxgi=n,b 3/3 gone same
  • The assertion text matches Wine bug 60534; its regression (ntdll: Merge the reserved areas and free ranges arrays) is in 11.20 and its fix (ntdll: Make sure that the address still fits in the reserved area after alignment) is in 11.21. That this is the commit that clears this case is inferred from the version boundary, not bisected.
  • So on Wine 11.21 or newer this PR does what it says here too: the run gets past GameInputCreate, all five XMemVirtualAlloc calls return, and the next stop is stop 5 of docs/retail_boot_chain.md, with 0 D3D12 calls so far.
  • It may be worth a line in docs/testing.md that Wine 11.20 specifically cannot run the retail executable past the allocator.

AI-assisted (Claude Code). Outcomes and counts only.

dadnotdaddy pushed a commit to dadnotdaddy/Leonida that referenced this pull request Nov 23, 2026
…l 1, the retail executable's GameInputCreate import

Squashed from ItsNotRexed#7216 by gkissel, head 5e45c7d (security scan PASS).
@oeirughrepuiohg

Copy link
Copy Markdown

Tested b7c320ba4 merged onto main 5d74c2723 on Linux, Wine 10.0, no GPU (llvmpipe; no D3D12 call is reached), offline Debian 13 VM, my own 1.0.2.1 copy: pass.

Built with clang-cl 19 and xwin SDK 10.0.26100, RelWithDebInfo, -DFETCHCONTENT_SOURCE_DIR_SDL3=<SDL3-3.4.20>, which is the pinned tarball with its hash checked. gta6rt --run … --trace … --trace-d3d12, LEONIDA_D3D12=vulkan.

Build Unimplemented call Stop
main + SDL3, without this PR gameinput.dll!#1 0xc0000005 (null read) in the title right after it
main + SDL3 + this PR xcrdapi.dll!DStorageGetFactory 0x80000003 (the title's assert): stop 5 in docs/retail_boot_chain.md

With this PR the log shows [rt] gameinput: SDL 3.4.20 gamepads, and the ordinal import binds to the shim. Under Wine there is no in-box GameInput.dll to fall back on, so this PR is required to get past stop 4 on Linux, not just useful. The earlier stops pass on main under Wine as well: the /GA TLS rewrite reports 53,246 rewritten reads, and XGameRuntimeInitialize runs.

Without SDL3 (no shim built) the import stays unimplemented whether or not this PR is applied. Linux builds need LEONIDA_SDL3_FETCH=ON or FETCHCONTENT_SOURCE_DIR_SDL3 to get past this stop.

AI-assisted (Claude Code, Claude Opus 5.5).

@icecreammule277-dot

Copy link
Copy Markdown
Contributor

Game-copy check of this head (b7c320ba4, fast-forwarded onto main 6312c057f), on Windows 11 Pro for Workstations 26300 / AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32015.12012, MSVC 19.52, Vulkan SDK 1.4.363.0, built with -FetchSdl3 so the GameInput shim is present.

The premise holds on a second copy of the executable. Reading its import table directly (names and ordinals only, nothing quoted from the image): 68 imported DLLs, 563 imports by name, 24 by ordinal — and GameInput.dll is imported by ordinal #1 and nothing else:

GameInput.dll
   by ordinal (1): #1

The change does what it says, on the retail executable, not just in the test. gta6rt --dry-run binds every import through the shim registry or the host, so it shows the binding change directly. Same machine, same build tree, only this PR's two TUs rebuilt between the two runs:

main 6312c057f:    game_scarlett_master.exe  base=0000000140000000 size=184995840 entry=+0x56a1ec8  shim=63 host=432 module=72 unimplemented=20
+ b7c320ba4:       game_scarlett_master.exe  base=0000000140000000 size=184995840 entry=+0x56a1ec8  shim=64 host=431 module=72 unimplemented=20

Exactly one import moves host → shim (63→64, 432→431); every other column is identical, and the other four mapped modules are untouched. That is the ordinal miss being closed, measured on the real image rather than a synthetic one. --dry-run with --overlay pointing at a scratch folder, so nothing was written into the package; exit 0 with the same 20 unimplemented as before.

And the test: gameinput_test → 342 checks, 0 failures (341 on main), including the new one:

PASS gameinput.dll!#1 (the ordinal import) is the same function

Why Windows never noticed, which the PR's description says and I can confirm locally: the host DLL is installed (C:\Windows\System32\GameInput.dll, 0.2309.26100.9818), so the fall-through resolved to something real. That matches the account; I have not run it under Wine.

One thing you may want to fold in while you are here. docs/runtime_imports.md publishes this exact line for the retail executable ("The retail executable (RT-5)", measured at 1cc6e3c1):

| game_scarlett_master.exe | 0x140000000 | 184,995,840 | 0x56a1ec8 | 53 | 432 | 72 | 30 |

At 6312c057f that row is already 63 / 432 / 72 / 20, and with this PR it becomes 64 / 431 / 72 / 20 — so the table is the natural place to record the binding change (and to catch up the ten imports that moved from unimplemented to shim since 1cc6e3c1). Numbers above are measured on this machine; the entry RVA, image size and base are unchanged, which is a nice sanity check that nothing else moved.

Not yours, just noise: the diff also carries an unrelated README.md line ("Custom Git Mirror: https://git.notrexed.dev/notrexed/Leonida"). It shows up in #5873's diff too, so it looks like something a branch picked up from the mirror rather than your change — mentioning it only so it does not surprise a reviewer.

No game data is quoted: counts, names, one RVA and one image size, all of which docs/runtime_imports.md already publishes. Tested b7c320ba4 merged onto main 6312c057f on a local 1.0.2.1 copy (Windows, RDNA4): pass — dry-run 64/431 and 342/342 checks. AI-assisted (OpenCode).

@pvfreis

pvfreis commented Nov 23, 2026

Copy link
Copy Markdown

checked: #7216b7c320b | with: gta6rt gameinput_test (-DLEONIDA_SDL3=ON), ctest -R "^gameinput$" | on: Windows 11 26H2 (26300), MSVC 19.44.35229 (v143) + Ninja, RelWithDebInfo, RTX 3060 617.14 | result: pass, 1/1 (the new head is a merge of main; the PR's own diff is unchanged)
negative control: runtime/shims/gameinput.cpp reverted to the merge-base | result: gameinput fails (gameinput.dll!#1 (the ordinal import) is the same function), so the test catches the change

AI-assisted (Claude Code). agent: yes

@oeirughrepuiohg

Copy link
Copy Markdown

Follow-up, the next stop under Wine with this PR stacked. Base: main 5d74c2723 + #7216 b7c320ba4 + #8461 3ec863f9b + #6919 36936f3bf + #7078 e2aa0ebf3, with SDL3 3.4.20. Same setup as above: Wine 10.0, no GPU, own 1.0.2.1 copy.

  • Stop 5 clears: [rt] dstorage: DStorageGetFactory asked for … serving the factory interface.
  • The title then hits a fatal assert (0x80000003). No unimplemented import is logged, no XMemAllocatePhysicalPages call happens (so this is before stop 6), and no D3D12 call is made.
  • The assert sits in the same caller that makes the GameInputCreate call, a few calls after it. It checks that a field filled in by an earlier call is non-zero.
  • The only debug string is the title failing to write its crash log to T:.

Why this matters for this PR: before it, the ordinal import bound to the in-box GameInput.dll on Windows. With it, the shim also serves Windows. So a Windows run with this PR and SDL3 would be the first to send the title's startup through the shim's IGameInput. Could someone on Windows with this PR + #8461 and SDL3 say whether they reach stop 6 or hit this assert? If they hit it too, the assert points at the shim's IGameInput (for example an interface version the October 2025 GRDK title expects). If not, it is Wine-specific and I'll keep digging here.

AI-assisted (Claude Code, Claude Opus 5.5).

@DJSN4KE

DJSN4KE commented Nov 23, 2026

Copy link
Copy Markdown

checked: b7c320b on Windows 10 Home 22H2 (19045), RTX 2060 (driver 621.01), VS 2022 Build Tools, RelWithDebInfo, SDL3 3.4.20 (pinned tarball), own 1.0.2.1 copy, LEONIDA_D3D12=vulkan, network blocked for gta6rt.exe. Control: main 5d74c27 built the same way.

A Windows 10 data point, where the host GameInput is the inbox GameInput.dll (0.2309) with no GameInput service installed:

  • gameinput_test: main 341 / 0 failures, this PR 342 / 0.
  • --dry-run: GameInput.dll!Add pytest regression tests for the RDNA2 -> SPIR-V translator, plus a Linux CI job #1 moves from host to shim (shim 63 -> 64, host 432 -> 431).
  • --run, 3 runs each: main and this PR give the same startup trace and the same stop, the unimplemented xcrdapi.dll!DStorageGetFactory and the title's int3 (stop 5). So on Windows 10 the inbox GameInput is also enough to get past this point; the PR changes the binding, not the stop.

No game data, traces stay local. AI-assisted (Claude Code).

@HQasper

HQasper commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

checked: #7216b7c320b | with: VS 18 BuildTools generator (-G "Visual Studio 18 2026" -A x64), RelWithDebInfo, -DLEONIDA_SDL3_FETCH=ON (SDL3 3.4.20 static), Vulkan SDK 1.4.363.0; gameinput_test, then gta6rt --dry-run/--init/--run on the retail 1.0.2.1 executable with --game-dir on the package and --overlay outside it, LEONIDA_D3D12=vulkan; each run repeated with the PR's two files reverted | on: Windows 11 Pro 26300, NVIDIA GeForce RTX 5090 32 GB, driver 621.24, MSVC 14.51 | result: pass (details below; the only count that moves is one import, host to shim)

Tested 5d74c2723 + this diff (b7c320ba4b) on Windows 11 Pro 26300, NVIDIA GeForce RTX 5090 32 GB, driver 621.24: pass.

Built runtime/ with MSVC 14.51 (VS 18 BuildTools), RelWithDebInfo, -DLEONIDA_SDL3_FETCH=ON (SDL3 3.4.20, static) and the Vulkan SDK 1.4.363.0, then ran the player's own 1.0.2.1 executable with --game-dir on the package, --overlay outside it and LEONIDA_D3D12=vulkan. The head already merges current main (its merge-base is exactly origin/main 5d74c2723), and the diff applied to a clean worktree without a conflict.

with this PR main only
gameinput_test 342 checks, 0 failures 341 checks, 0 failures
the executable's import line, --dry-run shim=64 host=431 module=72 unimplemented=20 shim=63 host=432 module=72 unimplemented=20
--dry-run / --init exit 0 / 0; 5 module(s) mapped, 20 unimplemented the same
--run startup trace 19 events: 5 map, 4 dllmain, 2 tls_callback, 5 xmem_attributes, 1 unimplemented_call, 1 exception 19 events, the same kinds
--run outcome the title's fatal assert 0x80000003 at 0.78 s, 0 D3D12 calls 0x80000003, 0 D3D12 calls

Exactly one import moves, host to shim: GameInput.dll!#1 (the dry run lists shim GameInput.dll!#1), which is the whole effect of the change, and the unit test's extra check is the 342nd. Everything else is identical, so there is no regression here in mapping, imports, TLS, DllMain or the entry call.

Two limits of this check: on current main the run still stops at the unimplemented xcrdapi.dll!DStorageGetFactory before any input call is made, so a native Windows boot cannot demonstrate the fix, only that it is harmless on this path; and on Windows the host GameInput already answers, so binding to the shim changes nothing visible in these counts. The Wine result in the description is where the alias does the work.

Outcomes and counts only; no game data, values or excerpts. AI-assisted.

Raxstreams added a commit to Raxstreams/Leonida that referenced this pull request Nov 23, 2026
Reviewed head: b7c320b
Review: ItsNotRexed#7216 (comment)
Board: ItsNotRexed#8919
AI-assisted integration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.