Accéder au contenu principal

Retro 0.1 RC

During last GUADEC, I had a chance to briefly present my project of having a powerful yet simple video game manager and player for GNOME. To make it a reality, a lot of work was needed on the backend side.

This article present the release of the first version of this backend, in its release candidate form.

Libretro

Libretro is a C/C++ API used mainly by retro video game console emulators and game engines. Writing an emulator and writing a GUI application require very different skills, using Libretro allows to isolate the backends (often called modules or cores) implementing the API from the frontends using the API to manipulate them, easying the port of the emulators or engines and offering a multiplicity of cores to choose from to application developers.

The main frontend of Libretro is RetroArch and it have been ported across multiple systems.

Retro

Retro (or retro-gobject) is a GObject based Libretro wrapping library written in Vala. It eases the creation of Libretro frontends by using OOP and automatic memory management (thanks to Vala and GObject); it allows the creation of Libretro frontends in other languages than C/C++ via GObject Introspection; and it allows to have multiple Libretro cores loaded at the  same time, through the use of a global variable to store the calling core's identity, and through file copy to avoid global variable collision in already used modules). Retro's API is not to be considered stable yet, but it is very close to be and shouldn't change much. Some objects are marked with a temporary internal visibility until they are tested and polished and can be part of the public API.

But most importantly, what Retro isn't is a fork of Libretro. All it does is to wrap it in a nice object-oriented layer and it is fully compatible with modules implementing Libretro.

Retro's git repository can be found here: https://github.com/Kekun/retro-gobject

Retro version 0.1 RC can be found here: https://github.com/Kekun/retro-gobject/releases/tag/v0.1-rc

Core

Core is the most important class of Retro. It represents the functionalities associated to a Libretro module and allow you to run it. A Core allows you to get information about its module, to set interfaces to handle the module's callbacks, and most importantly, to run it.

Video

The Video interface is use by a Core to ask the frontend to render video and to set details about how the video must be rendered, such as the source video's pixel format.

Audio

The Audio interface is used by a Core to ask the frontend to play audio.

Input

The Input interface is used by a Core to ask the frontend about the state of the input devices, such as gamepads, keyboards and mice.

Other interfaces

Lots of other interfaces can be set by the frontend or by the Core to communicate. Some examples are the Log interface, to let the Core write log messages, to the standard output or a file by example; the DiskControl interface, to let the frontend control a Core's virtual disk drive (for example, to swap disks on a CD based game console emulator); or the Variables interface to allow the frontend to know about the Core's special options and to set them.

RetroGtk

RetroGtk is a library written in Vala which links Retro, in order to run Libretro modules, and Gtk. It offers Gtk widgets implementing various Retro interfaces, allowing to easily display a Core's video, to forward keyboard and mouse events to it, and to mimick gamepads with a keyboard.

RetroGtk also contains non-Gtk related objects, like loops to help running a Core, an interface to forward a Core's log to a FileStream, and an interface to help manage a Core's variables.

You can use Clutter and ClutterGtk or Cairo to render the video, and I hope that the inclusion of a Gl widget in Gtk+ 3.16 will allow to get rid the dependency on Clutter. It currently can also play a Core's audio via PulseAudio, but it may be moved to some "RetroPa" library. Proper joystick support is still to come, certainly in a separate library (RetroJs?). RetroGtk's git repository can be found here: https://github.com/Kekun/retro-gtk

Libretro module collection

Being able to run, control and render Libretro implementations is of no use if you have no such implementation to run, control and render. To help solving this, I started collecting GPL compatible implementation in a git repository, adding a makefile to ease the compiling and installing them. It is still in its infancy but it already helped me quite a lot.

The machines currently emulated by the collection are:

  • Nintendo Entertainment System
  • Super Nintendo Entertainment System
  • Game Boy Advance
  • Saturn 
  • PC Engine
  • DOS

PlayStation support is to come, but an annoying bug in the emulator have to be solved first.

You can find this collection here: https://github.com/Kekun/libretro-free

Applications

Demo

