Here are some additional thoughts on this matter:
if ((_game.id == GID_BIRTHDAYYELLOW || _game.id == GID_BIRTHDAYRED) && _targetName.find("BluesBirthday") != 0) {
// Prepend generic name for shared game profile between targets
// for Yellow CD and Red CD of Blue's Birthday Adventure,
// but only if target name begins with "BluesBirthday" (default).
filePath = "BluesBirthday-" + filePath;
} else {
// Prepend the target name
filePath = _targetName + '-' + filePath;
}
This adds a placeholder condition that the target name must start with "BluesBirthday" - this allow the user to manually change target's name (ID:
in the GUI) to revert back to the old ways of per-target savegames, if that's ever desired.
However, for a better UX solution and one that allows using old savegames, this condition should probably be changed to a GUI-accessible game configuration key that's disabled by default (e.g. boolean "avoidSharedBirthdaySaves").
Sev suggested a mass-rename, so below is a partial solution. It's pretty seamless and doesn't bother the user with a GUI prompt.
void processBirthdaySaveFiles() {
// Condition 1: Check game ID and that target name begins with "BluesBirthday"
if ((_game.id != GID_BIRTHDAYYELLOW && _game.id != GID_BIRTHDAYRED) || _targetName.find("BluesBirthday") != 0) {
return;
}
// Condition 2: Check for existing shared savegame files
if (!_saveFileMan->listSavefiles("BluesBirthday-Blues1.nam").empty()) {
if (!_saveFileMan->listSavefiles(_targetName + "-Blues1.nam").empty() && _targetName != "BluesBirthday") {
debug("Old savegame files for target/ID '%s' detected, but ScummVM is using shared savegame files instead.", _targetName.c_str());
return;
} else {
return;
}
}
// Condition 3: Check if target name matches BluesBirthday or no existing target save files
if (_targetName == "BluesBirthday" || _saveFileMan->listSavefiles(_targetName + "-Blues1.nam").empty()) {
return;
}
// Rename save files
Common::StringArray targetFilenames = _saveFileMan->listSavefiles(_targetName + "-Blues1.nam");
targetFilenames.append(_saveFileMan->listSavefiles(_targetName + "-*.bca"));
targetFilenames.append(_saveFileMan->listSavefiles(_targetName + "-*.sg?"));
Common::String oldName, newName;
for (uint i = 0; i < targetFilenames.size(); ++i) {
oldName = targetFilenames[i];
newName = oldName;
newName.replace(_targetName, "BluesBirthday");
if (_saveFileMan->renameSavefile(oldName, newName)) {
debug("Renamed %s to %s.", oldName.c_str(), newName.c_str());
} else {
warning("Error %i (%s) occurred while renaming %s to %s", _saveFileMan->getError().getCode(),
_saveFileMan->getErrorDesc().c_str(), oldName.c_str(), newName.c_str());
return;
}
}
}
Basically:
- if non-gameID-target savegames exist and shared savegames exist: warn in console, but don't do anything (i.e. run shared savegames);
- if non-gameID-target savegames exist and shared savegames don't exist: rename target savegames to shared savegames;
- otherwise, don't do anything.
It's in untested doodled form, and I'm not sure where it's best wired in. It should be done once every time the target starts.
As suggested with the filePath part, the _targetName.find("BluesBirthday") != 0
condition should probably be changed to checking some avoidSharedBirthdaySaves
bool thing, and this should become a disabled-by-default option in the GUI. This way, users can choose to utilize their target's existing savegames by checking 'Avoid shared savegames (not recommended)' in the Game Options or something like that.