diff options
author | Yotam Barnoy | 2010-04-12 06:49:05 +0000 |
---|---|---|
committer | Yotam Barnoy | 2010-04-12 06:49:05 +0000 |
commit | 9a2eac7eee8fbe6a903e842cb257d96bd57f8702 (patch) | |
tree | ae70ab3fd6ae5253504045c4dece684f64844e1c /backends/platform/psp/trace.cpp | |
parent | 18609a70b3b10c25efdd09b12af21aacc299baa1 (diff) | |
download | scummvm-rg350-9a2eac7eee8fbe6a903e842cb257d96bd57f8702.tar.gz scummvm-rg350-9a2eac7eee8fbe6a903e842cb257d96bd57f8702.tar.bz2 scummvm-rg350-9a2eac7eee8fbe6a903e842cb257d96bd57f8702.zip |
PSP: refactoring/redesign of the backend
svn-id: r48632
Diffstat (limited to 'backends/platform/psp/trace.cpp')
-rw-r--r-- | backends/platform/psp/trace.cpp | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/backends/platform/psp/trace.cpp b/backends/platform/psp/trace.cpp index 28696c30a6..030dafdf1d 100644 --- a/backends/platform/psp/trace.cpp +++ b/backends/platform/psp/trace.cpp @@ -23,47 +23,33 @@ * */ +#define TRACE_C +#include <pspkernel.h> +#include <pspdebug.h> +#include "backends/platform/psp/trace.h" -#include "./trace.h" +int psp_debug_indent = 0; - -void PSPDebugTrace (const char *format, ...) { -#ifdef __PSP_DEBUG__ - va_list opt; - char buff[2048]; - int bufsz, fd; - - va_start(opt, format); - bufsz = vsnprintf( buff, (size_t) sizeof(buff), format, opt); - va_end(opt); - - fd = sceIoOpen("MS0:/DTRACE.TXT", PSP_O_RDWR | PSP_O_CREAT | PSP_O_APPEND, 0777); - - if (fd <= 0) - return; - - sceIoWrite(fd, (const void*)buff, bufsz); - sceIoClose(fd); -#endif /* __PSP_DEBUG__ */ -} - -void PSPDebugTrace (const char * filename, const char *format, ...) { -#ifdef __PSP_DEBUG__ +void PSPDebugTrace (bool alsoToScreen, const char *format, ...) { va_list opt; - char buff[2048]; - int bufsz, fd; + char buffer[2048]; + int bufsz; + FILE *fd = 0; va_start(opt, format); - bufsz = vsnprintf( buff, (size_t) sizeof(buff), format, opt); + bufsz = vsnprintf( buffer, (size_t) sizeof(buffer), format, opt); va_end(opt); - fd = sceIoOpen(filename, PSP_O_RDWR | PSP_O_CREAT | PSP_O_APPEND, 0777); - - if (fd <= 0) + //fd = fopen("MS0:/SCUMMTRACE.TXT", "ab"); + fd = fopen("SCUMMTRACE.TXT", "ab"); + + if (fd == 0) return; - sceIoWrite(fd, (const void*)buff, bufsz); - sceIoClose(fd); -#endif /* __PSP_DEBUG__ */ + fwrite(buffer, 1, bufsz, fd); + fclose(fd); + + if (alsoToScreen) + fprintf(stderr, buffer); } |