diff options
author | Filippos Karapetis | 2013-01-06 22:24:27 +0200 |
---|---|---|
committer | Filippos Karapetis | 2013-01-06 22:24:27 +0200 |
commit | 7058daaed164934ba66a6554235e8b23a9ccf110 (patch) | |
tree | 0ec6eb2d3623e9dd3218401b2b0cc7847002f1b5 | |
parent | 89bbc9c292ea3dd91ed1660cd8f775c4b4fad0f0 (diff) | |
download | scummvm-rg350-7058daaed164934ba66a6554235e8b23a9ccf110.tar.gz scummvm-rg350-7058daaed164934ba66a6554235e8b23a9ccf110.tar.bz2 scummvm-rg350-7058daaed164934ba66a6554235e8b23a9ccf110.zip |
MT32: Remove the screen drawing code of the MUNT debug messages (bug #3599702)
The MUNT debug messages are called from an audio callback, which is not allowed to
update the screen, as per the OSystem documentation in common/system.h:401
-rw-r--r-- | audio/softsynth/mt32.cpp | 48 |
1 files changed, 2 insertions, 46 deletions
diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp index 38cdaf1c3c..6813363fd5 100644 --- a/audio/softsynth/mt32.cpp +++ b/audio/softsynth/mt32.cpp @@ -50,8 +50,6 @@ #include "gui/message.h" -static void drawMessage(int offset, const Common::String &text); - namespace MT32Emu { class ReportHandlerScummVM : public ReportHandler { @@ -64,16 +62,7 @@ protected: // Callback for debug messages, in vprintf() format void printDebug(const char *fmt, va_list list) { - // Only show MUNT debug messages for debug level 4 and above - if (gDebugLevel < 4) - return; - - char buf[512]; - - vsnprintf(buf, 512, fmt, list); - buf[70] = 0; // Truncate to a reasonable length - - drawMessage(1, buf); + debug(4, fmt, list); } // Callbacks for reporting various errors and information @@ -144,39 +133,6 @@ public: int getRate() const { return _outputRate; } }; -static void drawMessage(int offset, const Common::String &text) { - const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kGUIFont)); - Graphics::Surface *screen = g_system->lockScreen(); - - assert(screen); - assert(screen->pixels); - - Graphics::PixelFormat screenFormat = g_system->getScreenFormat(); - - uint16 h = font.getFontHeight(); - uint16 y = g_system->getHeight() / 2 - h / 2 + offset * (h + 1); - - uint32 col; - - if (screenFormat.bytesPerPixel > 1) - col = screenFormat.RGBToColor(0, 0, 0); - else - col = 0; - - Common::Rect r(0, y, screen->w, y + h); - screen->fillRect(r, col); - - if (screenFormat.bytesPerPixel > 1) - col = screenFormat.RGBToColor(0, 171, 0); - else - col = 1; - - font.drawString(screen, text, 0, y, screen->w, col, Graphics::kTextAlignCenter); - - g_system->unlockScreen(); - g_system->updateScreen(); -} - //////////////////////////////////////// // // MidiDriver_MT32 @@ -246,7 +202,7 @@ int MidiDriver_MT32::open() { } _initializing = true; - drawMessage(-1, _s("Initializing MT-32 Emulator")); + debug(4, _s("Initializing MT-32 Emulator")); _controlFile = new Common::File(); if (!_controlFile->open("MT32_CONTROL.ROM")) error("Error opening MT32_CONTROL.ROM"); |