WIN32: Move Windows-specific implementation of logMessage out of OSystem_SDL
This commit is contained in:
parent
e1c83f8e87
commit
ada05fd726
5 changed files with 30 additions and 27 deletions
|
@ -22,12 +22,6 @@
|
||||||
|
|
||||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL
|
#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 "backends/platform/sdl/sdl.h"
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
#include "gui/EventRecorder.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)
|
// Then log into file (via the logger)
|
||||||
if (_logger)
|
if (_logger)
|
||||||
_logger->print(message);
|
_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 {
|
Common::String OSystem_SDL::getSystemLanguage() const {
|
||||||
|
|
|
@ -150,6 +150,14 @@ bool OSystem_Win32::openUrl(const Common::String &url) {
|
||||||
return true;
|
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 {
|
Common::String OSystem_Win32::getSystemLanguage() const {
|
||||||
#if defined(USE_DETECTLANG) && defined(USE_TRANSLATION)
|
#if defined(USE_DETECTLANG) && defined(USE_TRANSLATION)
|
||||||
// We can not use "setlocale" (at least not for MSVC builds), since it
|
// We can not use "setlocale" (at least not for MSVC builds), since it
|
||||||
|
|
|
@ -38,6 +38,8 @@ public:
|
||||||
|
|
||||||
virtual bool openUrl(const Common::String &url);
|
virtual bool openUrl(const Common::String &url);
|
||||||
|
|
||||||
|
virtual void logMessage(LogMessageType::Type type, const char *message);
|
||||||
|
|
||||||
virtual Common::String getSystemLanguage() const;
|
virtual Common::String getSystemLanguage() const;
|
||||||
|
|
||||||
virtual Common::String getScreenshotsPath();
|
virtual Common::String getScreenshotsPath();
|
||||||
|
|
|
@ -623,6 +623,25 @@ void OSystem_WINCE3::getTimeAndDate(TimeDate &t) const {
|
||||||
t.tm_wday = systime.wDayOfWeek;
|
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 {
|
Common::String OSystem_WINCE3::getSystemLanguage() const {
|
||||||
#ifdef USE_DETECTLANG
|
#ifdef USE_DETECTLANG
|
||||||
// We can not use "setlocale" (at least not for MSVC builds), since it
|
// We can not use "setlocale" (at least not for MSVC builds), since it
|
||||||
|
|
|
@ -54,6 +54,7 @@ public:
|
||||||
// Overloaded from SDL backend
|
// Overloaded from SDL backend
|
||||||
void init();
|
void init();
|
||||||
void quit();
|
void quit();
|
||||||
|
virtual void logMessage(LogMessageType::Type type, const char *message);
|
||||||
virtual Common::String getSystemLanguage() const;
|
virtual Common::String getSystemLanguage() const;
|
||||||
|
|
||||||
// Overloaded from OSystem
|
// Overloaded from OSystem
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue