Skip to content

Commit

Permalink
Merge pull request #7 from CrazyRedMachine/master
Browse files Browse the repository at this point in the history
Konami spoof (Infinitas/UM support)
  • Loading branch information
Gladuin authored Nov 21, 2022
2 parents c160310 + 8ca9dc4 commit 289a480
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
5 changes: 4 additions & 1 deletion config-tool/config-tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

def get_filtered_devices():
filter = hid.HidDeviceFilter(vendor_id = 0x0001, product_id = 0x0001)
# might be in konami spoof mode
if len(filter.get_devices()) == 0:
filter = hid.HidDeviceFilter(vendor_id = 0x1ccf, product_id = 0x8086)
return filter.get_devices()

def send(data):
Expand Down Expand Up @@ -168,4 +171,4 @@ def run(self):
status_label.config(text = "Controller disconnected")
status_label.config(foreground = "red")

time.sleep(1)
time.sleep(1)
26 changes: 22 additions & 4 deletions iidx-controller/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,31 @@
};

// Pins where the encoder is connected to
static const uint8_t encoder_pin0 = 0; // green wire (a phase)
static const uint8_t encoder_pin1 = 1; // white wire (b phase)
#define ENCODER_PIN_A 0 // green wire (a phase)
#define ENCODER_PIN_B 1 // white wire (b phase)

/* OPTIONS */
// Your encoder pulses per rotation
#define ENCODER_PPR 600


// Spoof the konami premium controller (UM/Infinitas compatibility)
#define KONAMI_SPOOF 1

#if KONAMI_SPOOF == 0
#define VID 0x0001
#define PID 0x0001
// The manufacturer name of this controller (leave the L in front of the ")
#define MF_NAME L"username"
#define MF_NAME L"username"
#define PROD_NAME L"IIDX Controller"
static const uint8_t encoder_pin0 = ENCODER_PIN_A;
static const uint8_t encoder_pin1 = ENCODER_PIN_B;
#else
#define VID 0x1ccf
#define PID 0x8086
#define MF_NAME L"Konami Amusement"
#define PROD_NAME L"beatmania IIDX controller premium model"
static const uint8_t encoder_pin0 = ENCODER_PIN_B;
static const uint8_t encoder_pin1 = ENCODER_PIN_A;
#endif

#endif
8 changes: 4 additions & 4 deletions iidx-controller/src/HID/Descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ USB_Descriptor_HIDReport_Datatype_t joystick_report[] = {
HID_RI_REPORT_SIZE(8, 16),
HID_RI_REPORT_COUNT(8, 1),
HID_RI_COLLECTION(8, 0),
HID_RI_USAGE(8, 49),
HID_RI_USAGE(8, 48),
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
HID_RI_END_COLLECTION(0),

Expand Down Expand Up @@ -186,8 +186,8 @@ const USB_Descriptor_Device_t PROGMEM device_descriptor = {

.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,

.VendorID = 0x0001,
.ProductID = 0x0001,
.VendorID = VID,
.ProductID = PID,
.ReleaseNumber = VERSION_BCD(0,0,1),

.ManufacturerStrIndex = STRING_ID_Manufacturer,
Expand Down Expand Up @@ -329,7 +329,7 @@ USB_descriptor_configuration_struct configuration_descriptor = {

const USB_Descriptor_String_t PROGMEM language_string = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG);
const USB_Descriptor_String_t PROGMEM manufacturer_string = USB_STRING_DESCRIPTOR(MF_NAME);
const USB_Descriptor_String_t PROGMEM product_string = USB_STRING_DESCRIPTOR(L"IIDX Controller");
const USB_Descriptor_String_t PROGMEM product_string = USB_STRING_DESCRIPTOR(PROD_NAME);

const USB_Descriptor_String_t PROGMEM
LEDString_00 = USB_STRING_DESCRIPTOR(L"Button 1"),
Expand Down

0 comments on commit 289a480

Please sign in to comment.