From: negativeExponent Date: Thu, 6 May 2021 05:38:18 +0000 (+0800) Subject: Fix reporting for connected or unconnected inputs X-Git-Tag: r24l~581^2 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d526ed8c645d7e2147b7d454f29d123b4cfa311d;p=pcsx_rearmed.git Fix reporting for connected or unconnected inputs Current implementation assumes all inputs are plugged, regardless of input type settings, so input reporting in games also says its connected. This PR fix this minor issue, by sending appropriate input register values when no controllers are attached. Related issue (what i used as well for testing): https://github.com/libretro/duckstation/issues/35 --- diff --git a/libpcsxcore/plugins.c b/libpcsxcore/plugins.c index 8d99be2d..a2f8fe27 100644 --- a/libpcsxcore/plugins.c +++ b/libpcsxcore/plugins.c @@ -630,6 +630,7 @@ void _PADstartPoll(PadDataS *pad) { switch (pad->controllerType) { case PSE_PAD_TYPE_MOUSE: stdpar[0] = 0x12; + stdpar[1] = 0x5a; stdpar[2] = pad->buttonStatus & 0xff; stdpar[3] = pad->buttonStatus >> 8; stdpar[4] = pad->moveX; @@ -639,6 +640,7 @@ void _PADstartPoll(PadDataS *pad) { break; case PSE_PAD_TYPE_NEGCON: // npc101/npc104(slph00001/slph00069) stdpar[0] = 0x23; + stdpar[1] = 0x5a; stdpar[2] = pad->buttonStatus & 0xff; stdpar[3] = pad->buttonStatus >> 8; stdpar[4] = pad->rightJoyX; @@ -691,6 +693,7 @@ void _PADstartPoll(PadDataS *pad) { break; case PSE_PAD_TYPE_ANALOGPAD: // scph1150 stdpar[0] = 0x73; + stdpar[1] = 0x5a; stdpar[2] = pad->buttonStatus & 0xff; stdpar[3] = pad->buttonStatus >> 8; stdpar[4] = pad->rightJoyX; @@ -702,6 +705,7 @@ void _PADstartPoll(PadDataS *pad) { break; case PSE_PAD_TYPE_ANALOGJOY: // scph1110 stdpar[0] = 0x53; + stdpar[1] = 0x5a; stdpar[2] = pad->buttonStatus & 0xff; stdpar[3] = pad->buttonStatus >> 8; stdpar[4] = pad->rightJoyX; @@ -712,8 +716,8 @@ void _PADstartPoll(PadDataS *pad) { respSize = 8; break; case PSE_PAD_TYPE_STANDARD: - default: stdpar[0] = 0x41; + stdpar[1] = 0x5a; stdpar[2] = pad->buttonStatus & 0xff; stdpar[3] = pad->buttonStatus >> 8; //avoid analog value in multitap mode if change pad type in game. @@ -723,6 +727,19 @@ void _PADstartPoll(PadDataS *pad) { stdpar[7] = 0xff; memcpy(buf, stdpar, 8); respSize = 8; + break; + default: + stdpar[0] = 0xff; + stdpar[1] = 0xff; + stdpar[2] = 0xff; + stdpar[3] = 0xff; + stdpar[4] = 0xff; + stdpar[5] = 0xff; + stdpar[6] = 0xff; + stdpar[7] = 0xff; + memcpy(buf, stdpar, 8); + respSize = 8; + break; } }