Skip to content

Commit

Permalink
fixed button mappings to make them more sensible
Browse files Browse the repository at this point in the history
  • Loading branch information
rsn8887 committed Jul 17, 2015
1 parent 1f4c2d8 commit c269c82
Show file tree
Hide file tree
Showing 11 changed files with 159 additions and 113 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 v0.99
Paul Qureshi RetroAdapter Firmware v2.1a Mod v1.0
--------------------------------------------------

References
Expand Down
12 changes: 6 additions & 6 deletions RetroAdapterV2_ArcadeMode.hex
Expand Up @@ -92,15 +92,15 @@
:1005B000492F253021F0293081F180E00895BFEFE7
:1005C000BA95F1F7B8ECBA95F1F791E080D09DD0EB
:1005D00069D0292F67D0392F65D0492F63D0592F83
:1005E0004083518340E050E027FD416026FD446098
:1005E0004083518340E050E027FD426026FD41609A
:1005F00025FD546024FD52602F7035FD406434FDAC
:10060000406833FD486032FD426031FD406130FD9D
:10060000406833FD486032FD446031FD406130FD9B
:10061000406245835683822F0895B4E6BA95F1F778
:1006200090E455D093E053D092E051D06ED03AD0C0
:10063000292F38D0392F36D0492F34D0592F32D0E6
:10064000692F30D0792F2ED0892F2CD04058505878
:1006500040835183605870586283738340E050E058
:1006600020FD416021FD446022FD426023FD486081
:1006600020FD426021FD416022FD486023FD446081
:1006700024FD526034FD546035FD406836FD406411
:10068000803408F04064903408F040684583568315
:100690003F70232F3E7F31FD31603D7F20FD326072
Expand Down Expand Up @@ -431,10 +431,10 @@
:101AE00003C08E8184608E83489903C08E8181609B
:101AF0008E834C9903C08F8188608F83E5E2F0E08C
:101B000080818B7F80830E94990C1C9903C08E81F9
:101B100080628E831D9903C08E8180618E83489977
:101B200003C08E8188608E834C9903C08E8180684B
:101B100080688E831D9903C08E8180648E8348996E
:101B200003C08E8188608E834C9903C08E81806251
:101B30008E83E5E2F0E08081846080830E94A40CC3
:101B40004C9903C08E8180648E83E5E2F0E0808151
:101B40004C9903C08E8180618E83E5E2F0E0808154
:101B50008B7F80830E94990C1C9902C000E101C018
:101B600000E01D9B0062489B00644C9B0068E5E21E
:101B7000F0E08081846080830E94A40C1C9B016043
Expand Down
12 changes: 6 additions & 6 deletions RetroAdapterV2_NormalMode.hex
Expand Up @@ -92,15 +92,15 @@
:1005B000492F253021F0293081F180E00895BFEFE7
:1005C000BA95F1F7B8ECBA95F1F791E080D09DD0EB
:1005D00069D0292F67D0392F65D0492F63D0592F83
:1005E0004083518340E050E027FD416026FD446098
:1005E0004083518340E050E027FD426026FD41609A
:1005F00025FD546024FD52602F7035FD406434FDAC
:10060000406833FD486032FD426031FD406130FD9D
:10060000406833FD486032FD446031FD406130FD9B
:10061000406245835683822F0895B4E6BA95F1F778
:1006200090E455D093E053D092E051D06ED03AD0C0
:10063000292F38D0392F36D0492F34D0592F32D0E6
:10064000692F30D0792F2ED0892F2CD04058505878
:1006500040835183605870586283738340E050E058
:1006600020FD416021FD446022FD426023FD486081
:1006600020FD426021FD416022FD486023FD446081
:1006700024FD526034FD546035FD406836FD406411
:10068000803408F04064903408F040684583568315
:100690003F70232F3E7F31FD31603D7F20FD326072
Expand Down Expand Up @@ -579,10 +579,10 @@
:102420001D9903C08E8184608E83489903C08E817C
:1024300081608E834C9903C08F8188608F83E5E231
:10244000F0E080818B7F80830E943A111C9903C049
:102450008E8180628E831D9903C08E8180618E8300
:102450008E8180688E831D9903C08E8180648E83F7
:10246000489903C08E8188608E834C9903C08E8109
:1024700080688E83E5E2F0E08081846080830E9442
:1024800045114C9903C08E8180648E83E5E2F0E0B3
:1024700080628E83E5E2F0E08081846080830E9448
:1024800045114C9903C08E8180618E83E5E2F0E0B6
:1024900080818B7F80830E943A111C9902C000E1E9
:1024A00001C000E01D9B0062489B00644C9B0068DB
:1024B000E5E2F0E08081846080830E9445111C9BEE
Expand Down
24 changes: 24 additions & 0 deletions changelog.txt
@@ -1,3 +1,27 @@
v1.0
- fixed button mappings again to make them more sensible
- new and hopefully final button layout:
Button 1: bottom button (SNES B, PSX Cross, NegCon B, NES B, NeoGeo A, Genesis A, Gamecube B, N64 B, PCE II)
Button 2: right button (SNES A, PSX Circle, NegCon A, NES A, Neogeo B, Genesis B, Gamecube A, N64 A, PCE I)
Button 4: left button (SNES Y, PSX Square, NeoGeo C, Genesis C, Gamecube Y, N64 Yellow Down),
Button 5: upper button (SNES X, PSX Triangle, NeoGeo D, Genesis X, Gamecube X, N64 Yellow Up)
Button 7: Left Shoulder (SNES L, PSX L1, Genesis Y, Gamecube L, N64 L)
Button 8: Right Shoulder (SNES R, PSX R1, Genesis Z, Gamecube R, N64 R)
Button 9: Misc 1 (PSX L2, N64 Yellow Left, Saturn L)
Button 10: Misc 2 (PSX R2, N64 Yellow Right, Saturn R)
Button 11: Select
Button 12: Start (PC Engine Play, Genesis Mode)
Button 14: Misc 3 (PSX L3, N64 Z, Gamecube Z)
Button 15: Misc 4 (PSX R3)
Analog:
Left Joystick: x,y
Right Joystick: z,Rz
NegCon mode (identifies as "Mojo Retro Adapter NegCon" instead of "Mojo Retro Adapter" when detected):
Steering: x
Button I: z (0..255 in NegCon mode instead of -128..127)
Button II: "Accelerator" axis
Button L: "Brake axis"

