Use the correct bits to detect 3-button.
@@ -649,9 +649,11 @@ static u16 read6Btn(u16 port)
v1 = TH_CONTROL_PHASE(pb); /* - 0 s a 0 0 d u - 1 c b r l d u */
val = TH_CONTROL_PHASE(pb); /* - 0 s a 0 0 d u - 1 c b r l d u */
v2 = TH_CONTROL_PHASE(pb); /* - 0 s a 0 0 0 0 - 1 c b m x y z */
- val = TH_CONTROL_PHASE(pb); /* - 0 s a 1 1 1 1 - 1 c b r l d u */
+ val = TH_CONTROL_PHASE(pb); /* - 0 s a - - - - - 1 c b r l d u */
- if ((val & 0x0F00) != 0x0F00) v2 = (JOY_TYPE_PAD3 << JOY_TYPE_SHIFT) | 0x0F00; /* three button pad */
+ // On a six-button controller, bits 0-3 of the high byte will always read 0.
+ // This corresponds to up + down on a 3-button controller.
+ if ((v2 & 0x0F00) != 0x0000) v2 = (JOY_TYPE_PAD3 << JOY_TYPE_SHIFT) | 0x0F00; /* three button pad */
else v2 = (JOY_TYPE_PAD6 << JOY_TYPE_SHIFT) | ((v2 & 0x000F) << 8); /* six button pad */
val = ((v1 & 0x3000) >> 6) | (v1 & 0x003F); /* 0 0 0 0 0 0 0 0 s a c b r l d u */
