diff --git a/src/xenia/hid/input_system.cc b/src/xenia/hid/input_system.cc index 017791f29..dd1f72db2 100644 --- a/src/xenia/hid/input_system.cc +++ b/src/xenia/hid/input_system.cc @@ -35,47 +35,67 @@ X_RESULT InputSystem::GetCapabilities(uint32_t user_index, uint32_t flags, X_INPUT_CAPABILITIES* out_caps) { SCOPE_profile_cpu_f("hid"); + bool any_connected = false; for (auto& driver : drivers_) { - if (XSUCCEEDED(driver->GetCapabilities(user_index, flags, out_caps))) { - return X_ERROR_SUCCESS; + X_RESULT result = driver->GetCapabilities(user_index, flags, out_caps); + if (result != X_ERROR_DEVICE_NOT_CONNECTED) { + any_connected = true; + } + if (result == X_ERROR_SUCCESS) { + return result; } } - return X_ERROR_DEVICE_NOT_CONNECTED; + return any_connected ? X_ERROR_EMPTY : X_ERROR_DEVICE_NOT_CONNECTED; } X_RESULT InputSystem::GetState(uint32_t user_index, X_INPUT_STATE* out_state) { SCOPE_profile_cpu_f("hid"); + bool any_connected = false; for (auto& driver : drivers_) { - if (driver->GetState(user_index, out_state) == X_ERROR_SUCCESS) { - return X_ERROR_SUCCESS; + X_RESULT result = driver->GetState(user_index, out_state); + if (result != X_ERROR_DEVICE_NOT_CONNECTED) { + any_connected = true; + } + if (result == X_ERROR_SUCCESS) { + return result; } } - return X_ERROR_DEVICE_NOT_CONNECTED; + return any_connected ? X_ERROR_EMPTY : X_ERROR_DEVICE_NOT_CONNECTED; } X_RESULT InputSystem::SetState(uint32_t user_index, X_INPUT_VIBRATION* vibration) { SCOPE_profile_cpu_f("hid"); + bool any_connected = false; for (auto& driver : drivers_) { - if (XSUCCEEDED(driver->SetState(user_index, vibration))) { - return X_ERROR_SUCCESS; + X_RESULT result = driver->SetState(user_index, vibration); + if (result != X_ERROR_DEVICE_NOT_CONNECTED) { + any_connected = true; + } + if (result == X_ERROR_SUCCESS) { + return result; } } - return X_ERROR_DEVICE_NOT_CONNECTED; + return any_connected ? X_ERROR_EMPTY : X_ERROR_DEVICE_NOT_CONNECTED; } X_RESULT InputSystem::GetKeystroke(uint32_t user_index, uint32_t flags, X_INPUT_KEYSTROKE* out_keystroke) { SCOPE_profile_cpu_f("hid"); + bool any_connected = false; for (auto& driver : drivers_) { - if (XSUCCEEDED(driver->GetKeystroke(user_index, flags, out_keystroke))) { - return X_ERROR_SUCCESS; + X_RESULT result = driver->GetKeystroke(user_index, flags, out_keystroke); + if (result != X_ERROR_DEVICE_NOT_CONNECTED) { + any_connected = true; + } + if (result == X_ERROR_SUCCESS) { + return result; } } - return X_ERROR_DEVICE_NOT_CONNECTED; + return any_connected ? X_ERROR_EMPTY : X_ERROR_DEVICE_NOT_CONNECTED; } } // namespace hid diff --git a/src/xenia/kernel/xam_input.cc b/src/xenia/kernel/xam_input.cc index 1cf1e326b..4f78c4947 100644 --- a/src/xenia/kernel/xam_input.cc +++ b/src/xenia/kernel/xam_input.cc @@ -155,7 +155,7 @@ SHIM_CALL XamInputGetKeystrokeEx_shim(PPCContext* ppc_state, uint32_t user_index = SHIM_MEM_32(user_index_ptr); - XELOGD("XamInputGetKeystroke(%.8X(%.d), %.8X, %.8X)", user_index_ptr, + XELOGD("XamInputGetKeystrokeEx(%.8X(%d), %.8X, %.8X)", user_index_ptr, user_index, flags, keystroke_ptr); if (!keystroke_ptr) {