Advmame controller problem
-
@spud11 I had a thought about your experience with mspacman. It strikes me that unless you have the virtual DIP switch set to cocktail mode, that this game does indeed use player 1 controls for player 2. Follow me here. Imagine the actual arcade system, a stand-up cabinet with a single joystick. Where is player 2 controls? There are none. On the real game, you have to share the same joystick. Well, that may be exactly why that game is behaving the way it is.
Now, if you enable Cocktail mode, which is for a specific kind of cabinet, with two sets of joysticks across from each other, you get the different controls for player 1 and 2 because they are actually different controls on the real system. Of course, the screen also flips.
This same effect happens in Black Tiger as well, where the controls for player 2 don't really do anything unless running in cocktail mode.
In the end, this might just be accurate emulation of the real hardware.
-
@caver01 Well, I've certainly learnt something new. I didn't realise the Advmame TAB setup was so sophisticated that it allowed this kind of key setup. That's really helpful. Thanks, caver01.
-
@caver01 That makes 100% sense to me. The only thing that strikes me though is why advmame would allow us to set up 2 Player controls that are different from 1 Player controls, if it's not going to allow us to use those controls. But I think you've got to the nub of the problem. I'll be posting a response to mediamogul's comments in a minute too.
-
@mediamogul I thought about this problem overnight. It strikes me that I should be able to use my existing lr-mame2003/xboxdrv setup to bypass this issue with advmame.
xboxdrv allows me to map all 4 joysticks to the same keyboard settings for lr-mame2003. So what I've done is map Joysticks 3 and 1 to Player's 1 keyboard controls and Joysticks 2 and 4 to Player 2's keyboard controls. What this means is that it doesn't matter whether the game is in Portrait mode or in Landscape mode, I can either use Joystick 1 or Joystick 3 for Player 1 depending on the orientation; same with Player 2, using Joystick 2 or 4. I've tested this with Ms Pacman "in game" and it appears to work as it records movement with Joysticks 1 and 3 whilst playing Player 1; same with Player 2 using Joysticks 2 and 4.
So what I'll probably do now is setup a new folder for the lr-mame2003 romset in landscape mode and remove the advmame romset for the time being. I'll post my new xboxdrv code in the "Advanced Mapping Guide" thread.
-
@spud11 I get your frustration about this. I thought the same thing with Black Tiger a while back. It is a horizontal game, and I wanted player 2 to use a second set of controls I have mounted in that orientation, but was angry when the game insisted I use player 1's joystick. Then I tried cocktail mode, which worked, but it was upsidedown for player 2.
So, the reason it lets you set separate controls for player 2 is for when you have a cabinet setup in cocktail mode that does indeed have separate controls. It would seem that the original game hardware would have to accommodate a second set of controls with this cabinet style. Otherwise, it all plays on the same joystick which is why the player 2 config is ignored on a regular cabinet. Makes sense, just doesn't make us very happy. It is easy to forget that the emulator is simply reproducing the capabilities of the original hardware, not merely adapting the gameplay to our modern control systems.
-
@caver01 Yep, it's really quite remarkable how far emulation has come, particularly in the last 3-4 years, as we can now much more easily create the "look" of an arcade machine with the Raspberry Pi as the guts of it.
Hopefully, the author of advmame will find a software solution to what is an issue caused by perfect hardware emulation (as you've said). In the meantime, I'll probably just use lr-mame2003 with xboxdrv. I started using that core in the first place because I found that with a 1920x1200 monitor I was able to implement "real" full screen resolution more easily, than with advmame .
I love your build, by the way. I took note of it when you first put the screenshots up. A labour of love.
-
@spud11 Thanks!
I wouldn't expect much to change in advancemame on this. By any account, the emulator is "working as designed" as they say. It is the game code that is ignoring player 2 controls, not mame. It simply checks the cocktail cabinet dip switch, and if it is set to upright, well there is only one joystick in the machine, so player 2 is going to share the player 1 joystick. Nothing to fix here. Not as much fun with friends, but you could use it as an opportunity to emphasize the quality of the emulation and explain how the original cabinet worked and chalk it up to "accuracy".
-
@caver01 Thanks for letting me know that - that it's unlikely to be "fixed" (not that it really needs fixing, as such, as it's just doing what it should be doing).
By the way, given that you are using arcade joysticks, could I ask please how you have addressed the 4-way/8-way joystick problem with older games like Ms Pacman? Are your joysticks already hardware (4 way) restricted? I ask because, with mediamogul's help, I turned to xboxdrv because of its ability to software restrict my 8-way joysticks for Ms Pacman etc.
-
@spud11 said in Advmame controller problem:
When I checked the advmame.rc again, it basically gave me this for each line:
input_map[p2_up] keyboard[0,r] or keyboard[1,scan0] or keyboard[2,scan0]
which might mean it can't find the extra virtual keyboards (?).
Edit: A proper solution to this can be found at the post below.
I noticed the same behavior today. Advance MAME/MAME can really be too smart for it's own good sometimes. It tries to set up everything automatically on every launch and ends up overwriting settings that I would prefer be set in stone.
There may be a better way, but I took a page out of the RetroPie playbook as to how RetroArch is set up and completely restricted the software's ability to make changes to the settings. From now on, I'll be configuring all the settings manually through a text editor. What I've done is added a command to
/opt/retropie/configs/all/runcommand-onstart
that removes write permissions to/opt/retropie/configs/mame-advmame/advmame.rc
on launch and paired it with a command in/opt/retropie/configs/all/runcommand-onend
that reinstates write permissions when the software exits. For anyone interested in this madness, the examples are below.runcommand-onstart
if [ "$2" = "advmame" ] || [ "$2" = "advmess" ] then chmod -w /opt/retropie/configs/mame-advmame/advmame.rc chmod -w /opt/retropie/configs/mame-advmame/advmess.rc
runcommand-onend
if [ "$2" = "advmame" ] || [ "$2" = "advmess" ] then chmod +w /opt/retropie/configs/mame-advmame/advmame.rc chmod +w /opt/retropie/configs/mame-advmame/advmess.rc
-
@mediamogul Okay, that's interesting. Ironically, over the weekend, I decided to ditch lr-mame2003 for the landscape roms (but leaving it for the portrait mode roms) and I have, once again, reinstalled my advmame setup with its romset, with a view to trying to get the Player 2 controls separately recognised, probably with xboxdrv. It is probably a forlorn hope for me, given that the roms themselves are acting consistently with their programming, but I might as well try and see if the keyboard workaround can be made to work on my system. I'll play around with your new runcommand-onstart/runcommand-onexit commands as part of my messing around.
One thing I was thinking of doing was, using xboxdrv, to tie all joysticks to Player 1's keyboard controls (up/down/left/right) etc, but the problem with that is that it no doubt will interfere with the 2 player simultaneous games. Having checked the forum and especially @caver01 's comments over the past 10 months, unlike the 4-way restricted games, there doesn't appear to be a comprehensive list of 2 player simultaneous games that can be "carved out".
-
@spud11 you don't have to break other games with a single rom control setup. Just add the
romname/
in front of the inputs in the .rc file and they will be just for that game. -
@caver01 Okay, thanks for that too.
-
@spud11 No prob. The .rc file is pretty sensitive to errors--mame won't launch if there is a mistake in the file. But you can use the rom prefix like a comment delimiter if it makes it easier for testing. For example, you could add the fake ROM name
comment/
in front of a line to effectively have Advancemame ignore it until you launch a ROM called "comment". -
Setting up reliable controls for Advance MAME has been a bit like wrestling a bear, but now that it's done, I'm amazed at the number of games that are finally playable on the Pi. Right off the bat I mapped a nice set of fully analog tank controls for 'Discs of TRON', and I was even able to play ATARI's 'Stun Runner', which was way past the tipping point previously. 'Tapper', 'Paperboy', 'Journey' and 'TRON' are also all performing well in the audio department after setting resample to 'internal' and the vector games are gorgeous after following your guide. Your name and insights have come up quite a few times while I've been researching all this, so I wanted to thank you personally.
-
@mediamogul Wow, that's real nice. Thanks. We each add what we can to the wealth of configuration knowledge and experience, and since my cabinet is primarily an arcade machine with real arcade controls, my contributions have been along those lines. Also, I started using another distribution--PiPlay which was built around AdvanceMAME, so I got pretty good at configuring it. We have come a long way since then, and everything keeps getting better.
I hope to payback the compliments soon, however, as my next build project will be a TV connected box with bluetooth 8bitdo controllers. At some point, I will be diving into many of the same challenges you faced configuring the games I love. I am especially curious about Tron, DOT, and other titles that can take advantage of analog sticks.
I am curious about a few arcade titles like Food Fight, Sinistar, and others that use either a 49-way or a hall-effect joystick. These perform clumsily on a digital 8-way stick. Do they translate better to an analog gamepad stick?
-
@spud11 I guess I overlooked your question/comment about 4-way vs. 8-way joysticks. But before I get into it, I wanted to mention that in the .rc file, if you specify your keyboard device as RAW, then all keyboards look like ONE keyboard to MAME. That saved me so much headache once I figured that out I can't even tell you. On AUTO, it was detecting multiple keyboards, and depending on USB ports and whether I had a real external keyboard attached, Keyboard [1] would get written into the config file when configuring my IPAC controls, and later, when I unplugged the external keyboard, it would move, so the inputs would no longer be recognized (the IPAC would now move to Keyboard [0]). Anyway, once I specified RAW those problems disappeared and ALL keyboard key presses were interpreted as if they were coming from a single keyboard. It no longer mattered if I attached an external. "J" was always "J" no matter where it came from.
Now, for the 4-way and 8-way sticks, this is a real problem for folks using actual arcade controls. The only true solution is a physical restrictor plate. I'd love to try one of the expensive 360 joysticks from Ultimarc to effectively pull this off in firmware, or the Mag-stik that allows you to switch this on the fly. On Happ Supers or Competition sticks, you can make some adjustments with the actuator on the bottom of the joystick but all you are really doing is making it easier or harder to hit both microswitches in the corners.
@mediamogul describes a way to overcome these issues with software using the xboxdriver, but from what I have heard to date, this solution is for gamepad users and won't really apply to folks like me using a keyboard controller. That's a real bummer, as I would love to have reliable 4-way control for games without giving up my 8-way setup. For now, I just have to pretend, and watch the frustration of friends when Mario gets stuck on a ladder, or PacMan doesn't turn. People usually chalk it up to user error, with the nostalgia overshadowing the bad gameplay--but I know better.
If there is one weakness in my build, it is the 8-way sticks for 4-way games. I hate it. But whadayagonnado.
-
if you specify your keyboard device as RAW, then all keyboards look like ONE keyboard to MAME.
...and with that valuable tip, you've just remedied the last problem I had with Advance MAME. Restricting write access to the preferences, as I mentioned above, allowed for a hackneyed solution to set keyboard controls that wouldn't shift, but it came at the price of not being able to use the GUI and one other insurmountable problem. I always map save state an load state to 'select+r' and 'select+l' respectively, but MAME was throwing up a notice to specify the slot location that would only accept input from keyboard 0. Setting
device_keyboard
to 'raw' solves the whole shebang. I'll make note of it in my post above, so that no one else wastes time going in that direction. -
@mediamogul Yeah, I don't know if I have ever mentioned raw keyboard for AdvMAME on this forum. I kinda forgot about it, to be honest, and with each new image I configure, I always pull in the changes I have made to my .rc file(s).
I can see a possible use case for individual keyboards detected, as you could get really creative with multiple controllers, but there are more than enough keys to go around, so it doesn't make much sense to have them separated.
I'm glad this tip helped. I was really pulling my hair out over this a long time back, almost to the point of maintaining my .rc file with a complicated spreadsheet so I could output changes that would include mapping to all "possible" keyboards attached. That would have been a big mess, especially given some of the complex mapping I have setup for games like Sarge where I am using a single joystick to drive a tank by leveraging <CODE NOT> boolean mapping for tanksticks.
-
@caver01 Oh, this is very good information - raw format. Over the past 3 or 4 days, I haven't had a chance to experiment with Advmame to see if I can make things happen the way I want them to. But I'll set things to raw mode and play around with that and xboxdrv and see if there might be some options.
Regarding the physical restrictor gates, this is true, but you'd be surprised how well the software solution can work (at least using the joysticks I have). I'm lucky that I went the DragonRise/USB encoder route rather than IPAC, as my encoder isn't recognised as a keyboard and so it actually works well with xboxdrv. (For me, with Ms Pacman, if xboxdrv is in "8-way mode", Ms Pacman's head spins around like Linda Blair in The Exorcist, whereas it doesn't in "4-way mode". It's very funny.)
However, before going down the xboxdrv route, I looked at other options. One such option we haven't mentioned is:
I have not tested one of these. These guys don't ship to my country and, although I have relatives in the US who I could ship it to, it is fairly expensive (if you buy 4, as I was contemplating). Because of my setup, getting under my arcade table is a real pain, so a solution that slots over the top was what I was looking for. The seller has 3 or 4 different varieties and a proper non-ebay website too if you want to know more.
-
@spud11 I appreciate those options, and if I was starting from scratch it would be hard to ignore those possibilities. However, I can't really modify the top surface of my panel. My best option for improving 4-way is via software, or replacing my sticks with ones that are a lot more expensive that let me trigger restrictors electronically, or with digital sticks that emulate 4 way action. The fancy digital sticks like the Ultimarc 360 would be preferable, as I could also leverage this for games that want a 49-way, or hall effect pseudo-analog input.
Still, I am VERY interested in seeing how far I could go with an IPAC and the xboxdrv. I had thought not very far, but perhaps there is a way to emulate a gamepad by way of keyboard presses? I just have not researched it.
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.