Repository navigation
Conversation
IGameInputReading returned nothing for keyboard and mouse, so a title that reads them through GameInput got no input on PC. With LEONIDA_KEYBOARD_MOUSE=1|always the shim connects a keyboard device and a mouse device next to the pads. Their readings carry GameInputKindKeyboard or GameInputKindMouse only: GetKeyCount/GetKeyState list the held keys (virtual key, scan code, character, dead-key flag; up to 16), GetMouseState the buttons and the cursor's movement summed into relative positions. Keys and buttons come from GetAsyncKeyState with the keyboard pad's focus rule. They stay out of the pad list (no SDL, rumble, battery or player slot), and every reading search, enumeration, aggregate and FindDeviceFromId covers them; a search with no device now filters by kind, so a gamepad query never answers with a keyboard reading. The v0 structs are declared in gameinput_abi.h with static_asserts on their layout. gameinput_test: 21 checks with fake keys, focus and cursor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, 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>
…hree calls the executable makes
|
Independent native Windows check of 83d80451 with MSVC 19.44.35230 x64 and SDL3 3.4.20. The stock Synthetic Enter produced one key with scan code The fixture supplied synthetic input with physical controller backends disabled. AI-assisted. |
|
Independent build + test: PASS AI-assisted (Claude Code). Windows 11 x64, MSVC 19.44.35220, Ninja RelWithDebInfo, SDL3 3.4.20 via Head
Code-reading notes (not blocking):
|
What
GameInput keyboard and mouse devices and readings (RT-159), merged with current main. With
LEONIDA_KEYBOARD_MOUSEset, the shim shows aKeyboard (Leonida)and aMouse (Leonida)device. Their readings carry the keyboard or mouse kind only.This PR resolves the conflicts with main in
runtime/shims/gameinput.cppanddocs/gameinput.md, keeping both sides: main's raw device reports (RT-175), force feedback and haptic motors, and the keyboard and mouse readings. It also adds tests for the three keyboard calls the executable makes.Why
The executable reads the keyboard through GameInput (#7637):
GetCurrentReading(Keyboard)once,GetNextReading(Keyboard)once andRegisterDeviceCallback(Keyboard, Connected)once. Without keyboard devices the shim answers all three with nothing.Tested
gameinput_test, cross-built with clang-cl and run under Wine (SDL3 fetched with-DLEONIDA_SDL3_FETCH=ON): 376 checks, 0 failures. This includes the focus-loss reading HRESULT checks:GetCurrentReading(Keyboard)with no key held is an empty reading.GetNextReading(Keyboard)with no key pressed isGAMEINPUT_E_READING_NOT_FOUND.VK_RETURN),GetNextReading(Keyboard)returns one key with scan code 0x1C, and nothing follows it.RegisterDeviceCallback(Keyboard, Connected)isS_OKand hears the keyboard once (not the mouse). The Gamepad callback does not hear it.Keyboard and mouse polling continues when SDL gamepad initialization fails; the harness has no gamepad initialization failure hook, so that failure path was not exercised. Key translation uses the foreground window thread layout. Focus-loss tests now require successful readings.
No existing
S_OKbecame an error in the test. I did not run the unmerged head of #2413 for a before number.Builds on #2413 by @TheHoracio (their commits are kept; merged with current main and conflicts resolved)
@ItsNotRexed: an exe PR, as you asked.
Claim: #8186 (comment)