Skip to content

Commit

Permalink
Fixed crippling bugs in v1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rsn8887 committed Mar 24, 2016
1 parent f4b4b3b commit 23767f6
Show file tree
Hide file tree
Showing 19 changed files with 1,799 additions and 1,448 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,7 +1,7 @@
# RetroAdapterMod
Mod of Paul Qureshi's Mojo RetroAdapter Firmware

Paul Qureshi RetroAdapter Firmware v2.1a Mod v1.3
Paul Qureshi RetroAdapter Firmware v2.1a Mod v1.4
-------------------------------------------------

References
Expand Down
1,433 changes: 717 additions & 716 deletions RetroAdapterV2_ArcadeMode.hex

Large diffs are not rendered by default.

1,433 changes: 717 additions & 716 deletions RetroAdapterV2_NormalMode.hex

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions changelog.txt
@@ -1,3 +1,10 @@
v1.4
- (Android/Windows) Last update was completely broken, it broke analog directions and 2 player mode, all fixed again now.

- (Android/Windows) Changed the USB polling interval back to 4ms. It makes no difference under Windows, because Windows locks the polling interval for low speed USB devices at 8ms (125 Hz max). However, Linux does not. So a 4ms polling rate should increase the refresh speed under Linux and maybe even Android, while still keeping low cpu usage.

- (Android/Windows) Came up with exact speed test using freqmeter.exe. On Windows the refresh rate is now 124 Hz (62 Hz for NegCon and 2P mode). Under linux it could be even faster.

v1.3
- (Android/Windows) Speed optimization! Used joystick frequency tester to optimize update rate. All single player mode controller rates are now 100 Hz (NegCon 50 Hz). For comparison, a Mayflash Dualjoybox Pro gave 66 Hz (44 Hz for NegCon). I suspect two player mode is also 50 Hz, but I cannot test it because there is no analog axis.

Expand Down
Binary file added misc/GamePad - Free60.pdf
Binary file not shown.
Binary file added misc/HID1_11.pdf
Binary file not shown.
Binary file added misc/Inside Xbox Controller.pdf
Binary file not shown.
Binary file not shown.
Binary file added misc/usbtreeview.zip
Binary file not shown.
48 changes: 48 additions & 0 deletions misc/xbox-hub-desc.txt
@@ -0,0 +1,48 @@
Device Descriptor Fields:

bLength 0x12
bDescriptorType 0x01
bcdUSB 0x0110 (USB spec. 01.10)
bDeviceClass 0x09 (Hub)
bDeviceSubClass 0x00
bDeviceProtocol 0x00
bMaxPacketSize0 0x08
idVendor 0x045E (unknown)
idProduct 0x001C
bcdDevice 0x0500 (release 05.00)
iManufacturer 0x00
iProduct 0x00
iSerialNumber 0x00
bNumConfigurations 0x01 (1)

Configuration Descriptor, Index 0x00

bLength 0x09
bDescriptorType 0x02
wTotalLength 0x0019 (25)
bNumInterfaces 0x01 (1)
bConfigurationValue 0x01
iConfiguration 0x00
bmAttributes 0xA0 (bus powered - remote wakeup)
MaxPower 0x20 (64 mA)

Interface Descriptor (Number 0x00, Alternate Setting 0x00)

bLength 0x09
bDescriptorType 0x04
bInterfaceNumber 0x00
bAlternateSetting 0x00
bNumEndpoints 0x01
bInterfaceClass 0x09 (USB specified device class)
bInterfaceSubClass 0x00
bInterfaceProtocol 0x00 (not vendor or class specific)
iInterface 0x00

Endpoint Descriptor 0x81

