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

    Unable to configure per-ROM input override for MAME

    Scheduled Pinned Locked Moved Help and Support
    overrideretroarchper-rommappingretroarch.cfg
    16 Posts 5 Posters 2.1k 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.
    • F
      Fidelio
      last edited by

      Hello!

      I recently updated my RetroPie image to 4.7.1 from a version at least 3 years old and made the mistake of not backing up my config files. I'm almost back in working order, but I've hit a roadblock with RetroArch input overrides at the ROM level.

      For reference, I have a pair of custom 6-putton joysticks that use arcade hardware wired to an IPac2. I'm testing using mame-libretro (mame2003) and the sf2.zip rom. Everything works as expected using the default set of inputs that map to the standard IPac2/MAME mapping. However, I'd like to introduce some overrides via RetroArch as the default button mappings do not properly line-up with standard Street Fighter button arrangement.

      I created the following config file (named sf2.zip.cfg) and placed it in my roms directory at ~/RetroPie/roms/arcade. As shown below, I'm only redefining the six keyboard inputs for each player; the remainder of the configuration is imported via the #include of the default RetroArch configuration.

      input_remapping_directory = "/home/pi/RetroPie/roms/arcade/"
      
      input_player1_y = "ctrl"
      input_player1_x = "shift"
      input_player1_l = "x"
      input_player1_b = "alt"
      input_player1_a = "space"
      input_player1_r = "z"
      
      input_player2_y = "a"
      input_player2_x = "w"
      input_player2_l = "k"
      input_player2_b = "s"
      input_player2_a = "q"
      input_player2_r = "i"
      
      
      # Never save-on-exit after an override config
      # or the override will make into the core config.
      config_save_on_exit = false
      
      #include "/opt/retropie/configs/all/retroarch.cfg"
      

      The file is detected when MAME runs, but only the L button input functions for either player. In fact, pressing two adjacent buttons will trigger some of the other inputs. This is very bizarre as removing the config file reverts to the default inputs, which are all functional, albeit in undesirable locations. I also tried to put the input_player[1|2]_* mappings in /opt/retropie/configs/arcade/retroarch.cfg and observed the same results.

      What is the proper way to accomplish this per-ROM input override? The official documentation for the per-ROM input override shows a trivial and unusable example. Furthermore, the top search result for this issue is a bit dated but refers to the syntax I've used albeit with an incorrect ROM path (/opt/retropie/roms).

      For reference, here is an excerpt of the input mappings from the global RetroArch configuration:

      input_player1_a = "alt"
      input_player1_b = "ctrl"
      input_player1_y = "shift"
      input_player1_x = "z"
      input_player1_start = "num1"
      input_player1_select = "num5"
      input_player1_l = "x"
      input_player1_r = "space"
      input_player1_left = "left"
      input_player1_right = "right"
      input_player1_up = "up"
      input_player1_down = "down"
      
      input_player2_a = "s"
      input_player2_b = "a"
      input_player2_y = "w"
      input_player2_x = "i"
      input_player2_start = "num2"
      input_player2_select = "nul"
      input_player2_l = "k"
      input_player2_r = "q"
      input_player2_left = "d"
      input_player2_right = "g"
      input_player2_up = "r"
      input_player2_down = "f"
      
      1 Reply Last reply Reply Quote 0
      • S
        sleve_mcdichael
        last edited by sleve_mcdichael

        Use core input remapping. Save it as a game remap. It will save a .rmp remap file to the remapping directory defined in your (core) retroarch.cfg , ex. /opt/retropie/configs/arcade/MAME\ 2003\ \(0.78\)/sf2.rmp. The game-specific .zip.cfg override should not be necessary for a simple game remap.

        https://retropie.org.uk/docs/RetroArch-Configuration/#core-input-remapping

        F 1 Reply Last reply Reply Quote 0
        • F
          Fidelio @sleve_mcdichael
          last edited by

          @sleve_mcdichael said in Unable to configure per-ROM input override for MAME:

          Use core input remapping. Save it as a game remap.

          https://retropie.org.uk/docs/RetroArch-Configuration/#core-input-remapping

          Thank you for the suggestion!

          I was able to launch RGUI within sf2 and produced the following sf2.rmp file. RetroArch confirms this is loaded when launching the game.

          input_libretro_device_p1 = "1"
          input_libretro_device_p2 = "1"
          input_player1_analog_dpad_mode = "0"
          input_player1_btn_a = "0"
          input_player1_btn_b = "1"
          input_player1_btn_r = "8"
          input_player1_btn_x = "11"
          input_player1_btn_y = "9"
          input_player2_analog_dpad_mode = "0"
          

          I don't know what the numbers represent for the player inputs, but I made sure to remap the button layouts as follows.

          A (button 4) -> (button 1)
          B (button 1) -> (button 2)
          Y (button 2) -> (button 3)
          X (button 3) -> (button 6)
          R (button 6) -> (button 4)
          

          The key-mappings remain unchanged.

          Unfortunately this has the same effect as my remapping at the ROM level. Only the unmodified L input is working and the rest only work when two adjacent buttons are pressed.

          Clearly there is some conflict happening between the emulator and RetroArch, but only when remapping is introduced. Any ideas what might be causing this?

          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator
            last edited by

            @fidelio said in Unable to configure per-ROM input override for MAME:

            I was able to launch RGUI within sf2 and produced the following sf2.rmp file. RetroArch confirms this is loaded when launching the game.
            [..]

            The remap refers to gamepad's buttons, while your original configuration had a keyboard override. Is your iPAC configured as a keyboard or gamepad ?

            Regarding your game .cfg file, you shouldn't include the main config file at the end of it, since the main config file is loaded automatically.

            Please provide also some information about your system, as asked in https://retropie.org.uk/forum/topic/3/read-this-first. A verbose log might shed some light on what remaps/configs are loaded by RetroArch when you start the game.

            F 1 Reply Last reply Reply Quote 0
            • F
              Fidelio @mitu
              last edited by

              @mitu said in Unable to configure per-ROM input override for MAME:

              The remap refers to gamepad's buttons, while your original configuration had a keyboard override. Is your iPAC configured as a keyboard or gamepad ?

              It is configured as a keyboard. In fact, I believe that's the only permissible configuration for this IPac (pre-2015 PS/2 I/O version). I should note that the RetroArch in-game control remapper saved the rmp file in the gamepad format.

              I also changed the configuration keys in the rmp file to the keyboard-based strings as in retroarch.cfg, but that reverted to the default behavior (suggesting the configuration keys were ignored).

              input_libretro_device_p1 = "1"
              input_libretro_device_p2 = "1"
              input_player1_analog_dpad_mode = "0"
              input_player1_a = "0"
              input_player1_b = "1"
              input_player1_l2 = "-1"
              input_player1_l3 = "-1"
              input_player1_r = "8"
              input_player1_r2 = "-1"
              input_player1_r3 = "-1"
              input_player1_x = "11"
              input_player1_y = "9"
              input_player2_analog_dpad_mode = "0"
              

              I also replaced both the keys and values in the rmp with those from my per-ROM configuration and observed the same effect.

              input_libretro_device_p1 = "1"
              input_libretro_device_p2 = "1"
              input_player1_analog_dpad_mode = "0"
              input_player1_y = "ctrl"
              input_player1_x = "shift"
              input_player1_l = "x"
              input_player1_b = "alt"
              input_player1_a = "space"
              input_player1_r = "z"
              input_player2_analog_dpad_mode = "0"
              

              Please provide also some information about your system, as asked in https://retropie.org.uk/forum/topic/3/read-this-first. A verbose log might shed some light on what remaps/configs are loaded by RetroArch when you start the game.

              Pi Model or other hardware: 3 Model B
              Power Supply used: 9V 2A via 5V buck regulator
              RetroPie Version Used (eg 3.6, 3.8.1, 4.1 - do not write latest): 4.7.1
              Built From: RetroPie pre-made image from website; updated core packages and emulators
              USB Devices connected: USB keyboard
              Controller used: custom arcade controller via pre-2015 IPAC2.
              Verbose log: https://pastebin.com/t1mwtpCp

              mituM 1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator @Fidelio
                last edited by

                @fidelio said in Unable to configure per-ROM input override for MAME:

                It is configured as a keyboard.

                In this case, the .cfg game overrides from the docs should work:

                input_player1_y = "ctrl"
                input_player1_x = "shift"
                input_player1_l = "x"
                input_player1_b = "alt"
                input_player1_a = "space"
                input_player1_r = "z"
                
                input_player2_y = "a"
                input_player2_x = "w"
                input_player2_l = "k"
                input_player2_b = "s"
                input_player2_a = "q"
                input_player2_r = "i"
                
                config_save_on_exit = false
                

                Your log doesn't show the game's .cfg being loaded - I assume you delete it ?

                F 1 Reply Last reply Reply Quote 0
                • F
                  Fidelio @mitu
                  last edited by

                  @mitu said in Unable to configure per-ROM input override for MAME:

                  In this case, the .cfg game overrides from the docs should work:

                  Thank you for your help, but unfortunately the prescribed .cfg produces the same effect as the other suggestions:

                  • Only the LR button is captured in the game.
                  • Other buttons are captured only when adjacent buttons are pressed simultaneously.
                  • All button inputs work when the overrides are removed, but are in non-ideal locations.

                  Here is a log of the output with only the prescribed sf2.zip.cfg file in the roms folder: https://pastebin.com/bGnnfgdK

                  Your log doesn't show the game's .cfg being loaded - I assume you delete it ?

                  Yes, I removed it during that test to isolate changes. During this test, I tried running with only the .cfg and also with both the prescribed .cfg and .rmp files, but did not observe any changes to the above behavior.

                  Contents of sf2.zip.cfg:

                  input_player1_y = "ctrl"
                  input_player1_x = "shift"
                  input_player1_l = "x"
                  input_player1_b = "alt"
                  input_player1_a = "space"
                  input_player1_r = "z"
                  
                  input_player2_y = "a"
                  input_player2_x = "w"
                  input_player2_l = "k"
                  input_player2_b = "s"
                  input_player2_a = "q"
                  input_player2_r = "i"
                  
                  config_save_on_exit = false
                  
                  1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator
                    last edited by

                    Can you also post your main retroarch.cfg from /opt/retropie/configs/all to pastebin.com ? I don't have an iPAC, but I can use a keyboard to replicate the settings.

                    F 1 Reply Last reply Reply Quote 0
                    • F
                      Fidelio @mitu
                      last edited by

                      @mitu said in Unable to configure per-ROM input override for MAME:

                      Can you also post your main retroarch.cfg from /opt/retropie/configs/all to pastebin.com ? I don't have an iPAC, but I can use a keyboard to replicate the settings.

                      Linked: https://pastebin.com/GXqu8zNc

                      Out of curiosity, I performed a diff of this file and the backup from the distribution and there are very few differences: input1 and input2 settings, and hotkey selection, among some other small things.

                      1 Reply Last reply Reply Quote 0
                      • mituM
                        mitu Global Moderator
                        last edited by mitu

                        That's weird, it seems to work for me.
                        Here's the default mapping, as presented in the RetroArch's Controls menu

                        sf2_default.png

                        After applying the re-map (via the sf2.zip.cfg file), the new mapping is reported fine - and you can easily see they're applied since the navigation in the RetroArch's menu is using the new input for A:

                        sf2_modified.png

                        I'd say check if the arcade's system config for RetroArch (retroarch.cfg) is set to default and also that you don't have any specific input settings set through the MAME's own menu - delete the arcade/mame2003/cfg/sf2.cfg file and retry the game.

                        You could try another game or another arcade emulator (lr-fbneo or lr-mame2003-plus) and see if you get the same behavior.

                        F 1 Reply Last reply Reply Quote 0
                        • F
                          Fidelio @mitu
                          last edited by

                          @mitu said in Unable to configure per-ROM input override for MAME:

                          That's weird, it seems to work for me.
                          After applying the re-map (via the sf2.zip.cfg file), the new mapping is reported fine - and you can easily see they're applied since the navigation in the RetroArch's menu is using the new input for A:

                          I was able to confirm this as well. Each time I modify either of the remapping files (.cfg or .rmp), the changes are reflected in the depicted menus. That said, the issues I mention arise during game play. Were you able to play the game with the input remapping?

                          You could try another game or another arcade emulator (lr-fbneo or lr-mame2003-plus) and see if you get the same behavior.

                          Thank you for this suggestion as it shed light on what may be happening. All other games I tested under mame experience the same problem with remapping, but not with FinalBurn-Neo. I suspected some conflict was causing this and now I'm certain it has to with some mame key-mappings. I deleted the mame configuration from the prescribed folder but that had no effect. I also tested with the default distribution version of the global retroarch.cfg with the same negative results.

                          At this stage, it might be easier for me to just use FinalBurn-Neo but I'll see if I can track down where this conflict with mame is coming from. To the best of my knowledge, all other configurations are in their default state, except for the global retroarch.cfg.

                          mituM 1 Reply Last reply Reply Quote 0
                          • M
                            mahoneyt944
                            last edited by

                            Have you tried bypassing the retroarch cfgs and just using the mame menu remapping directly? Retroarch main menu-> quick menu-> options -> display mame menu.

                            Input general are the global configs
                            Input this game are game level configs

                            F 1 Reply Last reply Reply Quote 0
                            • dankcushionsD
                              dankcushions Global Moderator
                              last edited by

                              However, I'd like to introduce some overrides via RetroArch as the default button mappings do not properly line-up with standard Street Fighter button arrangement.

                              point of order, but they do, but it relies on you using the correct physical location or your buttons:

                              B A R
                              Y X L

                              as for your rebind issue - you may have a per-game or global mame internal override that is present. see here for how to delete them: https://retropie.org.uk/docs/lr-mame2003/#mame-menu

                              F 1 Reply Last reply Reply Quote 0
                              • mituM
                                mitu Global Moderator @Fidelio
                                last edited by mitu

                                @fidelio said in Unable to configure per-ROM input override for MAME:

                                I was able to confirm this as well. Each time I modify either of the remapping files (.cfg or .rmp), the changes are reflected in the depicted menus. That said, the issues I mention arise during game play. Were you able to play the game with the input remapping?

                                With lr-mame2003, I have not.
                                I have a homebrew image for PS1 that works like an input tester, with a graphical gamepad (PS1 gamepad) image that shows which inputs are pressed. I use it to test any input configuration (it has almost all buttons supported by RetroArch) and testing the .cfg with it worked without issues.

                                1 Reply Last reply Reply Quote 0
                                • F
                                  Fidelio @mahoneyt944
                                  last edited by

                                  @mahoneyt944 said in Unable to configure per-ROM input override for MAME:

                                  Have you tried bypassing the retroarch cfgs and just using the mame menu remapping directly? Retroarch main menu-> quick menu-> options -> display mame menu.

                                  Input general are the global configs
                                  Input this game are game level configs

                                  Yes, this works fine. I was hoping to avoid this as I have several Street-Fighter-style games that use the same mapping, and I didn't want to configure every single one manually. The config file copy is ideal, unless I can copy mame's binary config file the same way.

                                  1 Reply Last reply Reply Quote 0
                                  • F
                                    Fidelio @dankcushions
                                    last edited by Fidelio

                                    Thank you everyone for your feedback and suggestions! I think I figured out what is causing the conflicts I am experiencing, for which I'll reference the following screenshot of the mame input configuration for sf2.zip:

                                    sf2-210802-174734.png

                                    My rebindings are attempting to "relocate" buttons, assigning buttons 1->2, 2->3, 3->6, etc... (as noted before). The end result is that only the RetroPad bindings changed, not the keyboard key bindings. The OR clause in the mame mappings thus maps one key/button to two events and that ends up breaking things!

                                    @dankcushions said in Unable to configure per-ROM input override for MAME:

                                    point of order, but they do, but it relies on you using the correct physical location or your buttons:

                                    B A R
                                    Y X L

                                    I had not considered this, but this seems very sensible given mame's default inputs (key or retropad event). I had have wired things using the IPAC switch numbers, which won't be hard to change.

                                    1 2 3
                                    4 5 6

                                    EDIT
                                    Here is a post descripting this same problem, which is due to the "simultaneous" core input setting in retroarch:

                                    https://retropie.org.uk/forum/topic/29976/mame-button-mapping-conflicting-with-retroarch-button-mapping

                                    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.