Sound size should only include sound data.

svn-id: r17667
This commit is contained in:
Travis Howell 2005-04-18 11:19:54 +00:00
parent 769b2fed46
commit 8d01148b79
3 changed files with 23 additions and 21 deletions

View File

@ -2191,6 +2191,7 @@ void ScummEngine_v100he::o100_writeFile() {
} }
void ScummEngine_v100he::o100_getResourceSize() { void ScummEngine_v100he::o100_getResourceSize() {
const byte *ptr;
int size, type; int size, type;
int resid = pop(); int resid = pop();
@ -2214,15 +2215,18 @@ void ScummEngine_v100he::o100_getResourceSize() {
int offs; int offs;
_sound->getHEMusicDetails(resid, offs, size); _sound->getHEMusicDetails(resid, offs, size);
push(size); push(size);
return; } else {
ptr = getResourceAddress(rtSound, resid);
assert(ptr);
size = READ_BE_UINT32(ptr + 4) - 40;
push(size);
} }
type = rtSound; return;
break;
default: default:
error("o100_getResourceSize: default type %d", subOp); error("o100_getResourceSize: default type %d", subOp);
} }
const byte *ptr = getResourceAddress(type, resid); ptr = getResourceAddress(type, resid);
assert(ptr); assert(ptr);
size = READ_BE_UINT32(ptr + 4) - 8; size = READ_BE_UINT32(ptr + 4) - 8;
push(size); push(size);

View File

@ -2163,13 +2163,12 @@ void ScummEngine_v72he::o72_getResourceSize() {
int offs; int offs;
_sound->getHEMusicDetails(resid, offs, size); _sound->getHEMusicDetails(resid, offs, size);
push(size); push(size);
return; } else {
const byte *ptr = getResourceAddress(rtSound, resid);
assert(ptr);
size = READ_BE_UINT32(ptr + 4) - 40;
push(size);
} }
const byte *ptr = getResourceAddress(rtSound, resid);
assert(ptr);
size = getResourceDataSize(ptr);
push(size);
} }
void ScummEngine_v72he::o72_setFilePath() { void ScummEngine_v72he::o72_setFilePath() {

View File

@ -806,6 +806,7 @@ void ScummEngine_v80he::o80_pickVarRandom() {
} }
void ScummEngine_v80he::o80_getResourceSize() { void ScummEngine_v80he::o80_getResourceSize() {
const byte *ptr;
int size, type; int size, type;
int resid = pop(); int resid = pop();
@ -817,10 +818,13 @@ void ScummEngine_v80he::o80_getResourceSize() {
int offs; int offs;
_sound->getHEMusicDetails(resid, offs, size); _sound->getHEMusicDetails(resid, offs, size);
push(size); push(size);
return; } else {
ptr = getResourceAddress(rtSound, resid);
assert(ptr);
size = READ_BE_UINT32(ptr + 4) - 40;
push(size);
} }
type = rtSound; return;
break;
case 14: case 14:
type = rtRoomImage; type = rtRoomImage;
break; break;
@ -837,14 +841,9 @@ void ScummEngine_v80he::o80_getResourceSize() {
error("o80_getResourceSize: default type %d", subOp); error("o80_getResourceSize: default type %d", subOp);
} }
const byte *ptr = getResourceAddress(type, resid); ptr = getResourceAddress(type, resid);
if (ptr) { assert(ptr);
size = getResourceDataSize(ptr); size = READ_BE_UINT32(ptr + 4) - 8;
} else {
debug(0, "o80_getResourceSize: invalid resource type %d id %d", type, resid);
size = 0;
}
push(size); push(size);
} }