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

    Configuring <CODE_NOT> Control Mapping in lr-MAME2003?

    Scheduled Pinned Locked Moved Help and Support
    45 Posts 3 Posters 24.8k 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.
    • caver01C
      caver01 @dankcushions
      last edited by

      @dankcushions Interesting! I am particularly curious about setting up Toobin, Sarge (if it would launch correctly) and Vindicators. I would say Battlezone for single-joysitck cabinets, but that one being vector is probably better in AdvanceMAME anyway.

      My 4-player cocktail style cabinet built as a custom "roadcase"

      1 Reply Last reply Reply Quote 0
      • RiverstormR
        Riverstorm @caver01
        last edited by Riverstorm

        @caver01 said in Configuring <CODE_NOT> Control Mapping in lr-MAME2003?:

        I have spare microswitches--I was merely trying to understand why/how I could accidentally get a "not" to show up in a mame2003 config. The fact that it shows up occasionally for me by accident proves that 2003 can handle <CODE_NOT> mapping. I am thinking that it's just interface timing that is messed up for this.

        Sorry I was building off previous posts/conversations. I know you have pretty much mastered AdvMAME! ;) I was referring to "regular" MAME.

        I haven't tried 2003 and I was taking it for granted it was fully working in 2003 as I believe it does in mame4all fine. The only reason I was asking about the cherry switches is they make such a clean click. When you look at the innards they seem to be magnetic when they "click" together. Hence a double click seems almost faulty but I suppose it's a good indicator that the program could be faulty too.

        If you have a moment can you explain what you do with the tank stick? You're trying to say up but not right and down but not left with a regular joystick?

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

          yeah... this works absolutely fine on my pi :) i'm using a normal UDEV controller (joystick, although i'm sure it would work on my gamepads also), and what i do is:

          • TAB on keyboard to enter mame menu
          • Input (This game) ... press ENTER on kb to select
          • UP/DOWN ARROW on kb to select whatever input
          • A button on stick (pause of about half a second), double tap B button)
          • wait a few seconds
          • result: "RetroPad1 A not RetroPad1 B"

          if i repeat the same but instead tap them both at the same time:

          • result: "RetroPad1 A RetroPad1 B" (i guess this means AND)

          so.. this doesn't work for others?

          RiverstormR 1 Reply Last reply Reply Quote 0
          • RiverstormR
            Riverstorm @dankcushions
            last edited by

            @dankcushions said in Configuring <CODE_NOT> Control Mapping in lr-MAME2003?:

            so.. this doesn't work for others?

            It works ok in mame4all-pi & lr-imame4all.

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

              @Riverstorm and lr-mame2003.. at least in my test above.

              RiverstormR 1 Reply Last reply Reply Quote 0
              • RiverstormR
                Riverstorm @dankcushions
                last edited by

                @dankcushions said in Configuring <CODE_NOT> Control Mapping in lr-MAME2003?:

                @Riverstorm and lr-mame2003.. at least in my test above.

                Ok, I am using an XBOX controller so we'll have to wait and see what Caver comes back with for input as it seems to be working software wise for both of us.

                caver01C 1 Reply Last reply Reply Quote 0
                • caver01C
                  caver01 @Riverstorm
                  last edited by

                  @Riverstorm @dankcushions Wow. Ok. I hope I am not wasting everyone's time with this. I have tried repeatedly to do this on my system, and tried again last night. I am using an IPAC which is effectively a keyboard interface.

                  I also happen to have an external USB keyboard attached. I haven't tried using that to do <CODE_NOT>, but I will try it in a couple of hours when I get home. As a possible comparison, can either of you do this with a keyboard, or is it only with joypad/handheld controllers?

                  My 4-player cocktail style cabinet built as a custom "roadcase"

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

                    @caver01 said in Configuring <CODE_NOT> Control Mapping in lr-MAME2003?:

                    I also happen to have an external USB keyboard attached. I haven't tried using that to do <CODE_NOT>, but I will try it in a couple of hours when I get home. As a possible comparison, can either of you do this with a keyboard, or is it only with joypad/handheld controllers?

                    just tried on my wireless keyboard.. works ok for me :) perhaps it's more fiddly with directions than buttons? i can see it harder to get a 'clean' press with a stick direction, than just tapping buttons. that's all i can think of, unless it's some specific ipac thing.

                    caver01C 1 Reply Last reply Reply Quote 0
                    • caver01C
                      caver01 @dankcushions
                      last edited by

                      @dankcushions I don't think this is a fiddly thing related to sensitivity etc. I think it must be how I am configured in some way.

                      Just so we can compare apples to apples:
                      When I first setup my RetroPie image (3.6 image) I setup my configuration in Emulation Station using my arcade buttons (via IPAC4). Of course, ES saw this as a keyboard. Everything went fine.

                      I have all of my buttons setup in configs/all/retroarch.cfg so that all four players are mapped to joystick directions and buttons like so:

                      input_player1_a = alt
                      input_player1_b = ctrl
                      input_player1_y = shift
                      input_player1_x = space
                      input_player1_start = num1
                      input_player1_select = num5
                      input_player1_l = z
                      input_player1_r = x
                      input_player1_left = left
                      input_player1_right = right
                      input_player1_up = up
                      input_player1_down = down
                      

                      and so on with players 2,3,4.

                      No other input configs apply in configs/arcade/retroarch.cfg (nor mame-libretro).

                      If I launch Vindicators with lr-mame2003, press TAB on my external keyboard, then configure inputs (this game), then arrow down to "P1 Left/Up".
                      ENTER
                      press UP, Left, Left in sequence, wait a moment for it to save, I get this written in the box:

                      UP RetroPad1 Up LEFT RetroPad1 Left LEFT RetroPad1 Left

                      Which is a bummer. No "not LEFT" like I would expect. What do you get when you do it?

                      This "UP RetroPad1 Up" reads as though everything is a double-entry on my end. Like it can't do a NOT because it is detecting both a LEFT and a RetroPad Left at the same time.

                      Ideas?

                      My 4-player cocktail style cabinet built as a custom "roadcase"

                      dankcushionsD RiverstormR 2 Replies Last reply Reply Quote 0
                      • dankcushionsD
                        dankcushions Global Moderator @caver01
                        last edited by

                        @caver01 ok that makes sense - what I think is happening is that mame2003 handles keyboard and joystick/gampad presses independently. eg, you can bind your keyboard's LEFT ARROW to RetroPad1 Left (within retroarch global configs), but when you press it in mame2003 it will read both the keyboard LEFT ARROW press, AND RetroPad1 Left in the same input poll. this appears to be messing with the CODE_NOT stuff.

                        i can see some code related to this in https://github.com/libretro/mame2003-libretro/blob/dfea13cbb7a3ece51e84e8e02b87a486ab181beb/src/input.c so i will try and find a way to ignore duplicate presses somehow.

                        1 Reply Last reply Reply Quote 0
                        • RiverstormR
                          Riverstorm @caver01
                          last edited by Riverstorm

                          @caver01 said in Configuring <CODE_NOT> Control Mapping in lr-MAME2003?:

                          If I launch Vindicators with lr-mame2003, press TAB on my external keyboard, then configure inputs (this game), then arrow down to "P1 Left/Up".
                          ENTER
                          press UP, Left, Left in sequence, wait a moment for it to save, I get this written in the box:

                          UP RetroPad1 Up LEFT RetroPad1 Left LEFT RetroPad1 Left

                          Which is a bummer. No "not LEFT" like I would expect. What do you get when you do it?

                          This "UP RetroPad1 Up" reads as though everything is a double-entry on my end. Like it can't do a NOT because it is detecting both a LEFT and a RetroPad Left at the same time.

                          Ideas?

                          I have an IPAC 2 which I can test tonight which would be similar.

                          If I remember right the way MAME works is you would press Enter, Up and let it register. Then without leaving the line (if you leave the line with an up/down arrow and go back it will start over erasing everything). Then press Enter, Left, Left and it will register the NOT Left. Which would be up-but-not-left. If that's what you're trying to do?

                          What I usually do is like for player 1 coin in on a XBOX controller is press Enter, Keyboard 1 and let it register. Then press Enter, Joystick 1 Select and let it register. That way I can use my IPAC/Keyboard button 1 for coin in and also Joystick 1 Select on the controller. I can basically use keyboard or joystick.

                          For player 2 I press Enter, Keyboard 2, let it register. Then Enter, Joystick 2 Select, let it register. Then Enter, Joystick 1 Select+Joystick Left, let it register. What this does is allows me to use the IPAC/keyboard button 2 for coin in for player 2, joystick 2 Select for coin in and also joystick 1 Select+joystick left.

                          Basically it allows player 2 to fully use their joystick but also I can add coins from joystick 1 too. For player 3 it's Keyboard 3 & Joystick 3 Select & Joystick 1 Select+Down and for player 4 it's Keyboard 4 & Joystick 4 Select & Joystick 1 Select+Right.

                          I repeat the same process with Start, Start+Left, Start+Down, Start+Right for players 1-4 start. That way when playing games like Gauntlet in addition to their own controllers working I can also start and add coins from joystick 1. Joystick 1 is kind of like the master joystick in a sense.

                          caver01C 1 Reply Last reply Reply Quote 0
                          • caver01C
                            caver01 @Riverstorm
                            last edited by

                            @Riverstorm What you are describing is how MAME does <CODE_OR> mapping. Waiting for it to register, then, without leaving the line, hitting enter and doing another keymap will <OR> them together (either one will register the input). I can't get it to recognize an intentional double-tap under any circumstance--only the ones done in error, and I can't tell what causes that (I suspect a flakey microswitch).

                            The thing is, I can do these mappings just fine in AdvanceMAME, so it's not like I am inept with this process.

                            Hearing your success with this makes me think I have something going on with my configuration. By that, I mean, something could be amiss with my base retroarch.cfg. I shouldn't be seeing "LEFT RetroPad Left" when I map to the left arrow on a keyboard. That just reads like two separate inputs. It makes sense that it won't allow me to do a <CODE_NOT> because it thinks I am pressing two keys at once (the raw keyboard key and the RetroPad virtual).

                            It makes me wonder what might happen if I try mapping all of my player controls to "nul" in retroarch.cfg. MAME should then just see the raw keyboard inputs. But I am curious how your IPAC is setup.

                            One thing I will say is that I haven't been getting double inputs. Dropping a coin, for example, doesn't give me two credits.

                            My 4-player cocktail style cabinet built as a custom "roadcase"

                            RiverstormR 1 Reply Last reply Reply Quote 0
                            • RiverstormR
                              Riverstorm @caver01
                              last edited by

                              @caver01 said in Configuring <CODE_NOT> Control Mapping in lr-MAME2003?:

                              But I am curious how your IPAC is setup.

                              No I never thought you to be inept at all. If there's any files or information I can pass along just let me know. I will test it out tonight. I have a Pi but not the IPAC with me as it's in the case. :)

                              caver01C 1 Reply Last reply Reply Quote 0
                              • caver01C
                                caver01 @Riverstorm
                                last edited by

                                @Riverstorm Tests with an external keyboard interest me. Thinking this through, I suspect anyone who uses handheld controllers and hooks up a USB keyboard to do this test does NOT have the keyboard setup in retroarch.cfg (lines with inputs mapped to keyboard keys). Maybe I am wrong, but I am still thinking mame2003 is recognizing both the virtual retropad and the raw key being pressed, as revealed by the resulting line displayed (compare mine to @dankcushions notes).

                                My 4-player cocktail style cabinet built as a custom "roadcase"

                                1 Reply Last reply Reply Quote 0
                                • caver01C
                                  caver01
                                  last edited by caver01

                                  @dankcushions @Riverstorm Ok, PROGRESS HAS BEEN MADE! Yippee!

                                  Here's what I discovered:

                                  If I remove all of my player input bindings from retroarch.cfg, I can do some <CODE_NOT> bindings in MAME2003 GUI. However, it fails when I try to map the Player1 joystick and buttons. For those, it is still recognizing double-inputs. For example, LEFT on the player 1 joystick (which the IPAC sends as the left arrow key) is coming in as LEFT RetroPad1 Left. Whereas, outside of Player one controls, keys come as they are. For example, LEFT on the Player 2 joystick registers as d and has none of this RetroPad2 Left virtual input attached.

                                  If I re-edit retroarch.cfg and force-bind all of my Player1 inputs to "nul" I can do <CODE_NOT> bindings in MAME2003 GUI and even regular bindings show up as only the key inputs (i.e. pushing LEFT on the P1 joystick binds in the GUI as LEFT and doesn't include the virtual RetroPad Left.

                                  So, here are my initial conclusions about what is going on:

                                  1. RetroArch sends the virtual inputs (via RetroPads) to MAME2003, as it should, but when the RetroPads happen to be KEYBOARD keys, MAME2003 "hears" both the RetroPad input and the raw key input. This is why TAB works, even though I don't have it bound anywhere in retroarch.cfg. It's also why the inputs I DO have setup in retroarch.cfg show up as both the raw key and the RetroPad input TOGETHER which prevents issuing a <CODE_NOT> (because it is already capturing a <CODE_AND>. Finally, it explains why folks who use handheld controllers don't have this problem. Their virtual inputs aren't raw keypresses, so MAME only sees the RetroPad.

                                  2. Even if I remove the Player1 bindings in retroarch.cfg, MAME still sees a RetroPad on Player 1 controls. I am thinking there's some kind of EmulationStation-to-RetroArch thing happening here where the initial setup in ES is automatically configured in the cores. The only recourse is to force-bind "nul" to the same.

                                  So. . . I think I have uncovered a bit of a mess. MAME should not be allowed to see both the RAW input and the virtual one at the same time IF THEY ARE BOTH THE SAME RAW KEY. I don't know how one would correct for this programatically. Maybe it has been dealt with in other cores. The only folks affected are those of us who use keyboard controllers as these create raw inputs that MAME sees by default.

                                  We don't want to block the RAW keyboard inputs since not everything has an equivalent input on the RetroArch side. I could just bind everything to "nul" but this seems messy. Moreover, how would I handle that configuration when I want to keep the bindings for FBA (it looks like the lr-mame2003 uses the retroarch.cfg in the Arcade folder--what about FBA?) Does anyone know about a way to BLOCK the Virtual RetroPad inputs for one emulator core? That would be preferred approach.

                                  My 4-player cocktail style cabinet built as a custom "roadcase"

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

                                    @caver01 nice job! sounds like my theory earlier was right.

                                    Does anyone know about a way to BLOCK the Virtual RetroPad inputs for one emulator core? That would be preferred approach.

                                    my plan before was to block the raw keyboard inputs IF they match the RetroPad inputs. i need to break through the code i linked to earlier to see if that's viable.. maybe this could be logged as an issue against lr-mame2003?

                                    caver01C 1 Reply Last reply Reply Quote 0
                                    • caver01C
                                      caver01 @dankcushions
                                      last edited by caver01

                                      @dankcushions Yes. That would do the trick! Sorry, I completely missed your reply, but your interpretation is proving to be correct. And, because two inputs are detected, the double-taps are ignored--each attempt looks like two buttons pressed simultaneously.

                                      Would you like me to try to post the issue against lr-mame2003? I've never done that.

                                      My 4-player cocktail style cabinet built as a custom "roadcase"

                                      dankcushionsD caver01C 2 Replies Last reply Reply Quote 0
                                      • dankcushionsD
                                        dankcushions Global Moderator @caver01
                                        last edited by

                                        @caver01 please do! it's https://github.com/libretro/mame2003-libretro/issues - you could link to this thread if you don't want to repeat your findings there. i'll have a play over the weekend hopefully

                                        caver01C 1 Reply Last reply Reply Quote 0
                                        • caver01C
                                          caver01 @caver01
                                          last edited by

                                          In the mean time, I can't really tell if the current state is having an affect on gameplay. I suspect it creates unnecessary overhead--with every input generated the emulator process simultaneous inputs--but I don't get a sense that there is a timing issue or delay.But now that I know what is happening, I tried a workaround on a single ROM using a per-rom config vindictr.zip.cfg where I force-bind every input represented configs/all/retroarch.cfg to "nul". This, temporarily, at least, lets me build single joystick "tank stick" configurations with the <CODE_NOT> key maps described in the original post. Lo and behold. . .I can play Vindicators with lr-mame2003 in all of its CRT-PI shader glory!

                                          I consider this workaround temporary, as it will become unnecessary if double-inputs gets resolved the way you describe.

                                          My 4-player cocktail style cabinet built as a custom "roadcase"

                                          1 Reply Last reply Reply Quote 0
                                          • caver01C
                                            caver01 @dankcushions
                                            last edited by

                                            @dankcushions Issue added.

                                            My 4-player cocktail style cabinet built as a custom "roadcase"

                                            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.