aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/platform/psp/mp3.cpp2
-rw-r--r--backends/platform/psp/trace.cpp11
-rw-r--r--backends/platform/psp/trace.h6
-rw-r--r--common/textconsole.cpp9
4 files changed, 21 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;
diff --git a/common/textconsole.cpp b/common/textconsole.cpp
index 87ba55ebf1..2e5a347489 100644
--- a/common/textconsole.cpp
+++ b/common/textconsole.cpp
@@ -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();