Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 7058daaed164934ba66a6554235e8b23a9ccf110 1 parent 89bbc9c
@bluegr bluegr authored
Showing with 2 additions and 46 deletions.
  1. +2 −46 audio/softsynth/mt32.cpp
View
48 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 @@ friend class Synth;
// 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 @@ class MidiDriver_MT32 : public MidiDriver_Emulated {
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");

1 comment on commit 7058daa

@bluegr
Collaborator

Forgot to say, thanks to LordHoto for pointing out the bad usage of OSystem here, as well as pointing me to the documentation in the code regarding this

Please sign in to comment.
Something went wrong with that request. Please try again.