smpc/input_intback: handle controller disconnection
This still only parses digital pad correctly.
This commit is contained in:
parent
f40510d0b1
commit
b092850c07
@ -160,15 +160,20 @@ void smpc_int(void) {
|
|||||||
switch (intback.fsm++) {
|
switch (intback.fsm++) {
|
||||||
case PORT_STATUS:
|
case PORT_STATUS:
|
||||||
port_connected = (PORT_STATUS__CONNECTORS(oreg) == 1);
|
port_connected = (PORT_STATUS__CONNECTORS(oreg) == 1);
|
||||||
break;
|
|
||||||
case PERIPHERAL_ID:
|
|
||||||
if (port_connected) {
|
if (port_connected) {
|
||||||
assert(PERIPHERAL_ID__IS_DIGITAL_PAD(oreg));
|
assert(PORT_STATUS__MULTITAP_ID(oreg) == 0xf);
|
||||||
assert(PERIPHERAL_ID__DATA_SIZE(oreg) == 2);
|
} else {
|
||||||
|
intback.fsm = FSM_NEXT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PERIPHERAL_ID:
|
||||||
|
assert(port_connected);
|
||||||
|
assert(PERIPHERAL_ID__IS_DIGITAL_PAD(oreg));
|
||||||
|
assert(PERIPHERAL_ID__DATA_SIZE(oreg) == 2);
|
||||||
|
break;
|
||||||
case DATA1:
|
case DATA1:
|
||||||
if (port_connected) {
|
assert(port_connected);
|
||||||
|
{
|
||||||
controller_state& c = intback.controller[intback.controller_ix];
|
controller_state& c = intback.controller[intback.controller_ix];
|
||||||
c.right = (DIGITAL__1__RIGHT & oreg) == 0;
|
c.right = (DIGITAL__1__RIGHT & oreg) == 0;
|
||||||
c.left = (DIGITAL__1__LEFT & oreg) == 0;
|
c.left = (DIGITAL__1__LEFT & oreg) == 0;
|
||||||
@ -177,6 +182,7 @@ void smpc_int(void) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DATA2:
|
case DATA2:
|
||||||
|
assert(port_connected);
|
||||||
// ignore data2
|
// ignore data2
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user