Browse Source

ifdef unused rawdata fields to save memory

Save 32 bytes.
pull/5/head
Raphael Assenat 5 years ago
parent
commit
412c1a42eb
3 changed files with 11 additions and 0 deletions
  1. +3
    -0
      gamecube.c
  2. +6
    -0
      gamepads.h
  3. +2
    -0
      n64.c

+ 3
- 0
gamecube.c View File

@ -92,7 +92,10 @@ void gc_decodeAnswer(unsigned char chn, unsigned char data[8])
cy = data[5];
last_built_report[chn].gc.lt = data[6];
last_built_report[chn].gc.rt = data[7];
#ifdef PAD_DATA_HAS_RAW
memcpy(last_built_report[chn].gc.raw_data, data, 8);
#endif
if (origins_set[chn]) {
last_built_report[chn].gc.x = ((int)x-(int)orig_x[chn]);


+ 6
- 0
gamepads.h View File

@ -1,6 +1,8 @@
#ifndef _gamepads_h__
#define _gamepads_h__
#undef PAD_DATA_HAS_RAW
#define PAD_TYPE_NONE 0
#define PAD_TYPE_N64 4
#define PAD_TYPE_GAMECUBE 5
@ -12,7 +14,9 @@ typedef struct _n64_pad_data {
unsigned char pad_type; // PAD_TYPE_N64
char x,y;
unsigned short buttons;
#ifdef PAD_DATA_HAS_RAW
unsigned char raw_data[N64_RAW_SIZE];
#endif
} n64_pad_data;
#define N64_BTN_A 0x8000
@ -38,7 +42,9 @@ typedef struct _gc_pad_data {
char x,y,cx,cy;
unsigned char lt,rt;
unsigned short buttons;
#ifdef PAD_DATA_HAS_RAW
unsigned char raw_data[GC_RAW_SIZE];
#endif
} gc_pad_data;
#define GC_BTN_A 0x0001


+ 2
- 0
n64.c View File

@ -218,11 +218,13 @@ static char n64Update(unsigned char chn)
last_built_report[chn].n64.x = x;
last_built_report[chn].n64.y = y;
#ifdef PAD_DATA_HAS_RAW
/* Copy all the data as-is for the raw field */
last_built_report[chn].n64.raw_data[0] = btns1;
last_built_report[chn].n64.raw_data[1] = btns2;
last_built_report[chn].n64.raw_data[2] = x;
last_built_report[chn].n64.raw_data[3] = y;
#endif
/* Some cheap non-official controllers
* use the full 8 bit range instead of the


Loading…
Cancel
Save