Skip to content

Commit c7dc6e3

Browse files
committed
Handle busy state specially
1 parent 34ba7f5 commit c7dc6e3

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

libogc/pad.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,10 @@ u32 PAD_ScanPads(void)
912912

913913
case PAD_ERR_NO_CONTROLLER:
914914
switch(SI_Probe(i)) {
915+
case SI_ERROR_BUSY:
916+
if(n64status[i].err==N64_ERR_NO_CONTROLLER)
917+
goto no_controller;
918+
915919
case SI_N64_CONTROLLER:
916920
N64_ReadAsync(i,&n64status[i],NULL);
917921

@@ -950,17 +954,16 @@ u32 PAD_ScanPads(void)
950954
break;
951955

952956
case N64_ERR_NO_CONTROLLER:
953-
if(__pad_keys[i].chan!=-1) memset(&__pad_keys[i],0,sizeof(keyinput));
954-
__pad_keys[i].chan = -1;
957+
goto no_controller;
955958
break;
956959

957960
default:
958-
__pad_keys[i].up = __pad_keys[i].down = 0;
959-
if(__pad_keys[i].chan!=-1) connected |= (1<<i);
961+
goto not_ready;
960962
break;
961963
}
962964
break;
963965

966+
no_controller:
964967
default:
965968
if(__pad_keys[i].chan!=-1) memset(&__pad_keys[i],0,sizeof(keyinput));
966969
__pad_keys[i].chan = -1;
@@ -969,6 +972,7 @@ u32 PAD_ScanPads(void)
969972
}
970973
break;
971974

975+
not_ready:
972976
default:
973977
__pad_keys[i].up = __pad_keys[i].down = 0;
974978
if(__pad_keys[i].chan!=-1) connected |= (1<<i);

0 commit comments

Comments
 (0)