Hardcoding header size of the Thumbnail and of the Info section of scumm games.
(because packed struct handling changed and gcc seems not to be happy with it) This should unbreak new save games made after this commit. svn-id: r23565
This commit is contained in:
parent
16de659f59
commit
d272f6c483
2 changed files with 9 additions and 11 deletions
|
@ -69,6 +69,8 @@ struct SaveInfoSection {
|
||||||
uint16 time;
|
uint16 time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define SaveInfoSectionSize (4+4+4 + 4+4 + 4+2)
|
||||||
|
|
||||||
#if defined(END_PACK_STRUCTS)
|
#if defined(END_PACK_STRUCTS)
|
||||||
#pragma END_PACK_STRUCTS
|
#pragma END_PACK_STRUCTS
|
||||||
#endif
|
#endif
|
||||||
|
@ -519,7 +521,7 @@ bool ScummEngine::loadInfos(Common::InSaveFile *file, InfoStuff *stuff) {
|
||||||
section.size = file->readUint32BE();
|
section.size = file->readUint32BE();
|
||||||
|
|
||||||
// if we extend this we should add a table for the special sizes at the versions to check it
|
// if we extend this we should add a table for the special sizes at the versions to check it
|
||||||
if (section.version == INFOSECTION_VERSION && section.size != sizeof(SaveInfoSection)) {
|
if (section.version == INFOSECTION_VERSION && section.size != SaveInfoSectionSize) {
|
||||||
warning("Info section is corrupt");
|
warning("Info section is corrupt");
|
||||||
file->skip(section.size);
|
file->skip(section.size);
|
||||||
return false;
|
return false;
|
||||||
|
@ -549,8 +551,8 @@ bool ScummEngine::loadInfos(Common::InSaveFile *file, InfoStuff *stuff) {
|
||||||
|
|
||||||
// skip all newer features, this could make problems if some older version uses more space for
|
// skip all newer features, this could make problems if some older version uses more space for
|
||||||
// saving informations, but this should NOT happen
|
// saving informations, but this should NOT happen
|
||||||
if (section.size > sizeof(SaveInfoSection)) {
|
if (section.size > SaveInfoSectionSize) {
|
||||||
file->skip(section.size - sizeof(SaveInfoSection));
|
file->skip(section.size - SaveInfoSectionSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -560,7 +562,7 @@ void ScummEngine::saveInfos(Common::OutSaveFile* file) {
|
||||||
SaveInfoSection section;
|
SaveInfoSection section;
|
||||||
section.type = MKID_BE('INFO');
|
section.type = MKID_BE('INFO');
|
||||||
section.version = INFOSECTION_VERSION;
|
section.version = INFOSECTION_VERSION;
|
||||||
section.size = sizeof(SaveInfoSection);
|
section.size = SaveInfoSectionSize;
|
||||||
|
|
||||||
// still save old format for older versions
|
// still save old format for older versions
|
||||||
section.timeTValue = time(0);
|
section.timeTValue = time(0);
|
||||||
|
|
|
@ -43,6 +43,8 @@ struct ThumbnailHeader {
|
||||||
byte bpp;
|
byte bpp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define ThumbnailHeaderSize (4+4+1+2+2+1)
|
||||||
|
|
||||||
#if defined(END_PACK_STRUCTS)
|
#if defined(END_PACK_STRUCTS)
|
||||||
#pragma END_PACK_STRUCTS
|
#pragma END_PACK_STRUCTS
|
||||||
#endif
|
#endif
|
||||||
|
@ -111,13 +113,7 @@ void ScummEngine::saveThumbnail(Common::OutSaveFile *file) {
|
||||||
|
|
||||||
ThumbnailHeader header;
|
ThumbnailHeader header;
|
||||||
header.type = MKID_BE('THMB');
|
header.type = MKID_BE('THMB');
|
||||||
#if defined(PALMOS_ARM) || defined(__GP32__)
|
header.size = ThumbnailHeaderSize + thumb.w*thumb.h*thumb.bytesPerPixel;
|
||||||
// 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.
|
|
||||||
header.size = 14 + thumb.w*thumb.h*thumb.bytesPerPixel;
|
|
||||||
#else
|
|
||||||
header.size = sizeof(header) + thumb.w*thumb.h*thumb.bytesPerPixel;
|
|
||||||
#endif
|
|
||||||
header.version = THMB_VERSION;
|
header.version = THMB_VERSION;
|
||||||
header.width = thumb.w;
|
header.width = thumb.w;
|
||||||
header.height = thumb.h;
|
header.height = thumb.h;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue