Fixed some log messages

Fixed a crash when no game ini exists


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2690 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-03-20 15:01:49 +00:00
parent ed70ca6d48
commit ad76edd157
9 changed files with 40 additions and 44 deletions

View File

@ -74,7 +74,7 @@ const Section* IniFile::GetSection(const char* sectionName) const
Section* IniFile::GetSection(const char* sectionName) Section* IniFile::GetSection(const char* sectionName)
{ {
for (std::vector<Section>::iterator iter = sections.begin(); iter != sections.end(); ++iter) for (std::vector<Section>::iterator iter = sections.begin(); iter != sections.end(); ++iter)
if (!strcmp(iter->name.c_str(), sectionName)) if (!strcasecmp(iter->name.c_str(), sectionName))
return (&(*iter)); return (&(*iter));
return 0; return 0;
} }
@ -171,10 +171,10 @@ std::string* IniFile::GetLine(Section* section, const char* key, std::string* va
return 0; return 0;
} }
bool IniFile::Exists(const char* sectionName, const char* key) bool IniFile::Exists(const char* const sectionName, const char* key) const
{ {
const Section* section = GetSection(sectionName); const Section* const section = GetSection(sectionName);
if (!section) if (!section)
return false; return false;

View File

@ -58,7 +58,7 @@ public:
void SetLines(const char* sectionName, const std::vector<std::string> &lines); void SetLines(const char* sectionName, const std::vector<std::string> &lines);
// Returns true if exists key in section // Returns true if exists key in section
bool Exists(const char* sectionName, const char* key); bool Exists(const char* sectionName, const char* key) const;
// getter should be const // getter should be const
bool Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue = ""); bool Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue = "");

View File

@ -17,6 +17,7 @@
#include "Setup.h" #include "Setup.h"
#include "Thread.h" #include "Thread.h"
#include "Log.h"
// ----------------------------------------- // -----------------------------------------
#ifdef SETUP_TIMER_WAITING #ifdef SETUP_TIMER_WAITING
// ----------------- // -----------------
@ -26,8 +27,6 @@
#endif #endif
// ------------------------ // ------------------------
#define THREAD_DEBUG 1
namespace Common namespace Common
{ {
#ifdef _WIN32 #ifdef _WIN32
@ -373,7 +372,7 @@ CriticalSection::~CriticalSection()
void CriticalSection::Enter() void CriticalSection::Enter()
{ {
int ret = pthread_mutex_lock(&mutex); int ret = pthread_mutex_lock(&mutex);
if (ret) fprintf(stderr, "%s: pthread_mutex_lock(%p) failed: %s\n", if (ret) ERROR_LOG(COMMON, "%s: pthread_mutex_lock(%p) failed: %s\n",
__FUNCTION__, &mutex, strerror(ret)); __FUNCTION__, &mutex, strerror(ret));
} }
@ -387,7 +386,7 @@ bool CriticalSection::TryEnter()
void CriticalSection::Leave() void CriticalSection::Leave()
{ {
int ret = pthread_mutex_unlock(&mutex); int ret = pthread_mutex_unlock(&mutex);
if (ret) fprintf(stderr, "%s: pthread_mutex_unlock(%p) failed: %s\n", if (ret) ERROR_LOG(COMMON, "%s: pthread_mutex_unlock(%p) failed: %s\n",
__FUNCTION__, &mutex, strerror(ret)); __FUNCTION__, &mutex, strerror(ret));
} }
@ -399,12 +398,10 @@ Thread::Thread(ThreadFunc function, void* arg)
pthread_attr_init(&attr); pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, 1024 * 1024); pthread_attr_setstacksize(&attr, 1024 * 1024);
int ret = pthread_create(&thread_id, &attr, function, arg); int ret = pthread_create(&thread_id, &attr, function, arg);
if (ret) fprintf(stderr, "%s: pthread_create(%p, %p, %p, %p) failed: %s\n", if (ret) ERROR_LOG(COMMON, "%s: pthread_create(%p, %p, %p, %p) failed: %s\n",
__FUNCTION__, &thread_id, &attr, function, arg, strerror(ret)); __FUNCTION__, &thread_id, &attr, function, arg, strerror(ret));
#ifdef THREAD_DEBUG INFO_LOG(COMMON, "created new thread %lu (func=%p, arg=%p)\n", thread_id, function, arg);
fprintf(stderr, "created new thread %lu (func=%p, arg=%p)\n", thread_id, function, arg);
#endif
} }
@ -420,9 +417,9 @@ void Thread::WaitForDeath()
{ {
void* exit_status; void* exit_status;
int ret = pthread_join(thread_id, &exit_status); int ret = pthread_join(thread_id, &exit_status);
if (ret) fprintf(stderr, "error joining thread %lu: %s\n", thread_id, strerror(ret)); if (ret) ERROR_LOG(COMMON, "error joining thread %lu: %s\n", thread_id, strerror(ret));
if (exit_status) if (exit_status)
fprintf(stderr, "thread %lu exited with status %d\n", thread_id, *(int *)exit_status); ERROR_LOG(COMMON, "thread %lu exited with status %d\n", thread_id, *(int *)exit_status);
thread_id = 0; thread_id = 0;
} }
} }
@ -480,9 +477,7 @@ void SleepCurrentThread(int ms)
void SetCurrentThreadName(const TCHAR* szThreadName) void SetCurrentThreadName(const TCHAR* szThreadName)
{ {
pthread_setspecific(threadname_key, strdup(szThreadName)); pthread_setspecific(threadname_key, strdup(szThreadName));
#ifdef THREAD_DEBUG INFO_LOG(COMMON, "%s(%s)\n", __FUNCTION__, szThreadName);
fprintf(stderr, "%s(%s)\n", __FUNCTION__, szThreadName);
#endif
} }

