Share common N64 and GC buffers

This commit is contained in:
Raphael Assenat 2015-10-28 00:16:02 -04:00
parent 03fcfa5b6c
commit 831487efe2
5 changed files with 13 additions and 14 deletions

View File

@ -1,2 +1,2 @@
OBJS=main.o usb.o usbpad.o mappings.o gcn64_protocol.o n64.o gamecube.o usart1.o bootloader.o eeprom.o config.o hiddata.o usbstrings.o intervaltimer.o version.o gcn64txrx.o OBJS=main.o usb.o usbpad.o mappings.o gcn64_protocol.o n64.o gamecube.o usart1.o bootloader.o eeprom.o config.o hiddata.o usbstrings.o intervaltimer.o version.o gcn64txrx.o gamepads.o
VERSIONSTR=\"3.0.0\" VERSIONSTR=\"3.0.0\"

View File

@ -32,12 +32,6 @@ static void gamecubeInit(void);
static char gamecubeUpdate(void); static char gamecubeUpdate(void);
static char gamecubeChanged(void); static char gamecubeChanged(void);
/* What was most recently read from the controller */
static gamepad_data last_built_report;
/* What was most recently sent to the host */
static gamepad_data last_sent_report;
static char gc_rumbling = 0; static char gc_rumbling = 0;
static char origins_set = 0; static char origins_set = 0;
static unsigned char orig_x, orig_y, orig_cx, orig_cy; static unsigned char orig_x, orig_y, orig_cx, orig_cy;

6
gamepads.c Normal file
View File

@ -0,0 +1,6 @@
#include "gamepads.h"
/* Shared between N64 and GC (only one is used at a time). Saves memory. */
gamepad_data last_sent_report;
gamepad_data last_built_report;

View File

@ -80,6 +80,12 @@ typedef struct {
char (*probe)(void); /* return true if found */ char (*probe)(void); /* return true if found */
} Gamepad; } Gamepad;
/* What was most recently read from the controller */
extern gamepad_data last_built_report;
/* What was most recently sent to the host */
extern gamepad_data last_sent_report;
#endif // _gamepads_h__ #endif // _gamepads_h__

7
n64.c
View File

@ -36,13 +36,6 @@ static char must_rumble = 0;
static char force_rumble = 0; static char force_rumble = 0;
#endif #endif
/* What was most recently read from the controller */
static gamepad_data last_built_report;
/* What was most recently reported through getReport */
static gamepad_data last_sent_report;
static void n64Init(void) static void n64Init(void)
{ {
n64Update(); n64Update();