aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl
diff options
context:
space:
mode:
authorJohannes Schickel2010-11-18 19:12:14 +0000
committerJohannes Schickel2010-11-18 19:12:14 +0000
commite1030e53a537677c234ad39de419fb97b88a37b7 (patch)
treeefa0f61d219a9de5299567c92f80662a7e5fb272 /backends/platform/sdl
parent411866ee1881d248400da25f1889ad872ed54ee3 (diff)
downloadscummvm-rg350-e1030e53a537677c234ad39de419fb97b88a37b7.tar.gz
scummvm-rg350-e1030e53a537677c234ad39de419fb97b88a37b7.tar.bz2
scummvm-rg350-e1030e53a537677c234ad39de419fb97b88a37b7.zip
BACKENDS: Implement logging API proposed by Max on -devel.
This commits a slightly modified patch from my patch tracker item #3104630 "OSYSTEM: Add logging API as proposed by Max on -devel". I was not able to test compilation on Android and SamsungTV, since there is no toolchain for those on buildbot (or I was too blind to find them). svn-id: r54339
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r--backends/platform/sdl/sdl.cpp24
-rw-r--r--backends/platform/sdl/sdl.h3
2 files changed, 27 insertions, 0 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 2e3819f6f5..8a139e5c1b 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -562,6 +562,30 @@ void OSystem_SDL::quit() {
#endif
}
+void OSystem_SDL::logMessage(LogMessageType::Type type, const char *message) {
+ BaseBackend::logMessage(type, message);
+
+#if defined( USE_WINDBG )
+#if defined( _WIN32_WCE )
+ TCHAR buf_unicode[1024];
+ MultiByteToWideChar(CP_ACP, 0, message, strlen(message) + 1, buf_unicode, sizeof(buf_unicode));
+ OutputDebugString(buf_unicode);
+
+ if (type == LogMessageType::kError) {
+#ifndef DEBUG
+ drawError(message);
+#else
+ int cmon_break_into_the_debugger_if_you_please = *(int *)(message + 1); // bus error
+ printf("%d", cmon_break_into_the_debugger_if_you_please); // don't optimize the int out
+#endif
+ }
+
+#else
+ OutputDebugString(message);
+#endif
+#endif
+}
+
void OSystem_SDL::setupIcon() {
int x, y, w, h, ncols, nbytes, i;
unsigned int rgba[256];
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index b701824517..328bb03426 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -191,6 +191,9 @@ public:
// Quit
virtual void quit(); // overloaded by CE backend
+ // Logging
+ virtual void logMessage(LogMessageType::Type type, const char *message);
+
void deinit();
virtual void getTimeAndDate(TimeDate &t) const;