Help mapping USB N64 Controller C Right & C Down (Batocera on Pi 4)

1,760 views
Skip to first unread message

Lee

unread,
Jun 13, 2021, 8:46:32 PM6/13/21
to mupen...@googlegroups.com
Hi, Mupen64Plus Team!

I'm building a mini N64 for my girlfriend's birthday and your emulator ROCKS!

But here's where I REALLY would like your help - I can't get Mupen to recognise a few of the C buttons on the controllers.

I do know the actual hardware works though, because every button automatically maps normally when using (the inferior) Retroarch.

Here's what I'm using:

- a Pi 4 (4GB)
- the latest Batocera install
- 2 x SWITCH CO.,LTD. Controller (Dinput) controllers

I can see the mappings in:

\\192.168.0.112\share\system\configs\mupen64\mupen64plus.cfg

..but I can't set them here, because they get overwritten every time the emulator boots a new ROM.

C Up and C Left work okay, but that's because I can set them in the Batocera front end.  I don't get the option to set C Right and C Down, and I think that's because Batocera assumes the controller has a stick, not buttons.

Some guides on the internet also recommend changing InputAutoCfg.ini but this file doesn't exist on my Batocera install.

PLEASE can you help me set custom buttons in the CFG that don't get overwritten?  I've attached the files I do have.  I would REALLY love your help to finish this gift for my girlfriend.

Thank you!

Lee
input.xml
mupen64plus.cfg

Richard Goedeken

unread,
Jun 16, 2021, 10:22:56 PM6/16/21
to mupen...@googlegroups.com, leogame...@gmail.com
Hi Lee,

I don't know which front-end application is used in the Batocera distribution
or if that application is doing something to overwrite the input configuration.

But you can prevent the Mupen64Plus library itself from overwriting the
configuration parameters with the Input Auto-Config feature by setting the
"mode" parameter's value to 0 for every desired [Input-SDL-Control*]
configuration section. This tells the mupen64plus SDL input plugin not to
bother with the auto-configuration and just use the settings exactly as they
are in the config file. You can then set your C buttons as necessary in the
mupen64plus.cfg file.

Richard

On 6/12/21 10:09 AM, Lee wrote:
> Hi, Mupen64Plus Team!
>
> I'm building a mini N64 for my girlfriend's birthday and your emulator ROCKS!
>
> But here's where I REALLY would like your help - I can't get Mupen to
> recognise a few of the C buttons on the controllers.
>
> I do know the actual hardware works though, because every button automatically
> maps normally when using (the inferior) Retroarch.
>
> Here's what I'm using:
>
> - a Pi 4 (4GB)
> - the latest Batocera install
> - 2 x /SWITCH CO.,LTD. Controller (Dinput)/ controllers
>
> I can see the mappings in:
>
> \\192.168.0.112\share\system\configs\mupen64\mupen64plus.cfg
>
> ..but I /can't/ set them here, because they get overwritten every time the
> emulator boots a new ROM.
>
> C Up and C Left work okay, but that's because I can set them in the Batocera
> front end.  I don't get the option to set C Right and C Down, and I think
> that's because Batocera assumes the controller has a stick, not buttons.
>
> Some guides on the internet also recommend changing InputAutoCfg.ini but this
> file doesn't exist on my Batocera install.
>
> PLEASE can you help me set custom buttons in the CFG that don't get
> overwritten?  I've attached the files I do have.  I would REALLY love your
> help to finish this gift for my girlfriend.
>
> Thank you!
>
> Lee
>
> --
> You received this message because you are subscribed to the Google Groups
> "mupen64plus" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mupen64plus...@googlegroups.com
> <mailto:mupen64plus...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/mupen64plus/CAMBvrd73aTCvmTNa1W%3DaR5F6V3VFCHr4mGOVJWTMYU1TO6pTTQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/mupen64plus/CAMBvrd73aTCvmTNa1W%3DaR5F6V3VFCHr4mGOVJWTMYU1TO6pTTQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Richard Winters

