From f9170fd3fe07bf5c4d75f7d19e15ea58e7ed9895 Mon Sep 17 00:00:00 2001 From: Sylpheed RE agent Date: Wed, 19 Aug 2026 08:35:26 +0000 Subject: [PATCH] [RE] xam_input: log the keystroke path that REACHES the driver The existing [RE-INPUT] line only fires when IsUIActive() swallows a keystroke, so its silence is ambiguous: it means either 'the game is polling and getting nothing' or 'the game is not polling at all'. That is exactly the fork the title-screen investigation is stuck on - with the sign-in dialog fixed the swallow count is 0 and the title still does not respond to (A). Adds two logs on the other side: a rate-limited count of calls that get past IsUIActive to a driver, and one line per keystroke actually handed to the guest (rare by construction - one per physical press - so every one is logged, with user index, virtual key and flags). --- src/xenia/kernel/xam/xam_input.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/xenia/kernel/xam/xam_input.cc b/src/xenia/kernel/xam/xam_input.cc index 6b869916d..2034e35b1 100644 --- a/src/xenia/kernel/xam/xam_input.cc +++ b/src/xenia/kernel/xam/xam_input.cc @@ -211,6 +211,21 @@ dword_result_t XamInputGetKeystrokeEx_entry( return X_ERROR_SUCCESS; } + // RE aid, the other half of the pair above: count the calls that DO reach a + // driver, and log every keystroke actually handed to the guest. Without this, + // "the swallow log is silent" is ambiguous between "the game is polling and + // getting nothing" and "the game is not polling at all" — which is exactly + // the fork the title-screen investigation got stuck on + // (docs/re/ui-paint-order-third-permutation.md in the Reborn tree). + { + static std::atomic polled{0}; + const uint32_t n = polled.fetch_add(1, std::memory_order_relaxed); + if ((n % 600) == 0) { + XELOGI("[RE-INPUT] XamInputGetKeystrokeEx reached the driver ({} so far)", + n + 1); + } + } + uint32_t user_index = *user_index_ptr; auto input_system = kernel_state()->emulator()->input_system(); auto lock = input_system->lock(); @@ -239,6 +254,12 @@ dword_result_t XamInputGetKeystrokeEx_entry( if (XSUCCEEDED(result)) { *user_index_ptr = keystroke->user_index; + // Rare by construction — one per physical press — so log every one. + XELOGI( + "[RE-INPUT] XamInputGetKeystrokeEx -> user={} vk={:04X} flags={:04X} " + "(call flags {:08X})", + (uint32_t)keystroke->user_index, (uint32_t)keystroke->virtual_key, + (uint32_t)keystroke->flags, (uint32_t)flags); } return result; }