From 4aa66fa5aa337c7aef7d20013f776168042d45f0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 6 Jun 2011 10:41:20 +0200 Subject: PSP: Make logMessage() implementation independent from parent class(es) --- backends/platform/psp/osys_psp.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 01124b420e..8c8180d04e 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -20,8 +20,7 @@ * */ -// Allow use of stuff in -#define FORBIDDEN_SYMBOL_EXCEPTION_time_h +#define FORBIDDEN_SYMBOL_ALLOW_ALL #include #include @@ -422,7 +421,15 @@ void OSystem_PSP::quit() { } void OSystem_PSP::logMessage(LogMessageType::Type type, const char *message) { - EventsBaseBackend::logMessage(type, message); + FILE *output = 0; + + if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) + output = stdout; + else + output = stderr; + + fputs(message, output); + fflush(output); if (type == LogMessageType::kError) PspDebugTrace(false, "%s", message); // write to file -- cgit v1.2.3 From 50896e6029076c6c5087cb2d3a918f7545b47008 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 6 Jun 2011 10:43:48 +0200 Subject: WII: Add logMessage() implementation --- backends/platform/wii/osystem.cpp | 18 +++++++++++++----- backends/platform/wii/osystem.h | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp index c6b23783b8..258a782cc4 100644 --- a/backends/platform/wii/osystem.cpp +++ b/backends/platform/wii/osystem.cpp @@ -19,11 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -// Allow use of stuff in -#define FORBIDDEN_SYMBOL_EXCEPTION_time_h - -#define FORBIDDEN_SYMBOL_EXCEPTION_printf -#define FORBIDDEN_SYMBOL_EXCEPTION_getcwd +#define FORBIDDEN_SYMBOL_ALLOW_ALL #include @@ -291,6 +287,18 @@ void OSystem_Wii::showOptionsDialog() { _padAcceleration = 9 - ConfMan.getInt("wii_pad_acceleration"); } +void OSystem_Wii::logMessage(LogMessageType::Type type, const char *message) { + FILE *output = 0; + + if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) + output = stdout; + else + output = stderr; + + fputs(message, output); + fflush(output); +} + #ifndef GAMECUBE Common::String OSystem_Wii::getSystemLanguage() const { const char *wiiCountries[] = { diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index 6863a6840e..64197f913a 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -211,6 +211,8 @@ public: virtual FilesystemFactory *getFilesystemFactory(); virtual void getTimeAndDate(TimeDate &t) const; + virtual void logMessage(LogMessageType::Type type, const char *message); + #ifndef GAMECUBE virtual Common::String getSystemLanguage() const; #endif // GAMECUBE -- cgit v1.2.3 From c06ddf2e57ac7247c6a944212f6aea923c03364c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 6 Jun 2011 10:58:06 +0200 Subject: IPHONE: Add logMessage() implementation --- backends/platform/iphone/osys_main.cpp | 12 ++++++++++++ backends/platform/iphone/osys_main.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp index 9325ed50bf..4bc567c39d 100644 --- a/backends/platform/iphone/osys_main.cpp +++ b/backends/platform/iphone/osys_main.cpp @@ -242,6 +242,18 @@ void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priorit } } +void OSystem_IPHONE::logMessage(LogMessageType::Type type, const char *message) { + FILE *output = 0; + + if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) + output = stdout; + else + output = stderr; + + fputs(message, output); + fflush(output); +} + void iphone_main(int argc, char *argv[]) { //OSystem_IPHONE::migrateApp(); diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index 14325f8090..37896cceeb 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -180,6 +180,8 @@ public: virtual Common::String getDefaultConfigFileName(); + virtual void logMessage(LogMessageType::Type type, const char *message); + protected: void internUpdateScreen(); void dirtyFullScreen(); -- cgit v1.2.3 From 263e23bd810a87bf76023948923a5bb7c203ac2c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 6 Jun 2011 10:58:23 +0200 Subject: N64: Add logMessage() implementation --- backends/platform/n64/osys_n64.h | 1 + backends/platform/n64/osys_n64_base.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h index dfa8f58cce..285e2afa55 100644 --- a/backends/platform/n64/osys_n64.h +++ b/backends/platform/n64/osys_n64.h @@ -199,6 +199,7 @@ public: virtual Audio::Mixer *getMixer(); virtual void getTimeAndDate(TimeDate &t) const; virtual void setTimerCallback(TimerProc callback, int interval); + virtual void logMessage(LogMessageType::Type type, const char *message); void rebuildOffscreenGameBuffer(void); void rebuildOffscreenMouseBuffer(void); diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp index 69e8da3526..4bc3780fe2 100644 --- a/backends/platform/n64/osys_n64_base.cpp +++ b/backends/platform/n64/osys_n64_base.cpp @@ -870,6 +870,18 @@ void OSystem_N64::getTimeAndDate(TimeDate &t) const { return; } +void OSystem_N64::logMessage(LogMessageType::Type type, const char *message) { + FILE *output = 0; + + if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) + output = stdout; + else + output = stderr; + + fputs(message, output); + fflush(output); +} + void OSystem_N64::setTimerCallback(TimerProc callback, int interval) { assert (interval > 0); -- cgit v1.2.3 From 7607a077fe589c2cdbdd587ba4c6285f1134c422 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 6 Jun 2011 10:59:23 +0200 Subject: NULL: Add logMessage() implementation --- backends/platform/null/null.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp index 106cde1699..4690a67c55 100644 --- a/backends/platform/null/null.cpp +++ b/backends/platform/null/null.cpp @@ -52,6 +52,8 @@ public: virtual uint32 getMillis(); virtual void delayMillis(uint msecs); virtual void getTimeAndDate(TimeDate &t) const {} + + virtual void logMessage(LogMessageType::Type type, const char *message); }; OSystem_NULL::OSystem_NULL() { @@ -97,6 +99,18 @@ uint32 OSystem_NULL::getMillis() { void OSystem_NULL::delayMillis(uint msecs) { } +void OSystem_NULL::logMessage(LogMessageType::Type type, const char *message) { + FILE *output = 0; + + if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) + output = stdout; + else + output = stderr; + + fputs(message, output); + fflush(output); +} + OSystem *OSystem_NULL_create() { return new OSystem_NULL(); } -- cgit v1.2.3 From 3599d0708709b9f434c96b9922024a8b87361fb0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 6 Jun 2011 11:25:46 +0200 Subject: SDL: Make logMessage() implementation independent from parent class(es) --- backends/platform/sdl/sdl.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index fd27c82797..e36878db07 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -275,10 +275,22 @@ void OSystem_SDL::fatalError() { void OSystem_SDL::logMessage(LogMessageType::Type type, const char *message) { - ModularBackend::logMessage(type, message); + // First log to stdout/stderr + FILE *output = 0; + + if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) + output = stdout; + else + output = stderr; + + fputs(message, output); + fflush(output); + + // 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]; -- cgit v1.2.3 From f7c1e7d002c21eeaf0b5c06d3527ede532f5cd51 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 6 Jun 2011 11:05:23 +0200 Subject: COMMON: Remove default implementation of OSystem::logMessage --- common/system.cpp | 19 ------------------- common/system.h | 2 +- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/common/system.cpp b/common/system.cpp index fae7a3ef34..1645a6be10 100644 --- a/common/system.cpp +++ b/common/system.cpp @@ -21,11 +21,6 @@ */ #define FORBIDDEN_SYMBOL_EXCEPTION_exit -#define FORBIDDEN_SYMBOL_EXCEPTION_FILE -#define FORBIDDEN_SYMBOL_EXCEPTION_fputs -#define FORBIDDEN_SYMBOL_EXCEPTION_fflush -#define FORBIDDEN_SYMBOL_EXCEPTION_stdout -#define FORBIDDEN_SYMBOL_EXCEPTION_stderr #include "common/system.h" #include "common/events.h" @@ -136,20 +131,6 @@ Common::String OSystem::getDefaultConfigFileName() { return "scummvm.ini"; } -void OSystem::logMessage(LogMessageType::Type type, const char *message) { -#if !defined(__PLAYSTATION2__) && !defined(__DS__) - FILE *output = 0; - - if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) - output = stdout; - else - output = stderr; - - fputs(message, output); - fflush(output); -#endif -} - Common::String OSystem::getSystemLanguage() const { return "en_US"; } diff --git a/common/system.h b/common/system.h index d26bc593aa..3e740ff0c1 100644 --- a/common/system.h +++ b/common/system.h @@ -1101,7 +1101,7 @@ public: * @param type the type of the message * @param message the message itself */ - virtual void logMessage(LogMessageType::Type type, const char *message); + virtual void logMessage(LogMessageType::Type type, const char *message) = 0; /** * Open the log file in a way that allows the user to review it, -- cgit v1.2.3