mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-17 07:07:10 +00:00
Aargh, my work around code was using a wrong check, and then using the wrong operations (which were effectively not doing anything)... Fixed the workaround code, which cures bug #918280 (and its dup #1003717)
svn-id: r14467
This commit is contained in:
parent
c6dcbd8eca
commit
b569d58b6e
@ -483,6 +483,8 @@ int ScummEngine_v6::findFreeArrayId() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
#define SWAP16(x) x = SWAP_BYTES_16(x)
|
||||
|
||||
ArrayHeader *ScummEngine_v6::getArray(int array) {
|
||||
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array));
|
||||
if (!ah)
|
||||
@ -492,10 +494,10 @@ ArrayHeader *ScummEngine_v6::getArray(int array) {
|
||||
// endianness, instead of a fixed endianness. We try to detect savegames
|
||||
// which were created on a big endian system and convert them to little
|
||||
// endian.
|
||||
if ((ah->dim1 & 0xF000) || (ah->dim2 & 0xF000) || (ah->type & 0xFF00)) {
|
||||
SWAP_BYTES_16(ah->dim1);
|
||||
SWAP_BYTES_16(ah->dim2);
|
||||
SWAP_BYTES_16(ah->type);
|
||||
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;
|
||||
@ -519,7 +521,6 @@ int ScummEngine_v6::readArray(int array, int idx, int base) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const int offset = base + idx * FROM_LE_16(ah->dim1);
|
||||
|
||||
if (offset < 0 || offset >= FROM_LE_16(ah->dim1) * FROM_LE_16(ah->dim2)) {
|
||||
|
Loading…
Reference in New Issue
Block a user