mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-03 08:40:59 +00:00
HE demos sometimes call music tracks that don't exist.
svn-id: r18080
This commit is contained in:
parent
d987a58529
commit
739e0640ad
@ -1760,7 +1760,10 @@ int ScummEngine_v72he::getSoundResourceSize(int id) {
|
||||
int offs, size;
|
||||
|
||||
if (id > _numSounds) {
|
||||
_sound->getHEMusicDetails(id, offs, size);
|
||||
if (!_sound->getHEMusicDetails(id, offs, size)) {
|
||||
debug(0, "getSoundResourceSize: musicID %d not found", id);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
ptr = getResourceAddress(rtSound, id);
|
||||
if (!ptr)
|
||||
|
@ -202,18 +202,18 @@ void Sound::setupHEMusicFile() {
|
||||
musicFile.close();
|
||||
}
|
||||
|
||||
void Sound::getHEMusicDetails(int id, int &musicOffs, int &musicSize) {
|
||||
bool Sound::getHEMusicDetails(int id, int &musicOffs, int &musicSize) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < _heMusicTracks; i++) {
|
||||
if (_heMusic[i].id == id) {
|
||||
musicOffs = _heMusic[i].offset;
|
||||
musicSize = _heMusic[i].size;
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
error("getHEMusicDetails: musicID %d not found", id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) {
|
||||
@ -250,8 +250,11 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) {
|
||||
warning("playSound: Can't open music file %s", buf);
|
||||
return;
|
||||
}
|
||||
if (!getHEMusicDetails(soundID, music_offs, size)) {
|
||||
debug(0, "playSound: musicID %d not found", soundID);
|
||||
return;
|
||||
}
|
||||
|
||||
getHEMusicDetails(soundID, music_offs, size);
|
||||
musicFile.seek(music_offs, SEEK_SET);
|
||||
ptr = (byte *)malloc(size);
|
||||
musicFile.read(ptr, size);
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
int getCurrentCDSound() const { return _currentCDSound; }
|
||||
|
||||
void setupHEMusicFile();
|
||||
void getHEMusicDetails(int id, int &musicOffs, int &musicSize);
|
||||
bool getHEMusicDetails(int id, int &musicOffs, int &musicSize);
|
||||
|
||||
// Used by the save/load system:
|
||||
const SaveLoadEntry *getSaveLoadEntries();
|
||||
|
Loading…
x
Reference in New Issue
Block a user