Phase 1a: per-slot poll viz + input-path diagnostics

Surfaced by a game (Life is Strange: Before the Storm) that ignores
controller input when it lacks true OS focus even though it still polls
XInput. To find the focus-gated detection path, instrument the hook.

Protocol v3 status back-channel now reports:
- per-slot XInputGetState and XInputGetCapabilities counters (replacing the
  single aggregate), so the overlay shows exactly which slots the game polls
  and how fast;
- focus-API call counts (GetForegroundWindow/GetActiveWindow/GetFocus) to see
  whether the game consults the APIs we spoof;
- input-path diagnostics: whether the process registered Raw Input for a
  gamepad usage and whether it set RIDEV_INPUTSINK (background delivery), and
  whether a DirectInput dll is loaded.

Host overlay gains a per-slot poll table and an "Input path" section. The DLL
refreshes input diagnostics each worker tick via GetRegisteredRawInputDevices.
hook_selftest updated for per-slot counters; passes.

This is diagnostic-only: once a real run shows which path LiS uses, the
targeted focus fix (e.g. forcing RIDEV_INPUTSINK or DI background coop) follows.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 00:38:07 +02:00
parent df4325d21b
commit a0a12d69fe
11 changed files with 210 additions and 36 deletions

View File

@@ -64,7 +64,7 @@ DWORD query_state(DWORD user_index, XINPUT_STATE* state, bool keep_guide)
}
if (g_ipc != nullptr)
{
g_ipc->note_query(user_index); // proves to the host the game is polling us
g_ipc->note_state_query(user_index); // proves to the host the game is polling us
}
refresh_cache();
const CoopPadState& pad = g_cache[user_index];
@@ -100,6 +100,10 @@ DWORD WINAPI hk_XInputGetCapabilities(DWORD user_index, DWORD /*flags*/, XINPUT_
{
return ERROR_DEVICE_NOT_CONNECTED;
}
if (g_ipc != nullptr)
{
g_ipc->note_caps_query(user_index);
}
refresh_cache();
if (!g_cache[user_index].connected)
{