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 gamepad remapping

    Scheduled Pinned Locked Moved Help and Support
    5 Posts 3 Posters 317 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic was forked from How to remap controls in mupen64plus-GlideN64 on retropie x86 mitu
    This topic has been deleted. Only users with topic management privileges can see it.
    • duglorD
      duglor
      last edited by

      How do you remap this emulator PER GAME? I don't want to remap the entire system. I just want to custom remap for one game: Densha de Go! 64 , the Train game.

      S 1 Reply Last reply Reply Quote 0
      • S
        sleve_mcdichael @duglor
        last edited by sleve_mcdichael

        @duglor said in How to remap controls in mupen64plus-GlideN64 on retropie x86:

        How do you remap this emulator PER GAME? I don't want to remap the entire system. I just want to custom remap for one game: Densha de Go! 64 , the Train game.

        So glad you asked! I worked this out a while ago and been slacking on finishing and posting the write-up.

        ...

        Concept/guide: N64 individual game remaps for stand-alone mupen64plus

        Playing N64 games on a modern controller can present certain challenges, and they offer few if any options to rebind or remap the controls in-game. With RetroArch it is easy enough to manage remaps in any way you can imagine through the menu interface but the performance often suffers, compared to using the stand-alone mupen64plus. However in the stand-alone case, our only option to rebind controls outside the game is to edit InputAutoCfg.ini in the N64 config folder. Further, this affects all games equally and there is no mechanism for individual per-game remaps.

        Enter: runcommand on-start/on-end scripts. The trick here is to manually edit the InputAutoCfg.ini file and save a copy for each game that needs remapped. Upon start, when launching any stand-alone mupen64plus-* emulator, then if a remap file exists for that game, then swap it out: the original(*) InputAutoCfg.ini is moved aside and the remap is copied to its place.

        After the game exits, the on-end script looks for a backed-up original, and restores one that it finds.

        (*) auto-self-correcting: if a crash occurs and prevents the on-end script from properly replacing the default config, then next time, when the backed-up original already exists, then the mv -n option prevents it being overwritten by the currently-existing (wrong, remapped) one in the folder. Then, the current game's remap is applied, if one exists (if not, controls will be messed up for this one time only as it reads the existing remap for the last loaded game.) After exit, it reads the backed up original (in-tact, since it wasn't clobbered earlier), and sets it back to place.

        ...

        Execution - on-start /opt/retropie/configs/all/runcommand-onstart.sh (excerpt):

        # $1 = system, $2 = emulator, $3 = rompath, $4 = command
        
        # mupen64plus stand-alone remaps
        if [[ "$2" == mupen64plus-* ]]; then
            inputcfg="/opt/retropie/configs/n64/InputAutoCfg.ini"
            romfile="${3##*/}"
            remap="/opt/retropie/configs/n64/mupen64plus/remaps/${romfile%.*}.ini"
            if [[ -f "$remap" ]]; then
                mv -n "$inputcfg" "$inputcfg.swap"
                cp -f "$remap" "$inputcfg"
            fi
        fi
        

        On-end /opt/retropie/configs/all/runcommand-onend.sh excerpt:

        # $1 = system, $2 = emulator, $3 = rompath, $4 = command
        
        # mupen64plus stand-alone remaps
        if [[ "$2" == mupen64plus-* ]]; then
            inputcfg="/opt/retropie/configs/n64/InputAutoCfg.ini"
            if [[ -f "$inputcfg.swap" ]]; then
                mv -f "$inputcfg.swap" "$inputcfg"
            fi
        fi
        

        Usage example: in Star Fox 64 / Lylat Wars, the buttons to roll the ship are R1 and L2 (N64 R-trig and Z-trig). I'd rather have this on the L1 button instead so that it's symmetrical on both sides. I'd also like to make my X ("north") button be the N64 C-L (boost) instead of C-U (change view). Here is a diff illustrating how I have accomplished this on my own controller (you'll have to adapt this for your own device):

        --- /opt/retropie/configs/n64/InputAutoCfg.ini  2023-10-11 12:42:55.460995455 -0700
        +++ "/opt/retropie/configs/n64/mupen64plus/remaps/Star Fox 64 (USA) (Rev 1).ini"        2024-06-24 12:27:56.445124520 -0700
        @@ -86,27 +86,27 @@
         ; Logitech Gamepad F710_START 
         [Logitech Gamepad F710]
         plugged = True
         plugin = 2
         mouse = False
         AnalogDeadzone = 4096,4096
         AnalogPeak = 32768,32768
         Mempak switch = button(9) 
         Rumblepak switch = button(10) 
        -C Button U = button(3) axis(4-) 
        +C Button U = axis(4-) 
         L Trig = button(4) 
         C Button D = button(1) axis(4+) 
         DPad U = hat(0 Up) 
         DPad L = hat(0 Left) 
        -C Button L = axis(3-) 
        +C Button L = button(3) axis(3-) 
         Y Axis = axis(1-,1+)
         X Axis = axis(0-,0+)
         DPad R = hat(0 Right) 
        -Z Trig = axis(2+) 
        +Z Trig = button(4) 
         C Button R = axis(3+) 
         R Trig = button(5) 
         B Button = button(2) 
         DPad D = hat(0 Down) 
         Start = button(7) 
         A Button = button(0) 
         ; Logitech Gamepad F710_END 
        
        

        Another example, 007 Goldeneye converted to a modern twin-stick shooter style (you gotta switch to control scheme "1.2 Solitaire" also.) The N64 C-buttons (right stick) and analog stick (left stick) are swapped places, and the Z-trig (fire) is moved to the R2 instead of L2 (*I tried to make it so both triggers could fire, but despite other buttons handling two inputs just fine, this didn't seem to work with Z-trig when I tried Z Trig = axis(2+) axis(5+); here only the first-defined one would actually function as the Z-trig button in-game):

        --- /opt/retropie/configs/n64/InputAutoCfg.ini  2023-10-11 12:42:55.460995455 -0700
        +++ "/opt/retropie/configs/n64/mupen64plus/remaps/GoldenEye 007 (USA).ini"      2023-10-11 15:37:06.115837883 -0700
        @@ -86,27 +86,27 @@
         ; Logitech Gamepad F710_START 
         [Logitech Gamepad F710]
         plugged = True
         plugin = 2
         mouse = False
         AnalogDeadzone = 4096,4096
         AnalogPeak = 32768,32768
         Mempak switch = button(9) 
         Rumblepak switch = button(10) 
        -C Button U = button(3) axis(4-) 
        +C Button U = axis(1-) 
         L Trig = button(4) 
        -C Button D = button(1) axis(4+) 
        +C Button D = axis(1+) 
         DPad U = hat(0 Up) 
         DPad L = hat(0 Left) 
        -C Button L = axis(3-) 
        -Y Axis = axis(1-,1+)
        -X Axis = axis(0-,0+)
        +C Button L = axis(0-) 
        +Y Axis = axis(4-,4+) button(1,3)
        +X Axis = axis(3-,3+)
         DPad R = hat(0 Right) 
        -Z Trig = axis(2+) 
        -C Button R = axis(3+) 
        +Z Trig = axis(5+)
        +C Button R = axis(0+) 
         R Trig = button(5) 
         B Button = button(2) 
         DPad D = hat(0 Down) 
         Start = button(7) 
         A Button = button(0) 
         ; Logitech Gamepad F710_END 
        
        
        duglorD 1 Reply Last reply Reply Quote 2
        • mituM
          mitu Global Moderator
          last edited by mitu

          NOTE: I split this from the old topic. @duglor please don't bump old topics.
          I have the feeling this is about something else, since the Densha de GO! games have all special controllers which are emulated or not by emulators.

          duglorD 1 Reply Last reply Reply Quote 0
          • duglorD
            duglor @sleve_mcdichael
            last edited by

            @sleve_mcdichael Wow! Perfect! Thanks so much for your help!!!!!!!!!!!!

            1 Reply Last reply Reply Quote 0
            • duglorD
              duglor @mitu
              last edited by duglor

              @mitu No, not about something else. This game ran with a simple n64 controller, but it did also have support for another. I am only talking about running this through my xbox controller.

              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.