From e7e92a7577fcaadd4d63483a41ab2a71d913c3d6 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 27 Dec 2010 14:02:17 +0000 Subject: SCUMM: Fix bug #3143039 - ACTIVITY: Circus Stormin' crash. svn-id: r55049 --- engines/scumm/script_v6.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index 0226343df5..e0a6528670 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -381,15 +381,17 @@ ScummEngine_v6::ArrayHeader *ScummEngine_v6::getArray(int array) { if (!ah) return 0; - // Workaround for a long standing bug where we saved array headers in native - // endianness, instead of a fixed endianness. We now always store the - // dimensions in little endian byte order. But to stay compatible with older - // savegames, we try to detect savegames which were created on a big endian - // system and convert them to the proper little endian format on the fly. - if ((FROM_LE_16(ah->dim1) & 0xF000) || (FROM_LE_16(ah->dim2) & 0xF000) || (FROM_LE_16(ah->type) & 0xFF00)) { - SWAP16(ah->dim1); - SWAP16(ah->dim2); - SWAP16(ah->type); + if (_game.heversion == 0) { + // Workaround for a long standing bug where we saved array headers in native + // endianness, instead of a fixed endianness. We now always store the + // dimensions in little endian byte order. But to stay compatible with older + // savegames, we try to detect savegames which were created on a big endian + // system and convert them to the proper little endian format on the fly. + if ((FROM_LE_16(ah->dim1) & 0xF000) || (FROM_LE_16(ah->dim2) & 0xF000) || (FROM_LE_16(ah->type) & 0xFF00)) { + SWAP16(ah->dim1); + SWAP16(ah->dim2); + SWAP16(ah->type); + } } return ah; -- cgit v1.2.3