diff options
-rw-r--r-- | engines/scumm/saveload.cpp | 19 | ||||
-rw-r--r-- | engines/scumm/thumbnail.cpp | 9 |
2 files changed, 13 insertions, 15 deletions
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 23307d64ec..80d309bacf 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -165,12 +165,10 @@ bool ScummEngine::loadState(int slot, bool compat) { // Since version 52 a thumbnail is saved directly after the header. if (hdr.ver >= VER(52)) { - uint32 type; - in->read(&type, 4); - + uint32 type = in->readUint32BE(); // Check for the THMB header. Also, work around a bug which caused // the chunk type (incorrectly) to be written in LE on LE machines. - if (! (type == MKID('THMB') || (hdr.ver < VER(55) && type == MKID('BMHT')))){ + if (! (type == MKID_BE('THMB') || (hdr.ver < VER(55) && type == MKID_BE('BMHT')))){ warning("Can not load thumbnail"); delete in; return false; @@ -521,12 +519,11 @@ bool ScummEngine::loadInfosFromSlot(int slot, InfoStuff *stuff) { return false; } - uint32 type; - in->read(&type, 4); + uint32 type = in->readUint32BE(); // Check for the THMB header. Also, work around a bug which caused // the chunk type (incorrectly) to be written in LE on LE machines. - if (! (type == MKID('THMB') || (hdr.ver < VER(55) && type == MKID('BMHT')))){ + if (! (type == MKID_BE('THMB') || (hdr.ver < VER(55) && type == MKID_BE('BMHT')))){ delete in; return false; } @@ -546,8 +543,8 @@ bool ScummEngine::loadInfos(Common::InSaveFile *file, InfoStuff *stuff) { memset(stuff, 0, sizeof(InfoStuff)); SaveInfoSection section; - file->read(§ion.type, 4); - if (section.type != MKID('INFO')) { + section.type = file->readUint32BE(); + if (section.type != MKID_BE('INFO')) { return false; } @@ -594,7 +591,7 @@ bool ScummEngine::loadInfos(Common::InSaveFile *file, InfoStuff *stuff) { void ScummEngine::saveInfos(Common::OutSaveFile* file) { SaveInfoSection section; - section.type = MKID('INFO'); + section.type = MKID_BE('INFO'); section.version = INFOSECTION_VERSION; section.size = sizeof(SaveInfoSection); @@ -607,7 +604,7 @@ void ScummEngine::saveInfos(Common::OutSaveFile* file) { section.date = (curTime->tm_mday & 0xFF) << 24 | ((curTime->tm_mon + 1) & 0xFF) << 16 | (curTime->tm_year + 1900) & 0xFFFF; section.time = (curTime->tm_hour & 0xFF) << 8 | (curTime->tm_min) & 0xFF; - file->write(§ion.type, 4); + file->writeUint32BE(section.type); file->writeUint32BE(section.version); file->writeUint32BE(section.size); file->writeUint32BE(section.timeTValue); diff --git a/engines/scumm/thumbnail.cpp b/engines/scumm/thumbnail.cpp index 13e9ef49bf..f1854f71c7 100644 --- a/engines/scumm/thumbnail.cpp +++ b/engines/scumm/thumbnail.cpp @@ -56,11 +56,12 @@ inline void colorToRGB(uint16 color, uint8 &r, uint8 &g, uint8 &b) { Graphics::Surface *ScummEngine::loadThumbnail(Common::InSaveFile *file) { ThumbnailHeader header; - file->read(&header.type, 4); + + header.type = file->readUint32BE(); // We also accept the bad 'BMHT' header here, for the sake of compatibility // with some older savegames which were written incorrectly due to a bug in // ScummVM which wrote the thumb header type incorrectly on LE systems. - if (header.type != MKID('THMB') && header.type != MKID('BMHT')) + if (header.type != MKID_BE('THMB') && header.type != MKID_BE('BMHT')) return 0; header.size = file->readUint32BE(); @@ -109,7 +110,7 @@ void ScummEngine::saveThumbnail(Common::OutSaveFile *file) { thumb.create(kThumbnailWidth, kThumbnailHeight2, sizeof(uint16)); ThumbnailHeader header; - header.type = MKID('THMB'); + header.type = MKID_BE('THMB'); #if defined(PALMOS_ARM) || defined(__GP32__) // sizeof(header) is hardcoded here, because the compiler add padding to // have a 4byte aligned struct and there is no easy way to pack it. @@ -122,7 +123,7 @@ void ScummEngine::saveThumbnail(Common::OutSaveFile *file) { header.height = thumb.h; header.bpp = thumb.bytesPerPixel; - file->write(&header.type, 4); + file->writeUint32BE(header.type); file->writeUint32BE(header.size); file->writeByte(header.version); file->writeUint16BE(header.width); |