[Scummvm-cvs-logs] SF.net SVN: scummvm:[50113] scummvm/trunk
Bluddy at users.sourceforge.net
Bluddy at users.sourceforge.net
Mon Jun 21 15:58:51 CEST 2010
Revision: 50113
http://scummvm.svn.sourceforge.net/scummvm/?rev=50113&view=rev
Author: Bluddy
Date: 2010-06-21 13:58:51 +0000 (Mon, 21 Jun 2010)
Log Message:
-----------
PSP: errors from both ScummVM and the PSP port now print to file by default. This should make debugging easier, especially for users.
Modified Paths:
--------------
scummvm/trunk/backends/platform/psp/mp3.cpp
scummvm/trunk/backends/platform/psp/trace.cpp
scummvm/trunk/backends/platform/psp/trace.h
scummvm/trunk/common/textconsole.cpp
Modified: scummvm/trunk/backends/platform/psp/mp3.cpp
===================================================================
--- scummvm/trunk/backends/platform/psp/mp3.cpp 2010-06-21 13:23:13 UTC (rev 50112)
+++ scummvm/trunk/backends/platform/psp/mp3.cpp 2010-06-21 13:58:51 UTC (rev 50113)
@@ -319,7 +319,7 @@
// 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
}
Modified: scummvm/trunk/backends/platform/psp/trace.cpp
===================================================================
--- scummvm/trunk/backends/platform/psp/trace.cpp 2010-06-21 13:23:13 UTC (rev 50112)
+++ scummvm/trunk/backends/platform/psp/trace.cpp 2010-06-21 13:58:51 UTC (rev 50113)
@@ -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 @@
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;
Modified: scummvm/trunk/backends/platform/psp/trace.h
===================================================================
--- scummvm/trunk/backends/platform/psp/trace.h 2010-06-21 13:23:13 UTC (rev 50112)
+++ scummvm/trunk/backends/platform/psp/trace.h 2010-06-21 13:58:51 UTC (rev 50113)
@@ -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;
Modified: scummvm/trunk/common/textconsole.cpp
===================================================================
--- scummvm/trunk/common/textconsole.cpp 2010-06-21 13:23:13 UTC (rev 50112)
+++ scummvm/trunk/common/textconsole.cpp 2010-06-21 13:58:51 UTC (rev 50113)
@@ -47,6 +47,10 @@
#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 @@
#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();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list