mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 09:56:30 +00:00
SCI: stopping scripts from sending to unused channels manually (fixes sq1vga)
svn-id: r50060
This commit is contained in:
parent
24459b5842
commit
089f5bba14
@ -144,6 +144,20 @@ void MidiParser_SCI::unloadMusic() {
|
||||
}
|
||||
}
|
||||
|
||||
// this is used for scripts sending direct midi commands to us. we verify in that case that the channel is actually
|
||||
// used
|
||||
void MidiParser_SCI::sendManuallyToDriver(uint32 b) {
|
||||
byte midiChannel = b & 0xf;
|
||||
|
||||
if (!_channelUsed[midiChannel]) {
|
||||
// scripts trying to send to unused channel
|
||||
// this happens at least in sq1vga right at the start, it's a script issue
|
||||
return;
|
||||
}
|
||||
|
||||
sendToDriver(b);
|
||||
}
|
||||
|
||||
void MidiParser_SCI::sendToDriver(uint32 b) {
|
||||
byte midiChannel = b & 0xf;
|
||||
|
||||
@ -161,11 +175,7 @@ void MidiParser_SCI::sendToDriver(uint32 b) {
|
||||
return;
|
||||
// Channel remapping
|
||||
int16 realChannel = _channelRemap[midiChannel];
|
||||
if (realChannel == -1) {
|
||||
// FIXME: Happens in SQ1VGA when the game starts
|
||||
warning("Attempt to send to uninitialized channel %d", midiChannel);
|
||||
return;
|
||||
}
|
||||
assert(realChannel != -1);
|
||||
|
||||
b = (b & 0xFFFFFFF0) | realChannel;
|
||||
_driver->send(b);
|
||||
|
@ -80,6 +80,7 @@ public:
|
||||
void sendToDriver(byte status, byte firstOp, byte secondOp) {
|
||||
sendToDriver(status | ((uint32)firstOp << 8) | ((uint32)secondOp << 16));
|
||||
}
|
||||
void sendManuallyToDriver(uint32 b);
|
||||
|
||||
protected:
|
||||
void parseNextEvent(EventInfo &info);
|
||||
|
@ -463,7 +463,7 @@ void SciMusic::sendMidiCommand(uint32 cmd) {
|
||||
|
||||
void SciMusic::sendMidiCommand(MusicEntry *pSnd, uint32 cmd) {
|
||||
if (pSnd->pMidiParser)
|
||||
pSnd->pMidiParser->sendToDriver(cmd);
|
||||
pSnd->pMidiParser->sendManuallyToDriver(cmd);
|
||||
else
|
||||
error("tried to cmdSendMidi on non midi slot (%04x:%04x)", PRINT_REG(pSnd->soundObj));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user