LASTEXPRESS: Remove use of skip from savegame functions when loading

We cannot accurately skip over compressed data as it is not know before decoding how much data will be used
This commit is contained in:
Littleboy 2012-08-01 02:58:55 -04:00
parent eb6c60cec0
commit 7f05e1413c
3 changed files with 25 additions and 3 deletions

View file

@ -88,7 +88,13 @@ void EntityData::EntityCallData::saveLoadWithSerializer(Common::Serializer &s) {
syncString(s, sequenceNameCopy, 13); syncString(s, sequenceNameCopy, 13);
// Skip pointers to frame & sequences // Skip pointers to frame & sequences
s.skip(5 * 4); // (we are using a compressed stream, so we cannot seek on load)
if (s.isLoading()) {
byte empty[5 * 4];
s.syncBytes(empty, 5 * 4);
} else {
s.skip(5 * 4);
}
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////

View file

@ -242,7 +242,15 @@ void SavePoints::saveLoadWithSerializer(Common::Serializer &s) {
} }
// Skip uninitialized data if any // Skip uninitialized data if any
s.skip((_savePointsMaxSize - dataSize) * 16); // (we are using a compressed stream, so we cannot seek on load)
uint32 unusedDataSize = (_savePointsMaxSize - dataSize) * 16;
if (s.isLoading()) {
byte *empty = (byte *)malloc(unusedDataSize);
s.syncBytes(empty, unusedDataSize);
free(empty);
} else {
s.skip(unusedDataSize);
}
// Number of savepoints // Number of savepoints
uint32 numSavepoints = _savepoints.size(); uint32 numSavepoints = _savepoints.size();

View file

@ -372,7 +372,15 @@ void SoundQueue::saveLoadWithSerializer(Common::Serializer &s) {
(*i)->saveLoadWithSerializer(s); (*i)->saveLoadWithSerializer(s);
} else { } else {
warning("[Sound::saveLoadWithSerializer] Loading not implemented"); warning("[Sound::saveLoadWithSerializer] Loading not implemented");
s.skip(numEntries * 64);
uint32 unusedDataSize = numEntries * 64;
if (s.isLoading()) {
byte *empty = (byte *)malloc(unusedDataSize);
s.syncBytes(empty, unusedDataSize);
free(empty);
} else {
s.skip(unusedDataSize);
}
} }
} }