MAME2003/MAME078 Control problem

Questions about arcade game emulation support on the ARpiCADE (MAME, DAPHNE, Picodrive, etc...)

Moderator: dee2eR

dee2eR
Inventor
Inventor
Posts: 1860
Joined: Tue Aug 22, 2017 2:07 pm

Re: Set control order in MAME emulators

Post by dee2eR » Wed Oct 21, 2020 1:18 am

Ah, I understand how you were getting joystick one as presented as joy2 now... from your other thread it sounded line the rotary controller was simulating a keyboard so this issue never occurred to me. If you can stop the roatary controller sending joystick events by reflashing it as keyboard only it may fix the issue (I'm not sure if the rotary hardware can do/be set up like that though).

I think it should also be fixable system wide using some UDEV rules, unfortunately I'm not sure about it. A quick Google didn't bring an immediate result for me to pass on either. Linux can be a bit funny about USB ordering, I haven't heard of it interfering with the GPIO before though... guess USB must be setup first during boot up.

If the issue is only noticed in MAME 0.078 (and the other Retroarch based stuff) and not the dedicated MAME versions it may be simplest to check the controller setup in the Retroarch menus. Settings > Input > User 1 Binds > User 1 Device Index [change this to be RaspberryJAMMA Player1] (and probably do this for P2 as well in the User 2 section). This way you shouldn't have to redo all of the MAME inputs.

EDIT: I've merged the topics together just to make it easier to keep track of.

User avatar
triggerhappy
Super Contributor
Super Contributor
Posts: 59
Joined: Thu Sep 17, 2020 11:49 pm

Re: MAME2003/MAME078 Control problem

Post by triggerhappy » Wed Oct 21, 2020 2:53 am

dee2eR wrote:
Wed Oct 21, 2020 1:18 am
from your other thread it sounded line the rotary controller was simulating a keyboard so this issue never occurred to me. If you can stop the roatary controller sending joystick events by reflashing it as keyboard only it may fix the issue
That occurred to me too, and I checked that again myself today by connecting the rotary controller to my PC and running the Ultimarc WinIPAC utility. However, the utility reports that the board is already running in keyboard mode, so I'm not sure why the RPi is detecting it as a 'joystick'.

As for which versions of MAME I have observed this behavior in, it appears to be 078, 139, 172 and 203. I have not had to remap the P1 controls in 106.

Re. the Retroarch menus, can you explain how I access those? I'm not sure I know how to get to Settings > Input > User 1 Binds > User 1 Device Index. Thanks dee2eR!

dee2eR
Inventor
Inventor
Posts: 1860
Joined: Tue Aug 22, 2017 2:07 pm

Re: MAME2003/MAME078 Control problem

Post by dee2eR » Thu Oct 22, 2020 5:26 am

you can open the Retroarch menu when a game is running in Retroarch by pressing either p1start+b6 or f1 on a keyboard. Once it's open you will need to press b2 (back in the RA menu) to exit the quick menu to see all the options you need. Joystick to move around the menu and b1 selects.

User avatar
triggerhappy
Super Contributor
Super Contributor
Posts: 59
Joined: Thu Sep 17, 2020 11:49 pm

Re: MAME2003/MAME078 Control problem

Post by triggerhappy » Fri Oct 23, 2020 8:46 pm

triggerhappy wrote:
Wed Oct 21, 2020 2:53 am
That occurred to me too, and I checked that again myself today by connecting the rotary controller to my PC and running the Ultimarc WinIPAC utility. However, the utility reports that the board is already running in keyboard mode, so I'm not sure why the RPi is detecting it as a 'joystick'.
Thanks again, dee2eR. Couple of updates:
  • Per Andy at Ultimarc, the rotary board being detected as a joypad controller is by design, regardless of whether it is configured to emit keystrokes or button presses. This is in spite of the fact that the WinIPAC utility actually reports the board is running "Keyboard-only Firmware," which suggests it should only be seen as a keyboard. Andy explained that this is actually a known issue in the WinIPAC software with re. to its detection of the rotary board and will be corrected in a future release. He also speculated that a true keyboard-only firmware for the rotary board could be released, but he didn't make any predictions on when that could happen, so I'm not holding my breath at this point.
  • I experimented unsuccessfully with changing the Retroarch input settings. When the rotary board is connected to the RPi, the JAMMA controls will not even allow me to access or move around the Retroarch menus; I have to disconnect the board in order for my joystick and buttons to work. In that scenario, Settings > Input > User 1 Binds > User 1 Device Index is already set to "RaspberryJAMMA Player1". There doesn't appear to be a way for me to navigate to that setting when the rotary board is connected. So if I can't get to it, how do I change it?

dee2eR
Inventor
Inventor
Posts: 1860
Joined: Tue Aug 22, 2017 2:07 pm

Re: MAME2003/MAME078 Control problem

Post by dee2eR » Tue Oct 27, 2020 6:41 am

sorry for the slow reply.

that makes sense, if p1 is setup wrong you can't use the menu to fix it... Do you have access to the second partition? You can edit the config file(s) directly, they're in /home/pi/.config/retroarch/ (check the launcher script for whatever emulators to see which config file to edit, there are lots in there...)

Back the file up before editing in case, the Retroarch config files are long and a typo could break them...

Unfortunately the joystick order may not be respected as the config files should have already been setup right for the RaspberryJAMMA. Keeping the Ultimarc joysticks in the config but making them player 3 and 4 (or even 5 and 6 maybe) may force them to respect the config though, I'm not sure. Your first instinct to edit the config via MAME may be the one to do in the end.

Otherwise a UDEV rule or similar to force the Linux kernel to either ignore the extra joysticks generated by the Ultimarc board or at least force them to be players 3 and 4 (or 5 or whatever) may be possible. I don't have the hardware to try anything to help unfortunately.

User avatar
triggerhappy
Super Contributor
Super Contributor
Posts: 59
Joined: Thu Sep 17, 2020 11:49 pm

Re: MAME2003/MAME078 Control problem

Post by triggerhappy » Wed Oct 28, 2020 6:20 pm

dee2eR wrote:
Tue Oct 27, 2020 6:41 am
Do you have access to the second partition?
Yes, I have wifi and ssh set up, so I can access all files.
dee2eR wrote:
Tue Oct 27, 2020 6:41 am
Unfortunately the joystick order may not be respected as the config files should have already been setup right for the RaspberryJAMMA. Keeping the Ultimarc joysticks in the config but making them player 3 and 4 (or even 5 and 6 maybe) may force them to respect the config though, I'm not sure. Your first instinct to edit the config via MAME may be the one to do in the end.
I figured out how to get around my Retroarch control issues. I first booted without the rotary controller attached, which allowed me to move about the Retroarch settings using the P1 controls. I then turned Settings > Input > All Users Control Menu to "ON". After powering down, reconnecting the rotary board, and restarting, I was then able to navigate the Retroarch menu with my joystick. This allowed me to go back to Settings > Input > User 1 Binds > User 1 Device Index and set it to "RaspberryJAMMA Player1". That solved my control issues in games running under MAME 0.078 (Retroarch)!

I also figured out how to map my P1 inputs to my GPIO controller in MAME 0.203 by creating a new ctrlr file (custom.cfg), which I placed in the /home/pi/mame203/ctrlr folder (see below).

Code: Select all

<mameconfig version="10">
    <system name="default">
        <input>
            <mapdevice device="GPIOController1" controller="JOYCODE_1" />
            <mapdevice device="GPIOController2" controller="JOYCODE_2" />
        </input>
    </system>
</mameconfig>
I then set the value of the ctrlr setting in /home/pi/mame203/mame.ini to "custom" and voila! All my games running under MAME 0.203 work as expected with the P1 input settings in the default.cfg.

The only remaining sticking point I have is that I was not able to apply this same fix to MAME 0.172. I tried copying the same ctrlr file I used in 0.203 into /home/pi/mame172/ctrlr and updated the ctrlr setting in /home/pi/mame172/mame.ini, but for some reason, MAME 0.172 does not recognize the control mapping. I can't for the life of me figure out what is going on there. So as a fallback, I edited the P1 input mappings in the /home/pi/mame172/cfg/default.cfg file, changing all "JOYCODE_1" instances to "JOYCODE_2".

This ultimately allowed my controls to function as expected in games running under MAME 0.172. However, it's not as elegant as the control mapping solution I used for MAME 0.203. Any idea why this doesn't work in 0.172?

User avatar
cool_factor
Legendary Contributor
Legendary Contributor
Posts: 332
Joined: Tue Sep 26, 2017 10:55 am
Location: Fort Worth TX

Re: MAME2003/MAME078 Control problem

Post by cool_factor » Sat Apr 22, 2023 1:43 am

Seeing this exact same issue with the GRS Star Wars yoke. Bumps my joysticks to j3 and j4, disconnect flight yoke and everything works as it should. Very frustrating...

Post Reply