bLength 0x07
bDescriptorType 0x05
bEndpointAddress 0x81 (ep #1, IN)
bmAttributes 0x03 (Transfer Type : Interrupt)
wMaxPacketSize 0x0001
bInterval 0xFF (255 milliseconds)
57 changes: 57 additions & 0 deletions misc/xbox-memory-desc.txt
@@ -0,0 +1,57 @@
Device Descriptor Fields:

bLength 0x12
bDescriptorType 0x01
bcdUSB 0x0110 (USB spec. 01.10)
bDeviceClass 0x00 (ifc's specify own)
bDeviceSubClass 0x00
bDeviceProtocol 0x00
bMaxPacketSize0 0x08
idVendor 0x045E (unknown)
idProduct 0x0280
bcdDevice 0x000E (release 00.0E)
iManufacturer 0x00
iProduct 0x00
iSerialNumber 0x00
bNumConfigurations 0x01 (1)

Configuration Descriptor, Index 0x00

bLength 0x09
bDescriptorType 0x02
wTotalLength 0x0020 (32)
bNumInterfaces 0x01 (1)
bConfigurationValue 0x01
iConfiguration 0x00
bmAttributes 0x80 (bus powered)
MaxPower 0x1E (60 mA)

Interface Descriptor (Number 0x00, Alternate Setting 0x00)

bLength 0x09
bDescriptorType 0x04
bInterfaceNumber 0x00
bAlternateSetting 0x00
bNumEndpoints 0x02
bInterfaceClass 0x08 (USB specified device class)
bInterfaceSubClass 0x42
bInterfaceProtocol 0x50 (class specific)
iInterface 0x00

Endpoint Descriptor 0x81

bLength 0x07
bDescriptorType 0x05
bEndpointAddress 0x81 (ep #1, IN)
bmAttributes 0x02 (Transfer Type : Bulk)
wMaxPacketSize 0x0040
bInterval 0x00 (0 milliseconds)

Endpoint Descriptor 0x02

bLength 0x07
bDescriptorType 0x05
bEndpointAddress 0x02 (ep #2, OUT)
bmAttributes 0x02 (Transfer Type : Bulk)
wMaxPacketSize 0x0040
bInterval 0x00 (0 milliseconds)
57 changes: 57 additions & 0 deletions misc/xbox-pad-desc.txt
@@ -0,0 +1,57 @@
Device Descriptor Fields:

bLength 0x12
bDescriptorType 0x01
bcdUSB 0x0110 (USB spec. 01.10)
bDeviceClass 0x00 (ifc's specify own)
bDeviceSubClass 0x00
bDeviceProtocol 0x00
bMaxPacketSize0 0x40
idVendor 0x045E (unknown)
idProduct 0x0202
bcdDevice 0x0100 (release 01.00)
iManufacturer 0x00
iProduct 0x00
iSerialNumber 0x00
bNumConfigurations 0x01 (1)

Configuration Descriptor, Index 0x00

bLength 0x09
bDescriptorType 0x02
wTotalLength 0x0020 (32)
bNumInterfaces 0x01 (1)
bConfigurationValue 0x01
iConfiguration 0x00
bmAttributes 0x80 (bus powered)
MaxPower 0x32 (100 mA)

Interface Descriptor (Number 0x00, Alternate Setting 0x00)

bLength 0x09
bDescriptorType 0x04
bInterfaceNumber 0x00
bAlternateSetting 0x00
bNumEndpoints 0x02
bInterfaceClass 0x58 (USB specified device class)
bInterfaceSubClass 0x42
bInterfaceProtocol 0x00 (not vendor or class specific)
iInterface 0x00

Endpoint Descriptor 0x82

bLength 0x07
bDescriptorType 0x05
bEndpointAddress 0x82 (ep #2, IN)
bmAttributes 0x03 (Transfer Type : Interrupt)
wMaxPacketSize 0x0020- Must be full speed device
bInterval 0x04 (4 milliseconds)

Endpoint Descriptor 0x02

bLength 0x07
bDescriptorType 0x05
bEndpointAddress 0x02 (ep #2, OUT)
bmAttributes 0x03 (Transfer Type : Interrupt)
wMaxPacketSize 0x0020- Must be full speed device
bInterval 0x04 (4 milliseconds)
Binary file added misc/xbox-pad-report-desc.hid
Binary file not shown.
159 changes: 159 additions & 0 deletions misc/xbox-pad-report-desc.txt
@@ -0,0 +1,159 @@
0501 Usage Page (Generic Desktop)
0905 Usage (Game Pad)
A101 Collection (Application)

0501 Usage Page (Generic Desktop)
093A Usage (Counted Buffer) ;XXX
A102 Collection (Logical)

; padding
7508 Report Size (8)
9501 Report Count (1)
8101 Input (Constant)

; byte count
7508 Report Size (8)
9501 Report Count (1)
0501 Usage Page (Generic Desktop)
093B Usage (Byte Count) ;XXX
8101 Input (Constant)

; D-pad
0501 Usage Page (Generic Desktop)
0901 Usage (Pointer)
A100 Collection (Physical)
7501 Report Size (1)
1500 Logical Minimum (0)
2501 Logical Maximum (1)
3500 Physical Minimum (0)
4501 Physical Maximum (1)
9504 Report Count (4)
0501 Usage Page (Generic Desktop)
0990 Usage (D-pad Up)
0991 Usage (D-pad Down)
0993 Usage (D-pad Left)
0992 Usage (D-pad Right)
8102 Input (Data,Variable,Absolute)
C0 End Collection

; start, back, stick press
7501 Report Size (1)
1500 Logical Minimum (0)
2501 Logical Maximum (1)
3500 Physical Minimum (0)
4501 Physical Maximum (1)
9504 Report Count (4)
0509 Usage Page (Button)
1907 Usage Minimum (Button 7)
290A Usage Maximum (Button 10)
8102 Input (Data,Variable,Absolute)

; reserved
7501 Report Size (1)
9508 Report Count (8)
8101 Input (Constant)

; analog buttons
7508 Report Size (8)
1500 Logical Minimum (0)
26FF00 Logical Maximum (255)
3500 Physical Minimum (0)
46FF00 Physical Maximum (255)
9506 Report Count (6)
0509 Usage Page (Button)
1901 Usage Minimum (Button 1)
2906 Usage Minimum (Button 6)
8102 Input (Data,Variable,Absolute)

; triggers
7508 Report Size (8)
1500 Logical Minimum (0)
26FF00 Logical Maximum (255)
3500 Physical Minimum (0)
46FF00 Physical Maximum (255)
9502 Report Count (2)
0501 Usage Page (Generic Desktop)
0932 Usage (Z)
0935 Usage (Rz)
8102 Input (Data,Variable,Absolute)

; sticks
7510 Report Size (16)
160080 Logical Minimum (-32768)
26FF7F Logical Maximum (32767)
360080 Physical Minimum (-32768)
46FF7F Physical Maximum (32767)

0501 Usage Page (Generic Desktop)
0901 Usage (Pointer)
A100 Collection (Physical)
9502 Report Count (2)
0501 Usage Page (Generic Desktop)
0930 Usage (X)
0931 Usage (Y) ;north positive
8102 Input (Data,Variable,Absolute)
C0 End Collection

0501 Usage Page (Generic Desktop)
0901 Usage (Pointer)
A100 Collection (Physical)
9502 Report Count (2)
0501 Usage Page (Generic Desktop)
0933 Usage (Rx)
0934 Usage (Ry) ;north positive
8102 Input (Data,Variable,Absolute)
C0 End Collection

C0 End Collection

0501 Usage Page (Generic Desktop)
093A Usage (Counted Buffer) ;XXX
A102 Collection (Logical)

; padding
7508 Report Size (8)
9501 Report Count (1)
9101 Output (Constant)

; byte count
7508 Report Size (8)
9501 Report Count (1)
0501 Usage Page (Generic Desktop)
093B Usage (Byte Count) ;XXX
9101 Output (Constant)

; padding
7508 Report Size (8)
9501 Report Count (1)
9101 Output (Constant)

; left actuator
7508 Report Size (8)
1500 Logical Minimum (0)
26FF00 Logical Maximum (255)
3500 Physical Minimum (0)
46FF00 Physical Maximum (255)
9501 Report Count (1)
0600FF Usage Page (vendor-defined)
0901 Usage (1)
9102 Output (Data,Variable,Absolute)

; padding
7508 Report Size (8)
9501 Report Count (1)
9101 Output (Constant)

; right actuator
7508 Report Size (8)
1500 Logical Minimum (0)
26FF00 Logical Maximum (255)
3500 Physical Minimum (0)
46FF00 Physical Maximum (255)
9501 Report Count (1)
0600FF Usage Page (vendor-defined)
0902 Usage (2)
9102 Output (Data,Variable,Absolute)

C0 End Collection

C0 End Collection
9 changes: 2 additions & 7 deletions readme.txt
@@ -1,10 +1,5 @@
NOTE: THIS VERSION IS MODIFIED TO BE USED WITH A 16 MHZ CRYSTAL INSTEAD OF 15 MHZ.
THIS VERSION WILL NOT WORK WITH THE ORIGINAL MOJO RETROADAPTER WHICH IS EQUIPPED WITH
A 15 MHZ CRYSTAL. FOR THE ORIGINAL VERSION OF THIS MOD FOR 15 MHZ, GO TO
https://github.com/rsn8887/RetroAdapterMod/releases

Paul Qureshi RetroAdapter Firmware v2.1a Mod v1.3
--------------------------------------------------
Paul Qureshi RetroAdapter Firmware v2.1a Mod v1.4
---------------------------------------------------

References
----------
Expand Down
18 changes: 15 additions & 3 deletions src_NormalAndArcadeMode/ArcadeMode/RetroAdapterV2.c
Expand Up @@ -532,6 +532,8 @@ int main(void)
ReadController(1);
SetHIDMode();

// uchar j = 1; //for speed test only

for(;;){ /* main event loop */
usbPoll();
if(usbInterruptIsReady()){
Expand All @@ -540,7 +542,12 @@ int main(void)

switch (hidCurrentMode)
{
case HIDM_1P || HIDM_2P:
case HIDM_1P:
RemapController(&(reportBuffer.x), &(reportBuffer.y),
&(reportBuffer.rx), &(reportBuffer.ry),
&(reportBuffer.b1), &(reportBuffer.b2));
break;
case HIDM_2P:
RemapController(&(reportBuffer.x), &(reportBuffer.y),
&(reportBuffer.rx), &(reportBuffer.ry),
&(reportBuffer.b1), &(reportBuffer.b2));
Expand All @@ -551,10 +558,15 @@ int main(void)
&(reportBufferNegCon.b1), &(reportBufferNegCon.b2));
break;
}

remainingData=reportBufferLength;
offset=0;


// For speed test, uncommnent the next three lines and the line "uchar j=0" above
// reportBuffer.x=(j%4)*10; //for speed test only
// reportBufferNegCon.x=(j%4)*10; //for speed test only
// j++; //for speed test only

// handle report with more than 8 byte length (for NegCon and future expansion)
do {
if (remainingData<=8) {
Expand Down

0 comments on commit 23767f6

Please sign in to comment.