mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-26 12:21:39 +00:00
hid: respect PlayStation touchpad button as back button
This commit is contained in:
parent
8f4f1ea33e
commit
c98f3942d6
1 changed files with 17 additions and 14 deletions
|
|
@ -102,6 +102,7 @@ public:
|
||||||
|
|
||||||
pad.wButtons |= TRANSLATE_INPUT(SDL_CONTROLLER_BUTTON_START, XAMINPUT_GAMEPAD_START);
|
pad.wButtons |= TRANSLATE_INPUT(SDL_CONTROLLER_BUTTON_START, XAMINPUT_GAMEPAD_START);
|
||||||
pad.wButtons |= TRANSLATE_INPUT(SDL_CONTROLLER_BUTTON_BACK, XAMINPUT_GAMEPAD_BACK);
|
pad.wButtons |= TRANSLATE_INPUT(SDL_CONTROLLER_BUTTON_BACK, XAMINPUT_GAMEPAD_BACK);
|
||||||
|
pad.wButtons |= TRANSLATE_INPUT(SDL_CONTROLLER_BUTTON_TOUCHPAD, XAMINPUT_GAMEPAD_BACK);
|
||||||
|
|
||||||
pad.wButtons |= TRANSLATE_INPUT(SDL_CONTROLLER_BUTTON_LEFTSTICK, XAMINPUT_GAMEPAD_LEFT_THUMB);
|
pad.wButtons |= TRANSLATE_INPUT(SDL_CONTROLLER_BUTTON_LEFTSTICK, XAMINPUT_GAMEPAD_LEFT_THUMB);
|
||||||
pad.wButtons |= TRANSLATE_INPUT(SDL_CONTROLLER_BUTTON_RIGHTSTICK, XAMINPUT_GAMEPAD_RIGHT_THUMB);
|
pad.wButtons |= TRANSLATE_INPUT(SDL_CONTROLLER_BUTTON_RIGHTSTICK, XAMINPUT_GAMEPAD_RIGHT_THUMB);
|
||||||
|
|
@ -196,8 +197,9 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
|
||||||
{
|
{
|
||||||
auto* controller = FindController(event->cdevice.which);
|
auto* controller = FindController(event->cdevice.which);
|
||||||
|
|
||||||
if (controller)
|
if (!controller)
|
||||||
{
|
break;
|
||||||
|
|
||||||
if (event->type == SDL_CONTROLLERAXISMOTION)
|
if (event->type == SDL_CONTROLLERAXISMOTION)
|
||||||
{
|
{
|
||||||
if (abs(event->caxis.value) > 8000)
|
if (abs(event->caxis.value) > 8000)
|
||||||
|
|
@ -211,7 +213,6 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
|
||||||
|
|
||||||
controller->Poll();
|
controller->Poll();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -241,7 +242,9 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
|
||||||
|
|
||||||
case SDL_USER_EVILSONIC:
|
case SDL_USER_EVILSONIC:
|
||||||
{
|
{
|
||||||
if (!g_activeController)
|
auto* controller = FindController(event->cdevice.which);
|
||||||
|
|
||||||
|
if (!controller)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
auto isNight = event->user.code;
|
auto isNight = event->user.code;
|
||||||
|
|
@ -249,7 +252,7 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
|
||||||
auto g = isNight ? 0 : 37;
|
auto g = isNight ? 0 : 37;
|
||||||
auto b = isNight ? 101 : 184;
|
auto b = isNight ? 101 : 184;
|
||||||
|
|
||||||
SDL_GameControllerSetLED(g_activeController->controller, r, g, b);
|
SDL_GameControllerSetLED(controller->controller, r, g, b);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue