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

@@ -243,6 +243,7 @@ enum class VirtualKey : uint16_t {
// because XInput is the API used for the Xbox 360 controller.
// To avoid confusion between VK_GAMEPAD_* and VK_PAD_*, here they are
// prefixed with kXboxOne and kXInput respectively.
// https://learn.microsoft.com/en-us/uwp/api/windows.system.virtualkey
kXboxOneGamepadA = 0xC3,
kXboxOneGamepadB = 0xC4,
kXboxOneGamepadX = 0xC5,
@@ -317,7 +318,7 @@ enum class VirtualKey : uint16_t {
// VK_PAD_* from XInput.h for XInputGetKeystroke. kXInput prefix added to
// distinguish from VK_GAMEPAD_*, added much later for the Xbox One
// controller.
// https://learn.microsoft.com/en-us/windows/win32/api/xinput/ns-xinput-xinput_keystroke
kXInputPadA = 0x5800,
kXInputPadB = 0x5801,
kXInputPadX = 0x5802,
@@ -354,6 +355,8 @@ enum class VirtualKey : uint16_t {
kXInputPadRThumbUpRight = 0x5835,
kXInputPadRThumbDownRight = 0x5836,
kXInputPadRThumbDownLeft = 0x5837,
// Undocumented therefore kNone however using 0x5838 for now.
kXInputPadGuide = 0x5838,
};
} // namespace ui