aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorPaweł Kołodziejski2004-01-09 20:20:01 +0000
committerPaweł Kołodziejski2004-01-09 20:20:01 +0000
commit25854050deb1a7780c545946753b66fec3f64c66 (patch)
tree555191b67d7894af0fdd57ac00b90502eddef720 /scumm
parent06caf87bdcf27cf40f25351c0a264ca9c602aca8 (diff)
downloadscummvm-rg350-25854050deb1a7780c545946753b66fec3f64c66.tar.gz
scummvm-rg350-25854050deb1a7780c545946753b66fec3f64c66.tar.bz2
scummvm-rg350-25854050deb1a7780c545946753b66fec3f64c66.zip
added loading Sync datas
svn-id: r12283
Diffstat (limited to 'scumm')
-rw-r--r--scumm/imuse_digi/dimuse_sndmgr.cpp14
-rw-r--r--scumm/imuse_digi/dimuse_sndmgr.h8
2 files changed, 21 insertions, 1 deletions
diff --git a/scumm/imuse_digi/dimuse_sndmgr.cpp b/scumm/imuse_digi/dimuse_sndmgr.cpp
index b6fd9dcd9a..43e68004bb 100644
--- a/scumm/imuse_digi/dimuse_sndmgr.cpp
+++ b/scumm/imuse_digi/dimuse_sndmgr.cpp
@@ -116,7 +116,17 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, int slot) {
_sounds[slot].numJumps++;
break;
case MKID_BE('SYNC'):
- size = READ_BE_UINT32(ptr); ptr += size + 4;
+ size = READ_BE_UINT32(ptr); ptr += 4;
+ if (_sounds[slot].numSyncs >= MAX_IMUSE_SYNCS) {
+ warning("ImuseDigiSndMgr::prepareSound(%d/%s) Not enough space for Sync", _sounds[slot].soundId, _sounds[slot].name);
+ ptr += size;
+ break;
+ }
+ _sounds[slot].sync[_sounds[slot].numSyncs].size = size;
+ _sounds[slot].sync[_sounds[slot].numSyncs].ptr = (byte *)malloc(size);
+ memcpy(_sounds[slot].sync[_sounds[slot].numSyncs].ptr, ptr, size);
+ _sounds[slot].numSyncs++;
+ ptr += size;
break;
case MKID_BE('DATA'):
size = READ_BE_UINT32(ptr); ptr += 4;
@@ -271,6 +281,8 @@ void ImuseDigiSndMgr::closeSound(soundStruct *soundHandle) {
free(_sounds[l].resPtr);
if (_sounds[l]._bundle)
delete _sounds[l]._bundle;
+ for (int r = 0; r < _sounds[l].numSyncs; r++)
+ free(_sounds[l].sync[r].ptr);
memset(&_sounds[l], 0, sizeof(soundStruct));
}
}
diff --git a/scumm/imuse_digi/dimuse_sndmgr.h b/scumm/imuse_digi/dimuse_sndmgr.h
index d53eefbb52..02000eb77c 100644
--- a/scumm/imuse_digi/dimuse_sndmgr.h
+++ b/scumm/imuse_digi/dimuse_sndmgr.h
@@ -38,6 +38,7 @@ public:
#define MAX_IMUSE_JUMPS 80
#define MAX_IMUSE_REGIONS 85
#define MAX_IMUSE_MARKERS 60
+#define MAX_IMUSE_SYNCS 4
#define IMUSE_RESOURCE 1
#define IMUSE_BUNDLE 2
@@ -61,6 +62,11 @@ private:
struct _marker {
char name[256]; // name of marker
};
+
+ struct _sync {
+ int32 size; // size of sync
+ byte *ptr; // pointer to sync
+ };
public:
@@ -71,6 +77,7 @@ public:
int numJumps; // number of Jumps
int numRegions; // number of Regions
int numMarkers; // number of Markers
+ int numSyncs; // number of Syncs
int32 offsetStop; // end offset in source data
bool endFlag;
bool inUse;
@@ -84,6 +91,7 @@ public:
_region region[MAX_IMUSE_REGIONS];
_marker marker[MAX_IMUSE_MARKERS];
_jump jump[MAX_IMUSE_JUMPS];
+ _sync sync[MAX_IMUSE_SYNCS];
};
private: