1
0
mirror of https://github.com/raphnet/gc_n64_usb-v3 synced 2024-12-21 14:58:51 -05:00

Force rumble through command

This commit is contained in:
Raphael Assenat 2015-11-06 23:27:30 -05:00
parent 05a30a21ba
commit 3757250833
6 changed files with 22 additions and 2 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 gamepads.o
VERSIONSTR=\"3.0.0\"
VERSIONSTR=\"3.1.0\"

View File

@ -1,3 +1,6 @@
- October 5, 2015 : Version 3.1.0
- Add a test rumble command (for GUI tool, or for simple rumble control)
- October 2, 2015 : Version 3.0.0
Initial release:
- Gamecube and N64 controller support

View File

@ -115,6 +115,12 @@ static void hiddata_processCommandBuffer(void)
cmdbuf[2] = current_pad_type;
cmdbuf_len = 3;
break;
case RQ_GCN64_SET_VIBRATION:
// CMD : RQ, CHN, Vibrate
// Answer: RQ, CHN, Vibrate
usbpad_forceVibrate(cmdbuf[2]);
cmdbuf_len = 3;
break;
}
#ifdef DEBUG

View File

@ -8,6 +8,7 @@
#define RQ_GCN64_GET_VERSION 0x04
#define RQ_GCN64_GET_SIGNATURE 0x05
#define RQ_GCN64_GET_CONTROLLER_TYPE 0x06
#define RQ_GCN64_SET_VIBRATION 0x07
#define RQ_GCN64_RAW_SI_COMMAND 0x80
#define RQ_GCN64_JUMP_TO_BOOTLOADER 0xFF

View File

@ -36,7 +36,7 @@
static volatile unsigned char gamepad_vibrate = 0; // output
static unsigned char vibration_on = 0;
static unsigned char vibration_on = 0, force_vibrate = 0;
static unsigned char constant_force = 0;
static unsigned char magnitude = 0;
@ -209,8 +209,17 @@ void usbpad_update(const gamepad_data *pad_data)
}
}
void usbpad_forceVibrate(char force)
{
force_vibrate = force;
}
char usbpad_mustVibrate(void)
{
if (force_vibrate) {
return 1;
}
if (!vibration_on) {
gamepad_vibrate = 0;
} else {

View File

@ -9,6 +9,7 @@ unsigned char *usbpad_getReportBuffer(void);
void usbpad_update(const gamepad_data *pad_data);
char usbpad_mustVibrate(void);
void usbpad_forceVibrate(char force);
uint8_t usbpad_hid_set_report(const struct usb_request *rq, const uint8_t *data, uint16_t len);
uint16_t usbpad_hid_get_report(struct usb_request *rq, const uint8_t **dat);