Skip to content

Commit

Permalink
ENGINES: Fix autosave name check (#3648)
Browse files Browse the repository at this point in the history
The length of the German translation for Autosave is 23 characters. Save names in Groovie are limited to 15 characters, and it's probably not the only engine with a similar limit. This meant you would get a warning on every autosave, even though you just told it to overwrite. Mminimum of 14 characters for confidence that the name is a match and not a false positive.
  • Loading branch information
Die4Ever committed Jan 13, 2022
1 parent d794b23 commit 0d36402
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion engines/savestate.cpp
Expand Up @@ -95,7 +95,16 @@ bool SaveStateDescriptor::isAutosave() const {

bool SaveStateDescriptor::hasAutosaveName() const
{
return _description.contains(_("Autosave"));
const Common::U32String &autosave = _("Autosave");

// if the save file name is long enough, just check if it starts with "Autosave"
if (_description.size() >= autosave.size())
return _description.substr(0, autosave.size()) == autosave;

// if the save name has been trimmed, as long as it isn't too short, use fallback logic
if (_description.size() < 14)
return false;
return autosave.substr(0, _description.size()) == _description;
}

bool SaveStateDescriptor::isValid() const
Expand Down

0 comments on commit 0d36402

Please sign in to comment.