HLE/gameinput: the system button registration gets its own six arguments #838
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!838
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-838"
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?
@CwWwWwW on GitHub · 2026-11-28 07:34 UTC · original
CwWwWwW:fix/gameinput-system-button-arity→main· +54 −4 · 1 files · 1 commits · merged 2026-11-29 08:16 UTCPorted to trustno1-coder/VIctory-NVIDIA from the same change submitted to fxceless/victory-fork as PR #1462 (head
9911e5efde, author CwWwWwW). The fork's own line was dropped when it rebased onto959dcaf(5dbf5ce), so this is submitted here directly. The description below is the original one; its 'Verification' numbers refer to the fork tree. Rebased onto main63b902f.The problem
The
IInputvtable (crates/victory-hle/src/modules/gameinput.rs:897) pointed both0x50(RegisterSystemButtonCallback) and0x58(RegisterKeyboardLayoutCallback) at the sameextern "system"handler with five arguments. The platform's signatures differ: slot0x50takes(this, device, button filter, context, callback, token*)鈥?six arguments, the filter between the device and the context 鈥?while0x58takes the five the handler has.On x64 a six-argument call passes the fifth and sixth on the stack, so the shared five-argument handler's
outwas the title's callback pointer, not itstoken*:token(out)(:707-713) wrote the registration token over the first 8 bytes of the title's callback code 鈥?an access violation on a read-only code page, or a write to whatever page the callback lives in;Trigger: any title that calls
RegisterSystemButtonCallbackfor the guide/share buttons. The current title only registers device callbacks (slot 0x48), so this is latent today and a crash for the first title or update that uses it.Evidence for the platform argument lists: the host's own
C:\Windows\System32\GameInput.dllwas disassembled read-only offline for these two slots (slot 0x50 readsrcxthis,rdxdevice,r8dfilter,r9context,[rsp+0x90]callback,[rsp+0x98]token*; slot 0x58 readsr8context,r9callback, token on the stack). No game launch was involved.The change
Two handlers with their own argument lists:
register_buttonfor slot0x50(six arguments) andregister_layoutfor slot0x58(five, unchanged behaviour). Neither callback runs in the HLE either way; only the token is written, now into the right place.Evidence
New test
gameinput::tests::a_system_button_registration_writes_its_token_and_not_the_callbackcalls slot0x50with the platform's six-argument signature and passes a writable buffer where the callback code would be:left: 0, right: 0onassert_ne!(token, 0)) and the buffer is written instead;Verification on this branch (base
9a9091d):cargo test -p victory-hle --lib --locked -- --test-threads=1鈥?104 passed, 0 failedcargo clippy -p victory-hle --all-targets --locked -- -D warnings鈥?cleancargo clippy -p victory-hle --all-targets --locked --all-features -- -D warnings鈥?cleangit diff --checkclean; the crate is not fmt-clean on this toolchain already (pre-existing diffs in this file at 834/1169/1594/1603), and the change adds no new fmt diff.Scope and overlap
One file,
crates/victory-hle/src/modules/gameinput.rs(+54/-4). Checked the open tracker: no open PR changes this pairing (open #534/#485 keep the same five-argument handler at both slots; #680 is xstore). CI'scheckmay be red from main's own victory-shader clippy errors (#1440) and asset policy (#1322), which this diff does not touch.Verification on this tree (base
63b902f, 2026-11-27)63b902ffailed on those before this change.