View File

@ -377,13 +377,13 @@ void Write16(const u16 _Value, const u32 _Address)
" - Anyway, fifo flush will be forced if you press OK and dolphin might continue to work...\n" " - Anyway, fifo flush will be forced if you press OK and dolphin might continue to work...\n"
" - We aren't betting on that :)", fifo.CPReadWriteDistance); " - We aren't betting on that :)", fifo.CPReadWriteDistance);
*/ */
WARN_LOG(COMMANDPROCESSOR, "*********************** GXSetGPFifo very soon? ***********************"); DEBUG_LOG(COMMANDPROCESSOR, "*********************** GXSetGPFifo very soon? ***********************");
u32 ct=0; u32 ct=0;
// (mb2) We don't sleep here since it could be a perf issue for super monkey ball (yup only this game IIRC) // (mb2) We don't sleep here since it could be a perf issue for super monkey ball (yup only this game IIRC)
// Touching that game is a no-go so I don't want to take the risk :p // Touching that game is a no-go so I don't want to take the risk :p
while (fifo.bFF_GPReadEnable && fifo.CPReadWriteDistance > 0 ) while (fifo.bFF_GPReadEnable && fifo.CPReadWriteDistance > 0 )
ct++; ct++;
if (ct) {WARN_LOG(COMMANDPROCESSOR, "(Write16): %lu cycles for nothing :[ ", ct);} if (ct) {INFO_LOG(COMMANDPROCESSOR, "(Write16): %lu cycles for nothing :[ ", ct);}
} }
} }

View File

