Compiling MAME, Linux Wiz Advice Needed

Hi all, I would like to try MAME in standalone mode to see if some of my non working roms work better that way. I did the same and compiled FBA (FBNeo) and it helped. I have found a tutorial for an older version of MAME, can a Linux Wiz tell me if the steps seems sound or if there is other tutorials out there…

I need to know because yesterday at 1am I tried some kind of tutorials elsewhere and…well, I had to reflash my GS lol

Here is the tutorial:

What you did with FBA? It is interesting! And helped with what? :grinning:

Well I now use FBneo_libretro core (compiled from FBNeo: Look at the compiling FAQ here:

All this with Romset FinalBurn Neo on buildbot is: 29.8 MB (31,312,612 bytes)
fbneo core compiled manually is: 35.4 MB (37,153,480 bytes)
So, something is different but what exactly, I do not know…

Most games that where already working stay the same of course but some other titles, that where causing problems, are “less buggy”. Some of them still have major issues but others like ex. Night Slashers, can be played very well after tweaking retroarch settings a little.

I can’t go into an exhaustive list of what work better or not since there is so many of them. But I am currently working on a cleaned pack of roms (without all the crap), that I test 1 by 1 and create .alias files to rename them etc… It should take me a while! lol

My goal is to use the latest rom pack possible to get more games out of the emulator, wether its FBA or MAME…

You wanna compile core, or standalone emulator? If you want to compile core, then there was a discussion here: Running ScummVM games on RetroArch

I want StandAlone MAME.
Compiling MAME seems to be more complicated than ScummVM

I haven’t tried this myself, hut it looks like there is a newer way to build the latest Mame for Raspberry Pi. This guy has build instructions on his website, and also has a binary for download that he’s built. (There’s some setup to do even before running his binary.)

Did you already try this one? If his build works well enough that would save the compile time (which sounds like it takes many, many hours!) May still be good to do a native build on GameShell in case there are optimizations or maybe issues with compatible libraries.

Anyhow, I may try this when I get some time. Hoping it might fix the display problems (being scaled wrong and cut off) that happen with the Retroarch core.

1 Like

it’s over 48 hours, but GameShell still compiling the standalone MAME
so if it is possible to finish, the binary size of standalone MAME would be very large ,I guess

So, I tried running the binary available at the site I posted above. I didn’t remove or build the SDL2 sources, and I didn’t build mame sources either.

Direct download is here:

I unzipped the contents in a temporary directory. Then I ran:

./mame -cc

to create a mame.ini file. I saw the roms directory was already created when I unzipped. I copied a few roms over and then I ran:

DISPLAY=:0 ./mame pacman
via ssh.

Pacman booted up, and the display isn’t cut off! None of the keybindings are correct though, so I didn’t get farther than that, though the menu button (esc) exited out cleanly.

I’m on OS 0.4 and currently have the lima driver turned on.

A custom build for the GameShell might be more optimized. And it’s possible replacing SDL2 might help, as per the guide at the website linked above. But I just wanted to see if ti worked at all before I kicked off a multi-hour build process, or potentially wrecked my SD2 support and had to reinstall the OS. :wink:

I’m going to hack around with keybindings in mame.ini now and see if I can get this playable. I’m also not sure if sound is working since there’s no sound in the pacman attract mode anyway, and I can’t coin up or do anything yet because my inputs are not set right.

Sound does work, but the only way I could test it was by running a game with sound in the attract mode (Do Run Run). I haven’t been able to get input recognized from the GameShell buttons. Need to play around with this more. The trick I’ve used before to map keys before running it doesn’t seem to be working.

If I put this in a file and run it, I can press an arrow key to get past the info screen but then none of the keys work. It’s weird.

xmodmap -e “keysym BackSpace = Tab”
xmodmap -e “keysym space = 5”
xmodmap -e “keysym Return = 1”
xmodmap -e “keysym KP_Subtract = ~”
xmodmap -e “keysym KP_Add = p”
xmodmap -e “keysym j = Control_L”
xmodmap -e “keysym k = Alt_L”
xmodmap -e “keysym u = space”
xmodmap -e “keysym i = Shift_L”
xmodmap -e “keysym h = z”
xmodmap -e “keysym l = x”
DISPLAY=:0 ./mame dorunrun

I’m also getting lots of:
“ALSA lib pcm.c:8424:(snd_pcm_recover) underrun occurred”
errors in my ssh window. It might be a little slow too, but it’s hard to tell since I haven’t been able to actually play anything yet, or get into the MAME menu to tweak settings.

Hmm… I was expecting better results. Could be optimisations issues. Which ROMset did you try, 0.189? Also, in the tutorial he was talking about swap file size, did you try it also?

For performance, in FBNeo core (compiled manually), I set some things in RetroArch, namely Frameskip (most are at 1 or 2) and I lower the Audio Hz. This is for “bigger” games, old old stuff work well as is.

For controls: If you launch games using a Launcher with the Retroarch -L method, you should be able to then press Shift + Menu to go into Retroarch and set your Controls there.

Ok so I just tried your MAME 0.211 and I get the same results you do. Resolution seems to be waaay to high even when I change it in mame.ini… Sound is crakling like crazy, and stay that way even when I change Hz.

Someone must know if its possible or not…

I want to try the other link you provided but I believe the swap-file steps is key. Do we have such a setting on the GameShell?

Maybe I am trying to do something useless here…
It seems that the latest use Romset 0.203.

But… …does not load at all…
I am on the verge of throwing my GameShell through the window!

Testing…nothing work for me, even with the right Romset.

Testing…No way to make inputs work…

Going back to…

Soooo disapointing! I am less and less impress with this device. Its sad because I like the form factor and the design of it.

@adcockm, do you think it was a RetroArch change that introduced the scaling/cropping problem? Remember, MAME looked good with RetroArch 1.7.0 back in OS 0.21.

Would you be savvy enough to downgrade to RetroArch 1.7.0 on OS 0.4?

I am not sure I understand your question.
When I talked abour resolution being too high, I was referring to the manually built version of MAME, not the cores.

I’m not sure what caused the scaling to break in RetroArch. It might be a change in the core, a change in RetroArch configs, or some kind of interaction between the GameShell OS and those things.

I decided not to use RetroArch for MAME anymore, or actually, for any system if I can find a suitable replacement. The standalone emulators seem to all perform better anyway, when they are either built for GameShell (and maybe optimized), or configured properly, or both. RetroArch is an “easy” way to get emulation running on any platform these days, but it’s never been a speed demon, especially on less powerful systems like the GameShell. It also seems to change so frequently (kinda remind me of MAME back in the day, when it was brand new!) that cores break on a regular basis and finding the right combination of things seems to be a real pain. :frowning:

I agree with you and its exactly why I wanted MAME StandAlone.

Ok, I spent more time on this today, and I got something working. If anyone can figure out better MAME settings for the mame.ini or the default.cfg, or anything else, please share. I think I’ve reached the limit of what I can do with the pre-compiled Raspberry Pi 3 binary that was found at the link above.

I expect compiling a custom GameShell build could bring speed improvements. I’m not sure if this one is making use of the multiple cores on GameShell, and I’m not sure if it’s making use of any video acceleration. To help with speed I turned off joystick inputs and also reduced the sound quality. Frameskip is also on by default, which is painfully obvious in games like dorunrun.

Since it seems that guy maintains an updated Raspberry Pi binary for MAME releases, I copied his file to my own server. That way the link won’t break if he changes/updated the file If someone else wants to mirror or put it on github or whatever, that’s great – feel free!

Here’s my copy of his file, for MAME 0.211, that will run on GameShell:

Download that file and unzip somewhere on your GameShell (I unzipped in the cpi home directory so it created /home/cpi/mame0211b_rpi3).

Next, download this file:

Put it in the MAME directory you created (in my case, /home/cpi/mame0211b_rpi3) and unzip. This will give you a new mame.ini file with settings that seemed to work decently on GameShell, a default.cfg file with GameShell buttons mapped to MAME keys (more on that in a moment), and a better MAME UI font so you can actually read the text on the screen (it’s still tiny though!)

Finally, download this action.config:

Put it where you want in your menu. I created a new /home/cpi/apps/Menu/20_Retro Games/09_MAMEPI and put it there. The contents are:


You’ll need to change the mame directory paths at the top if you put yours somewhere else. This was just a hacky way to use an action config and launch standalone MAME, like other folks have done in the past. The ROM path is there as well. I recommend keeping the MAME ROMs separate from your Retroarch version since this is the latest version of MAME, and things would get messy.

While the action config will let you pick roms from the usual launcher list, It’s worth noting that MAME can also be run without passing any ROM name to it. If you just launch the binary “./mame” using a script, you’ll get the default MAME menu screen and can pick ROMs. With the font change I made, it’s actually sort of usable. You’ll need to be able to use the Tab key though, which brings me to…

MAME GameShell key bindings:
dpad - usual arrow keys for joystick (left side) in games, menu selection, etc.
A/B/X/Y - (xbox layout) for dual stick games (like Robotron), these are the right side joystick
A - player 1, button 1
B - player 1, button 2
X - player 1, button 3
Y - player 1, button 4
SHIFT A - player 1, button 5
SHIFT B - player 1, button 6
SHIFT X - player 1, button 7
SHIFT Y - player 1, button 8
SELECT - coin 1
START - start 1
MENU - quit / go back in menu
SHIFT SELECT (-) - reset machine (needed for initial setup of some games like Williams games including Robotron)
SHIFT START (+) - not used

I never hooked up my lightkey, since I like the GameShell as-is without the bulky stuff on the back. Someone with a lightkey may want to include key assignments for it as well.

I also recommend being choosy about which ROMs you copy over. The launcher takes forever to display any sizable collection of ROMs, so if you have a full or nearly full set you’ll be waiting around a long time just for the list to display and the launcher to load again. Better to just copy over a few games for testing, or your favorites. That’s not a MAME thing though, as it happens with every emulator using the launcher to list ROMs.

I’m hoping someone else finds a way to speed this up, or someone manages to build a custom version. (I may take a crack at that myself eventually.) For this build, games like Pac Man and Frogger work fine, and seemingly full speed with sound, etc. Flicky and Do Run Run frame skip so much as to be unplayable though. I just tried Asteroids and noticed that while it runs 100%, the key mapping is wrong, so you’ll need to do up a custom one for that (press shift-menu, go through the MAME menu, and do it how you like and menu to escape back to game; it will be saved for next time). Surprisingly, something like Time Killers actually runs, and while it’s frameskipping it’s almost playable. Even Space Lords runs, but is quite choppy due to frameskip. Although the controls would be horrible even if it ran fine, that’s one of my holy grail games, and I’d love to see it running full speed on the GameShell. The fact that it runs at all made me smile. :slight_smile:

1 Like

I think the swap file commands as provided on that site will work on GameShell. I’ve seen folks mention the same thing in the forums when trying to build really large memory-intensive projects.

Thing is, I doubt having a swap file will help with how MAME runs. If there are games that require too much RAM and are failing because of that, then they might work with a swap file, but they would probably run slowly, depending on how much the swap gets used. Even fast SD cards are slower than main memory. It’s also not a good idea to leave the swap on indefinitely because you’re sort of tearing up your SD card. They have a limited number of writes/reads over the lifetime of the card, so if you’re constantly using it because you’ve got a swap file there, it’s not going to last as long.

A swap file makes sense as a temporary solution to allow building code on GameShell though. Some things are just so big there’s not enough system memory to allow them to build without errors. And I’m sure building MAME would require one since it’s insanely large and takes forever to build even on a desktop machine.

One thing to consider for GameShell is to build targeted, driver-based MAME binaries. This has been done in the past for various handheld platforms and other systems with limited memory/speed/etc. As far as I know, the MAME build system still allows for it. So instead of building a single MAME binary that supports all drivers/platforms/games, instead you build a separate binary for each game, or subset of games, etc. That will speed up the start time, because this version of MAME would only “know” about the few games it can run and won’t go looking for other ROMs. It would also be a lot smaller file. And if someone wanted to optimize the build settings, or even go hacking in the driver code to optimize things a bit more, it would be easier to do so without breaking all the other games. It would also build a lot faster and maybe not even require the swap file for building, since it would only need to use the code related to the specific game/driver it was targeting.

Assuming MAME still supports building that way, that seems like a good way to experiment with building GameShell versions without having to wait a couple of days for a build to finish. :wink:

Also, FYI, I’m on 0.4 of the OS, but performed the upgrade to Buster as described here: GameShell OS image files (v0.4 latest)

I’m also running launcher “stable 1.25”.

I did my MAME testing with the Lima driver. But I just tried it with FBTurbo, and I’m honestly not sure I can see any difference. So that makes me think this version of MAME is using software rendering only. When I was messing around with this (and on Lima), I tried the various rendering options inside MAME (via built-in menu) and didn’t notice any differences. There are options for Open GL, but I’m pretty sure they didn’t work (for me, at least!)

I also tried to turn off all the “fancy” rendering stuff. MAME does a great job these days of filtering the screen when stretching it, and also making it look more like an old monitor, but all those fancy effects just kill the framerate on a device like the GameShell, so I turned them off. Or at least I think I did. There may still be room for improvement or something I missed, so if you find it, please post the changes here. :slight_smile:

If we could get a custom build that actually uses video acceleration, I’d hope MAME would be able to handle more games at full speed, and maybe even support some of the filtering on older games that would have plenty of juice left to spare.

Wow man I will make a backup of my GS and try all that for sure!!!
Thanks, I’ll report back with my experience.