mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-03-10 16:14:36 +00:00
Implement extended controller button support
This commit is contained in:
parent
737be029ec
commit
feedede6f9
@ -254,7 +254,7 @@ namespace input {
|
|||||||
<< "--begin controller packet--"sv << std::endl
|
<< "--begin controller packet--"sv << std::endl
|
||||||
<< "controllerNumber ["sv << packet->controllerNumber << ']' << std::endl
|
<< "controllerNumber ["sv << packet->controllerNumber << ']' << std::endl
|
||||||
<< "activeGamepadMask ["sv << util::hex(packet->activeGamepadMask).to_string_view() << ']' << std::endl
|
<< "activeGamepadMask ["sv << util::hex(packet->activeGamepadMask).to_string_view() << ']' << std::endl
|
||||||
<< "buttonFlags ["sv << util::hex(packet->buttonFlags).to_string_view() << ']' << std::endl
|
<< "buttonFlags ["sv << util::hex((uint32_t) packet->buttonFlags | (packet->buttonFlags2 << 16)).to_string_view() << ']' << std::endl
|
||||||
<< "leftTrigger ["sv << util::hex(packet->leftTrigger).to_string_view() << ']' << std::endl
|
<< "leftTrigger ["sv << util::hex(packet->leftTrigger).to_string_view() << ']' << std::endl
|
||||||
<< "rightTrigger ["sv << util::hex(packet->rightTrigger).to_string_view() << ']' << std::endl
|
<< "rightTrigger ["sv << util::hex(packet->rightTrigger).to_string_view() << ']' << std::endl
|
||||||
<< "leftStickX ["sv << packet->leftStickX << ']' << std::endl
|
<< "leftStickX ["sv << packet->leftStickX << ']' << std::endl
|
||||||
@ -691,8 +691,9 @@ namespace input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::uint16_t bf = packet->buttonFlags;
|
std::uint16_t bf = packet->buttonFlags;
|
||||||
|
std::uint32_t bf2 = packet->buttonFlags2;
|
||||||
platf::gamepad_state_t gamepad_state {
|
platf::gamepad_state_t gamepad_state {
|
||||||
bf,
|
bf | (bf2 << 16),
|
||||||
packet->leftTrigger,
|
packet->leftTrigger,
|
||||||
packet->rightTrigger,
|
packet->rightTrigger,
|
||||||
packet->leftStickX,
|
packet->leftStickX,
|
||||||
|
@ -49,21 +49,27 @@ namespace video {
|
|||||||
namespace platf {
|
namespace platf {
|
||||||
constexpr auto MAX_GAMEPADS = 32;
|
constexpr auto MAX_GAMEPADS = 32;
|
||||||
|
|
||||||
constexpr std::uint16_t DPAD_UP = 0x0001;
|
constexpr std::uint32_t DPAD_UP = 0x0001;
|
||||||
constexpr std::uint16_t DPAD_DOWN = 0x0002;
|
constexpr std::uint32_t DPAD_DOWN = 0x0002;
|
||||||
constexpr std::uint16_t DPAD_LEFT = 0x0004;
|
constexpr std::uint32_t DPAD_LEFT = 0x0004;
|
||||||
constexpr std::uint16_t DPAD_RIGHT = 0x0008;
|
constexpr std::uint32_t DPAD_RIGHT = 0x0008;
|
||||||
constexpr std::uint16_t START = 0x0010;
|
constexpr std::uint32_t START = 0x0010;
|
||||||
constexpr std::uint16_t BACK = 0x0020;
|
constexpr std::uint32_t BACK = 0x0020;
|
||||||
constexpr std::uint16_t LEFT_STICK = 0x0040;
|
constexpr std::uint32_t LEFT_STICK = 0x0040;
|
||||||
constexpr std::uint16_t RIGHT_STICK = 0x0080;
|
constexpr std::uint32_t RIGHT_STICK = 0x0080;
|
||||||
constexpr std::uint16_t LEFT_BUTTON = 0x0100;
|
constexpr std::uint32_t LEFT_BUTTON = 0x0100;
|
||||||
constexpr std::uint16_t RIGHT_BUTTON = 0x0200;
|
constexpr std::uint32_t RIGHT_BUTTON = 0x0200;
|
||||||
constexpr std::uint16_t HOME = 0x0400;
|
constexpr std::uint32_t HOME = 0x0400;
|
||||||
constexpr std::uint16_t A = 0x1000;
|
constexpr std::uint32_t A = 0x1000;
|
||||||
constexpr std::uint16_t B = 0x2000;
|
constexpr std::uint32_t B = 0x2000;
|
||||||
constexpr std::uint16_t X = 0x4000;
|
constexpr std::uint32_t X = 0x4000;
|
||||||
constexpr std::uint16_t Y = 0x8000;
|
constexpr std::uint32_t Y = 0x8000;
|
||||||
|
constexpr std::uint32_t PADDLE1 = 0x010000;
|
||||||
|
constexpr std::uint32_t PADDLE2 = 0x020000;
|
||||||
|
constexpr std::uint32_t PADDLE3 = 0x040000;
|
||||||
|
constexpr std::uint32_t PADDLE4 = 0x080000;
|
||||||
|
constexpr std::uint32_t TOUCHPAD_BUTTON = 0x100000;
|
||||||
|
constexpr std::uint32_t MISC_BUTTON = 0x200000;
|
||||||
|
|
||||||
struct rumble_t {
|
struct rumble_t {
|
||||||
KITTY_DEFAULT_CONSTR(rumble_t)
|
KITTY_DEFAULT_CONSTR(rumble_t)
|
||||||
@ -154,7 +160,7 @@ namespace platf {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct gamepad_state_t {
|
struct gamepad_state_t {
|
||||||
std::uint16_t buttonFlags;
|
std::uint32_t buttonFlags;
|
||||||
std::uint8_t lt;
|
std::uint8_t lt;
|
||||||
std::uint8_t rt;
|
std::uint8_t rt;
|
||||||
std::int16_t lsX;
|
std::int16_t lsX;
|
||||||
|
@ -520,6 +520,9 @@ namespace platf {
|
|||||||
|
|
||||||
if (gamepad_state.buttonFlags & HOME) buttons |= DS4_SPECIAL_BUTTON_PS;
|
if (gamepad_state.buttonFlags & HOME) buttons |= DS4_SPECIAL_BUTTON_PS;
|
||||||
|
|
||||||
|
// Allow either PS4/PS5 clickpad button or Xbox Series X share button to activate DS4 clickpad
|
||||||
|
if (gamepad_state.buttonFlags & (TOUCHPAD_BUTTON | MISC_BUTTON)) buttons |= DS4_SPECIAL_BUTTON_TOUCHPAD;
|
||||||
|
|
||||||
return (DS4_SPECIAL_BUTTONS) buttons;
|
return (DS4_SPECIAL_BUTTONS) buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user