unread,
Aug 4, 2021, 2:41:54 AM8/4/21
to mupen64plus
Hey, I *just* got finished fixing this on my own Raspberry Pi 4, Batocera setup, and it even looks like we're using the same brand USB N64 controller!  So I hope this helps.

The trick I found was to leave the Mupen64 configuration as default, but manually modify the Batocera "emulationstation" controller configuration.  You'll find it in:

      \\batocera\share\system\configs\emulationstation\es_input.cfg

In this file, you'll want to look for the controller information.  It should be a line that looks like this: 

        <inputConfig type="joystick" deviceName="SWITCH CO.,LTD. Controller (Dinput)" deviceGUID="03000000632500007505000011010000">

I'm not 100% confident that the device GUID will be identical, but it looks like the SWITCH CO.LTD. part should match your device, given the cfg file you posted above.  Anyway, find this section, and replace the controller inputs with this:

<inputConfig type="joystick" deviceName="SWITCH CO.,LTD. Controller (Dinput)" deviceGUID="03000000632500007505000011010000">
<input name="joystick1left" type="axis" id="0" value="-1" code="0" />
<input name="joystick1up" type="axis" id="1" value="-1" code="1" />
<!--A--> <input name="b" type="button" id="1" value="1" code="305" /> 
<!--B--> <input name="y" type="button" id="2" value="1" code="306" />
<!--C↑--> <input name="joystick2up" type="button" id="9" value="1" code="313" />
<!--C↓--> <input name="joystick2down" type="button" id="0" value="1" code="304" />
<!--C←--> <input name="joystick2left" type="button" id="3" value="1" code="307" />
<!--C→--> <input name="joystick2right" type="button" id="8" value="1" code="312" />
<!--L--> <input name="pageup" type="button" id="4" value="1" code="308" />
<!--R--> <input name="pagedown" type="button" id="5" value="1" code="309" />
<!--Z--> <input name="l2" type="button" id="6" value="1" code="310" />
<!--START--> <input name="start" type="button" id="12" value="1" code="316" />
<!--D↑--> <input name="up" type="hat" id="0" value="1" />
<!--D↓--> <input name="down" type="hat" id="0" value="4" />
<!--D←--> <input name="left" type="hat" id="0" value="8" />
<!--D→--> <input name="right" type="hat" id="0" value="2" />
</inputConfig>

(The stuff in the <!-- --> blocks is not required, I just had that there because it was driving me crazy figuring out all the button id's and codes and how they matched to the controller.)

If you do that, then the default configuration file Batocera gives you for Mupen64 should work perfectly without a hitch.  I don't know why the emulationstation frontend GUI doesn't allow you to set the joystick2 to buttons instead of a joystick axis, but as you can see, the raw configuration file supports that option perfectly.

If it turns out your USB N64 controller varies slightly from mine, you should still be able to puzzle out how to get this working by manually adding the correct value and code options to the joystick2down and joystick2right entries.  But I'm pretty sure it'll match perfectly.

Hope this helps!
--Richard Winters

Michael Mauck

unread,
Aug 27, 2021, 12:53:10 PM8/27/21
to mupen64plus

Yo, these inputs work PERFECT in game! Thank you so much for the help there. I am also using this same controller (its the more "modern" looking n64 controller yeah? I needed that analog to my far left.) I decided to change the Z button to the right back trigger instead, and all I had to do was change the id to "7" and code to "311". Its also really nice that the left back trigger + start seems to work as a way to get back into the batocera games menu, Im not sure how its programmed like that, but its what I strongly prefer since I wasn't planning on using that left back trigger for anything else.

I do have one MINOR nitpick though and I hope you can help me out. The only thing I cannot successfully do is back out of anything while in the batocera menu. I might be able to get around it since I have a keyboard laying around I can use (the esc button works just fine for backing out), but it would be nice to figure out why its not working.

Jonny Kershner

unread,
Jan 5, 2024, 10:11:30 PMJan 5
to mupen64plus
Can't thank you enough for this! Worked like a charm and took all of 2 minutes to get this done.  Thanks again!
Reply all
Reply to author
Forward
0 new messages