From 40fa31a64e572937cc3c04008f60871473dd4518 Mon Sep 17 00:00:00 2001 From: "gregory.hainaut@gmail.com" Date: Tue, 14 Sep 2010 11:51:26 +0000 Subject: [PATCH] zzogl-pg: * Allow to load the plugin without log (better but not mandatory) * Only reload the log file when it was open in the first place git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3766 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/zzogl-pg/opengl/GSmain.cpp | 2 +- plugins/zzogl-pg/opengl/ZZLog.cpp | 15 ++++++--------- plugins/zzogl-pg/opengl/ZZLog.h | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/plugins/zzogl-pg/opengl/GSmain.cpp b/plugins/zzogl-pg/opengl/GSmain.cpp index 88ae0c7121..e389a1ac29 100644 --- a/plugins/zzogl-pg/opengl/GSmain.cpp +++ b/plugins/zzogl-pg/opengl/GSmain.cpp @@ -303,7 +303,7 @@ s32 CALLBACK GSinit() { FUNCLOG - if (ZZLog::Open() == false) return -1; + ZZLog::Open(); ZZLog::WriteLn("Calling GSinit."); WriteTempRegs(); diff --git a/plugins/zzogl-pg/opengl/ZZLog.cpp b/plugins/zzogl-pg/opengl/ZZLog.cpp index 6ad727a9c5..dd18e366cc 100644 --- a/plugins/zzogl-pg/opengl/ZZLog.cpp +++ b/plugins/zzogl-pg/opengl/ZZLog.cpp @@ -34,21 +34,16 @@ bool IsLogging() return (gsLog != NULL && conf.log); } -bool Open() +void Open() { - bool result = true; const std::string LogFile(s_strLogPath + "GSzzogl.log"); gsLog = fopen(LogFile.c_str(), "w"); if (gsLog != NULL) setvbuf(gsLog, NULL, _IONBF, 0); else - { SysMessage("Can't create log file %s\n", LogFile.c_str()); - result = false; - } - return result; } void Close() @@ -64,9 +59,11 @@ void SetDir(const char* dir) // Get the path to the log directory. s_strLogPath = (dir==NULL) ? "logs/" : dir; - // Reload the log file after updated the path - Close(); - Open(); + // Reload previously open log file + if (gsLog) { + Close(); + Open(); + } } void WriteToScreen(const char* pstr, u32 ms) diff --git a/plugins/zzogl-pg/opengl/ZZLog.h b/plugins/zzogl-pg/opengl/ZZLog.h index e5db14ea16..2a33ca269e 100644 --- a/plugins/zzogl-pg/opengl/ZZLog.h +++ b/plugins/zzogl-pg/opengl/ZZLog.h @@ -171,7 +171,7 @@ namespace ZZLog { extern bool IsLogging(); void SetDir(const char* dir); -extern bool Open(); +extern void Open(); extern void Close(); extern void Message(const char *fmt, ...); extern void Log(const char *fmt, ...);