[HID] Added drivers filter for GetState
This commit is contained in:
parent
d6ed8af4e7
commit
4584794e24
|
@ -1833,7 +1833,8 @@ void EmulatorWindow::GamepadHotKeys() {
|
|||
|
||||
for (uint32_t user_index = 0; user_index < XUserMaxUserCount;
|
||||
++user_index) {
|
||||
X_RESULT result = input_sys->GetState(user_index, &state);
|
||||
X_RESULT result = input_sys->GetState(
|
||||
user_index, X_INPUT_FLAG::X_INPUT_FLAG_GAMEPAD, &state);
|
||||
|
||||
// Release the lock before processing the hotkey
|
||||
input_lock.mutex()->unlock();
|
||||
|
|
|
@ -104,13 +104,16 @@ X_RESULT InputSystem::GetCapabilities(uint32_t user_index, uint32_t flags,
|
|||
return X_ERROR_DEVICE_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
X_RESULT InputSystem::GetState(uint32_t user_index, X_INPUT_STATE* out_state) {
|
||||
X_RESULT InputSystem::GetState(uint32_t user_index, uint32_t flags,
|
||||
X_INPUT_STATE* out_state) {
|
||||
SCOPE_profile_cpu_f("hid");
|
||||
|
||||
for (auto& driver : drivers_) {
|
||||
std::vector<InputDriver*> filtered_drivers = FilterDrivers(flags);
|
||||
|
||||
for (auto& driver : filtered_drivers) {
|
||||
X_RESULT result = driver->GetState(user_index, out_state);
|
||||
if (result == X_ERROR_SUCCESS) {
|
||||
UpdateUsedSlot(driver.get(), user_index, true);
|
||||
UpdateUsedSlot(driver, user_index, true);
|
||||
AdjustDeadzoneLevels(user_index, &out_state->gamepad);
|
||||
|
||||
if (out_state->gamepad.buttons != 0) {
|
||||
|
|
|
@ -40,7 +40,8 @@ class InputSystem {
|
|||
|
||||
X_RESULT GetCapabilities(uint32_t user_index, uint32_t flags,
|
||||
X_INPUT_CAPABILITIES* out_caps);
|
||||
X_RESULT GetState(uint32_t user_index, X_INPUT_STATE* out_state);
|
||||
X_RESULT GetState(uint32_t user_index, uint32_t flags,
|
||||
X_INPUT_STATE* out_state);
|
||||
X_RESULT SetState(uint32_t user_index, X_INPUT_VIBRATION* vibration);
|
||||
X_RESULT GetKeystroke(uint32_t user_index, uint32_t flags,
|
||||
X_INPUT_KEYSTROKE* out_keystroke);
|
||||
|
|
|
@ -118,7 +118,7 @@ dword_result_t XamInputGetState_entry(dword_t user_index, dword_t flags,
|
|||
|
||||
auto input_system = kernel_state()->emulator()->input_system();
|
||||
auto lock = input_system->lock();
|
||||
return input_system->GetState(user_index, input_state);
|
||||
return input_system->GetState(user_index, flags, input_state);
|
||||
}
|
||||
DECLARE_XAM_EXPORT2(XamInputGetState, kInput, kImplemented, kHighFrequency);
|
||||
|
||||
|
|
Loading…
Reference in New Issue