mercredi 19 juillet 2017

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 Collection

Games 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 represent no games and some games may require multiple files, a typical case of multi-resources game is a multi-disc PlayStation games. Depending on the files and the kind of games they may represent, we may have to reject them, parse them, store them and gather them into a single game.

We also have to be particularly careful when games are represented by files with a generic MIME type such as application/zip — i.e. MAME games — or application/x-cue as most of the search results for these will probably be invalid.

To these are added more exotic game sources such a Steam games or so called desktop games — the games from your applications menu and represented by .desktop files. These add another layer of complexity as gathering the resources representing these games has to be done in a slightly different way than for your typical game files. For example, Steam is a video game store and launcher giving a unique ID it each of its games: a number starting from 10 with Counter Strike.

How Games 3.24 Builds your Collection

Games 3.24 handles no game types directly, it relies on plugins for that. Plugins are providing a GameSource, these game sources are iterable and produce Game objects in the way they please. Most of them find the game resources by querying Tracker for URIs of files of specific MIME types and by parsing these files to build the Game objects; others handle the resulting URIs in a more complex way to support multi-disc games, while others are querying the URIs of the .desktop files of the registered applications or are parsing the Steam library.

This works well but it led to some code duplication and adding support for a simple type was done by copying some other plugin and tweaking one or two strings. Copying the plugin is fastidious for an actually very small change. Some refactoring is needed.

How Games 3.26 Will Do It

For Games 3.26 the way the games collection is built has been completely refactored, GameSource’s role has been split into several parts: UriSource objects output URIs from whichever way they want, UriGameFactory objects take URIs and output games in an asynchronous way — giving them URIs may result or not in the creation of a Game object or in the improvement of an existing one — and GameCollection act as a glue in-between them. A UriGameFactory declares the URI schemes it can handle and the MIME types of the files it can handle — the file URI scheme is implicit —, allowing GameCollection to send URIs only to the relevant UriGameFactory objects.

Plugins don’t declare GameSource objects anymore but instead UriSource and UriGameFactory ones. An interesting new change is that plugins now also declare MIME types of files to search, avoiding the need to declare a UriSource for a very common search case: they all will be given to a specific UriSource which will perform the corresponding Tracker queries; this also solves the problem of searching multiple times for the same MIME type in different plugins. It doesn’t make sense to declared MIME types to search that are not handled by an UriGameFactory, but it can make sense not to search for all the handled MIME types, more on that later.

Many very simple types have been reduced to the RetroSimpleType type: a simple declaration of the MIME type corresponding to the simple game type, whether this game type should be searched and the name of the corresponding gaming platform.

{ "application/x-gameboy-rom", true, "GameBoy", "game-boy" }

Example of a SimpleType declaration.

All the supported game types were successfully ported to this mechanism and it is expected to support any future game type.

Adding More Games

Thanks to all these changes, it is now possible to give any URI to GameCollection and it will handle it properly, which means we can now have external game URI sources and properly use their results! This allows us to handle opening files with Games: the users can double click on their game file and if all goes well, Games will automatically run them! Another source of games that has been added is a “Add game files” button on the games collection view: the user can select game files to be added to the collection, given they are valid.

Opening a game file with Games.

All the game resources you added to Games are saved and will be loaded when starting the application again: if for some reason searching game files doesn’t work, you will still be able to use Games. This also allows you to manually add games that can be handled by Games but which it doesn’t know how to search for right now, either because of the lack of a clear MIME type representing the game type or for the lack of ability to know if a URI represents a game or something else.

Games Support

Games 3.26 will list Atari Lynx, MS-DOS, WonderSwan and WonderSwan Color games and, given you have the corresponding Libretro core installed properly, you will be able to run them too. Unfortunately as it can’t make a difference between regular MS-DOS executables and MS-DOS games, Games can’t automatically look for your MS-DOS games and you will have to manually add them to your collection. Games doesn’t support the mouse for Libretro cores right now, so you won’t be able to run MD-DOS games requiring one right now.

The detection of PlayStation discs has been reworked and the disc images are now parsed properly, which should greatly expand the number of detected discs and games. If you still have PlayStation games not showing up in your games collection or if games used to show up but don’t anymore, please file a bug!

