aboutsummaryrefslogtreecommitdiff
path: root/scumm/resource_v7he.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scumm/resource_v7he.cpp')
-rw-r--r--scumm/resource_v7he.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/scumm/resource_v7he.cpp b/scumm/resource_v7he.cpp
index 52e92518b5..d5a2a1bc8f 100644
--- a/scumm/resource_v7he.cpp
+++ b/scumm/resource_v7he.cpp
@@ -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