Introduce a minimum supported save game format

macos_ci_fix
Evil Eye 1 year ago
parent 8d8e970aba
commit 23aacbd914

@ -106,6 +106,7 @@
Feature #6447: Add LOD support to Object Paging
Feature #6491: Add support for Qt6
Feature #6556: Lua API for sounds
Feature #6624: Drop support for old saves
Feature #6726: Lua API for creating new objects
Feature #6864: Lua file access API
Feature #6922: Improve launcher appearance

@ -411,10 +411,25 @@ void MWState::StateManager::loadGame(const Character* character, const std::file
ESM::ESMReader reader;
reader.open(filepath);
if (reader.getFormatVersion() > ESM::CurrentSaveGameFormatVersion)
throw VersionMismatchError(
"This save file was created using a newer version of OpenMW and is thus not supported. Please upgrade "
"to the newest OpenMW version to load this file.");
ESM::FormatVersion version = reader.getFormatVersion();
if (version > ESM::CurrentSaveGameFormatVersion)
throw VersionMismatchError("#{OMWEngine:LoadingRequiresNewVersionError}");
else if (version < ESM::MinSupportedSaveGameFormatVersion)
{
const char* release;
// Report the last version still capable of reading this save
if (version <= ESM::OpenMW0_48SaveGameFormatVersion)
release = "OpenMW 0.48.0";
else
{
// Insert additional else if statements above to cover future releases
static_assert(ESM::MinSupportedSaveGameFormatVersion <= ESM::OpenMW0_49SaveGameFormatVersion);
release = "OpenMW 0.49.0";
}
auto l10n = MWBase::Environment::get().getL10nManager()->getContext("OMWEngine");
std::string message = l10n->formatMessage("LoadingRequiresOldVersionError", { "version" }, { release });
throw VersionMismatchError(message);
}
std::map<int, int> contentFileMap = buildContentFileIndexMap(reader);
reader.setContentFileMapping(&contentFileMap);
@ -607,11 +622,7 @@ void MWState::StateManager::loadGame(const Character* character, const std::file
std::vector<std::string> buttons;
buttons.emplace_back("#{Interface:OK}");
std::string error;
if (typeid(e) == typeid(VersionMismatchError))
error = "#{OMWEngine:LoadingFailed}: #{OMWEngine:LoadingRequiresNewVersionError}";
else
error = "#{OMWEngine:LoadingFailed}: " + std::string(e.what());
std::string error = "#{OMWEngine:LoadingFailed}: " + std::string(e.what());
MWBase::Environment::get().getWindowManager()->interactiveMessageBox(error, buttons);
}

@ -26,6 +26,10 @@ namespace ESM
inline constexpr FormatVersion MaxUseEsmCellIdFormatVersion = 26;
inline constexpr FormatVersion MaxActiveSpellSlotIndexFormatVersion = 27;
inline constexpr FormatVersion CurrentSaveGameFormatVersion = 29;
inline constexpr FormatVersion MinSupportedSaveGameFormatVersion = 0;
inline constexpr FormatVersion OpenMW0_48SaveGameFormatVersion = 21;
inline constexpr FormatVersion OpenMW0_49SaveGameFormatVersion = CurrentSaveGameFormatVersion;
}
#endif

@ -25,6 +25,9 @@ BuildingNavigationMesh: "Baue Navigationsgitter"
#LoadingRequiresNewVersionError: |-
# This save file was created using a newer version of OpenMW and is thus not supported.
# Please upgrade to the newest OpenMW version to load this file.
# LoadingRequiresOldVersionError: |-
# This save file was created using an older version of OpenMW in a format that is no longer supported.
# Load and save this file using {version} to upgrade it.
#NewGameConfirmation: "Do you want to start a new game and lose the current one?"
#SaveGameDenied: "The game cannot be saved right now."
#SavingInProgress: "Saving..."

@ -22,6 +22,9 @@ LoadingInProgress: "Loading Save Game"
LoadingRequiresNewVersionError: |-
This save file was created using a newer version of OpenMW and is thus not supported.
Please upgrade to the newest OpenMW version to load this file.
LoadingRequiresOldVersionError: |-
This save file was created using an older version of OpenMW in a format that is no longer supported.
Load and save this file using {version} to upgrade it.
NewGameConfirmation: "Do you want to start a new game and lose the current one?"
SaveGameDenied: "The game cannot be saved right now."
SavingInProgress: "Saving..."

@ -22,6 +22,9 @@ LoadingInProgress: "Chargement de la sauvegarde"
LoadingRequiresNewVersionError: |-
Ce fichier de sauvegarde provient d'une version plus récente d'OpenMW, il n'est par consequent pas supporté.
Mettez à jour votre version d'OpenMW afin de pouvoir charger cette sauvegarde.
# LoadingRequiresOldVersionError: |-
# This save file was created using an older version of OpenMW in a format that is no longer supported.
# Load and save this file using {version} to upgrade it.
NewGameConfirmation: "Voulez-vous démarrer une nouvelle partie ? Toute progression non sauvegardée sera perdue."
SaveGameDenied: "Sauvegarde impossible"
SavingInProgress: "Sauvegarde en cours..."

@ -22,6 +22,9 @@ LoadingInProgress: "Загрузка сохранения"
LoadingRequiresNewVersionError: |-
Это сохранение создано более новой версией OpenMW и поэтому не может быть загружено.
Обновите OpenMW до последней версии, чтобы загрузить этот файл.
# LoadingRequiresOldVersionError: |-
# This save file was created using an older version of OpenMW in a format that is no longer supported.
# Load and save this file using {version} to upgrade it.
NewGameConfirmation: "Вы хотите начать новую игру? Текущая игра будет потеряна."
SaveGameDenied: "В данный момент игру нельзя сохранить."
SavingInProgress: "Сохранение..."

@ -22,6 +22,9 @@ LoadingInProgress: "Laddar sparat spel"
LoadingRequiresNewVersionError: |-
Denna sparfil skapades i en nyare version av OpenMW och stöds därför inte.
Uppgradera till den senaste versionen av OpenMW för att ladda filen.
# LoadingRequiresOldVersionError: |-
# This save file was created using an older version of OpenMW in a format that is no longer supported.
# Load and save this file using {version} to upgrade it.
NewGameConfirmation: "Vill du starta ett nytt spel och förlora det pågående spelet?"
SaveGameDenied: "Spelet kan inte sparas just nu."
SavingInProgress: "Sparar..."

Loading…
Cancel
Save