mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-13 15:40:57 +00:00
TSAGE: Bugfixes for extracting sound data properties
This commit is contained in:
parent
941fc4b1d5
commit
c5cbfc4ac2
@ -33,8 +33,12 @@ SoundManager::SoundManager() {
|
||||
_minVersion = 0x102;
|
||||
_maxVersion = 0x10A;
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
for (int i = 0; i < SOUND_ARR_SIZE; ++i) {
|
||||
_field89[i] = 0;
|
||||
_groupList[i] = 0;
|
||||
_fieldE9[i] = 0;
|
||||
_field109[i] = 0;
|
||||
}
|
||||
|
||||
_groupMask = 0;
|
||||
_volume = 127;
|
||||
@ -85,12 +89,12 @@ void SoundManager::listenerSynchronize(Serializer &s) {
|
||||
}
|
||||
|
||||
void SoundManager::checkResVersion(const byte *soundData) {
|
||||
int minVersion = READ_LE_UINT16(soundData + 4);
|
||||
int maxVersion = READ_LE_UINT16(soundData + 6);
|
||||
int maxVersion = READ_LE_UINT16(soundData + 4);
|
||||
int minVersion = READ_LE_UINT16(soundData + 6);
|
||||
|
||||
if (_globals->_soundManager._minVersion >= maxVersion)
|
||||
if (_globals->_soundManager._minVersion < minVersion)
|
||||
error("Attempt to play/prime sound resource that is too new");
|
||||
if (_globals->_soundManager._minVersion > minVersion)
|
||||
if (_globals->_soundManager._minVersion > maxVersion)
|
||||
error("Attempt to play/prime sound resource that is too old");
|
||||
}
|
||||
|
||||
@ -211,7 +215,7 @@ int SoundManager::_sfDetermineGroup(const byte *soundData) {
|
||||
if ((v & _globals->_soundManager._groupMask) == v)
|
||||
return v;
|
||||
|
||||
p = soundData + 6 + (READ_LE_UINT16(p + 4) * 4);
|
||||
p += 6 + (READ_LE_UINT16(p + 4) * 4);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -295,7 +299,7 @@ void SoundManager::_sfExtractTrackInfo(trackInfoStruct *trackInfo, const byte *s
|
||||
}
|
||||
}
|
||||
|
||||
p = soundData + 6 + (READ_LE_UINT16(p + 4) * 4);
|
||||
p += 6 + (READ_LE_UINT16(p + 4) * 4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,6 +307,14 @@ void SoundManager::_sfTerminate() {
|
||||
|
||||
}
|
||||
|
||||
void SoundManager::_sfExtractGroupMask() {
|
||||
uint32 mask = 0;
|
||||
for (int idx = 0; idx < SOUND_ARR_SIZE; ++idx)
|
||||
mask |= _globals->_soundManager._groupList[idx];
|
||||
|
||||
_globals->_soundManager._groupMask = mask;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Sound::Sound() {
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
bool __sndmgrReady;
|
||||
int _minVersion, _maxVersion;
|
||||
Common::List<Sound *> _playList;
|
||||
int _field109[16];
|
||||
int _field109[SOUND_ARR_SIZE];
|
||||
uint32 _groupMask;
|
||||
int _volume;
|
||||
int _disableCtr;
|
||||
@ -72,9 +72,9 @@ public:
|
||||
Common::List<SoundDriverEntry> _driverList;
|
||||
|
||||
Common::List<SoundDriver *> _installedDrivers;
|
||||
int _field89[16];
|
||||
int _fieldA9[16];
|
||||
int _fieldE9[16];
|
||||
int _field89[SOUND_ARR_SIZE];
|
||||
uint16 _groupList[SOUND_ARR_SIZE];
|
||||
int _fieldE9[SOUND_ARR_SIZE];
|
||||
|
||||
int _field16D;
|
||||
public:
|
||||
@ -129,6 +129,7 @@ public:
|
||||
static void _sfUpdateLoop(Sound *sound);
|
||||
static void _sfSetMasterVol(int volume);
|
||||
static void _sfExtractTrackInfo(trackInfoStruct *trackInfo, const byte *soundData, int groupNum);
|
||||
static void _sfExtractGroupMask();
|
||||
};
|
||||
|
||||
class Sound: public EventHandler {
|
||||
|
Loading…
x
Reference in New Issue
Block a user