aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorCameron Cawley2018-05-27 22:24:55 +0100
committerThierry Crozat2018-06-03 17:43:30 +0100
commitada05fd726f5e02a79f2de457241b614e33c7745 (patch)
tree61012ee3986407f8a31b4a31ae1db3728fac67d9 /backends/platform
parente1c83f8e8707abb268b3536c2993bcdd9dfee25e (diff)
downloadscummvm-rg350-ada05fd726f5e02a79f2de457241b614e33c7745.tar.gz
scummvm-rg350-ada05fd726f5e02a79f2de457241b614e33c7745.tar.bz2
scummvm-rg350-ada05fd726f5e02a79f2de457241b614e33c7745.zip
WIN32: Move Windows-specific implementation of logMessage out of OSystem_SDL
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/sdl/sdl.cpp27
-rw-r--r--backends/platform/sdl/win32/win32.cpp8
-rw-r--r--backends/platform/sdl/win32/win32.h2
-rw-r--r--backends/platform/wince/wince-sdl.cpp19
-rw-r--r--backends/platform/wince/wince-sdl.h1
5 files changed, 30 insertions, 27 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index f9affa0a1c..63f1e97337 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -22,12 +22,6 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL
-#ifdef WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef ARRAYSIZE // winnt.h defines ARRAYSIZE, but we want our own one...
-#endif
-
#include "backends/platform/sdl/sdl.h"
#include "common/config-manager.h"
#include "gui/EventRecorder.h"
@@ -412,27 +406,6 @@ void OSystem_SDL::logMessage(LogMessageType::Type type, const char *message) {
// Then log into file (via the logger)
if (_logger)
_logger->print(message);
-
- // Finally, some Windows / WinCE specific logging code.
-#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
}
Common::String OSystem_SDL::getSystemLanguage() const {
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index f262ff090b..bcaa6e4d7b 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -150,6 +150,14 @@ bool OSystem_Win32::openUrl(const Common::String &url) {
return true;
}
+void OSystem_Win32::logMessage(LogMessageType::Type type, const char *message) {
+ OSystem_SDL::logMessage(type, message);
+
+#if defined( USE_WINDBG )
+ OutputDebugString(message);
+#endif
+}
+
Common::String OSystem_Win32::getSystemLanguage() const {
#if defined(USE_DETECTLANG) && defined(USE_TRANSLATION)
// We can not use "setlocale" (at least not for MSVC builds), since it
diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h
index 8523345d3c..bee160f0a0 100644
--- a/backends/platform/sdl/win32/win32.h
+++ b/backends/platform/sdl/win32/win32.h
@@ -38,6 +38,8 @@ public:
virtual bool openUrl(const Common::String &url);
+ virtual void logMessage(LogMessageType::Type type, const char *message);
+
virtual Common::String getSystemLanguage() const;
virtual Common::String getScreenshotsPath();
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index 02853b548e..f03068f6e3 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -623,6 +623,25 @@ void OSystem_WINCE3::getTimeAndDate(TimeDate &t) const {
t.tm_wday = systime.wDayOfWeek;
}
+void OSystem_WINCE3::logMessage(LogMessageType::Type type, const char *message) {
+ OSystem_SDL::logMessage(type, message);
+
+#if defined( USE_WINDBG )
+ 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
+ }
+#endif
+}
+
Common::String OSystem_WINCE3::getSystemLanguage() const {
#ifdef USE_DETECTLANG
// We can not use "setlocale" (at least not for MSVC builds), since it
diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h
index 2d5a02a23d..1fbdbde9cb 100644
--- a/backends/platform/wince/wince-sdl.h
+++ b/backends/platform/wince/wince-sdl.h
@@ -54,6 +54,7 @@ public:
// Overloaded from SDL backend
void init();
void quit();
+ virtual void logMessage(LogMessageType::Type type, const char *message);
virtual Common::String getSystemLanguage() const;
// Overloaded from OSystem