mirror of
https://github.com/raphnet/gc_n64_usb-v3
synced 2025-01-30 23:00:11 -05:00
Implement gc invert and full sliders
This commit is contained in:
parent
a55ac8069a
commit
9b17716b20
@ -5,6 +5,7 @@
|
|||||||
#include "hiddata.h"
|
#include "hiddata.h"
|
||||||
#include "bootloader.h"
|
#include "bootloader.h"
|
||||||
#include "gcn64_protocol.h"
|
#include "gcn64_protocol.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#define CMDBUF_SIZE 64
|
#define CMDBUF_SIZE 64
|
||||||
|
|
||||||
@ -96,6 +97,12 @@ static void hiddata_processCommandBuffer(void)
|
|||||||
// CMD: RQ, PARAM
|
// CMD: RQ, PARAM
|
||||||
g_polling_suspended = cmdbuf[1];
|
g_polling_suspended = cmdbuf[1];
|
||||||
break;
|
break;
|
||||||
|
case RQ_GCN64_GET_VERSION:
|
||||||
|
// CMD: RQ
|
||||||
|
// Answer: RQ, version string
|
||||||
|
strcpy((char*)(cmdbuf + 1), g_version);
|
||||||
|
cmdbuf_len = 1 + strlen(g_version);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#define RQ_GCN64_SET_CONFIG_PARAM 0x01
|
#define RQ_GCN64_SET_CONFIG_PARAM 0x01
|
||||||
#define RQ_GCN64_GET_CONFIG_PARAM 0x02
|
#define RQ_GCN64_GET_CONFIG_PARAM 0x02
|
||||||
#define RQ_GCN64_SUSPEND_POLLING 0x03
|
#define RQ_GCN64_SUSPEND_POLLING 0x03
|
||||||
|
#define RQ_GCN64_GET_VERSION 0x04
|
||||||
#define RQ_GCN64_RAW_SI_COMMAND 0x80
|
#define RQ_GCN64_RAW_SI_COMMAND 0x80
|
||||||
#define RQ_GCN64_JUMP_TO_BOOTLOADER 0xFF
|
#define RQ_GCN64_JUMP_TO_BOOTLOADER 0xFF
|
||||||
|
|
||||||
@ -19,9 +20,9 @@
|
|||||||
#define CFG_PARAM_POLL_INTERVAL2 0x12
|
#define CFG_PARAM_POLL_INTERVAL2 0x12
|
||||||
#define CFG_PARAM_POLL_INTERVAL3 0x13
|
#define CFG_PARAM_POLL_INTERVAL3 0x13
|
||||||
|
|
||||||
#define CFG_PARAM_N64_SQUARE 0x20
|
#define CFG_PARAM_N64_SQUARE 0x20 // Not implemented
|
||||||
#define CFG_PARAM_GC_MAIN_SQUARE 0x21
|
#define CFG_PARAM_GC_MAIN_SQUARE 0x21 // Not implemented
|
||||||
#define CFG_PARAM_GC_CSTICK_SQUARE 0x22
|
#define CFG_PARAM_GC_CSTICK_SQUARE 0x22 // Not implemented
|
||||||
#define CFG_PARAM_FULL_SLIDERS 0x23
|
#define CFG_PARAM_FULL_SLIDERS 0x23
|
||||||
#define CFG_PARAM_INVERT_TRIG 0x24
|
#define CFG_PARAM_INVERT_TRIG 0x24
|
||||||
|
|
||||||
|
19
usbpad.c
19
usbpad.c
@ -4,6 +4,8 @@
|
|||||||
#include "gamepads.h"
|
#include "gamepads.h"
|
||||||
#include "usbpad.h"
|
#include "usbpad.h"
|
||||||
#include "mappings.h"
|
#include "mappings.h"
|
||||||
|
#include "eeprom.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#define REPORT_ID 1
|
#define REPORT_ID 1
|
||||||
#define REPORT_SIZE 15
|
#define REPORT_SIZE 15
|
||||||
@ -107,11 +109,26 @@ static void buildReportFromGC(const gc_pad_data *gc_data, unsigned char dstbuf[R
|
|||||||
cxval *= 160;
|
cxval *= 160;
|
||||||
cyval *= -160;
|
cyval *= -160;
|
||||||
|
|
||||||
/* Scane 0...255 to 0...16000 */
|
if (g_eeprom_data.cfg.flags & FLAG_GC_FULL_SLIDERS) {
|
||||||
|
int16_t lts = (int16_t)ltrig - 127;
|
||||||
|
int16_t rts = (int16_t)rtrig - 127;
|
||||||
|
lts *= 126;
|
||||||
|
ltrig = lts;
|
||||||
|
rts *= 126;
|
||||||
|
rtrig = rts;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* Scale 0...255 to 0...16000 */
|
||||||
ltrig *= 63;
|
ltrig *= 63;
|
||||||
if (ltrig > 16000) ltrig=16000;
|
if (ltrig > 16000) ltrig=16000;
|
||||||
rtrig *= 63;
|
rtrig *= 63;
|
||||||
if (rtrig > 16000) rtrig=16000;
|
if (rtrig > 16000) rtrig=16000;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_eeprom_data.cfg.flags & FLAG_GC_INVERT_TRIGS) {
|
||||||
|
ltrig = -ltrig;
|
||||||
|
rtrig = -rtrig;
|
||||||
|
}
|
||||||
|
|
||||||
/* Unsign for HID report */
|
/* Unsign for HID report */
|
||||||
xval += 16000;
|
xval += 16000;
|
||||||
|
5
version.c
Normal file
5
version.c
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
const char *g_version = VERSIONSTR; // From Makefile
|
||||||
|
const char signature[] PROGMEM = "9c3ea8b8-753f-11e5-a0dc-001bfca3c593";
|
Loading…
Reference in New Issue
Block a user