From 74cf60d8398369b5cc66bde95008540384e9cbb5 Mon Sep 17 00:00:00 2001 From: Raphael Assenat Date: Mon, 4 Feb 2019 17:08:52 -0500 Subject: [PATCH] Add support for the N64 mouse For now, just recognizes it's a mouse and treat it like a controller. --- gcn64_protocol.c | 6 ++++++ gcn64_protocol.h | 1 + main.c | 1 + 3 files changed, 8 insertions(+) diff --git a/gcn64_protocol.c b/gcn64_protocol.c index 3bd63a7..f09ed3b 100644 --- a/gcn64_protocol.c +++ b/gcn64_protocol.c @@ -181,6 +181,9 @@ int gcn64_detectController(unsigned char chn) * 0000 0101 0000 0000 0000 0001 : 0x050001 With expansion pack * 0000 0101 0000 0000 0000 0010 : 0x050002 Expansion pack removed * + * -- N64 mouse -- + * 0000 0010 0000 0000 0000 0000 : 0x020000 + * * -- Ascii keyboard (keyboard connector) * 0000 1000 0010 0000 0000 0000 : 0x082000 * @@ -215,6 +218,9 @@ int gcn64_detectController(unsigned char chn) #endif switch ((id >> 8) & 0x0F) { + case 0x02: + return CONTROLLER_IS_N64_MOUSE; + case 0x05: return CONTROLLER_IS_N64; diff --git a/gcn64_protocol.h b/gcn64_protocol.h index f6617a4..5424a0d 100644 --- a/gcn64_protocol.h +++ b/gcn64_protocol.h @@ -6,6 +6,7 @@ #define CONTROLLER_IS_GC 2 #define CONTROLLER_IS_GC_KEYBOARD 3 #define CONTROLLER_IS_UNKNOWN 4 +#define CONTROLLER_IS_N64_MOUSE 5 /* Return many unknown bits, but two are about the expansion port. */ diff --git a/main.c b/main.c index 701e270..4b3aed1 100644 --- a/main.c +++ b/main.c @@ -553,6 +553,7 @@ Gamepad *detectPad(unsigned char chn) case CONTROLLER_IS_UNKNOWN: return NULL; + case CONTROLLER_IS_N64_MOUSE: case CONTROLLER_IS_N64: return n64GetGamepad();