Implemented Controller Hotkeys (#111)

Implemented Controller Hotkeys

Added controller hotkeys
Added guide button support for XInput and winkey

The hotkey configurations can be found in HID -> Display controller hotkeys
If the Xbox Gamebar overlay is enabled then use the Back button instead of the Guide button.

- Fixed hotkey thread destruction
- Fixed XINPUT_STATE by padding 4 bytes
- Added hotkey vibration for user feedback
- Replaced MessageBoxA with ImGuiDialog::ShowMessageBox

Co-authored-by: Margen67 <Margen67@users.noreply.github.com>
This commit is contained in:
Adrian
2023-01-13 08:17:43 +00:00
committed by GitHub
parent ea1003c6bf
commit 459497f0b6
12 changed files with 455 additions and 50 deletions

View File

@@ -249,7 +249,7 @@ X_RESULT SDLInputDriver::GetKeystroke(uint32_t users, uint32_t flags,
// The order of this list is also the order in which events are send if
// multiple buttons change at once.
static_assert(sizeof(X_INPUT_GAMEPAD::buttons) == 2);
static constexpr std::array<ui::VirtualKey, 34> kVkLookup = {
static constexpr std::array<ui::VirtualKey, 35> kVkLookup = {
// 00 - True buttons from xinput button field
ui::VirtualKey::kXInputPadDpadUp,
ui::VirtualKey::kXInputPadDpadDown,
@@ -261,7 +261,8 @@ X_RESULT SDLInputDriver::GetKeystroke(uint32_t users, uint32_t flags,
ui::VirtualKey::kXInputPadRThumbPress,
ui::VirtualKey::kXInputPadLShoulder,
ui::VirtualKey::kXInputPadRShoulder,
ui::VirtualKey::kNone, /* Guide has no VK */
// Guide has no VK (kNone), however using kXInputPadGuide.
ui::VirtualKey::kXInputPadGuide,
ui::VirtualKey::kNone, /* Unknown */
ui::VirtualKey::kXInputPadA,
ui::VirtualKey::kXInputPadB,