Add per-backend input debug visualization + round-trip view

Makes it possible to isolate an input->tool problem from a tool->game one in the
Controllers panel (under Debug details):
- which backend fed each slot is already shown via the per-pad source tag
  ("XInput #0" / "Steam Input") in the Incoming section;
- a new "Round-trip" table shows, per slot, the state we forwarded (the active
  backend's pad) next to what the game actually read back, highlighting matches.

For the round-trip, the XInput hook now echoes the state it returns to the game into
the status (protocol v9->v10: per-slot read_state in HookStatus).

Verified: hook_selftest (x64 + x86) asserts the hook records the game-read state;
full build x64 + x86 clean; ctest x64 9/9, x86 3/3.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 05:15:07 +02:00
parent 056a478e19
commit 327ba1f394
8 changed files with 57 additions and 10 deletions

View File

@@ -12,7 +12,7 @@ namespace coop
// Bump whenever the layout of SharedBlock or CoopPadState changes. The hook
// refuses to attach to a host with a mismatched version.
inline constexpr std::uint32_t kProtocolVersion = 9;
inline constexpr std::uint32_t kProtocolVersion = 10;
// 'COOP' little-endian, used to sanity-check the mapping before trusting it.
inline constexpr std::uint32_t kProtocolMagic = 0x504F4F43u;
@@ -133,6 +133,10 @@ struct HookStatus
// other diagnostics -- benign cross-process races are fine.
std::uint16_t rumble_left[kMaxPads];
std::uint16_t rumble_right[kMaxPads];
// The last pad state the hook actually returned to the game per slot, so the host
// can show a true input round-trip (forwarded vs what the game read).
CoopPadState read_state[kMaxPads];
};
// Host -> hook control channel. The host requests which hook subsystems should be