Repository navigation
Conversation
…RT-159) IGameInputReading returned nothing for the keyboard and the mouse, so a title that reads them directly got no input on PC. With LEONIDA_KEYBOARD_MOUSE=1 (or always) the shim connects one GameInput keyboard device and one mouse device: - GetKeyCount/GetKeyState: the keys that are down, by virtual-key code, at most 16, left/right modifiers instead of the generic ones, with the scan code and glyph from MapVirtualKeyW. - GetMouseState: five buttons, and positionX/Y as summed cursor movement (GameInput positions are cumulative). No wheel yet: hasWheelX/Y false. - Device info with keyboardInfo/mouseInfo (v0 layouts, static_asserts), device and reading callbacks for their kinds, history, aggregate devices. - Same sources and focus rules as the keyboard pad (GetAsyncKeyState, GetCursorPos, the existing test seams). Off by default. Gamepad behaviour is unchanged: gamepad-kind queries and callbacks never see the two devices, and connected_count()/output_state() count gamepads only.
Contributor
Author
2 tasks done
Contributor
|
Independent review on Windows 11: built with MSVC 19.44 + SDL3 3.4.20. 238 checks, 0 failures (37 new); CTest 1/1. This is the more complete of the two RT-159 implementations: real One nit: the API table still lists Recommendation: keep #2426, close #2413 as superseded. No blocker from my side. |
TheHoracio
added a commit
to TheHoracio/Leonida
that referenced
this pull request
Nov 22, 2026
…, non-null nativeLanguage, full key compare From Kam471's review of ItsNotRexed#2413 and @justr4mzi's ItsNotRexed#2426: - keyboardInfo.layout is the active KLID (GetKeyboardLayoutNameW), keyCount the reportable virtual keys with a scan code, functionKeyCount GetKeyboardType(2) (12 if Windows doesn't say). - keyboardInfo.nativeLanguage points at an empty GameInputString instead of null, so a title reading it does not dereference null. - mouseInfo.sampleRate is 500: one sample per 2 ms poll_thread() pass. - A held key whose scan code, character or dead-key flag changes (a layout switch) is a new reading: same_keys compares every field, not only virtualKey. gameinput_test: 226 checks, 0 failures (4 new). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TheHoracio
added a commit
to TheHoracio/Leonida
that referenced
this pull request
Nov 22, 2026
…, non-null nativeLanguage, full key compare From Kam471's review of ItsNotRexed#2413 and @justr4mzi's ItsNotRexed#2426: - keyboardInfo.layout is the active KLID (GetKeyboardLayoutNameW), keyCount the reportable virtual keys with a scan code, functionKeyCount GetKeyboardType(2) (12 if Windows doesn't say). - keyboardInfo.nativeLanguage points at an empty GameInputString instead of null, so a title reading it does not dereference null. - mouseInfo.sampleRate is 500: one sample per 2 ms poll_thread() pass. - A held key whose scan code, character or dead-key flag changes (a layout switch) is a new reading: same_keys compares every field, not only virtualKey. gameinput_test: 226 checks, 0 failures (4 new). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TheHoracio
added a commit
to TheHoracio/Leonida
that referenced
this pull request
Nov 22, 2026
…, non-null nativeLanguage, full key compare From Kam471's review of ItsNotRexed#2413 and @justr4mzi's ItsNotRexed#2426: - keyboardInfo.layout is the active KLID (GetKeyboardLayoutNameW), keyCount the reportable virtual keys with a scan code, functionKeyCount GetKeyboardType(2) (12 if Windows doesn't say). - keyboardInfo.nativeLanguage points at an empty GameInputString instead of null, so a title reading it does not dereference null. - mouseInfo.sampleRate is 500: one sample per 2 ms poll_thread() pass. - A held key whose scan code, character or dead-key flag changes (a layout switch) is a new reading: same_keys compares every field, not only virtualKey. gameinput_test: 226 checks, 0 failures (4 new). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: RT-159 (#2300)
What and why
IGameInputReadingreturned nothing for the keyboard and the mouse (docs/gameinput.md API table), so a title that reads them through GameInput directly gets no input on PC. WithLEONIDA_KEYBOARD_MOUSE=1(oralways) the shim now connects one GameInput keyboard device and one mouse device. Off by default, like the keyboard pad.GetKeyCount/GetKeyState: the keys that are down, lowest virtual-key code first, at most 16 (maxSimultaneousKeys). Generic Shift/Ctrl/Alt are left out, their left/right keys are reported. Scan code fromMapVirtualKeyW(MAPVK_VK_TO_VSC_EX), glyph fromMAPVK_VK_TO_CHAR(dead-key bit ->isDeadKey).GetMouseState: left, right, middle, X1, X2, andpositionX/Yas the cursor movement summed since connect (GameInput positions are cumulative, the title takes the difference).keyboardInfo/mouseInfo(layout id,GetKeyboardType, F1-F24, five buttons), familyGameInputFamilyHid, fixed ids, device and reading callbacks for their kinds, history (GetNext/PreviousReading), aggregate devices.GetAsyncKeyState,GetCursorPos; with1nothing counts while another app has focus, no mouse jump when focus returns).gameinput_abi.h: v0GameInputKeyState,GameInputMouseState,GameInputKeyboardInfo,GameInputMouseInfoand the two enums, withstatic_asserts on size and offsets.Gamepad behaviour is unchanged: gamepad-kind queries and callbacks never see the two devices,
connected_count()/output_state()count gamepads only, and a gamepad reading answers exactly the kinds it did before.Not done (written in docs/gameinput.md): the wheel (no window or message loop, so
wheelX/Ystay 0 andhasWheelX/Yis false; raw input on a message-only window would give the wheel and unaccelerated counts), and cursor movement stops at the screen edge, as for the keyboard pad. VERIFY items added: the family, the scan-code convention, the key order and the v0 layouts, which come from Microsoft's docs and were not compiled against the public v0 header.Tested
gameinput_test: newtest_keyboard_mouse(37 checks on fake keys, focus and cursor). Whole test: 238 checks, 0 failures, before the change 201/0, run three times.-Wall -Wextra, no warnings) against the pinned SDL3 3.4.20, run under Wine 9.0 on Linux. No GPU involved. Not built with MSVC: please let CI check the/W4build.gameinput_probestill builds.AI-assisted.
Checklist
docs/design.md, with how it was confirmed. (No translator change.)