@ -109,7 +109,7 @@ CWII_IPC_HLE_Device_FileIO::Open(u32 _CommandAddress, u32 _Mode)
} }
else else
{ {
ERROR_LOG(WII_IPC_FILEIO, " failed - File doesn't exist"); ERROR_LOG(WII_IPC_FILEIO, " FileIO failed open: %s - File doesn't exist", m_Filename.c_str());
ReturnValue = -106; ReturnValue = -106;
} }
@ -155,10 +155,9 @@ CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
// What should we return for Zelda, the new correct or old incorrect seek position? // What should we return for Zelda, the new correct or old incorrect seek position?
ReturnValue = SeekPosition; ReturnValue = SeekPosition;
} else { } else {
ERROR_LOG(WII_IPC_FILEIO, "FILEIO: Seek failed"); ERROR_LOG(WII_IPC_FILEIO, "FILEIO: Seek failed - %s", GetDeviceName().c_str());
} }
} else { } else {
ERROR_LOG(WII_IPC_FILEIO, "CWII_IPC_HLE_Device_FileIO unsupported seek mode %i", Mode);
PanicAlert("CWII_IPC_HLE_Device_FileIO unsupported seek mode %i", Mode); PanicAlert("CWII_IPC_HLE_Device_FileIO unsupported seek mode %i", Mode);
} }
@ -241,7 +240,6 @@ CWII_IPC_HLE_Device_FileIO::IOCtl(u32 _CommandAddress)
default: default:
{ {
ERROR_LOG(WII_IPC_FILEIO, "CWII_IPC_HLE_Device_FileIO: Parameter %i", Parameter);
PanicAlert("CWII_IPC_HLE_Device_FileIO: Parameter %i", Parameter); PanicAlert("CWII_IPC_HLE_Device_FileIO: Parameter %i", Parameter);
} }
break; break;

View File