v0.99
- changed USB Usage ID to game pad to comply with Android and Windows simultaneously
- new button layout to fully conform with Android while maintaining Windows compatibility
Expand Down
Binary file added misc/Android_KeyEvents.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion readme.txt
@@ -1,4 +1,4 @@
Paul Qureshi RetroAdapter Firmware v2.1a Mod v0.99
Paul Qureshi RetroAdapter Firmware v2.1a Mod v1.0
--------------------------------------------------

References
Expand Down
97 changes: 54 additions & 43 deletions src_NormalAndArcadeMode/ArcadeMode/RetroAdapterV2.c
Expand Up @@ -7,34 +7,44 @@
* License: GNU GPL v2
*/

/* Button mapping to conform with Android:
button 1: bottom button (SNES B, PSX Cross, NegCon B, NES B, NeoGeo A, Genesis A, Gamecube A, N64 A. PCE II),
button 2: right button (SNES A, PSX Circle, NegCon A, NES A, Neogeo B, Genesis B, Gamecube X, N64 Yellow Down, PCE I)
/* Button mapping (used to conform with Android and Windows simultaneously):
Button 1: bottom button (SNES B, PSX Cross, NegCon B, NES B, NeoGeo A, Genesis A, Gamecube B, N64 B, PCE II)
Button 2: right button (SNES A, PSX Circle, NegCon A, NES A, Neogeo B, Genesis B, Gamecube A, N64 A, PCE I)
Button 4: left button (SNES Y, PSX Square, NeoGeo C, Genesis C, Gamecube Y, N64 Yellow Down),
Button 5: upper button (SNES X, PSX Triangle, NeoGeo D, Genesis X, Gamecube X, N64 Yellow Up)
Button 7: Left Shoulder (SNES L, PSX L1, Genesis Y, Gamecube L, N64 L)
Button 8: Right Shoulder (SNES R, PSX R1, Genesis Z, Gamecube R, N64 R)
Button 9: Misc 1 (PSX L2, N64 Yellow Left, Saturn L)
Button 10: Misc 2 (PSX R2, N64 Yellow Right, Saturn R)
Button 11: Select
Button 12: Start (PC Engine Play, Genesis Mode)
Button 14: Misc 3 (PSX L3, N64 Z, Gamecube Z)
Button 15: Misc 4 (PSX R3)
button 4: left button (SNES Y, PSX Square, NeoGeo C, Genesis C, Gamecube B, N64 B),
button 5: upper button (SNES X, PSX Triangle, NeoGeo D, Genesis X, Gamecube Y, N64 Yellow Up)
button 7: Left Shoulder (PSX L1, Genesis Y, Gamecube L, N64 L, Saturn L)
button 8: Right Shoulder (PSX R1 Genesis Z, Gamecube R, N64 R, Saturn R)
button 9: Misc 1 (PSX L2, N64 Yellow Left),
button 10: Misc 2 (PSX R2, N64 Yellow Right),
button 11: Select
button 12: Start (PC Engine Play, Genesis Mode)
button 14: Misc 3 (PSX L3, N64 Z, Gamecube Z)
button 15: Misc 4 (PSX R3)
Analog:
Left Joystick: x,y
Right Joystick: z,Rz
NegCon mode, identifies as "Mojo Retro Adapter NegCon" instead of "Mojo Retro Adapter" when detected:
Steering: x
Button I: z (0..255 in NegCon mode instead of -128..127)
Button II: "Accelerator" axis
Button L: "Brake axis"
*/

