From 1c0be9d631f53b5ca3e65f68a16867151a5f5966 Mon Sep 17 00:00:00 2001 From: Ilya Shurumov Date: Mon, 7 Jun 2021 01:56:06 +0600 Subject: [PATCH] - [Psy-X] use combination for "Select + Start pressed + Up/Down" --- src_rebuild/PsyX/src/pad/PsyX_pad.cpp | 76 +++++++++++++-------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src_rebuild/PsyX/src/pad/PsyX_pad.cpp b/src_rebuild/PsyX/src/pad/PsyX_pad.cpp index e52bed7e..80895ec1 100644 --- a/src_rebuild/PsyX/src/pad/PsyX_pad.cpp +++ b/src_rebuild/PsyX/src/pad/PsyX_pad.cpp @@ -230,50 +230,50 @@ void PsyX_Pad_InternalPadUpdates() PsyX_Pad_UpdateGameControllerInput(controller->gc, pad); - if (i == 0) // Update keyboard for PAD 1 + ushort test = *(u_short*)pad->buttons; + + // Select + Start pressed + Down + if (pad->analog[3] == 255) + { + if ((test & 0x1) == 0 && (test & 0x8) == 0) + { + // switch to analog state + if (pad->id == 0x41) + { + eprintf("Port %d ANALOG: ON\n", i + 1); + pad->id = 0x73; + } + } + } + + // Select + Start pressed + Up + if (pad->analog[3] == 0) + { + if ((test & 0x1) == 0 && (test & 0x8) == 0) + { + // switch to analog state + if (pad->id == 0x73) + { + eprintf("Port %d ANALOG: OFF\n", i + 1); + pad->id = 0x41; + } + } + } + + // Update keyboard for PAD + if ((g_activeKeyboardControllers & (1 << i)) && kbInputs != 0xffff) { pad->status = 0; // PadStateStable? - // switch to analog state - if ((pad->analog[0] == 255 || - pad->analog[1] == 255 || - pad->analog[2] == 255 || - pad->analog[3] == 255) && - pad->id == 0x41) + if (pad->id != 0x41) { - eprintf("Switched controller type to ANALOG\n"); - pad->id = 0x73; + if(pad->id != 0x73) + eprintf("Port %d ANALOG: OFF\n", i + 1); + + pad->id = 0x41; // force disable analog } - if (g_activeKeyboardControllers & 0x1) - { - // switch state - if (kbInputs != 0xFFFF && pad->id == 0x73) - { - eprintf("Switched controller type to SIMPLE\n"); - pad->id = 0x41; - pad->analog[0] = 127; // TODO: mouse? - pad->analog[1] = 127; - pad->analog[2] = 127; - pad->analog[3] = 127; - } - - *(u_short*)pad->buttons &= kbInputs; - } - } - else if (i == 1) // Update keyboard for PAD 2 - { - if (g_activeKeyboardControllers & 0x2) - { - pad->status = 0; // PadStateStable? - pad->id = 0x41; - pad->analog[0] = 127; - pad->analog[1] = 127; - pad->analog[2] = 127; - pad->analog[3] = 127; - - *(u_short*)pad->buttons &= kbInputs; - } + *(u_short*)pad->buttons &= kbInputs; } } }