Common::Error MutationOfJBEngine::saveGameState(int slot, const Common::String &desc) { const Common::String saveName = Common::String::format("%s.%03d", _targetName.c_str(), slot); Common::OutSaveFile *const saveFile = g_system->getSavefileManager()->openForSaving(saveName); Common::Serializer sz(nullptr, saveFile); SaveHeader saveHdr; saveHdr._description = desc; saveHdr.sync(sz); _game->getGameData().saveLoadWithSerializer(sz); saveFile->finalize(); delete saveFile; return Common::kNoError; }
Common::Error MutationOfJBEngine::loadGameState(int slot) { const Common::String saveName = Common::String::format("%s.%03d", _targetName.c_str(), slot); Common::InSaveFile *const saveFile = g_system->getSavefileManager()->openForLoading(saveName); Common::Serializer sz(saveFile, nullptr); SaveHeader saveHdr; saveHdr.sync(sz); _game->getGameData().saveLoadWithSerializer(sz); delete saveFile; _game->changeScene(_game->getGameData()._currentScene, _game->getGameData()._partB); _game->getGui().markDirty(); return Common::kNoError; }