Hi all,
I decided to update my bindings the other day and it ended up being a bit more work than I’d intended. I thought I share my notes in case someone else is in the same boat.
Starting with the final result:
#!/usr/bin/env python
import serial
picade = serial.Serial('/dev/ttyACM0',9600,timeout=1.0)
picade.write("a 218 217 216 215 130 129 120 128 32 122 53 176 253 239 49 177 0 0 0 220 221 222 223 230 322 233 234 235 236 0 0 0 0 0 0 0 0 0 218 217 216 215 251 101 120 250 105 116 0 0 0 0 0 0 0 0 0")
print(picade.readline().strip())
Alt 1 switches to gamepad mode
Alt 2 controls the volume with A/B and types “exit” with the other four buttons
(That’s what it’s supposed to do anyway. It’s not quite doing what I want yet. I’m still working on making it behave properly across emulation station and the different emulators.)
This uses Gadgetoid’s awesome firmware with alt buttons. Thank you!
Defaults
Retropie default keys
Label Key
COIN 1 5
START 1 1
1 RIGHT R arrow
1 LEFT L arrow
1 UP U arrow
1 DOWN D arrow
1 SW 1 L-ctrl
1 SW 2 L-alt
1 SW 3 space
1 SW 4 L-shift
1 SW 5 Z
1 SW 6 X
1 SW 7 C
1 SW 8 V
1 A P
1 B ENTER
Select+Start Exit
Select+Right Shoulder Save
Select+Left Shoulder Load
Select+Right Input State Slot Increase
Select+Left Input State Slot Decrease
Select+X RGUI Menu
Select+B Reset
Default cfg file
/opt/retropie/configs/all/retroarch.cfg
input_player1_a = alt
input_player1_b = ctrl
input_player1_y = shift
input_player1_x = space
input_player1_l = z
input_player1_r = x
input_player1_start = num1
input_player1_select = num5
input_player1_left = left
input_player1_right = right
input_player1_up = up
input_player1_down = down
input_player1_l2 =
input_player1_r2 =
input_player1_l3 =
input_player1_r3 =
Picade default
a 218 217 216 215 128 130 32 129 122 120 115 99 176 177 250 251 105 111 112
Notes
Button locations
Potential conflicts with A, B switches
I’m still a bit confused by this, but the bottom line is simple enough…
Looking at these defaults, all of the directional keys and switches 1-8 for each player (“1 SW 1”, “1 SW 2”, etc.) align with MAME defaults, so when wiring pushbuttons, it makes sense to use these. However, newer IPAC models also have the “1 A”, “1 B”, “2 A” and “2 B” switches. The default keys sent by these are “P”, “ENTER”, “TAB”, and “ESC” respectively. MAME uses those keys for administrative functions: TAB brings up the GUI menu in MAME, P is for pause, ESC is exit. Enter makes menu selections. This can lead to confusion, as “A” “B” happen to be common gamepad buttons (like on the Nintendo NES) but using these switches for pushbuttons and expecting seamless gameplay in MAME will be problematic. It is perhaps better to set aside “1 A”, “1 B”, “2 A” and “2 B” as dedicated admin buttons. They are convenient if you have an Exit button on your control panel, for example, but will require confusing remapping in software to eliminate conflicts in MAME if you use them for your player pushbuttons. Bottom line: Don’t use A,B switches for player input buttons. Wire your buttons to SW1 - SW8 instead.
Serial update format
• 19 mapping codes for normal key actions
• 19 mapping codes for alt1 key actions (hold left side)
• 19 mapping codes for alt2 key actions (hold right side)
• 1 byte of shift state information the saved volume
Gagetoid n64 example
a 220 221 222 223 230 231 232 233 234 235 236 237 253 239 240 252 0 0 0 0 0 0 0 0 242 243 0 244 245 0 0 0 0 0 0 0 0 0 250 251 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
From the firmware docs
should be one of:
0 = Joy U 1 = Joy D 2 = Joy L 3 = Joy R
4 = Btn 1 5 = Btn 2 6 = Btn 3 7 = Btn 4 8 = Btn 5 9 = Btn 6
10 = Start 11 = Coin 12 = Enter 13 = Escape
14 = Vol Up 15 = Vol Down
16 = MOSI 17 = MISO 18 = SCLK
should be one of:
220 = Gpad U 221 = Gpad D 222 = Gpad L 223 = Gpad R
230 = Gpad 0 231 = Gpad 1 232 = Gpad 2 233 = Gpad 3
234 = Gpad 4 235 = Gpad 5 236 = Gpad 6 237 = Gpad 7
238 = Gpad 8 239 = Gpad 9 240 = Gpad 10 241 = Gpad 11
242 = Gpad 12 243 = Gpad 13 244 = Gpad 14 245 = Gpad 15
250 = Volume Up 251 = Volume Down
218 = U Arrow 217 = D Arrow 216 = L Arrow 215 = R Arrow
128 = L Ctrl 129 = L Shift 130 = L Alt 131 = L GUI
132 = R Ctrl 133 = R Shift 134 = R Alt 135 = R GUI
178 = Backspc 179 = TAB 176 = Return 177 = ESC
209 = Insert 212 = Delete 211 = Pg Up 214 = Pg Down
210 = Home 213 = End 193 = Caps Lk 13 = Space
194 = F1 195 = F2 196 = F3 197 = F4
198 = F5 199 = F6 200 = F7 201 = F8
202 = F9 203 = F10 204 = F11 205 = F12
32=space
33 = ! 34 = " 35 = # 36 = $
37 = % 38 = & 39 = ’ 40 = (
41 = ) 42 = * 43 = + 44 = ,
45 = - 46 = . 47 = / 48 = 0
49 = 1 50 = 2 51 = 3 52 = 4
53 = 5 54 = 6 55 = 7 56 = 8
57 = 9 58 = : 59 = ; 60 = <
61 = = 62 = > 63 = ? 64 = @
65 = A 66 = B 67 = C 68 = D
69 = E 70 = F 71 = G 72 = H
73 = I 74 = J 75 = K 76 = L
77 = M 78 = N 79 = O 80 = P
81 = Q 82 = R 83 = S 84 = T
85 = U 86 = V 87 = W 88 = X
89 = Y 90 = Z 91 = [ 92 =
93 = ] 94 = ^ 95 = _ 96 = `
97 = a 98 = b 99 = c 100 = d
101 = e 102 = f 103 = g 104 = h
105 = i 106 = j 107 = k 108 = l
109 = m 110 = n 111 = o 112 = p
113 = q 114 = r 115 = s 116 = t
117 = u 118 = v 119 = w 120 = x
121 = y 122 = z 123 = { 124 = |
125 = } 126 = ~