[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).
This commit is contained in:
Sylpheed RE agent
2026-08-19 08:35:26 +00:00
parent 53b208bf4d
commit f9170fd3fe

View File

@@ -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<uint32_t> 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;
}