Since my last blog post the main merge request of my GSoC project has landed and after that I followed up with subsequent bugfixes and also a couple of enhancements to the savestates manager.
I will use this blog post for the final submission as part of my participation in the program. As such this post will be a bit longer than the others but I’ll still keep it visual and populate it with gifs and screenshots 🙂
My main merge request
Merge request (MR) !278 is the largest and most important one that I have submitted for this project. The changes it introduces can be summarized as follows:
- Automatic migration from the old directory layout
- Backend changes to use the new directory layout and savestates
- An initial implementation of the UI to manipulate savestates. This UI was capable of saving, loading and deleting savestates.
The most important change was the refactor of the RetroRunner class which is a class that manages the emulator core used to run games (the core is represented as an instance of a Retro.Core object). An instance of a RetroRunner manages an instance of a Retro.Core for one game and now it also manages the savestates for that game.
Secondary MR 1) Add the savestates renaming feature
!301 introduces a new enhancement to the savestates manager, it allows the user to rename savestates.
Secondary MR 2) Add shortcuts for using savestates
The former MR implements the shortcuts themselves, while the latter (not yet merged) MR lists them in the Shortcuts window.
Secondary MR 3) Flash effect when creating savestates
!310 introduces a pretty flash effect which is played every time a new savestate is created. This effect was inspired by the one used by GNOME Screenshot and we attempted to mimic it’s implementation. 🙂
I was very surprised to find out the flash is actually not implemented by GNOME Screenshot but rather by GNOME Shell. This feature was very interesting to work on as I had to check the source code of GNOME Shell to find out what interpolation function and duration it used for the animation. Then, using that information, I had to write code that animated the opacity property of the background widget in order to achieve the same effect. We concluded that the initial version of the flash was too bright and might distract the user from the game. Because of that the Games flash has a reduced opacity compared to the GNOME Shell one and as such appears a bit dimmer.
Secondary MR 4) Use a nicer date format for savestates
As I’m writing this post, !319 still needs a bit of work, but it aims to show the savestates dates similarly to how Nautilus shows the Modified date for files. Note that in the screenshot below the dates are of course fabricated (since there were no savestates back in 2018) in order to simply illustrate the various available formats.
Along with these MRs, there were also several others with bugfixes and small tweaks:
- !294 Here an important bug was fixed in which the automatic savestates were not pruned properly and we also changed the way in which new savestate names were generated such that it works similarly to how new file names are generated by the file manager (e.g. If we have savestates “New savestate 1”, “A”, “B” and we create a new savestate it would be called “New savestate 2” rather than “New savestate 4”)
- !295 Replace the Cancel button with a Back button
- !296 Remove left and right borders from the savestates menu
- !297 Fix a UI bug in which the user could apply Load/Delete operations even when there was no savestate selected
- !298 Fix a UI bug in which the top header bar would cover the savestates menu in fullscreen
- !299 A quickfix which renamed a method
- !300 Before this MR the game would unpause before the savestates menu finished it’s animation which would confuse the user
- !303 Fix a small UI bug in which the new savestate row (the one denoted by the + sign) could be selected, which is to be avoided
- !304 Fix a small issue in which savestates would get saved with a wrong thumbnail
- !306 These changes are a fix for bugs discovered in !294
- !307 The Nintendo DS core caused crashes because it wasn’t properly de-initialized
- !311 When renaming a savestate we iterate through the others to check if there exists one with the same name. This fix ensures that we don’t take the new savestate row into consideration when doing that
- !312 Some games don’t support savestates (e.g. Steam games) and we must ignore the savestates shortcuts with these games
- !313 UI fix for the edge case in which a savestate name spans multiple lines
- !314 If we click the Rename button and the selected row is not visible on the screen then we scroll to it
- !315 Allow creating multiple savestates per second. Creating savestates rapidly caused runtime errors because the new directories would have the same name based on time.
- !316 Avoid runtime errors when spamming the Delete button
Possible future improvements to the project
- Gamepad navigation – Allow the player to use the savestates manager with a gamepad. The difficulty of this task comes from the fact that the number of available buttons that games don’t use is limited.
- Undo loading – This is a feature common to many emulators and it helps the users in case they accidentally loaded a savestate and lost the progress of their current session.