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
This commit is contained in:
Yotam Barnoy 2010-06-21 13:58:51 +00:00
parent 57b8e2caaa
commit b5a25a6e19
4 changed files with 21 additions and 7 deletions

View File

@ -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
}

View File

@ -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;

View File

@ -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;

View File

@ -47,6 +47,10 @@ extern bool isSmartphone();
#include <android/log.h>
#endif
#ifdef __PSP__
#include "backends/platform/psp/trace.h"
#endif
namespace Common {
static OutputFormatter s_errorOutputFormatter = 0;
@ -159,6 +163,11 @@ void NORETURN_PRE error(const char *s, ...) {
#ifdef __SYMBIAN32__
Symbian::FatalError(buf_output);
#endif
#ifdef __PSP__
PspDebugTrace(false, "%s", buf_output); // write to file
#endif
// Finally exit. quit() will terminate the program if g_system is present
if (g_system)
g_system->quit();