endian fix for save games (including code for backward compatibility so that old BE games will still load)

svn-id: r4571
This commit is contained in:
Max Horn 2002-07-16 15:25:22 +00:00
parent b019de6872
commit 8951ea0cd1

View File

@ -62,7 +62,7 @@ bool Scumm::saveState(int slot, bool compat)
hdr.type = MKID('SCVM');
hdr.size = 0;
hdr.ver = _current_version;
hdr.ver = TO_LE_32(_current_version);
out.fwrite(&hdr, sizeof(hdr), 1);
@ -95,7 +95,10 @@ bool Scumm::loadState(int slot, bool compat)
return false;
}
if (hdr.ver < VER_V7 || hdr.ver > _current_version) {
if (hdr.ver < VER_V7 || hdr.ver > _current_version)
hdr.ver = TO_LE_32(hdr.ver);
if (hdr.ver < VER_V7 || hdr.ver > _current_version)
{
warning("Invalid version of '%s'", filename);
out.fclose();
return false;
@ -210,6 +213,8 @@ bool Scumm::getSavegameName(int slot, char *desc)
return false;
}
if (hdr.ver < VER_V7 || hdr.ver > _current_version)
hdr.ver = TO_LE_32(hdr.ver);
if (hdr.ver < VER_V7 || hdr.ver > _current_version) {
strcpy(desc, "Invalid version");
return false;