mirror of
https://github.com/whowechina/iidx_pico.git
synced 2024-11-24 06:50:13 +01:00
Konami spoof mode support.
This commit is contained in:
parent
aec14a715c
commit
14afa815bb
Binary file not shown.
Binary file not shown.
@ -37,6 +37,7 @@ typedef struct __attribute ((packed)) {
|
|||||||
uint8_t e3;
|
uint8_t e3;
|
||||||
uint8_t e4;
|
uint8_t e4;
|
||||||
} effects;
|
} effects;
|
||||||
|
bool konami; /* konami spoof */
|
||||||
} iidx_cfg_t;
|
} iidx_cfg_t;
|
||||||
|
|
||||||
extern iidx_cfg_t *iidx_cfg;
|
extern iidx_cfg_t *iidx_cfg;
|
||||||
|
@ -57,6 +57,24 @@ void boot_check()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mode_check()
|
||||||
|
{
|
||||||
|
uint16_t key1 = (1 << (button_num() - 1));
|
||||||
|
uint16_t key2 = (1 << (button_num() - 2));
|
||||||
|
uint16_t buttons = button_read();
|
||||||
|
if (buttons & key1) {
|
||||||
|
iidx_cfg->konami = true;
|
||||||
|
save_request();
|
||||||
|
} else if (buttons & key2) {
|
||||||
|
iidx_cfg->konami = false;
|
||||||
|
save_request();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iidx_cfg->konami) {
|
||||||
|
konami_mode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool request_core1_pause = false;
|
static bool request_core1_pause = false;
|
||||||
|
|
||||||
static void pause_core1(bool pause)
|
static void pause_core1(bool pause)
|
||||||
@ -132,6 +150,8 @@ void init()
|
|||||||
setup_init();
|
setup_init();
|
||||||
config_init();
|
config_init();
|
||||||
save_init(pause_core1);
|
save_init(pause_core1);
|
||||||
|
|
||||||
|
mode_check();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Device Descriptors
|
// Device Descriptors
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
tusb_desc_device_t const desc_device_joy = {
|
tusb_desc_device_t desc_device_joy = {
|
||||||
.bLength = sizeof(tusb_desc_device_t),
|
.bLength = sizeof(tusb_desc_device_t),
|
||||||
.bDescriptorType = TUSB_DESC_DEVICE,
|
.bDescriptorType = TUSB_DESC_DEVICE,
|
||||||
.bcdUSB = 0x0200,
|
.bcdUSB = 0x0200,
|
||||||
@ -127,7 +127,7 @@ uint8_t const* tud_descriptor_configuration_cb(uint8_t index) {
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
|
||||||
// array of pointer to string descriptors
|
// array of pointer to string descriptors
|
||||||
char const* string_desc_arr[] = {
|
const char *string_desc_arr[] = {
|
||||||
(const char[]){0x09, 0x04}, // 0: is supported language is English (0x0409)
|
(const char[]){0x09, 0x04}, // 0: is supported language is English (0x0409)
|
||||||
"WHowe" , // 1: Manufacturer
|
"WHowe" , // 1: Manufacturer
|
||||||
"Pico IIDX Controller", // 2: Product
|
"Pico IIDX Controller", // 2: Product
|
||||||
@ -185,3 +185,11 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid) {
|
|||||||
|
|
||||||
return _desc_str;
|
return _desc_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void konami_mode()
|
||||||
|
{
|
||||||
|
desc_device_joy.idVendor = 0x1ccf;
|
||||||
|
desc_device_joy.idProduct = 0x8048;
|
||||||
|
string_desc_arr[1] = "Konami Amusement";
|
||||||
|
string_desc_arr[2] = "beatmania IIDX controller premium model";
|
||||||
|
}
|
||||||
|
@ -64,4 +64,8 @@ enum {
|
|||||||
HID_USAGE_PAGE(HID_USAGE_PAGE_KEYBOARD), HID_USAGE_MIN(0), \
|
HID_USAGE_PAGE(HID_USAGE_PAGE_KEYBOARD), HID_USAGE_MIN(0), \
|
||||||
HID_USAGE_MAX(31 * 8 - 1), HID_INPUT(HID_VARIABLE), HID_COLLECTION_END
|
HID_USAGE_MAX(31 * 8 - 1), HID_INPUT(HID_VARIABLE), HID_COLLECTION_END
|
||||||
|
|
||||||
|
|
||||||
|
/* Enable Konami spoof mode */
|
||||||
|
void konami_mode();
|
||||||
|
|
||||||
#endif /* USB_DESCRIPTORS_H_ */
|
#endif /* USB_DESCRIPTORS_H_ */
|
Loading…
Reference in New Issue
Block a user