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
This commit is contained in:
parent
411866ee18
commit
e1030e53a5
11 changed files with 143 additions and 107 deletions
|
@ -23,8 +23,27 @@
|
|||
*
|
||||
*/
|
||||
|
||||
// Disable symbol overrides so that we can use system headers.
|
||||
// FIXME: Necessary for the PS2 port, should get rid of this eventually.
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
#ifdef __PLAYSTATION2__
|
||||
// for those replaced fopen/fread/etc functions
|
||||
#include "backends/platform/ps2/fileio.h"
|
||||
|
||||
#define fputs(str, file) ps2_fputs(str, file)
|
||||
#define fflush(a) ps2_fflush(a)
|
||||
#endif
|
||||
|
||||
#ifdef __DS__
|
||||
#include "backends/fs/ds/ds-fs.h"
|
||||
|
||||
#define fputs(str, file) DS::std_fwrite(str, strlen(str), 1, file)
|
||||
#define fflush(file) DS::std_fflush(file)
|
||||
#endif
|
||||
|
||||
OSystem *g_system = 0;
|
||||
|
||||
OSystem::OSystem() {
|
||||
|
@ -53,3 +72,21 @@ bool OSystem::setGraphicsMode(const char *name) {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
void OSystem::fatalError() {
|
||||
quit();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void OSystem::logMessage(LogMessageType::Type type, const char *message) {
|
||||
FILE *output = 0;
|
||||
|
||||
if (type == LogMessageType::kDebug)
|
||||
output = stdout;
|
||||
else
|
||||
output = stderr;
|
||||
|
||||
fputs(message, output);
|
||||
fflush(output);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue