(Almost) pixel-perfect arcade emulation on Raspberry Pi with AdvanceMAME

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Edit: I haven't tried AdvanceMame on this setup though. Most arcade games run full speed on fba. AdvanceMame doesn't perform well for games CPS1 onwards on this.

      Frank_fjs wrote:

      Any chance of a pre-built image?
      This is a Lakka image - you need to burn it on a minimum 8GB SD card.
      retrotink.com/downloads/RetroTINK_Lakka_211_08192018.zip


      If you use Gert VGA/VGA666 hat for RPI just change the config.txt as in the first post of the below link:
      reddit.com/r/RetroPie/comments…ipts_sony_pvm_240p_glory/

      Put the roms in an USB stick plug it in the pi and a gamepad and its ready.

      Demo for using the pre-built image - you can check there video quality here.


      Only issue I find is the lag on the PI, image quality is impressive.

      I have used for GertVGA and Retrotink using this prebuilt image, pretty nice.

      Thanks for the Tutorial @Scandy looking forward to try it out.
      DS MULTI: CPS2|STV|MVS
      DS WISHLIST: CPS1|PGM
      Other Wishlist: Sega Monaco GP| Taito Grand Champion | Taito Speed Race
      KLOV

      The post was edited 2 times, last by suverman ().

    • @suverman I'm sorry but you're "mixing" a little bit (or maybe I'm misreading your reply).

      On RPi it's possible to set custom (non-standard) video modes at boot just editing config.txt. It's also possible to use the command line to change these video modes on the fly. Various retrogaming distros take advantage of these features in different ways:
      • on LAKKA (www.lakka.tv) you can set a custom video mode at boot via config.txt (e.g. 256x240 if you're gonna use a NES emulator) and eventually change resolution and viewport manually for each core (emulator) or ROM (game). The "CRT SwitchRes" option is (still) not supported on RPi.
      • Recalbox (www.recalbox.com) AFAIK (maybe @archimage will confirm or deny this) use a fixed list of video modes to automatically set the "right" one at frontend, i.e. just before starting the emulator (I don't know if video modes are also different for each ROM loaded, for example if Bad Dudes is effectively loaded with a video refresh of 57Hz).
      • AdvanceMAME (www.advancemame.it) is different and, IMHO, currently is the most advanced in this feature, especially for arcade: set the type of monitor used (CRT TV, PC multisync, Arcade etc.) and chosen the mode of operation ("manual" like the one I have already described in the first post, or "automatic" like the one I will describe shortly for @PascalP) AdvanceMAME automatically and "intelligently" generates the best video mode considering both the ROM loaded and the monitor used. Latest versions of AdvanceMAME are optimized for RPi and (as you can also see from my previous post) most games including CPS2, M92 and some CPS3 like Street Fighter III Third Strike run at FULL speed (100%) with NO frameskip. Input lag is also reduced to minimum.
      Of course, as @Frank_fjs previously noted, RPi has strong limitations on the lower range of pixel clocks when using the DPI/GPIO interface, and this affect the ability to control low frequency monitors, like Arcade screens (this limit is obviously present for all distros). The only allowed pixel clocks suitable for low resolutions are 4.8 MHz, 6.4 MHz, 9.6MHz and 19.2 MHz; you can instead choose any pixel clock greater than 31.25 MHz.
      To overcome this, AdvanceMAME transparently increases the modeline horizontal size, until it reaches the 31.25 MHz pixel clock (don't be surprised if a modeline that works in AdvanceMAME, doesn't work when setting manually the timings in other ways).

      The post was edited 2 times, last by Scandy ().

    • Scandy wrote:

      @suverman I'm sorry but you're "mixing" a little bit (or maybe I'm misreading your reply).

      On RPi it's possible to set custom (non-standard) video modes at boot editing config.txt. It's also possible to use the command line to change these video modes on the fly. Various retrogaming distributions take advantage of these features in different ways:
      • on LAKKA (www.lakka.tv) you can set a custom video mode at boot via config.txt (e.g. NES video mode if you're gonna use a NES emulator) and eventually change resolution and viewport manually for each core (emulator) or ROM (game). The "CRT switchres" option is (still) not supported on RPi.
      • Recalbox (www.recalbox.com) AFAIK (maybe @archimage will confirm or deny this) use a fixed list of video modes to automatically set the "right" one at frontend level, i.e. just before starting the emulator (I don't know if video modes are also different for each for ROM loaded, so for example if Bad Dudes is effectively loaded with a video refresh of 57Hz).
      • AdvanceMAME (www.advancemame.it) is different and, IMHO, currently is the most advanced regarding this feature, especially for arcade: having set the type of monitor used (CRT TV, PC multisync, Arcade etc.) and having chosen the mode of operation ("manual" like the one I have already described in the guide, or "automatic" like the one I will describe shortly for @PascalP) AdvanceMAME automatically and "intelligently" generates the best video mode both for each ROM loaded and the monitor used. Latest versions of AdvanceMAME are optimized for RPi and (as you can also see from my previous post) most games including CPS2, M92 and some CPS3 like Street Fighter III Third Strike run at FULL speed (100%) with NOframeskip. Input lag is also reduced to minimum.

      Yes I realized the premade image was different but thanks for the detailed comparison. Your AdvanceMame method would be a totally different experience (a lot better one) from what I read. I need to try it out. :]

      Also thanks for the detailed information about config.txt.
      DS MULTI: CPS2|STV|MVS
      DS WISHLIST: CPS1|PGM
      Other Wishlist: Sega Monaco GP| Taito Grand Champion | Taito Speed Race
      KLOV

      The post was edited 1 time, last by suverman ().

    • @Scandy

      Recalbox has no support for CRT intially, they only introduced a fixed 1920x240p mode support based on our contribution some years ago which is roughly 240p60hz, then you can make Retroarch launch a viewport adapted to each game, which cauces stuttering because of imprecise refresh rates which can be more a less visible with vsync, which introduces small frames of lag, and sometimes black borders that are unvaoidable because some games integer scaling don't fit 240p (253p games for example). However it works OK most of the time.

      RGB-Pi which is a Recalbox based distro launched by Ironic and AtG uses a fixed list of modelines which is based on groovymame modelines list, and custom modelines for each console to launch before opening and after closing the emulator, which solves the refresh rate with exception of those limited with the pixel clock of the drivers. Vertical/Horizontal resolutions are all correct.

      Today there's a more arcade hardware wise solution which is Rpi2Jamma which is Aje's solution, which is really more oriented to cabinets. Best handy solution, but long wait queue list/support.

      Arcadeforge Pi2Jamma works well too and can support every solution you describe there, it's a hardware oriented solution, with no distribution preference, can be used easily on jamma with your tutorial actually, however it's less qualitative hardware wise than Aje's solution but more widely available.

      IMO software wise, every solution should follow Calamity's path, he's the god in the area, I don't know how Advancemame compares to Groovymame now, but seems Super Resolutions is the recommended way to go. A small list of 2560 x Y @ 60hz modelines supported by the OS, then emulator does the job of stretching, syncing etc.

      Today both Groovymame and Retroarch converge to Super Res method, simplest and cleanest way to manage database.
      Any Multi MVS bug ? Before asking do Reset NVRAM procedure : Power on without cart, Press Start multiple times until it asks to press ABC + Start, Do it, Power off > Done

      The post was edited 2 times, last by archimage ().

    • @archimage RGB-Pi, Rpi2Jamma, Arcadeforge Pi2JAMMA and also JammaPi (jammapi.it/descrizione/ no queue!) will all work with AdvanceMAME, since their setup is limited to the overlay in config.txt (all the rest is done by the emulator).

      AdvanceMAME use of course a kind of super-resolution, but if necessary (e.g. non arcade monitor) dynamically adapt it with display_adjust option:

      display_adjust none | x | clock | xclock | generate_exact | generate_y | generate_clock | generate_clocky | generate_yclock

      I doubt that GroovyMAME can run smoothly on RPi, while I can't wait to see SwitchRes available in LAKKA for RPi (also for console emulators).

      So today AdvanceMAME is IMHO the best option on RPi, but it is less known for the absence of a pre-built ISO (or misinterpreted on performance), so this is why I decided to write and translate my tutorial. :)
    • You are right, there's no groovymame project at all to wait for Rpi, it's geared to work with ATI drivers with bleeding edge mame romset, it's Calamity's work horse, he sould just be an inspiration to adapt his ways/discoveries.

      This guy is awesome, I can't imagine how sad would be emulation without him.

      Advancemame should be the best approach until Retroarch comes with newer cores/romset for the Rpi + Switchres integration, which I doubt is their main priority right now, it didn't move since a long time.

      Your solution is the right way to go at the present, btw if anytime you are interested to help try to reach Ben Templeman on Facebook.

      Lakka's support for X11 + CRT Switchres depends on him, a little support/interest should motivate him, people roughly declined to adopt X11 because no interest in CRT at all, also a lot of people sell their hardware, and don't see interest to help him to come with a solution that makes gpio obsolete, it somehow discouraged him ;)
      Any Multi MVS bug ? Before asking do Reset NVRAM procedure : Power on without cart, Press Start multiple times until it asks to press ABC + Start, Do it, Power off > Done
    • archimage wrote:
      Advancemame should be the best approach until Retroarch comes with newer cores/romset for the Rpi + Switchres integration, which I doubt is their main priority right now, it didn't move since a long time.

      Your solution is the right way to go at the present, btw if anytime you are interested to help try to reach Ben Templeman on Facebook.

      Lakka's support for X11 + CRT Switchres depends on him, a little support/interest should motivate him, people roughly declined to adopt X11 because no interest in CRT at all, also a lot of people sell their hardware, and don't see interest to help him to come with a solution that makes gpio obsolete, it somehow discouraged him ;)

      Hmm I'm not on Facebook anymore. :/
      But on YouTube there are a lot of videos of people struggling to reach (almost) pixel-perfect resolution with RetroArch / LAKKA, this should encourage him! Or bring him here on the forum! :thumbsup:
    • Hi guys,

      So I had this site forwarded to me today!

      I thought I would jump in and help/ get help. FYI I am the guy behid RetroArch CRT SitchRes.

      For my Linux port I built a modeline generator which installs, switches and removes the resolutions on-the-fly. The only prerequisite is that you need x11. This does mean however that any hardware running Linux should be able to run Retroarch CRT SwitchRes.

      I have spent a lot of time talking to the lakka team but we've been unable to get x11 working correctly. It does function to a point. However, you have to boot debug mode, close Retroarch and reopen it to get ig working. Without this it stays in a boot loop trying to load Retroarch with an X11 server.

      I have been successful in modifying raspian however. The main drawback here is that this is a full raspian with a desktop environment. However, as long as threaded video is on, there is now real performance difference.

      Check out my video test runs here.

      youtu.be/qRiHQ8zXOEA

      youtu.be/7hikfkHAcvk

      If anyone out there has a good knowledge of compiling custom Linux builds that could help finish the project that would be great.

      Also for RPI I am not using the gertvga. Which opens up the GPIO for more buttons etc.

      The post was edited 1 time, last by Alphanu ().

    • Hi @Alphanu and welcome!!!
      Seeing CRT Switchres in action on RPi is great, and I really hope that you'll get it working on LAKKA! Did you wrote a topic in Retroarch and Rasbperry Pi forums yet? Unfortunately I'm not expert in custom Linux builds, but someone there certainly is.
      May I ask why x11 is a prerequisite?

      @PascalP this weekend I plan to translate the last part of the tutorial (I just have to check some things).
      AdvanceMAME supports two basic ways to generate video modes:
      • 'Manual' operation mode (already described in the first post as it is ideal for TV CRTs) picks the video mode from a manually defined list of modelines, eventually adjusting them to match the game clock or size requirements.
      • 'Automatic' mode (that should be ideal for your setup) automatically create a 'perfect' video mode for the game that fit exactly the whole screen with the correct aspect and frame rate. To configure and activate this mode you'll need to run the advcfg utility and answer at the various questions. You don't need to create a list of video modes, any needed video mode is created at runtime. So during weekend I should be able to get a multi-sync CRT PC monitor to re-test this mode better.
      About the connection of the RPi to the arcade cabinet, I would recommend an all-in-one setup like JammaPi which BTW works perfectly with my tutorial (you'll only need to add a couple of lines to config.txt). Alternatively, perhaps this information from the official AdvanceMAME website could be useful:

      If the monitor accepts separate H/V sync signals at levels 0 - 5 V you can directly use the VGA sync signal of your PC. If the monitor uses another sync signal you must use a sync conversion circuit.

      If the monitor accepts a composite sync signal, instead of using a sync conversion circuits you can also try twisting the two H and V VGA signal together. It works if you select VGA negative H and V sync on the programs. To be on safe side I DO NOT RECOMMEND THIS HACK to connect sync signals directly together. Technically you should never just tie sync signal lines together. They are not usually designed for this, so this can damage your video card. If you try, use with caution.
      You must also ensure that the monitor accepts the VGA video signal level of 0.7 V p-p. Generally arcade monitors require a video signal between 1 V and 5 V for each line. Therefore if you attempt to drive an arcade monitor with a VGA video signal you will at most, have a very dark picture with no contrast. You will need to buy/make an amplifier for each line in order for it to work.
    • New

      Tried following your tutorial yesterday evening together with @PascalP and we got a working setup on my Nanao MS9, picture looks pretty nice, good tut! :) Only been playing the standard games until now. Noticed AdvanceMame uses the MAME 0.106 romset which is quite old, so had to download that first. Will have to setup samba next so I can transfer the roms over wifi.

      The most important question I have for you now @Scandy, how do I get support for my JVSPAC? :) I have been working with Lakka, and it was a matter of plugging it in and it had support. I am guessing I need to install a library, but I am unsure which one..
    • New

      Hey @Sp33dFr34k that's great!!!
      I'd really like to see some pictures of RPi and AdvanceMAME running on your Nanao MS9.

      I don't have a JVSPAC so unfortunately I can only "guess" how to use it, but no driver should be required.
      If it is recognized as a keyboard device I suppose it is sufficient to temporarily connect both the JVSPAC and real keyboard to the RPi, press "TAB" on the real keyboard to access the MAME menu and proceed with configuration of general inputs assigning the cabinet buttons as "keyboard 2" buttons thanks to the JVSPAC.

      If it is recognized as a joystick, sudo apt-get install joystick (and a reboot) should do the trick.

      Please take also a look at advk and advj utilities in the Documentation page of AdvanceMAME:
      advancemame.it/doc

      Can't wait for your feedback (and pictures!).

      The post was edited 1 time, last by Scandy ().