From bf293fface3d2eaf62466dca675c65118f347248 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Fri, 25 Nov 2016 22:03:30 -0600 Subject: SCI: Fix non-responsive application warning during sysex transfers This also fixes the display of the startup LCD message, which had been delayed until after the sysex transfer was finished. --- engines/sci/sci.cpp | 13 +++++++++---- engines/sci/sound/drivers/midi.cpp | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 1e3ab2ae34..d725e36a5a 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -317,10 +317,6 @@ Common::Error SciEngine::run() { // Must be called after game_init(), as they use _features _kernel->loadKernelNames(_features); - _soundCmd = new SoundCommandParser(_resMan, segMan, _kernel, _audio, _features->detectDoSoundType()); - - syncSoundSettings(); - syncIngameAudioOptions(); // Load our Mac executable here for icon bar palettes and high-res fonts loadMacExecutable(); @@ -328,6 +324,15 @@ Common::Error SciEngine::run() { // Initialize all graphics related subsystems initGraphics(); + // Sound must be initialized after graphics because SysEx transfers at the + // start of the game must pump the event loop to avoid making the OS think + // that ScummVM is hanged, and pumping the event loop requires GfxCursor to + // be initialized + _soundCmd = new SoundCommandParser(_resMan, segMan, _kernel, _audio, _features->detectDoSoundType()); + + syncSoundSettings(); + syncIngameAudioOptions(); + // Patch in our save/restore code, so that dialogs are replaced patchGameSaveRestore(); setLauncherLanguage(); diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp index 5e82e4a729..badbe663ca 100644 --- a/engines/sci/sound/drivers/midi.cpp +++ b/engines/sci/sound/drivers/midi.cpp @@ -1053,7 +1053,7 @@ int MidiPlayer_Midi::open(ResourceManager *resMan) { void MidiPlayer_Midi::close() { if (_isMt32) { // Send goodbye message - sendMt32SysEx(0x200000, _goodbyeMsg, 20); + sendMt32SysEx(0x200000, _goodbyeMsg, 20, true); } _driver->close(); @@ -1069,8 +1069,8 @@ void MidiPlayer_Midi::sysEx(const byte *msg, uint16 length) { if (_isMt32) delay += 40; - g_system->delayMillis(delay); g_system->updateScreen(); + g_sci->sleep(delay); } byte MidiPlayer_Midi::getPlayId() const { -- cgit v1.2.3