diff options
author | Travis Howell | 2005-04-14 06:06:59 +0000 |
---|---|---|
committer | Travis Howell | 2005-04-14 06:06:59 +0000 |
commit | a3882f3af779c5b5726b24734fc74a702f199be4 (patch) | |
tree | dd6fe0e6a03f4a8e55201aa2aeb9e2592ac9d4e0 /scumm/resource_v7he.cpp | |
parent | 50bf840b9fad86724863e0c323fc3e0d873e9acb (diff) | |
download | scummvm-rg350-a3882f3af779c5b5726b24734fc74a702f199be4.tar.gz scummvm-rg350-a3882f3af779c5b5726b24734fc74a702f199be4.tar.bz2 scummvm-rg350-a3882f3af779c5b5726b24734fc74a702f199be4.zip |
Add HE7.2 difference in o_getResourceSize().
Add support for checking size of music resource.
svn-id: r17595
Diffstat (limited to 'scumm/resource_v7he.cpp')
-rw-r--r-- | scumm/resource_v7he.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/scumm/resource_v7he.cpp b/scumm/resource_v7he.cpp index 52e92518b5..4b6eab74d6 100644 --- a/scumm/resource_v7he.cpp +++ b/scumm/resource_v7he.cpp @@ -1753,4 +1753,58 @@ byte *ScummEngine_v72he::getStringAddress(int i) { return ((ScummEngine_v72he::ArrayHeader *)addr)->data; } +int ScummEngine_v72he::getMusicResourceSize(int id) { + int size, total_size; + uint tracks, skip; + char buf[32], buf1[128]; + File musicFile; + + sprintf(buf, "%s.he4", getGameName()); + + if (_substResFileNameIndex > 0) { + generateSubstResFileName(buf, buf1, sizeof(buf1)); + strcpy(buf, buf1); + } + if (musicFile.open(buf) == false) { + warning("getMusicResourceSize: Music file is not open"); + return 0; + } + musicFile.seek(4, SEEK_SET); + total_size = musicFile.readUint32BE(); + musicFile.seek(+8, SEEK_CUR); + tracks = musicFile.readUint32LE(); + + skip = 0; + if (id >= 8500) + skip = (id - 8500); + else if (id >= 8000) + skip = (id - 8000); + else if (id >= 4000) + skip = (id - 4000); + + if (skip > tracks - 1) + skip = 0; + + if (_heversion >= 80) { + // Skip to offsets + musicFile.seek(+40, SEEK_CUR); + + // Skip to correct music header + skip *= 21; + } else { + // Skip to offsets + musicFile.seek(+4, SEEK_CUR); + + // Skip to correct music header + skip *= 25; + } + + musicFile.seek(+skip, SEEK_CUR); + musicFile.readUint32LE(); + size = musicFile.readUint32LE(); + musicFile.close(); + + return size; +} + } // End of namespace Scumm |