ENGINES: Improve management of empty autosave slot
Addresses a vulnerability where the autosave slot may present as a regular empty slot when autosaving is disabled. By default, an empty autosave slot will always: - be identified by a dummy autosave. - display the current autosave state. - remain clear until an autosave creates the autosave file.
This commit is contained in:
parent
95c542e713
commit
159f554d20
1 changed files with 6 additions and 2 deletions
|
@ -372,7 +372,7 @@ SaveStateList MetaEngine::listSaves(const char *target) const {
|
|||
|
||||
SaveStateList MetaEngine::listSaves(const char *target, bool saveMode) const {
|
||||
SaveStateList saveList = listSaves(target);
|
||||
int autosaveSlot = ConfMan.getInt("autosave_period") ? getAutosaveSlot() : -1;
|
||||
int autosaveSlot = getAutosaveSlot();
|
||||
if (!saveMode || autosaveSlot == -1)
|
||||
return saveList;
|
||||
|
||||
|
@ -387,7 +387,11 @@ SaveStateList MetaEngine::listSaves(const char *target, bool saveMode) const {
|
|||
|
||||
// No autosave yet. We want to add a dummy one in so that it can be marked as
|
||||
// write protected, and thus be prevented from being saved in
|
||||
SaveStateDescriptor desc(this, autosaveSlot, _("Autosave"));
|
||||
const Common::U32String &dummyAutosave = ConfMan.getInt("autosave_period”) ? _(“Autosave on”) : _(“Autosave off”);
|
||||
SaveStateDescriptor desc(this, autosaveSlot, dummyAutosave);
|
||||
desc.setWriteProtectedFlag(true);
|
||||
desc.setDeletableFlag(false);
|
||||
|
||||
saveList.push_back(desc);
|
||||
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue