1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-27 03:40:24 +00:00

Introduce a minimum supported save game format

This commit is contained in:
Evil Eye 2023-11-30 19:20:38 +01:00
parent 8d8e970aba
commit 23aacbd914
8 changed files with 40 additions and 9 deletions

View file

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

View file

@ -411,10 +411,25 @@ void MWState::StateManager::loadGame(const Character* character, const std::file
ESM::ESMReader reader; ESM::ESMReader reader;
reader.open(filepath); reader.open(filepath);
if (reader.getFormatVersion() > ESM::CurrentSaveGameFormatVersion) ESM::FormatVersion version = reader.getFormatVersion();
throw VersionMismatchError( if (version > ESM::CurrentSaveGameFormatVersion)
"This save file was created using a newer version of OpenMW and is thus not supported. Please upgrade " throw VersionMismatchError("#{OMWEngine:LoadingRequiresNewVersionError}");
"to the newest OpenMW version to load this file."); 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); std::map<int, int> contentFileMap = buildContentFileIndexMap(reader);
reader.setContentFileMapping(&contentFileMap); reader.setContentFileMapping(&contentFileMap);
@ -607,11 +622,7 @@ void MWState::StateManager::loadGame(const Character* character, const std::file
std::vector<std::string> buttons; std::vector<std::string> buttons;
buttons.emplace_back("#{Interface:OK}"); buttons.emplace_back("#{Interface:OK}");
std::string error; std::string error = "#{OMWEngine:LoadingFailed}: " + std::string(e.what());
if (typeid(e) == typeid(VersionMismatchError))
error = "#{OMWEngine:LoadingFailed}: #{OMWEngine:LoadingRequiresNewVersionError}";
else
error = "#{OMWEngine:LoadingFailed}: " + std::string(e.what());
MWBase::Environment::get().getWindowManager()->interactiveMessageBox(error, buttons); MWBase::Environment::get().getWindowManager()->interactiveMessageBox(error, buttons);
} }

View file

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

View file

@ -25,6 +25,9 @@ BuildingNavigationMesh: "Baue Navigationsgitter"
#LoadingRequiresNewVersionError: |- #LoadingRequiresNewVersionError: |-
# This save file was created using a newer version of OpenMW and is thus not supported. # 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. # 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?" #NewGameConfirmation: "Do you want to start a new game and lose the current one?"
#SaveGameDenied: "The game cannot be saved right now." #SaveGameDenied: "The game cannot be saved right now."
#SavingInProgress: "Saving..." #SavingInProgress: "Saving..."

View file

@ -22,6 +22,9 @@ LoadingInProgress: "Loading Save Game"
LoadingRequiresNewVersionError: |- LoadingRequiresNewVersionError: |-
This save file was created using a newer version of OpenMW and is thus not supported. 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. 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?" NewGameConfirmation: "Do you want to start a new game and lose the current one?"
SaveGameDenied: "The game cannot be saved right now." SaveGameDenied: "The game cannot be saved right now."
SavingInProgress: "Saving..." SavingInProgress: "Saving..."

View file

@ -22,6 +22,9 @@ LoadingInProgress: "Chargement de la sauvegarde"
LoadingRequiresNewVersionError: |- LoadingRequiresNewVersionError: |-
Ce fichier de sauvegarde provient d'une version plus récente d'OpenMW, il n'est par consequent pas supporté. 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. 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." NewGameConfirmation: "Voulez-vous démarrer une nouvelle partie ? Toute progression non sauvegardée sera perdue."
SaveGameDenied: "Sauvegarde impossible" SaveGameDenied: "Sauvegarde impossible"
SavingInProgress: "Sauvegarde en cours..." SavingInProgress: "Sauvegarde en cours..."

View file

@ -22,6 +22,9 @@ LoadingInProgress: "Загрузка сохранения"
LoadingRequiresNewVersionError: |- LoadingRequiresNewVersionError: |-
Это сохранение создано более новой версией OpenMW и поэтому не может быть загружено. Это сохранение создано более новой версией OpenMW и поэтому не может быть загружено.
Обновите 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: "Вы хотите начать новую игру? Текущая игра будет потеряна." NewGameConfirmation: "Вы хотите начать новую игру? Текущая игра будет потеряна."
SaveGameDenied: "В данный момент игру нельзя сохранить." SaveGameDenied: "В данный момент игру нельзя сохранить."
SavingInProgress: "Сохранение..." SavingInProgress: "Сохранение..."

View file

@ -22,6 +22,9 @@ LoadingInProgress: "Laddar sparat spel"
LoadingRequiresNewVersionError: |- LoadingRequiresNewVersionError: |-
Denna sparfil skapades i en nyare version av OpenMW och stöds därför inte. 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. 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?" NewGameConfirmation: "Vill du starta ett nytt spel och förlora det pågående spelet?"
SaveGameDenied: "Spelet kan inte sparas just nu." SaveGameDenied: "Spelet kan inte sparas just nu."
SavingInProgress: "Sparar..." SavingInProgress: "Sparar..."