End of GSoC

Hey everyone, GSoC has come to an end and I would just like to say that it’s been a great experience for me. I’ve learned a whole lot. I’d like to say thank you to Max for having been such a great mentor for me, always there when I needed help, and giving good advice. And thanks to everyone else who has helped me along the way as well.

I’ve provided a project summary which summarizes most everything that I’ve done this summer, as well as a list of things that could be done to further build upon this project. I think I will probably stick around for a while and work on some of these things in my spare time as well.

Global Main Menu/ Return To Launcher

Implementing the Return to Launcher (RTL) feature first consisted of identifying and resolving any memory leaks within the engines. Then, reworking and unifying the way that the engines quit.

The first thing I did was to go through each of the engines and fix the memory leaks. I was able to successfully get rid of almost all of the engine related memory leaks, the Agos engine still has one small (20 byte) leak, but it is still able to support RTL. Peres was a great help to me working on some leaks in the Parallaction engine, as well as LordHoto with the Kyra engine.

To properly RTL, it was also necessary to create a unified way for engines to quit. Many engines were using _system->quit() to exit, which was bad. The first steps to solving this problem involved creating a ‘quit’ flag in order to signal to the engine when to shutdown. I had to find the correct places within the engines to both set and check this ‘quit’ flag. Since _system->quit() instantly terminates the program, some work was needed to convert the engines which used it to use the quit flag instead.

Once that was done, the engines were tidily returning to the launcher in a similar fashion. Time to implement the Global Main Menu (GMM). The Global Main Menu is based on the Scumm engine’s F5 menu. It is pretty much the same thing, except no Save and Load dialogs, and adds on the ‘Return to Launcher’ button.

At first the RTL functionality from the GMM was accomplished using ‘quit’ and ‘rtl’ engine flags. The implementation was then greatly improved, by making use of artificial events which get added to the event manager’s event queue. I added a pushEvent() method to the event manager which allows you to create “fake” events and insert them into the event queue. Neat! Stephen Kennedy also made use of this feature for his GSoC project. Next, I added a ‘main menu’ event as well as a ‘rtl’ event. The use of ‘quit’ and ‘rtl’ flags in the engine was then dropped for the event manager’s shouldQuit() and shouldRTL() methods. At this point I went through all of the engines once again and converted them.

Now all of the engines quit and RTL in a uniform manner, and the event manager now keeps track of whether to quit ScummVM or RTL, so the engines need not worry about it.

If an engine needs to quit, it should call its quitGame() method, which sends a ‘quit’ event to the event manager.

If an engine needs to check whether or not it should shutdown or break out of its game loop, it should call its bool quit() method to check.

No more _system->quit()!

The next objective was to get the sound settings in the ‘Options’ dialog to function correctly. This involved creating a syncSoundSettings() method for the engines. Some of the engines used the default implementation, however some engines required their own specific implementation. I spent quite a bit (a little too much) time trying to get the settings to work right in all of the engines. These settings are now functional for all of the engines, however there are some improvements that can still be made which involve creating flags to identify if certain sound features (such as speech) are supported by the current game, and use them to show only the relevant controls in the Options dialog.

Savestate Management

The first thing I set out to do regarding save state management improvements was to implement support for –list-saves and –save-slot (-x). Some engines already supported these features, and I added support to many engines which did not have them yet. To accomplish this, I needed to become familiar with the saving/loading system for each engine I provided support for. I also managed to add auto-save support for AGI in the process.

Next I added a ‘Load’ button to the launcher, which brings up a dialog which lists the save states for the selected game and allows the user to directly load them from the launcher. I then added a ‘Delete’ button which allows the user to also delete their save games from the launcher. Some engines keep an index file to keep track of their save games, for these engines more work needs to be done before they can support deleting save games.

Since some engines do not support deleting save games, and a couple of engines (Agos and Gob) don’t support -x or –list-saves, it’s not very nice to make the user figure out which engines support these features. So, I created some meta engine feature flags which can be used to identify which features an engine supports. I use these to give a message to the user if an engine does not support loading from the Launcher, to enable/disable the ‘Delete’ button in the Launcher, as well as to enable/disable the RTL button in the GMM. The meta engine feature flags may come in handy for other purposes in the future as well.

TODO List

Global Main Menu/Return to Launcher

Double Quit Confirm Dialogs

When confirm exit is enabled in ScummVM, the ScummVM quit confirm dialog shows up in addition to the quit confirm dialogs for those games which have their own. For example, when you select ‘Quit’ from Beneath a Steel Sky’s in-game menu, it asks you if you really want to quit. Then, after answering, ScummVM gives you another dialog asking you if you really want to quit. So, ScummVM should not show the quit confirm dialog if the in-game dialog has already been displayed.

This affects any game which has it’s own menu system from where you can quit, or has a native quit confirm dialog. So this means most games.

Options Dialog

Implement engine flags to define which features in the Options dialog are supported by the current running game. Use these flags to hide/show the appropriate sliders and buttons in the Options Dialog

Improve the look of the GMM

This could include displaying the engine name and the ScummVM logo somewhere on the GMM.

Config Dialog code

Resolve the FIXME in engines/dialogs.cpp which pertains to having to use the empty string as the domain name.

Save State Management

Add Save and Load Dialogs to the GMM

Allow the user to Save and Load games from the GMM.

Add Save State Meta-info to Save State Descriptor

Define a standard for specifying save state meta-info (such as thumbnails, save date, play time, etc.) to the save state descriptor. Thumbnails should be treated differently than the other meta- info, since we do not want to load a large amount of thumbnails into memory each time we call MetaEngine::listSaves(). Thumbnails should perhaps be handled by implementing a new method, which returns a sort of extended SaveStateDescriptor, with more data than what listSaves() would return.

Enhance the ‘Load’ Dialog in the Launcher to show Save State Thumbnails and Meta-info Data

Use the previously mentioned extended SaveStateDescriptor to show save state thumbnails and other meta-info in the ‘Load’ dialog in the Launcher.

Deleting Save Games

Currently only engines which do not keep an index file for their save games support deleting save games from the Launcher. Add support for deleting save games for engines which do keep index files. This will include implementing a MetaEngine::removeSaveState() method for each of these engines.

Engines which use index files for their save games are:

  • CINE
  • SKY
  • SWORD1

I’m not sure if the following engines use an index file or not:

  • CRUISE
  • DRASCULA
  • IGOR
  • M4
  • MADE
–list-saves Support

If possible add –list-saves support to those engines which do not support it.

Engines which do not support –list-saves are:

  • CRUISE
  • DRASCULA
  • GOB
  • IGOR
  • M4
  • MADE
  • TINSEL
–save-slot/-x Support

If possible add –save-slot/-x support to those engines which do not support it.

Engines which to not support –save-slot/-x are:

  • AGOS
  • CRUISE
  • DRASCULA
  • GOB
  • IGOR
  • M4
  • MADE
  • TINSEL

NOTE: It is highly unlikely that AGOS and GOB will support –save-slot/-x, since the load/save system is script based.

Thanks for reading!