mirror of
https://github.com/raphnet/gc_n64_usb-v3
synced 2025-01-30 23:00:11 -05:00
Use gcn64_detectController to detect N64 vs Gamecube controllers
This commit is contained in:
parent
829ba2b560
commit
290588dbd5
30
main.c
30
main.c
@ -467,24 +467,27 @@ uint8_t hid_set_report_data(const struct usb_request *rq, const uint8_t *dat, ui
|
|||||||
|
|
||||||
#define NUM_PAD_TYPES 2
|
#define NUM_PAD_TYPES 2
|
||||||
|
|
||||||
static Gamepad *pads[NUM_PAD_TYPES];
|
|
||||||
|
|
||||||
void initPads(void)
|
|
||||||
{
|
|
||||||
gcn64protocol_hwinit();
|
|
||||||
pads[0] = n64GetGamepad();
|
|
||||||
pads[1] = gamecubeGetGamepad();
|
|
||||||
}
|
|
||||||
|
|
||||||
Gamepad *detectPad(void)
|
Gamepad *detectPad(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int type;
|
||||||
|
|
||||||
for (i=0; i<NUM_PAD_TYPES; i++) {
|
type = gcn64_detectController();
|
||||||
if (pads[i]->probe()) {
|
|
||||||
return pads[i];
|
switch (type)
|
||||||
}
|
{
|
||||||
|
case CONTROLLER_IS_ABSENT:
|
||||||
|
case CONTROLLER_IS_UNKNOWN:
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
case CONTROLLER_IS_N64:
|
||||||
|
return n64GetGamepad();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CONTROLLER_IS_GC:
|
||||||
|
return gamecubeGetGamepad();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,7 +499,6 @@ int main(void)
|
|||||||
|
|
||||||
hwinit();
|
hwinit();
|
||||||
usart1_init();
|
usart1_init();
|
||||||
initPads();
|
|
||||||
|
|
||||||
/* Init the buffer with idle data */
|
/* Init the buffer with idle data */
|
||||||
usbpad_buildReport(NULL, gamepad_report0);
|
usbpad_buildReport(NULL, gamepad_report0);
|
||||||
|
Loading…
Reference in New Issue
Block a user