Games was displaying desktop games that were asking not to be displayed or to be hidden, this is now fixed.

Gamepad Support

The gamepad handling has been ported from Vala to C. This change is a solution to the problem of our usage of the Vala preprocessor which was poorly handled by the Autotools, resulting in broken tarballs. Another solution would have been to not use make dist.

It has been refactored a bit to make Gamepad objects emit events very similar to GdkEvent, using Linux event codes instead of custom gamepad event types. This makes the gamepad support simpler and more flexible by improving the definition of events and by avoiding a layer of conversion for what is our only gamepad backend anyway.

UI Improvements

The GtkDialog objects used when resuming or quitting a game are replaced by GtkMessageDialog ones, as this type is more fitted to the messages they convey.

The look of the media selector has been improved, using checkmarks to denote the currently used media.

MediaSelector in 3.24 (left) and what will become 3.26 (right).

The games collection now use theme relative colors instead of ones set by the application, making it work better with any theme or with the light theme variant.

A useless sorting invalidation in CollectionIconView has been dropped, making the games collection load a bit faster.

Thanks to changes in retro-gtk, the logging of messages from Libretro cores has been improved: their log domain is now the core’s name instead of Games’ one, which should greatly help debugging.

Evolution of retro-gtk

retro-gtk is an important dependency of Games as it allows it to use Libretro cores. In what will become retro-gtk 0.12 a demo application has been added, it should help to develop and test retro-gtk without relying on Games.

So far, to load the games to use with a Core object, Core.load_game() or Core.prepare() had to be called just after Core.init() and the complex disk interface may had to be used if the Libretro core required it. Now the users of retro-gtk just have to use Core.set_medias() before calling Core.init() if any game has to be passed to the core, the games will then be loaded during the call to Core.init() and the user doesn’t have to take care of the disk interface. If multiple medias were passed to the Core, they can be changed with a call to Core.set_current_media().

As previously said, logging has been improved.

The CoreView widget has been added, it can handle the video output and some inputs — like keyboard and mouse inputs — for the core. It is still in an early stage and its design is expected to evolve, its goal is to be the simplest way possible to handle a Core. It is used by the demo application.

retro-gtk is slowly being ported to C and its API is being simplified in the hope to make the library as simple to use and as stable as possible.

Other Ongoing Works

Other works are ongoing too! Abhinav is working on allowing you to configure your gamepads in case Games doesn’t support them yet and Yasitha is working on supporting the multiple features of the Nintendo DS so you can run its games perfectly!

jeudi 8 juin 2017

Neo-Geo games on sale for GNOME Games

If you want to get some Neo-Geo games for Games, GOG.com has some on sales here.

You can run them in Games by simply unzipping the installer and retrieving the two .zip files corresponding to the game and the Neo-Geo firmware. Keep in mind you'll need a MAME Libretro core to run them.

mercredi 31 mai 2017

GNOME at the openSUSE Conference 2017

The openSUSE Conference was held during May 26–28, 2017 in Nuremberg, Germany. The event was really interesting and the location — Z-Bau — was perfect for this event.

GNOME had a booth there, were you could have tried “the GNOME gaming handheld”: a GPD Win running Games on GNOME/openSUSE Tumbleweed!

This handheld definitely caught some attention. ­čśâ

On a more personnal note I have been pleased to meet several persons I am looking forward to work with. ­čśâ

See in Prague for the openSUSE Conference 2018!

jeudi 2 mars 2017

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 Specification

In 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 information were present as comments and hence were not reliable… a better designed format fixing these problems was needed. Taking the desktop entry specification as a model, the Libretro core descriptor specification was born.

In order to use them, Games requires cores to come with a descriptor valid according to this specification — packagers, please remember to ship the needed .libretro files with your Libretro cores, you can find the ones used with the Flatpak version here.

Smooth and Sharp Video Output

So far, the video output of retro games in Games was smoothed out using bilinear filtering. It's a safe default, but you may prefer to see your retro games in all their pixely glory; head over to Games' preferences and you'll find the Filter option in the new Video page, letting you to choose between the familliar smooth video output and a new sharp one!

Smooth and sharp video filtering

Collection Loading Indicator