@ -82,6 +82,9 @@ void Config::Load()
void Config::GameIniLoad() { void Config::GameIniLoad() {
IniFile *iniFile = ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.gameIni; IniFile *iniFile = ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.gameIni;
if (! iniFile)
return;
if (iniFile->Exists("Video", "ForceFiltering")) if (iniFile->Exists("Video", "ForceFiltering"))
iniFile->Get("Video", "ForceFiltering", &bForceFiltering, 0); iniFile->Get("Video", "ForceFiltering", &bForceFiltering, 0);

View File

@ -336,22 +336,22 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
}; };
if (!(hDC=GetDC(EmuWindow::GetWnd()))) { if (!(hDC=GetDC(EmuWindow::GetWnd()))) {
MessageBox(NULL,"(1) Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); PanicAlert("(1) Can't Create A GL Device Context.");
return false; return false;
} }
if (!(PixelFormat = ChoosePixelFormat(hDC,&pfd))) { if (!(PixelFormat = ChoosePixelFormat(hDC,&pfd))) {
MessageBox(NULL,"(2) Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); PanicAlert("(2) Can't Find A Suitable PixelFormat.");
return false; return false;
} }
if (!SetPixelFormat(hDC,PixelFormat,&pfd)) { if (!SetPixelFormat(hDC,PixelFormat,&pfd)) {
MessageBox(NULL,"(3) Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); PanicAlert("(3) Can't Set The PixelFormat.");
return false; return false;
} }
if (!(hRC = wglCreateContext(hDC))) { if (!(hRC = wglCreateContext(hDC))) {
MessageBox(NULL,"(4) Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); PanicAlert("(4) Can't Create A GL Rendering Context.");
return false; return false;
} }
// -------------------------------------- // --------------------------------------
@ -395,16 +395,16 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
} }
else { else {
GLWin.doubleBuffered = True; GLWin.doubleBuffered = True;
ERROR_LOG(VIDEO, "Got Doublebuffered Visual!\n"); NOTICE_LOG(VIDEO, "Got Doublebuffered Visual!\n");
} }
glXQueryVersion(GLWin.dpy, &glxMajorVersion, &glxMinorVersion); glXQueryVersion(GLWin.dpy, &glxMajorVersion, &glxMinorVersion);
ERROR_LOG(VIDEO, "glX-Version %d.%d\n", glxMajorVersion, glxMinorVersion); NOTICE_LOG(VIDEO, "glX-Version %d.%d\n", glxMajorVersion, glxMinorVersion);
/* create a GLX context */ /* create a GLX context */
GLWin.ctx = glXCreateContext(GLWin.dpy, vi, 0, GL_TRUE); GLWin.ctx = glXCreateContext(GLWin.dpy, vi, 0, GL_TRUE);
if(!GLWin.ctx) if(!GLWin.ctx)
{ {
ERROR_LOG(VIDEO, "Couldn't Create GLX context.Quit"); PanicAlert("Couldn't Create GLX context.Quit");
exit(0); // TODO: Don't bring down entire Emu exit(0); // TODO: Don't bring down entire Emu
} }
/* create a color map */ /* create a color map */
@ -426,7 +426,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
// set best mode to current // set best mode to current
bestMode = 0; bestMode = 0;
ERROR_LOG(VIDEO, "XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion); NOTICE_LOG(VIDEO, "XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion);
XF86VidModeGetAllModeLines(GLWin.dpy, GLWin.screen, &modeNum, &modes); XF86VidModeGetAllModeLines(GLWin.dpy, GLWin.screen, &modeNum, &modes);
if (modeNum > 0 && modes != NULL) { if (modeNum > 0 && modes != NULL) {
@ -443,7 +443,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
XF86VidModeSetViewPort(GLWin.dpy, GLWin.screen, 0, 0); XF86VidModeSetViewPort(GLWin.dpy, GLWin.screen, 0, 0);
dpyWidth = modes[bestMode]->hdisplay; dpyWidth = modes[bestMode]->hdisplay;
dpyHeight = modes[bestMode]->vdisplay; dpyHeight = modes[bestMode]->vdisplay;
ERROR_LOG(VIDEO, "Resolution %dx%d\n", dpyWidth, dpyHeight); NOTICE_LOG(VIDEO, "Resolution %dx%d\n", dpyWidth, dpyHeight);
XFree(modes); XFree(modes);
/* create a fullscreen window */ /* create a fullscreen window */
@ -528,7 +528,7 @@ bool OpenGL_MakeCurrent()
cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin); cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin);
#elif defined(_WIN32) #elif defined(_WIN32)
if (!wglMakeCurrent(hDC,hRC)) { if (!wglMakeCurrent(hDC,hRC)) {
MessageBox(NULL,"(5) Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); PanicAlert("(5) Can't Activate The GL Rendering Context.");
return false; return false;
} }
#elif defined(USE_WX) && USE_WX #elif defined(USE_WX) && USE_WX
@ -541,9 +541,9 @@ bool OpenGL_MakeCurrent()
glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx); glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y, XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth); &GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
ERROR_LOG(VIDEO, "GLWin Depth %d", GLWin.depth) NOTICE_LOG(VIDEO, "GLWin Depth %d", GLWin.depth)
if (glXIsDirect(GLWin.dpy, GLWin.ctx)) { if (glXIsDirect(GLWin.dpy, GLWin.ctx)) {
ERROR_LOG(VIDEO, "you have Direct Rendering!"); NOTICE_LOG(VIDEO, "detected direct rendering");
} else { } else {
ERROR_LOG(VIDEO, "no Direct Rendering possible!"); ERROR_LOG(VIDEO, "no Direct Rendering possible!");
} }
@ -708,7 +708,7 @@ void OpenGL_Shutdown()
if (!wglDeleteContext(hRC)) // Are We Able To Delete The RC? if (!wglDeleteContext(hRC)) // Are We Able To Delete The RC?
{ {
MessageBox(NULL,"Release Rendering Context Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); ERROR_LOG(VIDEO, "Release Rendering Context Failed.");
} }
hRC = NULL; // Set RC To NULL hRC = NULL; // Set RC To NULL
} }
@ -716,7 +716,7 @@ void OpenGL_Shutdown()
if (hDC && !ReleaseDC(EmuWindow::GetWnd(), hDC)) // Are We Able To Release The DC if (hDC && !ReleaseDC(EmuWindow::GetWnd(), hDC)) // Are We Able To Release The DC
{ {
#ifndef SETUP_TIMER_WAITING // This fails #ifndef SETUP_TIMER_WAITING // This fails
MessageBox(NULL,"Release Device Context Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); ERROR_LOG(VIDEO, "Release Device Context Failed.");
#endif #endif
hDC = NULL; // Set DC To NULL hDC = NULL; // Set DC To NULL
} }

View File

@ -63,7 +63,7 @@ void PixelShaderCache::Init()
int maxinst, maxattribs; int maxinst, maxattribs;
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&maxinst); glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&maxinst);
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, (GLint *)&maxattribs); glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, (GLint *)&maxattribs);
ERROR_LOG(VIDEO, "pixel max_alu=%d, max_inst=%d, max_attrib=%d\n", s_nMaxPixelInstructions, maxinst, maxattribs); INFO_LOG(VIDEO, "pixel max_alu=%d, max_inst=%d, max_attrib=%d\n", s_nMaxPixelInstructions, maxinst, maxattribs);
char pmatrixprog[1024]; char pmatrixprog[1024];
sprintf(pmatrixprog, "!!ARBfp1.0" sprintf(pmatrixprog, "!!ARBfp1.0"

View File

@ -41,11 +41,11 @@ X11Window::X11Window() : GLWindow() {
ERROR_LOG("Only Singlebuffered Visual!\n"); ERROR_LOG("Only Singlebuffered Visual!\n");
} else { } else {
doubleBuffered = True; doubleBuffered = True;
ERROR_LOG("Got Doublebuffered Visual!\n"); NOTICE_LOG("Got Doublebuffered Visual!\n");
} }
glXQueryVersion(dpy, &glxMajorVersion, &glxMinorVersion); glXQueryVersion(dpy, &glxMajorVersion, &glxMinorVersion);
ERROR_LOG("glX-Version %d.%d\n", glxMajorVersion, glxMinorVersion); NOTICE_LOG("glX-Version %d.%d\n", glxMajorVersion, glxMinorVersion);
/* create a GLX context */ /* create a GLX context */
ctx = glXCreateContext(dpy, vi, 0, GL_TRUE); ctx = glXCreateContext(dpy, vi, 0, GL_TRUE);
if(!ctx) { if(!ctx) {
@ -72,7 +72,7 @@ X11Window::X11Window() : GLWindow() {
// set best mode to current // set best mode to current
bestMode = 0; bestMode = 0;
ERROR_LOG("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion); NOTICE_LOG("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion);
XF86VidModeGetAllModeLines(dpy, screen, &modeNum, &modes); XF86VidModeGetAllModeLines(dpy, screen, &modeNum, &modes);
if (modeNum > 0 && modes != NULL) { if (modeNum > 0 && modes != NULL) {
@ -90,7 +90,7 @@ X11Window::X11Window() : GLWindow() {
XF86VidModeSetViewPort(dpy, screen, 0, 0); XF86VidModeSetViewPort(dpy, screen, 0, 0);
dpyWidth = modes[bestMode]->hdisplay; dpyWidth = modes[bestMode]->hdisplay;
dpyHeight = modes[bestMode]->vdisplay; dpyHeight = modes[bestMode]->vdisplay;
ERROR_LOG("Resolution %dx%d\n", dpyWidth, dpyHeight); NOTICE_LOG("Resolution %dx%d\n", dpyWidth, dpyHeight);
XFree(modes); XFree(modes);
/* create a fullscreen window */ /* create a fullscreen window */
@ -264,11 +264,11 @@ bool X11Window::MakeCurrent() {
XGetGeometry(dpy, win, &winDummy, &x, &y, XGetGeometry(dpy, win, &winDummy, &x, &y,
&w, &h, &borderDummy, &depth); &w, &h, &borderDummy, &depth);
ERROR_LOG("GLWin Depth %d", depth); NOTICE_LOG("GLWin Depth %d", depth);
if (glXIsDirect(dpy, ctx)) { if (glXIsDirect(dpy, ctx)) {
ERROR_LOG("you have Direct Rendering!"); ERROR_LOG("you have Direct Rendering!");
} else { } else {
ERROR_LOG("no Direct Rendering possible!"); NOTICE_LOG("no Direct Rendering possible!");
} }
// better for pad plugin key input (thc) // better for pad plugin key input (thc)