To test all of this, I wrote a demo application, which uses Retro, RetroGtk and the module collection to run games. It allows you to open several game files (see the modules in the collection to know what can be run), to set the Core's options, and it supports inputs such as the keyboard, the mouse, and can use the keyboard as a virtual gamepad. You can set the virtual gamepad's configuration via a button.

Theme Park running in DOSBox
Virtual gamepad configuration when running PC Genjin 2 in Mednafen
Nestopia's options
bSNES running Yoshi's Island, showing the "ungrab the pointer" message

Here is the demo's git repository: https://github.com/Kekun/retro-gtk-demo

GNOME Games

The ultimate goal of this project is to write a video game manager and player for GNOME, with a user interface similar to GNOME Music or GNOME Video. This project is similar to OpenEmu for MacOS X systems.

Commentaires

  1. Great news, congrats! Good to see libretro getting a bit of gtk love, this will surely help me run my favourite games better integrated than I currently do (DosBox - and most emulators - looks a bit alien by default)

    RépondreSupprimer
  2. The libraries just need a little bit of gtk-doc love :)

    RépondreSupprimer
    Réponses
    1. I'll try to add it for the final 0.1 release! Too bad I can't manage to get Valadoc working.

      Supprimer
  3. Nice, maybe you should think about porting these project to autotools, so, for example, they can be easily compiled/run in jhbuild (Ive just added them to gnome-world moduleset but they fail to install as they try to install in a system directory)

    RépondreSupprimer
    Réponses
    1. I spent some time to port the building system from my makefiles to the autotools (via Anjuta, as I don't know how to use the autotools _yet_), here is the result: https://github.com/Kekun/retro-gobject/tree/automake
      I managed to make the autotools build and install most of what is needed, but it still lacks a way to generate documentation (I would love to have C documentation via Gtk-doc and Vala documentation via Valadoc).

      I'm not willing to merge this branch to master and publish the final 0.1 version until I can generate some form of documentation, maybe you could help me to achieve it?

      Supprimer
  4. Réponses
    1. Thanks, at least you now know part of why I didn't work more on the Python app. ;)

      Supprimer

Enregistrer un commentaire

Posts les plus consultés de ce blog

Moving the Blog

I am moving this blog to greener lands: https://fediverse.blog/~/AdrienPlazas . The existing articles will remain here on Blogger, and new articles will land on the fediverse.blog Plume instance.

Games 3.30: Features Overload

With a new version of GNOME always comes a new version of Games, and this new version comes packed with new features, bug fixes and developer experience improvements. Install Games 3.30 Platforms View and Developers View As part of his GSoC project, Saurabh implemented two new views of your games collection: one filtering games by their developers and another one filtering them by their platforms. To know more, read Saurabh's Segregating views and Description view articles on his blog. To implement this he needed to work a lot on the Grilo front, check his explanations in his Adding self registering keys to lua-factory article. He also started to work on a new page displaying many details about a game like the number of players and a description, it was unfortunately not ready on time for this release but will hopefully land in 3.32. Gamepad Navigation You can now navigate the UI with your gamepads! Select your collection view with the shoulder buttons, browse

Have You Played Atari Today? 🎵

This is a guest article by Laurent « Hell Pé » Pointecouteau, the Alfred Pennyworth of GNOME Games who relentlessly works in the shadows to help make Games what it is, when he’s not busy writing in French about video games or slacking on Twitter. I used to be really excited at New Stable Release Blog Posts™ like this one, back in the day when you had to wait six months for getting new GNOME stable releases (and matching Ubuntu PPAs) in order to discover what was new in your favourite apps. But nowadays, these blog posts, while still a delight to read, are just a little less surprising than before, and we’ve got Flatpak to thank for that! So, here’s a quick reminder: Games can be obtained by two ways. The old-school way, with the version provided by your distro; and soon, hopefully, your distro will upgrade to the brand-new 3.26 stable version that we’ve just released. And the Flatpak way, the one we actually recommend if your system is ready for it: it’ll give you the choice betwe