diff --git a/hiddata.c b/hiddata.c index a9e6ba2..261e51c 100644 --- a/hiddata.c +++ b/hiddata.c @@ -195,6 +195,32 @@ static void hiddata_processCommandBuffer(struct hiddata_ops *ops) case RQ_GCN64_BLOCK_IO: cmdbuf_len = processBlockIO(); break; + case RQ_RNT_GET_SUPPORTED_REQUESTS: + cmdbuf[1] = RQ_GCN64_JUMP_TO_BOOTLOADER; + cmdbuf[2] = RQ_GCN64_RAW_SI_COMMAND; + cmdbuf[3] = RQ_GCN64_GET_CONFIG_PARAM; + cmdbuf[4] = RQ_GCN64_SET_CONFIG_PARAM; + cmdbuf[5] = RQ_GCN64_SUSPEND_POLLING; + cmdbuf[6] = RQ_GCN64_GET_VERSION; + cmdbuf[7] = RQ_GCN64_GET_SIGNATURE; + cmdbuf[8] = RQ_GCN64_GET_CONTROLLER_TYPE; + cmdbuf[9] = RQ_GCN64_SET_VIBRATION; + cmdbuf[10] = RQ_GCN64_BLOCK_IO; + cmdbuf[11] = RQ_RNT_GET_SUPPORTED_CFG_PARAMS; + cmdbuf[12] = RQ_RNT_GET_SUPPORTED_MODES; + cmdbuf[13] = RQ_RNT_GET_SUPPORTED_REQUESTS; + cmdbuf_len = 14; + break; + case RQ_RNT_GET_SUPPORTED_CFG_PARAMS: + cmdbuf_len = 1 + config_getSupportedParams(cmdbuf + 1); + break; + case RQ_RNT_GET_SUPPORTED_MODES: + cmdbuf_len = 1; + if (ops && ops->getSupportedModes) { + cmdbuf_len += ops->getSupportedModes(cmdbuf + 1); + } + break; + } #ifdef DEBUG diff --git a/hiddata.h b/hiddata.h index 316f359..60a2f8f 100644 --- a/hiddata.h +++ b/hiddata.h @@ -7,6 +7,7 @@ struct hiddata_ops { void (*suspendPolling)(uint8_t suspend); void (*forceVibration)(uint8_t channel, uint8_t force); + uint8_t (*getSupportedModes)(uint8_t *dst); }; uint16_t hiddata_get_report(void *ctx, struct usb_request *rq, const uint8_t **dat); diff --git a/main.c b/main.c index 6d41c6c..6fa8d8e 100644 --- a/main.c +++ b/main.c @@ -422,9 +422,21 @@ static void forceVibration(uint8_t channel, uint8_t force) } } +static uint8_t getSupportedModes(uint8_t *dst) +{ + dst[0] = CFG_MODE_STANDARD; + dst[1] = CFG_MODE_N64_ONLY; + dst[2] = CFG_MODE_GC_ONLY; + dst[3] = CFG_MODE_2P_STANDARD; + dst[4] = CFG_MODE_2P_N64_ONLY; + dst[5] = CFG_MODE_2P_GC_ONLY; + return 6; +} + static struct hiddata_ops hiddata_ops = { .suspendPolling = setSuspendPolling, .forceVibration = forceVibration, + .getSupportedModes = getSupportedModes, }; #define STATE_WAIT_POLLTIME 0 diff --git a/requests.h b/requests.h index 57a49d8..f5adadf 100644 --- a/requests.h +++ b/requests.h @@ -11,6 +11,10 @@ #define RQ_GCN64_SET_VIBRATION 0x07 #define RQ_GCN64_RAW_SI_COMMAND 0x80 #define RQ_GCN64_BLOCK_IO 0x81 +#define RQ_RNT_GET_SUPPORTED_REQUESTS 0xF0 +#define RQ_RNT_GET_SUPPORTED_MODES 0xF1 +#define RQ_RNT_GET_SUPPORTED_CFG_PARAMS 0xF2 +#define RQ_RNT_RESET_FIRMWARE 0xFE #define RQ_GCN64_JUMP_TO_BOOTLOADER 0xFF /* Configuration parameters and constants */