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

The Path to GNOME Games 3.26

Games received a non-negligible amount of changes that you will find in 3.26. These changes can be big as much small, and more are to come!Building the Games CollectionGames presents your games collection and if everything goes as expected, it does so without the need of any input from you. From an implementation point of view it sounds simple to do, just ask Tracker “Hey, gimme all the games” and it’s done. If only it was that simple! 😃 The system has no idea which files represent games and which doesn’t, but it can associate a MIME type to each file thanks to shared-mime-info. shared-mime-info already had a few video game related MIME types and we added a lot more such as application/x-genesis-rom.That done, we can query Tracker for files having specific MIME types that we know to often represent video game files. Unfortunately, each of these files doesn’t necessarily represent a game and a game isn’t necessarily represented by a single file: some files may be invalid and hence rep…

GNOME Games 3.24

GNOME 3.24 will be out in a few weeks and with it will come Games 3.24. This new version will offer a few new features and many refinements, some of which have been implemented by new contributors theawless and Radhika Dua, kudos to them!Find how to get the latest nightly and (soon) stable Flatpak versions of Games on its web page.A Libretro Core Descriptor SpecificationIn its version 3.22, Games stopped using a hardcoded list of well known Libretro cores and instead looked for the right one to run a game by parsing files describing their corresponding Libretro core's capabilities. These files came from the libretro-super repository and were slightly modified to better suit Games' needs.The concept was great but the format of these files proved to be not very well suited for the job: many information were not useful to Games, some information it needed were lacking, the syntax wasn't specified, complex cases like firmwares were implemented in a messy way, some useful infor…

GNOME Gaming Handheld

Recently I got myself a GPD Win, to make it simple it's a PC in a Nintendo 3DS XL form factor, with a keyboard and a game controller. It comes with Windows 10 and many not too demanding games work perfectly on it: it's perfect to run indie games from Steam and for retro consoles emulation.But who simply want to play video games, let's make it fun, let's put a penguin in it! On this GNOME wiki page I'll report all my findings on Linux support on this machine, focusing mainly on OpenSUSE for the moment. Wouldn't it be awesome to have a fully working and easily installable GNOME desktop running Games and Steam on this machine? 😃