So far you had no way to know when Games finished loading the games collection. In 3.24, a small popup will appear while the games list is being loaded, letting you know when all the games are found.

Loading the games collection…

Smooth Collection Alignment

The game thumbnails spread evenly horizontally instead of packing themselves at the beginning of the line, making the games collection look more elegant.

Remembering the Window's State

Games remembers the size of your window and whether it is maximized or not, and restore the window's state when you start the application. Not only that, it also remembers whether your games should be displayed in fullscreen!

Improved Error Messages

Should a game fail to run, starting from 3.24 Games displays an error message in the error page explaining the failure in a non-technical way.

Games gives you some hint why a game failed to run

Supporting More Games

Famicom Disk System games are listed, and with the right firmware (see later) Games is even capable of running them!

A Famicom–Famicom Disk System combination — Evan-Amos, CC BY-SA 3.0

Games is also capable of listing and running standalone Libretro games — games distributed as Libretro cores — provided they ship a correct Libretro core descriptor. Notable examples are 2048, Dinothawr and Mr. Boom.

The Flatpak Version

The Flapak version of Games already shipped Libretro cores allowing you to play Super NES, Super Famicom, Game Boy, Game Boy Color and PlayStation games; Games comes with a few more Libretro cores:

  • Beetle NeoPop, allowing you to play Neo Geo Pocket and Neo Geo Pocket Color games;
  • Beetle PCE Fast, allowing you to play TurboGrafx-16/PC-Engine and TurboGrafx-CD/CD-ROM² games; and
  • Nestopia UE, allowing you to play NES, Famicom and Famicom Disk System games.

If you want to install the latest nightly — and soon the latest stable — Flatpak version of Games, head over to the documentation.

Firmwares

In most of the situations, no external firmware (BIOS) file is required to play retro games, but some Libretro cores may require an external firmware file to do so; these firmwares are described in the .libretro descriptor of the core. Usually, neither the Libretro cores nor Games can ship these firmwares for copyright reasons, so the user have to provide them in order to run these games.

Games 3.24 lets the Libretro cores look for external firmwares in the ~/.config/gnome-games/platforms/PLATFORM/system directory, where PLATFORM is the platform of the game as defined in the .libretro descriptor and in the known platforms of the Libretro core descriptor specification.

Games checks whether the required firmware files with the expected fingerprints are present and will fail to run the game otherwise.

For example, in order to run Famicom Disk System games in Games with the Nestopia UE Libretro core, you will need the ~/.config/gnome-games/platforms/FamicomDiskSystem/system/disksys.rom file with the right fingerprint, and in order to run TurboGrafx-CD and CD-ROM² games with the Beetle PCE Fast Libretro core, you will need the ~/.config/gnome-games/platforms/TurboGrafxCD/system/syscard3.pce file with the right fingerprint.

This is obviously not desirable to rely on such proprietary and globally illegal to distribute firmwares; become a video game preservation hero by writing a free implementation of these!

Various Fixes

In Games 3.24, all of the following bugs are fixed:

  • if the configuration move the application menu into the application's header bar, a menu bar was present in addition to the appmenu button;
  • an empty button was sometime present on the error page's headerbar;
  • keyboard shortcuts to make the game fullscreen made the application fullscreen even when the games doesn't support it;
  • keyboard navigation in the games collection was buggy.

Refactoring retro-gtk

retro-gtk is the library allowing Games to handle libretro cores, so it's one of its most important foundations. Unfortunately, the library's design has been rushed out in the first versions of Games which resulted in an overly complex library: it was harder to use than it should and making it evolve wasn't easy either.

A big refactoring of retro-gtk started this cycle: the retro-gobject and retro-gtk libraries were merged into retro-gtk; the Retro and RetroGtk namespaces were merged into Retro; many unused types where removed — they can be added back when they will actually be needed; and some parts of the code like the video and audio outputs have been simplified.

All of these simplifications will allow us to refactor the library even more, for example it would help us decoupling the process running the Libretro cores from the one running the UI, in a similar fashion to what WebKitGTK+ does with web pages; this would help resolving several problems with Libretro core support and would prevent the application from crashing because of a Libretro core.

As a reminder, retro-gtk's API is still extremely unstable.

mardi 10 janvier 2017

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? ­čśâ