N64 Controller Mapping
-
Hello! First things first:
Pi Model or other hardware: 5
Power Supply used: Official 27W
RetroPie Version Used: 4.8.9
Built From: Raspbian Lite (bookworm) + Manual Install
USB Devices connected: Keyboard, Controller
Controller used: SWITCH CO.,LTD. Controller (Dinput)
Error messages received: n/a
Verbose log: n/a
Guide used: n/a
Emulator: Mupen64Plus-GlideN64-HighresI've been battling with this for a couple weeks now and haven't been able to figure it out. I was able to get RetroPie up and running pretty easily, and NES, SNES, Atari, GameBoy, and GameBoy Advanced emulators all work fine. I have a USB SNES gamepad which works for all of those. I have unplugged that controller when intending to play N64 games to reduce any kind of confusion.
N64 games load up fine and look great. However, the controller mapping doesn't seem to be making it from the EmulationStation configuration to the actual emulator. The controller works fine to navigate the GUI with no issues. But once I load up a game, the mapping seems to be forgotten.
I've tried to edit
es_input.cfg
,InputAutoCfg.ini
,retroarch.cfg
, and themupen64next.cfg
file. The only one which seems to have an impact on what buttons do what ises_input.cfg
. I may be able to make it work with a bit of help in understanding the XML to know how to map controller buttons to the emulated game button, or to tweak the key codes that are registered, or something. I've tried every forum post I could pull up in search, but none have solved the issue. With the attachedes_input.cfg
I'm close; while most of the buttons seem to work, these are not mapped right. (Actual button pressed on the left, what it's been seen as on the right):
A -> C down
Z -> L
B -> A
L -> ZThe files from my system; some I've snipped out the relevant bits, if anyone needs more let me know and I'll post the entire thing.
~/.emulationstation/es_input.cfg
This is the only file which seems to change what happens in-game.<?xml version="1.0"?> <inputList> <inputAction type="onfinish"> <command>/opt/retropie/supplementary/emulationstation/scripts/inputconfiguration.sh</command> </inputAction> <inputConfig type="joystick" deviceName="USB gamepad" deviceGUID="0300cb231f08000001e40000100100 00"> <input name="a" type="button" id="2" value="1" code="304" /> <input name="b" type="button" id="1" value="1" code="305" /> <input name="down" type="hat" id="0" value="4" /> <input name="hotkey" type="button" id="8" value="1" code="312" /> <input name="joystick1left" type="axis" id="0" value="-1" code="0" /> <input name="joystick1up" type="axis" id="1" value="-1" code="1" /> <input name="joystick2left" type="axis" id="2" value="-1" code="2" /> <input name="joystick2up" type="axis" id="3" value="-1" code="5" /> <input name="l2" type="button" id="6" value="1" code="309" /> <input name="l3" type="button" id="10" value="1" code="314" /> <input name="left" type="hat" id="0" value="8" /> <input name="pagedown" type="button" id="5" value="1" code="310" /> <input name="pageup" type="button" id="4" value="1" code="308" /> <input name="r2" type="button" id="7" value="1" code="311" /> <input name="r3" type="button" id="11" value="1" code="315" /> <input name="right" type="hat" id="0" value="2" /> <input name="select" type="button" id="8" value="1" code="312" /> <input name="start" type="button" id="9" value="1" code="313" /> <input name="up" type="hat" id="0" value="1" /> <input name="x" type="button" id="3" value="1" code="307" /> </inputConfig> <inputConfig type="joystick" deviceName="Retro-bit Controller" deviceGUID="0300848b632500007505000011010000"> <input name="rightanalogdown" type="button" id="0" value="1"/> <input name="left" type="hat" id="0" value="8"/> <input name="right" type="hat" id="0" value="2"/> <input name="pagedown" type="button" id="5" value="1"/> <input name="down" type="hat" id="0" value="4"/> <input name="rightanalogup" type="button" id="9" value="1"/> <input name="pageup" type="button" id="6" value="1"/> <input name="y" type="button" id="3" value="1"/> <input name="x" type="button" id="9" value="1"/> <input name="b" type="button" id="2" value="1"/> <input name="a" type="button" id="1" value="1"/> <input name="up" type="hat" id="0" value="1"/> <input name="start" type="button" id="12" value="1"/> <input name="leftanalogright" type="axis" id="0" value="1"/> <input name="leftanalogleft" type="axis" id="0" value="-1"/> <input name="leftanalogup" type="axis" id="1" value="-1"/> <input name="leftanalogdown" type="axis" id="1" value="1"/> <input name="rightanalogleft" type="button" id="3" value="1"/> <input name="select" type="button" id="4" value="1"/> <input name="rightanalogright" type="button" id="8" value="1"/> </inputConfig> </inputList>
/opt/retropie/configs/n64/InputAutoCfg.ini
Seems to have no effect.; InputAutoCfg.ini for Mupen64Plus SDL Input plugin ; USB gamepad_START ;[USB gamepad] [SWITCH CO.,LTD. Controller (Dinput)] plugged = True plugin = 2 mouse = False AnalogDeadzone = 4096,4096 AnalogPeak = 32768,32768 Mempak switch = Rumblepak switch = R Trig = button(5) L Trig = button(4) B Button = button(2) C Button U = button(9) A Button = button(1) C Button D = button(0) C Button L = button(3) C Button R = button(8) Start = button(12) X Axis = axis(0-, 0+) Y Axis = axis(1-, 1+) Z Trig = button(6) ; USB gamepad_END
/opt/retropie/configs/n64/retroarch.cfg
Note I messed around in this file based on some findings in another forum thread, but they didn't work, so I commented the changes out to keep things simple. Posting for completeness.# Settings made here will only override settings in the global retroarch.cfg if placed above the #include line #input_remapping_directory = "/opt/retropie/configs/n64" #input_menu_toggle_btn = "button(0)" #input_player1_b_btn = "2" #input_player1_y_btn = "7" # dunno, this is not a real button #include "/opt/retropie/configs/all/retroarch.cfg"
/opt/retropie/configs/n64/rmupen64plus.cfg
Seems to have no effect. This is the only controller withplugged = True
set in the configuration.[Input-SDL-Control3] # Mupen64Plus SDL Input Plugin config parameter version number. Please don't change this version number. version = 2.000000 # Controller configuration mode: 0=Fully Manual, 1=Auto with named SDL Device, 2=Fully automatic mode = 0 # Specifies which joystick is bound to this controller: -1=No joystick, 0 or more= SDL Joystick nu mber device = -1 # SDL joystick name (or Keyboard) name = "" # Specifies whether this controller is 'plugged in' to the simulated N64 plugged = True # Specifies which type of expansion pak is in the controller: 1=None, 2=Mem pak, 4=Transfer pak, 5=Rumble pak plugin = 2 # If True, then mouse buttons may be used with this controller mouse = False # Scaling factor for mouse movements. For X, Y axes. MouseSensitivity = "2.00,2.00" # The minimum absolute value of the SDL analog joystick axis to move the N64 controller axis value from 0. For X, Y axes. AnalogDeadzone = "4096,4096" # An absolute value of the SDL joystick axis >= AnalogPeak will saturate the N64 controller axis v alue (at 80). For X, Y axes. For each axis, this must be greater than the corresponding AnalogDea dzone value AnalogPeak = "32768,32768" # Digital button configuration mappings DPad R = "" DPad L = "" DPad D = "" DPad U = "" Start = "button(12)" Z Trig = "button(6)" B Button = "button(2)" A Button = "button(1)" C Button R = "button(8)" C Button L = "button(3)" C Button D = "button(0)" C Button U = "button(9)" R Trig = "button(5)" L Trig = "button(4)" Mempak switch = "" Rumblepak switch = "" # Analog axis configuration mappings X Axis = "" Y Axis = ""
If it's helpful, here's what codes are reportedly being sent. If I understood the
es_input.cfg
file better I wonder if I could set up the event code to button mapping there?Event code 304 (BTN_SOUTH) Event code 305 (BTN_EAST) Event code 306 (BTN_C) Event code 307 (BTN_NORTH) Event code 308 (BTN_WEST) Event code 309 (BTN_Z) Event code 310 (BTN_TL) Event code 311 (BTN_TR) Event code 312 (BTN_TL2) Event code 313 (BTN_TR2) Event code 314 (BTN_SELECT) Event code 315 (BTN_START) Event code 316 (BTN_MODE)
Along with the button mappings I figured out from
jstest
SWITCH CO.,LTD. Controller (Dinput) Buttons: 0:C-DOWN 1: A 2: B 3: C-LEFT 4: L 5: R 6: Z 7: 8: C-RIGHT 9: C-UP 10: 11: 12: start
Thanks in advance for the help. Everything else has gone really smoothly!
-
Should it be [Input-SDL-Control3]?
I've only worked on Mupen64plus standalone button configuration. And for this I could ignore the RetroArch setup, if I'm right.
Isn't Es input if for the Emulation station only?
Can you find:
/opt/retropie/configs/All/InputAutoCfg.ini ?
I believe something like that should be there.
-
Should it be [Input-SDL-Control3]?
I've only worked on Mupen64plus standalone button configuration. And for this I could ignore the RetroArch setup, if I'm right.I tried to do the minimal amount of changing to existing files as possible. There are four total inputs defined, and 3 was the first one that was empty. The first two were, I think, pre-configured for a keyboard and then the SNES controller I had plugged in when setting up the other emulators. I can try moving this config block up to
[Input-SDL-Control1]
I guess, no harm in trying.Isn't Es input if for the Emulation station only?
That's what I thought too, but it's the only file where changes have any effect. I don't fully understand the order files are used to load controller mappings or how they're plumbed through.
Can you find:
/opt/retropie/configs/All/InputAutoCfg.ini ?I don't have an
/opt/retropie/configs/All
directory. I have anInputAutoCfg.ini
file at/opt/retropie/configs/n64/InputAutoCfg.ini
but changes there don't seem to have any impact on what Mupen64plus sees. Should I create this directory and file? -
I checked on my Orange Pi zero 2w
I have indeed used /opt/retropie/configs/n64/InputAutoCfg.ini to set up my controls.
Mupen64plus.cfg grabs it from here if I'm correct, it refreshes most info from other sources when starting roms.
Have you tried the controller on RetroArch/SNES and can you reconfigure those inputs?
Maybe lr-mupen64plus-next is an option. If your device is strong enough it can run N64 through RetroArch and that's how you can use the basic controls from RetroArch.Otherwise, reinstall RetroArch and Mupen64plus, takes 15 minutes tops.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.