Analog:
Left Joystick: x,y
Right Joystick: z,Rz
NegCon mode (identifies as "Mojo Retro Adapter NegCon" instead of "Mojo Retro Adapter" when NegCon is detected):
Steering: x
Button I: z (0..255 in NegCon mode instead of -128..127)
Button II: "Accelerator" axis
Button L: "Brake axis"
/*
Updated bitmap used in all current controller subroutines:
b1 bit 0 bottom button
bit 1 right button
bit 2 left button
bit 3 upper button
bit 4 L2
bit 5 R2
bit 6 L1
bit 7 R1
b2 bit 0 Select
bit 1 Start
bit 2 L3
bit 3 R3
*/

#include <avr/io.h>
Expand Down Expand Up @@ -395,21 +405,22 @@ uchar usbFunctionDescriptor(struct usbRequest *rq)
/* ------------------------------------------------------------------------- */
void RemapButtons(uchar *b1, uchar *b2)
{
/* Updated mapping used in all current subroutines:
bit 0 button 1: bottom button (SNES B, PSX Cross, NegCon B, NES B, NeoGeo A, Genesis A, Gamecube A, N64 A. PCE II),
bit 1 button 2: right button (SNES A, PSX Circle, NegCon A, NES A, Neogeo B, Genesis B, Gamecube X, N64 Yellow Down, PCE I)
bit 2 button 3: left button (SNES Y, PSX Square, NeoGeo C, Genesis C, Gamecube B, N64 B),
bit 3 button 4: upper button (SNES X, PSX Triangle, NeoGeo D, Genesis X, Gamecube Y, N64 Yellow Up)
bit 4 button 5: Misc 1 (PSX L2, N64 Yellow Left),
bit 5 button 6: Misc 2 (PSX R2, N64 Yellow Right),
bit 6 button 7: Left Shoulder (PSX L1, Genesis Y, Gamecube L, N64 L, Saturn L)
bit 7 button 8: Right Shoulder (PSX R1 Genesis Z, Gamecube R, N64 R, Saturn R)
bit 0 button 9: Select
bit 1 button 10: Start (PC Engine Play, Genesis Mode)
bit 2 button 11: Misc 3 (PSX L3, N64 Z, Gamecube Z)
bit 3 button 12: Misc 4 (PSX R3)
/* Mapping required by Android
/*
Updated mapping used in all current subroutines:
b1 bit 0 bottom button
bit 1 right button
bit 2 left button
bit 3 upper button
bit 4 L2
bit 5 R2
bit 6 L1
bit 7 R1
b2 bit 0 Select
bit 1 Start
bit 2 L3
bit 3 R3
Mapping required by Android:
buttons in parentheses are non-standard, but seem to be supported in android
bit 0 button 1: Android A (bottom)
bit 1 button 2: Android B (right)
Expand All @@ -424,8 +435,8 @@ void RemapButtons(uchar *b1, uchar *b2)
bit 2 button 11: (Android Select) (Select)
bit 3 button 12: (Android Start) (Start)
bit 4 button 13: ??
bit 5 button 14: Android Left Stick Press
bit 6 button 15: Android Right Stick Press
bit 5 button 14: Android Left Thumb Stick Press
bit 6 button 15: Android Right Thumb Stick Press
bit 7 button 16: ??
*/

Expand Down
97 changes: 54 additions & 43 deletions src_NormalAndArcadeMode/RetroAdapterV2.c
Expand Up @@ -7,34 +7,44 @@
* License: GNU GPL v2
*/

/* Button mapping to conform with Android:
button 1: bottom button (SNES B, PSX Cross, NegCon B, NES B, NeoGeo A, Genesis A, Gamecube A, N64 A. PCE II),
button 2: right button (SNES A, PSX Circle, NegCon A, NES A, Neogeo B, Genesis B, Gamecube X, N64 Yellow Down, PCE I)
/* Button mapping (used to conform with Android and Windows simultaneously):
Button 1: bottom button (SNES B, PSX Cross, NegCon B, NES B, NeoGeo A, Genesis A, Gamecube B, N64 B, PCE II)
Button 2: right button (SNES A, PSX Circle, NegCon A, NES A, Neogeo B, Genesis B, Gamecube A, N64 A, PCE I)
Button 4: left button (SNES Y, PSX Square, NeoGeo C, Genesis C, Gamecube Y, N64 Yellow Down),
Button 5: upper button (SNES X, PSX Triangle, NeoGeo D, Genesis X, Gamecube X, N64 Yellow Up)
Button 7: Left Shoulder (SNES L, PSX L1, Genesis Y, Gamecube L, N64 L)
Button 8: Right Shoulder (SNES R, PSX R1, Genesis Z, Gamecube R, N64 R)
Button 9: Misc 1 (PSX L2, N64 Yellow Left, Saturn L)
Button 10: Misc 2 (PSX R2, N64 Yellow Right, Saturn R)
Button 11: Select
Button 12: Start (PC Engine Play, Genesis Mode)
Button 14: Misc 3 (PSX L3, N64 Z, Gamecube Z)
Button 15: Misc 4 (PSX R3)
button 4: left button (SNES Y, PSX Square, NeoGeo C, Genesis C, Gamecube B, N64 B),
button 5: upper button (SNES X, PSX Triangle, NeoGeo D, Genesis X, Gamecube Y, N64 Yellow Up)
button 7: Left Shoulder (PSX L1, Genesis Y, Gamecube L, N64 L, Saturn L)
button 8: Right Shoulder (PSX R1 Genesis Z, Gamecube R, N64 R, Saturn R)
button 9: Misc 1 (PSX L2, N64 Yellow Left),
button 10: Misc 2 (PSX R2, N64 Yellow Right),
button 11: Select
button 12: Start (PC Engine Play, Genesis Mode)
button 14: Misc 3 (PSX L3, N64 Z, Gamecube Z)
button 15: Misc 4 (PSX R3)
Analog:
Left Joystick: x,y
Right Joystick: z,Rz
NegCon mode, identifies as "Mojo Retro Adapter NegCon" instead of "Mojo Retro Adapter" when detected:
Steering: x
Button I: z (0..255 in NegCon mode instead of -128..127)
Button II: "Accelerator" axis
Button L: "Brake axis"
*/

Analog:
Left Joystick: x,y
Right Joystick: z,Rz
NegCon mode (identifies as "Mojo Retro Adapter NegCon" instead of "Mojo Retro Adapter" when NegCon is detected):
Steering: x
Button I: z (0..255 in NegCon mode instead of -128..127)
Button II: "Accelerator" axis
Button L: "Brake axis"
/*
Updated bitmap used in all current controller subroutines:
b1 bit 0 bottom button
bit 1 right button
bit 2 left button
bit 3 upper button
bit 4 L2
bit 5 R2
bit 6 L1
bit 7 R1
b2 bit 0 Select
bit 1 Start
bit 2 L3
bit 3 R3
*/

#include <avr/io.h>
Expand Down Expand Up @@ -395,21 +405,22 @@ uchar usbFunctionDescriptor(struct usbRequest *rq)
/* ------------------------------------------------------------------------- */
void RemapButtons(uchar *b1, uchar *b2)
{
/* Updated mapping used in all current subroutines:
bit 0 button 1: bottom button (SNES B, PSX Cross, NegCon B, NES B, NeoGeo A, Genesis A, Gamecube A, N64 A. PCE II),
bit 1 button 2: right button (SNES A, PSX Circle, NegCon A, NES A, Neogeo B, Genesis B, Gamecube X, N64 Yellow Down, PCE I)
bit 2 button 3: left button (SNES Y, PSX Square, NeoGeo C, Genesis C, Gamecube B, N64 B),
bit 3 button 4: upper button (SNES X, PSX Triangle, NeoGeo D, Genesis X, Gamecube Y, N64 Yellow Up)
bit 4 button 5: Misc 1 (PSX L2, N64 Yellow Left),
bit 5 button 6: Misc 2 (PSX R2, N64 Yellow Right),
bit 6 button 7: Left Shoulder (PSX L1, Genesis Y, Gamecube L, N64 L, Saturn L)
bit 7 button 8: Right Shoulder (PSX R1 Genesis Z, Gamecube R, N64 R, Saturn R)
bit 0 button 9: Select
bit 1 button 10: Start (PC Engine Play, Genesis Mode)
bit 2 button 11: Misc 3 (PSX L3, N64 Z, Gamecube Z)
bit 3 button 12: Misc 4 (PSX R3)
/* Mapping required by Android
/*
Updated mapping used in all current subroutines:
b1 bit 0 bottom button
bit 1 right button
bit 2 left button
bit 3 upper button
bit 4 L2
bit 5 R2
bit 6 L1
bit 7 R1
b2 bit 0 Select
bit 1 Start
bit 2 L3
bit 3 R3
Mapping required by Android:
buttons in parentheses are non-standard, but seem to be supported in android
bit 0 button 1: Android A (bottom)
bit 1 button 2: Android B (right)
Expand All @@ -424,8 +435,8 @@ void RemapButtons(uchar *b1, uchar *b2)
bit 2 button 11: (Android Select) (Select)
bit 3 button 12: (Android Start) (Start)
bit 4 button 13: ??
bit 5 button 14: Android Left Stick Press
bit 6 button 15: Android Right Stick Press
bit 5 button 14: Android Left Thumb Stick Press
bit 6 button 15: Android Right Thumb Stick Press
bit 7 button 16: ??
*/

Expand Down
4 changes: 2 additions & 2 deletions src_NormalAndArcadeMode/dualdb9.c
Expand Up @@ -105,8 +105,8 @@ void Read2ndFamicom(report_t *reportBuffer)
_delay_us(FAMDELAY); // settle time

// button IDs in brackers are Super Famicom
if (Famicom2Read()) reportBuffer->b1 |= (1<<1); // A (snes B)
if (Famicom2Read()) reportBuffer->b1 |= (1<<0); // B (snes Y)
if (Famicom2Read()) reportBuffer->b1 |= (1<<1); // NES A (snes B)
if (Famicom2Read()) reportBuffer->b1 |= (1<<0); // NES B (snes Y)
if (Famicom2Read()) reportBuffer->b2 |= (1<<0); // Select
if (Famicom2Read()) reportBuffer->b2 |= (1<<1); // Start
if (Famicom2Read()) reportBuffer->y = -128; // Up
Expand Down
14 changes: 7 additions & 7 deletions src_NormalAndArcadeMode/n64gc_asm.S
Expand Up @@ -133,9 +133,9 @@ readn64:

; d-pad to hat switch is decoding done by n64gc.c, returned in r24
sbrc data1, 7 ; A
ori b1, (1<<0)
ori b1, (1<<1)
sbrc data1, 6 ; B
ori b1, (1<<2)
ori b1, (1<<0)
sbrc data1, 5 ; Z
ori b2, (1<<2)
sbrc data1, 4 ; Start
Expand All @@ -158,7 +158,7 @@ readn64:
sbrc data2, 3 ; C-Up
ori b1, (1<<3)
sbrc data2, 2 ; C-Down
ori b1, (1<<1)
ori b1, (1<<2)
sbrc data2, 1 ; C-Left
ori b1, (1<<4)
sbrc data2, 0 ; C-Right
Expand Down Expand Up @@ -224,13 +224,13 @@ readgc:
; 4 - Start

sbrc data1, 0 ; A
ori b1, (1<<0)
ori b1, (1<<1)
sbrc data1, 1 ; B
ori b1, (1<<2)
ori b1, (1<<0)
sbrc data1, 2 ; X
ori b1, (1<<1)
sbrc data1, 3 ; Y
ori b1, (1<<3)
sbrc data1, 3 ; Y
ori b1, (1<<2)
sbrc data1, 4 ; Start
ori b2, (1<<1)

Expand Down

0 comments on commit c269c82

Please sign in to comment.