[HID] Don't pass XInput input while UI pop-up is open

This commit is contained in:
NicknineTheEagle 2024-06-19 11:11:38 +03:00 committed by Radosław Gliński
parent db02755075
commit 5610116131
1 changed files with 15 additions and 7 deletions

View File

@ -162,13 +162,17 @@ X_RESULT XInputInputDriver::GetState(uint32_t user_index,
} }
out_state->packet_number = native_state.state.dwPacketNumber; out_state->packet_number = native_state.state.dwPacketNumber;
out_state->gamepad.buttons = native_state.state.Gamepad.wButtons; if (is_active()) {
out_state->gamepad.left_trigger = native_state.state.Gamepad.bLeftTrigger; out_state->gamepad.buttons = native_state.state.Gamepad.wButtons;
out_state->gamepad.right_trigger = native_state.state.Gamepad.bRightTrigger; out_state->gamepad.left_trigger = native_state.state.Gamepad.bLeftTrigger;
out_state->gamepad.thumb_lx = native_state.state.Gamepad.sThumbLX; out_state->gamepad.right_trigger = native_state.state.Gamepad.bRightTrigger;
out_state->gamepad.thumb_ly = native_state.state.Gamepad.sThumbLY; out_state->gamepad.thumb_lx = native_state.state.Gamepad.sThumbLX;
out_state->gamepad.thumb_rx = native_state.state.Gamepad.sThumbRX; out_state->gamepad.thumb_ly = native_state.state.Gamepad.sThumbLY;
out_state->gamepad.thumb_ry = native_state.state.Gamepad.sThumbRY; out_state->gamepad.thumb_rx = native_state.state.Gamepad.sThumbRX;
out_state->gamepad.thumb_ry = native_state.state.Gamepad.sThumbRY;
} else {
std::memset(&out_state->gamepad, 0, sizeof(out_state->gamepad));
}
return result; return result;
} }
@ -220,6 +224,10 @@ X_RESULT XInputInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
return result; return result;
} }
if (!is_active()) {
return X_ERROR_EMPTY;
}
out_keystroke->virtual_key = native_keystroke.VirtualKey; out_keystroke->virtual_key = native_keystroke.VirtualKey;
out_keystroke->unicode = native_keystroke.Unicode; out_keystroke->unicode = native_keystroke.Unicode;
out_keystroke->flags = native_keystroke.Flags; out_keystroke->flags = native_keystroke.Flags;