RetroArch/libretro status

By Squarepusher – Over the course of this week, two new ports have appeared courtesy of meancoot.

DOSbox libretro

Released on October 21 2012.

Next to maxe-libretro, this is probably the first time a libretro port is reliant on the keyboard and mouse as an input device. It seems to have MIDI and Soundfont support as of a few days ago, it supports CD images (no real physical CD support, but then again this is pretty much an undesirable feature anyway what with storage being cheap and CD access being slow – Genesis Plus GX libretro core doesn’t bother with physical CD support either, neither does Mednafen PCE/PSX).
I might consider looking into this as a candidate for the consoles – the problem is that (like DOSbox on PS3 before, port by Robo Hobo) the speed will be very slow without a dynarec. Even Duke Nukem 2 had to fall back on severe frameskipping (1/2/3) to run tolerably on PS3 before.
Repository: https://github.com/libretro/dosbox-libretro

MAME 0.78 libretro

Released on October 31, 2012.

MAME has seen several performance regressions over the years, some of them quite severe to the point of sacrificing +100fps in some games over the course of a few revisions. Unfortunately, what this means for us these days (in 2012) with so many low-performance systems out there on the market (Android, iOS, game consoles, Raspberry, etc) is that we have to resort to very old versions of MAME in order to get decent performance on anything beyond early/mid ’90s arcade games.

A year ago, Lantus ported a MAME 0.72 version to Xbox 360 (it was basically a re-port of MAMEox, released back in 2003/2004 for the Xbox 1). This managed to run Midway/Williams games like Mortal Kombat 1/2/3 and NBA Jam at fullspeed on the 360 – not something that can be taken for granted if you’ve ever tried to port a modern-day MAME version to the current-gen consoles.

Meancoot’s recently released MAME 0.78 port right now can be expected to run on OSX, Linux and Android libretro frontends.  I have requested for the repository to be transferred over to the libretro organization – when that has happened I’ll spend some time on including Wii, PS3, 360 and Xbox 1 support to it – which shouldn’t be too hard.

For people running 64-bit OSes, expect to run into quite a lot of problems with this MAME version – even though the source shows an indication of some effort having been made to ensure 64-bit compatibility, there are still many 64-bit errors lurking around in the code. I could never get any of the ROMs on XMAME 0.72 to run on x86_64 Linux – even with this being the case, this makes for a good port for the consoles and ARM-based devices, which all have 32-bit ABIs (including PS3/360).

Repository: https://github.com/libretro/mame078-libretro

Libretro – Recap of progress last week

By Squarepusher – Besides the Desmume and TGB Dual ports that appeared out of the blue, a lot of other work has been done. Here is a brief recap.

Genesis Plus GX

Ekeeke (the author of Genesis Plus GX – still not sure about the pronunciation) added CD audio support to Genesis Plus GX. The libretro port has been pushed to the official Genesis Plus GX repository some time ago so it’s very easy for either me or ekeeke himself to update it to reflect changes made to the emulator.

Link to official repository (ekeeke): https://github.com/ekeeke/Genesis-Plus-GX

Link to libretro experimental fork:  https://github.com/libretro/Genesis-Plus-GX

Mednafen libretro

I’m currently working on making the Mednafen libretro ports more sustainable in the future. Right now we have a lot of standalone Mednafen repositories with a lot of duplicate code.

I’m aiming at bringing them all together. Right now, the mednafen-psx repository allows building three separate cores – Mednafen PSX, Mednafen PC Engine Fast, and Mednafen Wonderswan. More will be added.

The backend right now is a modified Mednafen backend with lots if ifdefs strewn around such as NEED_CD, NEED_THREADING, and so on so that – for instance – the libretro port of Mednafen Wonderswan won’t be bloated by including lots of threading and CD-ROM code that the Wonderswan emu will never ever use.

At the moment a lot of work still remains to be done – to begin with, all the Visual Studio solutions need to be updated (for Xbox 1/360/PC), and the console ports have to be all tested.

RGB565 support

Previously, a libretro port would have either the option of using a 32bit color format (XRGB8888) or a 15/16bpp color format (ORGB1555 – picked implicitly if you did not specify anything). Now that the OpenGL driver has been completely overhauled to better accomodate OpenGL ES devices, we’ve found that ORGB1555 is an unlucky fit on most of these devices and isn’t natively supported.

Hence the introduction of a new pixel format to libretro if 15/16-bit color is desired (RGB565). The PS3, Raspberry Pi, Wii and PC ports have currently been updated to properly display libretro cores using RGB565. If pixel format is not explicitly defined, then it will assume ORGB1555 and the libretro frontend (ie. RetroArch) will perform automatic color format conversion to RGB565 behind the scenes. This will undoubtedly be slower, so it’s imperative that a libretro port picks a color format.

An example from – say – Gambatte, where 32bit color is used:

<code>
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;
if (environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
g_has_rgb32 = true;
</code>

You can select a different color format on a per-game basis (in this case, you would want to put this into your retro_load_game implementation) or you can choose to just have it apply for all games (in Genesis Plus GX/VBA Next/SNES9x Next/FCEUmm, a snippet similar to this has been put into retro_init for exactly this reason).

At the moment, the following emulators have been updated to support RGB565:

  • SNES9x Next
  • FCEUmm
  • Genesis Plus GX
  • iMAME4All
  • TGB Dual
  • PCSX ReARMed
  • VBA Next
  • Mednafen PC Engine Fast
  • Mednafen Wonderswan

Libretro-prboom will require a port from scratch to support RGB565 since the initial implementation required some sweeping changes that would preclude a merge into prboom mainline. FBA will be looked at later. Gambatte as it is uses ARGB 32bit color instead and so does Mednafen PSX, so these will not be looked at since color format is already ideal for these ports.

RetroArch/libretro status – new Desmume / TGB Dual ports

By Squarepusher – This will be more like a development diary to document the continuining development of RetroArch and all things related to libretro.

Desmume libretro

Meancoot made a libretro port of Desmume last week. There are currently some talks between me and zeromus to get this port merged into Desmume mainline. I’ll try to get this done ASAP.

Desmume is a Nintendo DS emulator.
Link to repository:  https://github.com/libretro/desmume-libretro

FCEUmm libretro

The libretro port has recently been adopted by FCEUmm author Ca4e3.

FCEUmm is a Nintendo Entertainment System /Nintendo Famicom emulator. This fork of FCEU focuses on experimental mapper compatibility among other things.

Link to repository: http://fceumm.svn.sourceforge.net/viewvc/fceumm/.

I will continue to update both our own repo on Github as well as submit patches back to mainline whenever a change has been made to the libretro API that affects the port.

TGB Dual

Also done by an external party, lifning (who also takes credit for the RetroArch Pandora port) spent some time making a libretro port of TGB Dual last week.

TGB Dual is a Game Boy / Game Boy Color emulator with one unique feature – it allows you to play Game Link-compatible games in two-player splitscreen mode. This works by using the Sufami Turbo API functions in libretro where two cartridges have to be loaded one after another (one each for each player with his own Gameboy).

Note that Sufami Turbo loading functionality is not yet in the RetroArch console ports and will need to be added later by me.

Link to repository: https://github.com/libretro/tgbdual-libretro