From 05cd6e2fce14a992611329f18373e3fc2b0f3341 Mon Sep 17 00:00:00 2001 From: LandonTheCoder <100165458+LandonTheCoder@users.noreply.github.com> Date: Mon, 8 Jun 2026 15:47:52 -0400 Subject: [PATCH] Fix controller emulation to derive digital L/R status from analog buttons when using DigitalLR=2 The DigitalLR=2 configuration option is meant to derive the status of the digital L/R buttons from the analog positions, but was instead checking the digital reported status with a >= comparison. This would cause it to be treated as fully pressed prematurely on some controllers. Set a default, hardcoded threshold (ANALOG_LR_FULL_PRESS) to test against, and set the digital button status by checking if the analog press exceeds that threshold. --- loader/source/ppc/PADReadGC/source/PADReadGC.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/loader/source/ppc/PADReadGC/source/PADReadGC.c b/loader/source/ppc/PADReadGC/source/PADReadGC.c index c38201311..5449222af 100644 --- a/loader/source/ppc/PADReadGC/source/PADReadGC.c +++ b/loader/source/ppc/PADReadGC/source/PADReadGC.c @@ -57,6 +57,8 @@ static u8 lastDanceMatPacket = 0x00; #define DRC_SWAP (1<<16) const s8 DEADZONE = 0x1A; +// This is the threshold for where an analog trigger is considered fully pressed. +const u8 ANALOG_LR_FULL_PRESS = 0xDF; #define HID_PAD_NONE 4 #define HID_PAD_NOT_SET 0xFF @@ -596,9 +598,9 @@ u32 PADRead(u32 calledByGame) } else //standard no digital trigger button { - if(HID_Packet[HID_CTRL->L.Offset] >= HID_CTRL->L.Mask) + if (HID_Packet[HID_CTRL->LAnalog] >= ANALOG_LR_FULL_PRESS) button |= PAD_TRIGGER_L; - if(HID_Packet[HID_CTRL->R.Offset] >= HID_CTRL->R.Mask) + if (HID_Packet[HID_CTRL->RAnalog] >= ANALOG_LR_FULL_PRESS) button |= PAD_TRIGGER_R; } }