diff options
author | Yotam Barnoy | 2010-06-21 13:58:51 +0000 |
---|---|---|
committer | Yotam Barnoy | 2010-06-21 13:58:51 +0000 |
commit | b5a25a6e1988c11929fe68cc9e5786bf738b21ce (patch) | |
tree | a9d83d6d3dc5f44c3257d6f25fdcdf45052fda40 /backends/platform | |
parent | 57b8e2caaabebde88eb46d0d85d3c09414cdc778 (diff) | |
download | scummvm-rg350-b5a25a6e1988c11929fe68cc9e5786bf738b21ce.tar.gz scummvm-rg350-b5a25a6e1988c11929fe68cc9e5786bf738b21ce.tar.bz2 scummvm-rg350-b5a25a6e1988c11929fe68cc9e5786bf738b21ce.zip |
PSP: errors from both ScummVM and the PSP port now print to file by default. This should make debugging easier, especially for users.
svn-id: r50113
Diffstat (limited to 'backends/platform')
-rw-r--r-- | backends/platform/psp/mp3.cpp | 2 | ||||
-rw-r--r-- | backends/platform/psp/trace.cpp | 11 | ||||
-rw-r--r-- | backends/platform/psp/trace.h | 6 |
3 files changed, 12 insertions, 7 deletions
diff --git a/backends/platform/psp/mp3.cpp b/backends/platform/psp/mp3.cpp index eab8670280..e25891396b 100644 --- a/backends/platform/psp/mp3.cpp +++ b/backends/platform/psp/mp3.cpp @@ -319,7 +319,7 @@ void Mp3PspStream::decodeMP3Data() { // This function blocks. We'll want to put it in a thread int ret = sceAudiocodecDecode(_codecParams, 0x1002); if (ret < 0) { - PSP_ERROR("failed to decode MP3 data in ME. sceAudiocodecDecode returned 0x%x\n", ret); + PSP_INFO_PRINT("failed to decode MP3 data in ME. sceAudiocodecDecode returned 0x%x\n", ret); // handle error here } diff --git a/backends/platform/psp/trace.cpp b/backends/platform/psp/trace.cpp index 4bf5450177..7bac6534da 100644 --- a/backends/platform/psp/trace.cpp +++ b/backends/platform/psp/trace.cpp @@ -30,8 +30,9 @@ #include <stdio.h> int psp_debug_indent = 0; +bool firstWriteToFile = true; -void PSPDebugTrace(bool alsoToScreen, const char *format, ...) { +void PspDebugTrace(bool alsoToScreen, const char *format, ...) { va_list opt; char buffer[2048]; int bufsz; @@ -41,8 +42,12 @@ void PSPDebugTrace(bool alsoToScreen, const char *format, ...) { bufsz = vsnprintf(buffer, (size_t) sizeof(buffer), format, opt); va_end(opt); - //fd = fopen("MS0:/SCUMMTRACE.TXT", "ab"); - fd = fopen("SCUMMTRACE.TXT", "ab"); + if (firstWriteToFile) { + fd = fopen("SCUMMTRACE.TXT", "wb"); // erase the file the first time we write + firstWriteToFile = false; + } else { + fd = fopen("SCUMMTRACE.TXT", "ab"); + } if (fd == 0) return; diff --git a/backends/platform/psp/trace.h b/backends/platform/psp/trace.h index 1aad0f6781..ade8fd7214 100644 --- a/backends/platform/psp/trace.h +++ b/backends/platform/psp/trace.h @@ -39,8 +39,8 @@ #define __PSP_PRINT__(format,...) fprintf(stderr, format, ## __VA_ARGS__) #endif /* PSP_PRINT_TO_FILE/SCREEN */ -/* Error function */ -#define PSP_ERROR(format,...) __PSP_PRINT__("Error in %s: " format, __PRETTY_FUNCTION__, ## __VA_ARGS__) +/* Error function - always print to file as well */ +#define PSP_ERROR(format,...) PspDebugTrace(true, "Error in %s: " format, __PRETTY_FUNCTION__, ## __VA_ARGS__) /* Do the indent */ #define __PSP_INDENT__ for(int _i=psp_debug_indent; _i>0; _i--) \ @@ -52,7 +52,7 @@ #define PSP_INFO_PRINT_INDENT(format,...) { __PSP_INDENT__; \ __PSP_PRINT__(format, ## __VA_ARGS__); } -void PSPDebugTrace(bool alsoToScreen, const char *format, ...); +void PspDebugTrace(bool alsoToScreen, const char *format, ...); extern int psp_debug_indent; |