Adjust again, for sound header differences.

svn-id: r17668
This commit is contained in:
Travis Howell 2005-04-18 11:44:01 +00:00
parent 8d01148b79
commit d391c2f837
5 changed files with 34 additions and 33 deletions

View file

@ -812,6 +812,7 @@ protected:
byte *heFindResource(uint32 tag, byte *ptr);
byte *findWrappedBlock(uint32 tag, byte *ptr, int state, bool flagError);
int findObject(int x, int y, int num, int *args);
int getSoundResourceSize(int id);
/* HE version 72 script opcodes */
void o72_pushDWord();

View file

@ -28,6 +28,7 @@
#include "scumm/intern.h"
#include "scumm/resource.h"
#include "scumm/resource_v7he.h"
#include "scumm/sound.h"
#include "scumm/util.h"
#include "common/stream.h"
@ -1753,4 +1754,32 @@ byte *ScummEngine_v72he::getStringAddress(int i) {
return ((ScummEngine_v72he::ArrayHeader *)addr)->data;
}
int ScummEngine_v72he::getSoundResourceSize(int id) {
const byte *ptr;
int offs, size;
if (id > _numSounds) {
_sound->getHEMusicDetails(id, offs, size);
} else {
ptr = getResourceAddress(rtSound, id);
if (!ptr)
return 0;
if (READ_UINT32(ptr) == MKID('HSHD')) {
ptr += READ_BE_UINT32(ptr + 4);
} else {
ptr += 8 + READ_BE_UINT32(ptr + 12);
}
if (READ_UINT32(ptr) == MKID('SBNG')) {
ptr += READ_BE_UINT32(ptr + 4);
}
assert(READ_UINT32(ptr) == MKID('SDAT'));
size = READ_BE_UINT32(ptr + 4) - 8;
}
return size;
}
} // End of namespace Scumm

View file

@ -2211,16 +2211,7 @@ void ScummEngine_v100he::o100_getResourceSize() {
type = rtScript;
break;
case 72:
if (resid > _numSounds) {
int offs;
_sound->getHEMusicDetails(resid, offs, size);
push(size);
} else {
ptr = getResourceAddress(rtSound, resid);
assert(ptr);
size = READ_BE_UINT32(ptr + 4) - 40;
push(size);
}
push (getSoundResourceSize(resid));
return;
default:
error("o100_getResourceSize: default type %d", subOp);

View file

@ -2156,19 +2156,8 @@ void ScummEngine_v72he::o72_writeINI() {
}
void ScummEngine_v72he::o72_getResourceSize() {
int resid, size;
resid = pop();
if (resid > _numSounds) {
int offs;
_sound->getHEMusicDetails(resid, offs, size);
push(size);
} else {
const byte *ptr = getResourceAddress(rtSound, resid);
assert(ptr);
size = READ_BE_UINT32(ptr + 4) - 40;
push(size);
}
int resid = pop();
push(getSoundResourceSize(resid));
}
void ScummEngine_v72he::o72_setFilePath() {

View file

@ -814,16 +814,7 @@ void ScummEngine_v80he::o80_getResourceSize() {
switch (subOp) {
case 13:
if (resid > _numSounds) {
int offs;
_sound->getHEMusicDetails(resid, offs, size);
push(size);
} else {
ptr = getResourceAddress(rtSound, resid);
assert(ptr);
size = READ_BE_UINT32(ptr + 4) - 40;
push(size);
}
push (getSoundResourceSize(resid));
return;
case 14:
type = rtRoomImage;