mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-07 19:36:21 +00:00
SWORD25: Removed the saved game filename from the savegame meta info struct
This commit is contained in:
parent
68118bdf7a
commit
a428835b38
@ -105,7 +105,6 @@ struct SavegameInformation {
|
||||
bool isOccupied;
|
||||
bool isCompatible;
|
||||
Common::String description;
|
||||
Common::String filename;
|
||||
uint gamedataLength;
|
||||
uint gamedataOffset;
|
||||
uint gamedataUncompressedLength;
|
||||
@ -118,7 +117,6 @@ struct SavegameInformation {
|
||||
isOccupied = false;
|
||||
isCompatible = false;
|
||||
description = "";
|
||||
filename = "";
|
||||
gamedataLength = 0;
|
||||
gamedataOffset = 0;
|
||||
gamedataUncompressedLength = 0;
|
||||
@ -175,8 +173,6 @@ struct PersistenceService::Impl {
|
||||
curSavegameInfo.isOccupied = true;
|
||||
// Check if the saved game is compatible with the current engine version.
|
||||
curSavegameInfo.isCompatible = (storedVersionID == Common::String(VERSIONID));
|
||||
// Store the save game name - FIXME: Why is this needed?
|
||||
curSavegameInfo.filename = filename;
|
||||
// Load the save game description.
|
||||
curSavegameInfo.description = gameDescription;
|
||||
// The offset to the stored save game data within the file.
|
||||
@ -253,10 +249,11 @@ Common::String &PersistenceService::getSavegameDescription(uint slotID) {
|
||||
}
|
||||
|
||||
Common::String &PersistenceService::getSavegameFilename(uint slotID) {
|
||||
static Common::String emptyString;
|
||||
static Common::String result;
|
||||
if (!checkslotID(slotID))
|
||||
return emptyString;
|
||||
return _impl->_savegameInformations[slotID].filename;
|
||||
return result;
|
||||
result = generateSavegameFilename(slotID);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool PersistenceService::saveGame(uint slotID, const Common::String &screenshotFilename) {
|
||||
@ -381,13 +378,13 @@ bool PersistenceService::loadGame(uint slotID) {
|
||||
|
||||
byte *compressedDataBuffer = new byte[curSavegameInfo.gamedataLength];
|
||||
byte *uncompressedDataBuffer = new Bytef[curSavegameInfo.gamedataUncompressedLength];
|
||||
|
||||
file = sfm->openForLoading(generateSavegameFilename(slotID));
|
||||
Common::String filename = generateSavegameFilename(slotID);
|
||||
file = sfm->openForLoading(filename);
|
||||
|
||||
file->seek(curSavegameInfo.gamedataOffset);
|
||||
file->read(reinterpret_cast<char *>(&compressedDataBuffer[0]), curSavegameInfo.gamedataLength);
|
||||
if (file->err()) {
|
||||
error("Unable to load the gamedata from the savegame file \"%s\".", curSavegameInfo.filename.c_str());
|
||||
error("Unable to load the gamedata from the savegame file \"%s\".", filename.c_str());
|
||||
delete[] compressedDataBuffer;
|
||||
delete[] uncompressedDataBuffer;
|
||||
return false;
|
||||
@ -397,7 +394,7 @@ bool PersistenceService::loadGame(uint slotID) {
|
||||
uLongf uncompressedBufferSize = curSavegameInfo.gamedataUncompressedLength;
|
||||
if (uncompress(reinterpret_cast<Bytef *>(&uncompressedDataBuffer[0]), &uncompressedBufferSize,
|
||||
reinterpret_cast<Bytef *>(&compressedDataBuffer[0]), curSavegameInfo.gamedataLength) != Z_OK) {
|
||||
error("Unable to decompress the gamedata from savegame file \"%s\".", curSavegameInfo.filename.c_str());
|
||||
error("Unable to decompress the gamedata from savegame file \"%s\".", filename.c_str());
|
||||
delete[] uncompressedDataBuffer;
|
||||
delete[] compressedDataBuffer;
|
||||
delete file;
|
||||
@ -420,7 +417,7 @@ bool PersistenceService::loadGame(uint slotID) {
|
||||
delete file;
|
||||
|
||||
if (!success) {
|
||||
error("Unable to unpersist the gamedata from savegame file \"%s\".", curSavegameInfo.filename.c_str());
|
||||
error("Unable to unpersist the gamedata from savegame file \"%s\".", filename.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user