aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2010-10-26 20:14:17 +0000
committerWillem Jan Palenstijn2010-10-26 20:14:17 +0000
commitd3523a604071eae4f78f879f9d42a81f29b9121f (patch)
treea46a424941837a58f76d1df719809c7ba788f464 /engines/lastexpress
parent9af803f575aa63cd30e82c596e9e6cbac82613bb (diff)
downloadscummvm-rg350-d3523a604071eae4f78f879f9d42a81f29b9121f.tar.gz
scummvm-rg350-d3523a604071eae4f78f879f9d42a81f29b9121f.tar.bz2
scummvm-rg350-d3523a604071eae4f78f879f9d42a81f29b9121f.zip
LASTEXPRESS: Read savegame in blocks instead of bytes
svn-id: r53854
Diffstat (limited to 'engines/lastexpress')
-rw-r--r--engines/lastexpress/game/savegame.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/engines/lastexpress/game/savegame.cpp b/engines/lastexpress/game/savegame.cpp
index 3a0da868ec..923ced8ab2 100644
--- a/engines/lastexpress/game/savegame.cpp
+++ b/engines/lastexpress/game/savegame.cpp
@@ -107,8 +107,17 @@ uint32 SaveLoad::init(GameId id, bool resetHeaders) {
error("SaveLoad::init - Savegame seems to be corrupted (not enough data: %i bytes)", save->size());
// Load all savegame data
- while (!save->eos() && !save->err())
- _savegame->writeByte(save->readByte());
+ uint8* buf = new uint8[4096];
+ while (!save->eos() && !save->err()) {
+ uint32 count = save->read(buf, sizeof(buf));
+ if (count) {
+ uint32 w = _savegame->write(buf, count);
+ assert (w == count);
+ }
+ }
+ if (save->err())
+ error("SaveLoad::init - Error reading savegame");
+ delete[] buf;
_savegame->seek(0);
SAFE_DELETE(save);