The autosave refactoring that was done in
7adad5aaf5 used g_engine for identifying the
autosave slot. This worked for in-game save/load, but doesn't fit when
called from the launcher.
Fix by passing MetaEngine to SaveStateDescriptor ctor and using it for this
query.
Amends 7adad5aaf5.
The MetaEngine claimed to support kSupportsDeleteSave, but
removeSaveState() was not implemented, so deleting savegames
was not doing anything.
This fixes bug #12896 (AGS: Can't delete savegames)
Some engines call setAutosave and some don't. isAutosave is used to
determine if a saved game is an autosave, but in fact, on most cases it
just falls back to comparing the name to "Autosave".
This is wrong for several reasons:
* Older versions of ScummVM used Autosave 0.
* The name "Autosave" is translated, so if you change the language, it
won't be detected.
Instead of relying on the name, use the well-known getAutosaveSlot() from
Engine/MetaEngine.
Fixes#12735.
One of the issue was that we were listing the restart point
savegame (in slot 999), and it should not have been listed.
This caused a crash in the ags savegamedialog as it tried
to use the next slot, 1000, which is out of bound.
Changing this fixes bug #12386.
Another issue is that we could do out of bound writes due
to the AGS engine having to MAXSAVEGAMES define, one set to 20
and the other to 50. And in one place we were using the wrong
one.
Also specify a maximum save slot of 99. This is what the
original uses as it reserves higher slots for special purposes.
And finally do not use slot 999 for autosaves as it conflicts
with the slot used bu AGS for the restart point.
At the moment, savegames made using the in-game save dialogs
show the dialog in the thumbnail. Not sure if it will be possible
to work around in the future, since the display of any save
dialog is controlled by game scripts, and so it would be difficult
to figure out a point to get a screenshot ready before the dialog
has been shown