RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    N64 Controller Mapping

    Scheduled Pinned Locked Moved Help and Support
    n64 controllerraspberry pi 5mupen64plus
    10 Posts 2 Posters 637 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MinivanDriver
      last edited by

      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-Highres

      I'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 the mupen64next.cfg file. The only one which seems to have an impact on what buttons do what is es_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 attached es_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 -> Z

      The 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 with plugged = 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!

      A 2 Replies Last reply Reply Quote 0
      • A
        Arrafart @MinivanDriver
        last edited by Arrafart

        @MinivanDriver

        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.

        M 1 Reply Last reply Reply Quote 0
        • M
          MinivanDriver @Arrafart
          last edited by

          @Arrafart

          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 an InputAutoCfg.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?

          A 1 Reply Last reply Reply Quote 0
          • A
            Arrafart @MinivanDriver
            last edited by Arrafart

            @MinivanDriver

            I checked on my Orange Pi zero 2w

            Mupen64plus standalone:
            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.

            RetroArch:
            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.

            M 1 Reply Last reply Reply Quote 0
            • M
              MinivanDriver @Arrafart
              last edited by

              @Arrafart I have some graphical corruption with lr-mupen64plus-next, although games are sometimes playable. I wouldn't be opposed to trying to fix those issues, although in that emulator:

              • A button does nothing
              • B button does what A should do
              • L and Z are swapped

              The InputAutoCfg.ini continues to have no effect. I tried swapping L and Z in the file (i.e. L Trig = button(6) instead of button(4) despite my jstest experiments) but nothing changed in-game.

              I loaded up an SNES game and the N64 controller seemed to work fine.

              How should I re-install RetroArch and Mupen64plus? With the ./retropie_setup.sh script is there an option to remove and then I would select install again, or is there a re-installation option?

              A 1 Reply Last reply Reply Quote 0
              • A
                Arrafart @MinivanDriver
                last edited by

                @MinivanDriver

                Strange and a bummer, hope it gets better

                How should I re-install RetroArch and Mupen64plus? With the ./retropie_setup.sh script is there an option to remove and then I would select install again, or is there a re-installation option?

                Yes, or just launch emulation station and find Retropie setup in the Retropie menu.

                Not entirely sure if there is a reinstall option, either way, you'll manage by removing and installing again. If I understand well, look for the regular Mupen64plus emulator. (I'm also the happiest with this for my weak device)

                M 1 Reply Last reply Reply Quote 0
                • M
                  MinivanDriver @Arrafart
                  last edited by

                  @Arrafart there is a re-install option. I did that for retroarch and mupen64. d98b20ba-e090-41de-b12a-cf670a0cc8c0-image.png

                  The controls were still not working. In looking at the list, I saw that I'm not able to install the libreto version of the "regular" Mupen64 emulator, but lr-mupen64plus-next is an option. b46e0025-6395-4a75-9251-1d738dab968f-image.png

                  BUT!

                  With the keyboard, and this being a libretro core, I was able to hit F1 and pull up the core menu. And now it gets weirder. No matter what I set the A button to, it doesn't work. The A button works in EmulationStation, it works to navigate the menu, so I know it isn't a physical problem... but in-game the A button doesn't do anything. I don't think it's a hotkey issue, as that's set to the L button.

                  M 1 Reply Last reply Reply Quote 0
                  • M
                    MinivanDriver @MinivanDriver
                    last edited by

                    The mystery continues...?

                    I continued to monkey around with the inputs and was able to map everything correctly. Now, I just need to make it "sticky" -- a remap file? Fixing the graphics would also be nice, as you can see an example of the corruption here. 5e0ba4d2-96a8-4ffa-a863-d7bdb914e3c5-81AE140A-45BA-4CB2-B490-FD1A40E9D1F6_1_105_c.jpeg

                    In the mupen64-glide emulator, no controllers are seen by the emulator, and I get a black screen (presumable in-game) that says to plug one in.

                    1 Reply Last reply Reply Quote 0
                    • A
                      Arrafart
                      last edited by Arrafart

                      This is all sadly above my level of experience, apart from the remapping. I remapped Turok for the N64.

                      Check if you see comparisons here.

                      https://retropie.org.uk/forum/topic/36781/no-gamepads-detected/34

                      And this one for remapping

                      https://retropie.org.uk/forum/post/301693

                      1 Reply Last reply Reply Quote 0
                      • A
                        Arrafart @MinivanDriver
                        last edited by Arrafart

                        @MinivanDriver i noticed a ; too many in front of the name [USB Gamepad] in the /opt/retropie/configs/n64/InputAutoCfg.ini file

                        Example:

                        ; 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)

                        Etc.

                        Remove it, and try it. I think it prevents the .ini to start the pad configuration

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        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.