diff --git a/Source/Core/Common/Src/IniFile.cpp b/Source/Core/Common/Src/IniFile.cpp index 038fe0b1d7..772a822919 100644 --- a/Source/Core/Common/Src/IniFile.cpp +++ b/Source/Core/Common/Src/IniFile.cpp @@ -74,7 +74,7 @@ const Section* IniFile::GetSection(const char* sectionName) const Section* IniFile::GetSection(const char* sectionName) { for (std::vector
::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 0; } @@ -171,10 +171,10 @@ std::string* IniFile::GetLine(Section* section, const char* key, std::string* va 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) return false; diff --git a/Source/Core/Common/Src/IniFile.h b/Source/Core/Common/Src/IniFile.h index 04f6aab246..d55ff54054 100644 --- a/Source/Core/Common/Src/IniFile.h +++ b/Source/Core/Common/Src/IniFile.h @@ -58,7 +58,7 @@ public: void SetLines(const char* sectionName, const std::vector &lines); // 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 bool Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue = ""); diff --git a/Source/Core/Common/Src/Thread.cpp b/Source/Core/Common/Src/Thread.cpp index b4ddb1b5be..d601dfef3c 100644 --- a/Source/Core/Common/Src/Thread.cpp +++ b/Source/Core/Common/Src/Thread.cpp @@ -17,6 +17,7 @@ #include "Setup.h" #include "Thread.h" +#include "Log.h" // ----------------------------------------- #ifdef SETUP_TIMER_WAITING // ----------------- @@ -26,8 +27,6 @@ #endif // ------------------------ -#define THREAD_DEBUG 1 - namespace Common { #ifdef _WIN32 @@ -373,7 +372,7 @@ CriticalSection::~CriticalSection() void CriticalSection::Enter() { 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)); } @@ -387,7 +386,7 @@ bool CriticalSection::TryEnter() void CriticalSection::Leave() { 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)); } @@ -399,12 +398,10 @@ Thread::Thread(ThreadFunc function, void* arg) pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 1024 * 1024); 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)); -#ifdef THREAD_DEBUG - fprintf(stderr, "created new thread %lu (func=%p, arg=%p)\n", thread_id, function, arg); -#endif + INFO_LOG(COMMON, "created new thread %lu (func=%p, arg=%p)\n", thread_id, function, arg); } @@ -420,9 +417,9 @@ void Thread::WaitForDeath() { void* 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) - 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; } } @@ -480,9 +477,7 @@ void SleepCurrentThread(int ms) void SetCurrentThreadName(const TCHAR* szThreadName) { pthread_setspecific(threadname_key, strdup(szThreadName)); -#ifdef THREAD_DEBUG - fprintf(stderr, "%s(%s)\n", __FUNCTION__, szThreadName); -#endif + INFO_LOG(COMMON, "%s(%s)\n", __FUNCTION__, szThreadName); } diff --git a/Source/Core/Core/Src/HW/CommandProcessor.cpp b/Source/Core/Core/Src/HW/CommandProcessor.cpp index 2ee79e4dad..5ac5ad6aca 100644 --- a/Source/Core/Core/Src/HW/CommandProcessor.cpp +++ b/Source/Core/Core/Src/HW/CommandProcessor.cpp @@ -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" " - We aren't betting on that :)", fifo.CPReadWriteDistance); */ - WARN_LOG(COMMANDPROCESSOR, "*********************** GXSetGPFifo very soon? ***********************"); + DEBUG_LOG(COMMANDPROCESSOR, "*********************** GXSetGPFifo very soon? ***********************"); 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) // Touching that game is a no-go so I don't want to take the risk :p while (fifo.bFF_GPReadEnable && fifo.CPReadWriteDistance > 0 ) ct++; - if (ct) {WARN_LOG(COMMANDPROCESSOR, "(Write16): %lu cycles for nothing :[ ", ct);} + if (ct) {INFO_LOG(COMMANDPROCESSOR, "(Write16): %lu cycles for nothing :[ ", ct);} } } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp index 8a2455875f..e31db78ba5 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp @@ -109,7 +109,7 @@ CWII_IPC_HLE_Device_FileIO::Open(u32 _CommandAddress, u32 _Mode) } 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; } @@ -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? ReturnValue = SeekPosition; } else { - ERROR_LOG(WII_IPC_FILEIO, "FILEIO: Seek failed"); + ERROR_LOG(WII_IPC_FILEIO, "FILEIO: Seek failed - %s", GetDeviceName().c_str()); } } 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); } @@ -241,7 +240,6 @@ CWII_IPC_HLE_Device_FileIO::IOCtl(u32 _CommandAddress) default: { - ERROR_LOG(WII_IPC_FILEIO, "CWII_IPC_HLE_Device_FileIO: Parameter %i", Parameter); PanicAlert("CWII_IPC_HLE_Device_FileIO: Parameter %i", Parameter); } break; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp index 3f70e35b98..b2352acc86 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp @@ -82,6 +82,9 @@ void Config::Load() void Config::GameIniLoad() { IniFile *iniFile = ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.gameIni; + if (! iniFile) + return; + if (iniFile->Exists("Video", "ForceFiltering")) iniFile->Get("Video", "ForceFiltering", &bForceFiltering, 0); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index d663f69c3e..b102e4f8d7 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -336,22 +336,22 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight }; 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; } 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; } 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; } 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; } // -------------------------------------- @@ -395,16 +395,16 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight } else { GLWin.doubleBuffered = True; - ERROR_LOG(VIDEO, "Got Doublebuffered Visual!\n"); + NOTICE_LOG(VIDEO, "Got Doublebuffered Visual!\n"); } 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 */ GLWin.ctx = glXCreateContext(GLWin.dpy, vi, 0, GL_TRUE); 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 } /* create a color map */ @@ -426,7 +426,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight // set best mode to current 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); 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); dpyWidth = modes[bestMode]->hdisplay; dpyHeight = modes[bestMode]->vdisplay; - ERROR_LOG(VIDEO, "Resolution %dx%d\n", dpyWidth, dpyHeight); + NOTICE_LOG(VIDEO, "Resolution %dx%d\n", dpyWidth, dpyHeight); XFree(modes); /* create a fullscreen window */ @@ -528,7 +528,7 @@ bool OpenGL_MakeCurrent() cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin); #elif defined(_WIN32) 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; } #elif defined(USE_WX) && USE_WX @@ -541,9 +541,9 @@ bool OpenGL_MakeCurrent() glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx); XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y, &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)) { - ERROR_LOG(VIDEO, "you have Direct Rendering!"); + NOTICE_LOG(VIDEO, "detected direct rendering"); } else { ERROR_LOG(VIDEO, "no Direct Rendering possible!"); } @@ -708,7 +708,7 @@ void OpenGL_Shutdown() 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 } @@ -716,7 +716,7 @@ void OpenGL_Shutdown() if (hDC && !ReleaseDC(EmuWindow::GetWnd(), hDC)) // Are We Able To Release The DC { #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 hDC = NULL; // Set DC To NULL } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp index a582d10caa..76d71d9d09 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp @@ -63,7 +63,7 @@ void PixelShaderCache::Init() 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_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]; sprintf(pmatrixprog, "!!ARBfp1.0" diff --git a/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp b/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp index 8ed588e526..a44ecb884c 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp @@ -41,11 +41,11 @@ X11Window::X11Window() : GLWindow() { ERROR_LOG("Only Singlebuffered Visual!\n"); } else { doubleBuffered = True; - ERROR_LOG("Got Doublebuffered Visual!\n"); + NOTICE_LOG("Got Doublebuffered Visual!\n"); } 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 */ ctx = glXCreateContext(dpy, vi, 0, GL_TRUE); if(!ctx) { @@ -72,7 +72,7 @@ X11Window::X11Window() : GLWindow() { // set best mode to current 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); if (modeNum > 0 && modes != NULL) { @@ -90,7 +90,7 @@ X11Window::X11Window() : GLWindow() { XF86VidModeSetViewPort(dpy, screen, 0, 0); dpyWidth = modes[bestMode]->hdisplay; dpyHeight = modes[bestMode]->vdisplay; - ERROR_LOG("Resolution %dx%d\n", dpyWidth, dpyHeight); + NOTICE_LOG("Resolution %dx%d\n", dpyWidth, dpyHeight); XFree(modes); /* create a fullscreen window */ @@ -264,11 +264,11 @@ bool X11Window::MakeCurrent() { XGetGeometry(dpy, win, &winDummy, &x, &y, &w, &h, &borderDummy, &depth); - ERROR_LOG("GLWin Depth %d", depth); + NOTICE_LOG("GLWin Depth %d", depth); if (glXIsDirect(dpy, ctx)) { ERROR_LOG("you have Direct Rendering!"); } else { - ERROR_LOG("no Direct Rendering possible!"); + NOTICE_LOG("no Direct Rendering possible!"); } // better for pad plugin key input (thc)