Two changes here:
1) Consolidated the Loggers so that we only have one in JGE. Added a helper constructor/destructor to the JLogger class so that you can instantiate one at the top of a function, it'll trace out a 'start' and 'end' message when it goes in & out of scope. 2) Fixed the crash part of a bug I've been chasing down where, on the psp, after saturating the cache, the game dies when trying to reload the background PNG image of the deck menu. We still need to fix the root cause of the failure (not enough memory to allocate a temporary buffer for the swizzle operation), but at least the psp doesn't lock up anymore. I've also left behind all the log traces I inserted into the LoadPNG code, since we'll probably need them again.
This commit is contained in:
38
JGE/include/DebugRoutines.h
Normal file
38
JGE/include/DebugRoutines.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef DEBUGROUTINES_H
|
||||
#define DEBUGROUTINES_H
|
||||
|
||||
// dirty, but I get OS header includes this way
|
||||
#include "JGE.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
#ifdef _DEBUG
|
||||
|
||||
#ifndef QT_CONFIG
|
||||
#define DebugTrace(inString) \
|
||||
{ \
|
||||
std::ostringstream stream; \
|
||||
stream << inString << std::endl; \
|
||||
OutputDebugString(stream.str().c_str()); \
|
||||
}
|
||||
#else
|
||||
#define DebugTrace(inString) \
|
||||
{ \
|
||||
std::ostringstream stream; \
|
||||
stream << inString << std::endl; \
|
||||
qDebug(stream.str().c_str()); \
|
||||
}
|
||||
#endif //QT_CONFIG
|
||||
|
||||
#endif //#ifdef _DEBUG
|
||||
#endif // Win32, Linux
|
||||
|
||||
#ifndef DebugTrace
|
||||
#define DebugTrace(inString) (void (0))
|
||||
#endif
|
||||
|
||||
#endif // DEBUGROUTINES_H
|
||||
@@ -1,19 +1,27 @@
|
||||
#ifndef _JLOGGER_H_
|
||||
#define _JLOGGER_H_
|
||||
//logging facility
|
||||
//#define DOJLOG
|
||||
//#define DOLOG
|
||||
|
||||
#ifdef DOJLOG
|
||||
#define JLOG(x) JLogger::Log(x);
|
||||
#ifdef DOLOG
|
||||
#define LOG(x) JLogger::Log(x);
|
||||
#else
|
||||
#define JLOG(x) {};
|
||||
#define LOG(x) {};
|
||||
#endif
|
||||
|
||||
#define JGE_LOG_FILE "jge_debug.txt"
|
||||
// saving myself the pain of search/replace
|
||||
#define JLOG(x) LOG(x)
|
||||
|
||||
#define LOG_FILE "debug.txt"
|
||||
|
||||
class JLogger{
|
||||
public:
|
||||
static void Log(const char * text);
|
||||
|
||||
JLogger(const char* text);
|
||||
~JLogger();
|
||||
|
||||
const char* mText;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user