Mednafen controller setup
Documenting this for my future attempts to map controller inputs in Mednafen and change hotkeys.
Controller Input
IMPORTANT: press all the buttons, then F3 so Mednafen detects all analog joysticks. My 8bitdo M30's left and right shoulders were apparently analog joysticks.
Then, press Alt-Shift-N, where N should be replaced by the controller port you're mapping, and you'll be prompted to press buttons. You have to do each one twice to confirm you're done and move onto the next one. This should save your settings to your config file.
If you want to manually set joystick buttons, there's no official documentation, but:
* the joystick's ID is printed when you start mednafen.
* in mednafen.cfg or a console-specific config file, set the relevant gamepad's controls: each one should be joystick [id] followed by either button_[n] or, if it's an axis, abs_[n][-|+]. I think the -|+ indicates polarity. e.g. ss.input.port1.gamepad.down joystick 0xblah abs_1+ (and up would be abs_1-).
* To find the button and axis numbers, I used another program that used SDL input (e.g. Ares); you can also write yourself a little SDL program that detects presses and prints out info. Let me know if there's something more convenient.
Here's the full configuration for my M30 (with joystick ID omitted)
;ss, Virtual Port 1, Digital Gamepad: A
ss.input.port1.gamepad.a joystick button_0
;ss, Virtual Port 1, Digital Gamepad: B
ss.input.port1.gamepad.b joystick button_1
;ss, Virtual Port 1, Digital Gamepad: C
ss.input.port1.gamepad.c joystick button_10
;ss, Virtual Port 1, Digital Gamepad: DOWN ↓
ss.input.port1.gamepad.down joystick abs_1+
;ss, Virtual Port 1, Digital Gamepad: LEFT ←
ss.input.port1.gamepad.left joystick abs_0-
;ss, Virtual Port 1, Digital Gamepad: Left Shoulder
ss.input.port1.gamepad.ls joystick abs_4-+
;ss, Virtual Port 1, Digital Gamepad: RIGHT →
ss.input.port1.gamepad.right joystick abs_0+
;ss, Virtual Port 1, Digital Gamepad: Right Shoulder
ss.input.port1.gamepad.rs joystick abs_5-+
;ss, Virtual Port 1, Digital Gamepad: START
ss.input.port1.gamepad.start joystick button_6
;ss, Virtual Port 1, Digital Gamepad: UP ↑
ss.input.port1.gamepad.up joystick abs_1-
;ss, Virtual Port 1, Digital Gamepad: X
ss.input.port1.gamepad.x joystick button_2
;ss, Virtual Port 1, Digital Gamepad: Y
ss.input.port1.gamepad.y joystick button_3
;ss, Virtual Port 1, Digital Gamepad: Z
ss.input.port1.gamepad.z joystick button_9
Changing Hotkeys
Also, the pause command is mapped to the Pause button by default. Uh oh, my keyboard doesn't have that button because it's a puny laptop keyboard, and remapping a hotkey (as described in the help dialog brought up by F1) typically involves pressing the original button first, then the new button. Instead, find your config (probably ~/.mednafen/mednafen.cfg) and replace all instances of the relevant scancode (0x0 72 for Pause) with the key for the desired scancode (e.g. I mapped Space, which is 0x0 44, to pause). Save. (Or just do it for the consoles and ports you care about.)