Status and Roadmap

Composer engine saving/loading now functions, with only audio sync issues remaining, so it seems a good time to discuss the roadmap for the main body of the task.

My design is as follows:

There will be a new entry added to the EngineFeature enum: kSupportsAnytimeSaving.

Engines which support anytime saving will return true when queried about this, and implement doQuickSave(int slot, const Common::String &desc). and doQuickLoad(int slot). It will likely also be necessary for these engines to support listSaves() in order to allow the user to select a save to load.

For cases where the engine only disallows saving to prevent cheating, these functions will simply call saveGameState() and loadGameState() without regard to the status of canSaveGameCurrently(). For more complex cases, where the engine disallows saving because it doesn’t implement saving for its current state, these functions will, of course, have to implement saving in those states, which can potentially require some extensive engine refactoring.

When I have the audio issues worked out of the composer engine, it should immediately be capable of supporting anytime saving, so the next step will just be creating those wrapper functions. After that, I intend to move on to the SCUMM engine module and make it ready for anytime saving.

After that, we’ll see…

PseudoComposition

In order to familiarize myself with file interfaces and general saving/loading practices in ScummVM, I have been working on implementing standard saving/loading for the Composer engine, beginning by generating a list of what needs to be saved, and some pseudocode for how to reinitialize the objects from the stored data.

My notes on this follow:

save:
ComposerEngine:

save to savefile:

  • RandomSource* _rnd,
  • uint32 _currentTime,
  • uint32 _lastTime,
  • bool _needsUpdate,
  • List<Sprite> _sprites,
  • String _bookGroup,
  • List<Library> _Libraries,
  • Array<PendingPageChange> _pendingPageChanges,
  • Array<uint16> _stack,
  • Array<uint16> _vars,
  • List<Oldscript *> _oldScripts,
  • Array<QueuedScript> _queuedScripts,
  • bool _mouseEnabled,
  • bool _mouseVisible,
  • uint16 _mouseSpriteId

RandomSource: uint32 getSeed()
List<T>: uint32 size(), T *ConstIterator begin() .. end()
Sprite: uint16 _id
Library: uint16 _id
Array<T>: uint32 size(), T *ConstIterator begin() .. end()
PendingPageChange: uint16 _pageId, bool _remove
OldScript: uint16 _id, uint32 _currDelay
QueuedScript: uint32 _baseTime, uint32 _duration, uint32 _count, uint16 _scriptId

load:
ComposerEngine:
filename = (find book.ini), _bookIni.loadFromFile(filename)

load from savefile:

  • RandomSource* _rnd,
  • uint32 _currentTime,
  • uint32 _lastTime,
  • bool _needsUpdate,
  • List<Sprite> _sprites,
  • String _bookGroup,
  • List<Library> _Libraries,
  • Array<PendingPageChange> _pendingPageChanges,
  • Array<uint16> _stack,
  • Array<uint16> _vars,
  • List<Oldscript *> _oldScripts,
  • Array<QueuedScript> _queuedScripts,
  • bool _mouseEnabled,
  • bool _mouseVisible,
  • uint16 _mouseSpriteId

RandomSource: setSeed(uint32)
List<T>: uint32 num, for (i = 0 .. num) (T, push_back(T))
Sprite: uint16 _id, initSprite(Sprite)
Library: uint16 _id, LoadLibrary(_id)
Array<T>: uint32 num, for (i = 0 .. num) (T, push_back(T))
PendingPageChange: uint16 _pageId, bool _remove, if (!_remove) LoadLibrary(_pageId)
OldScript: uint16 id, uint32 _currDelay, OldScript(id,getResource(ID_SCRP, id))
QueuedScript: uint32 _baseTime, uint32 _duration, uint32 _count, uint16 _scriptId

(Re)Introduction

Hello dear readers of the ScummVM blog aggregator,

This is Upthorn, joining the ranks of ScummVM development bloggers once again for Google Summer of Code 2012.

My project this year is to allow for as many engines as I can to provide saving functionality even when the game it is running would not normally give the user access to a savescreen. Preferably, these saves will offer the robustness of savestates in lower level emulators, but it is likely that this will vary by engine module. The primary goal of this functionality is to allow users of mobile devices to enjoy ScummVM without concern of low battery life eating their progress.

It is good to be back.