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
This commit is contained in:
gregory.hainaut@gmail.com 2010-09-14 11:51:26 +00:00
parent 752034c519
commit 40fa31a64e
3 changed files with 8 additions and 11 deletions

View File

@ -303,7 +303,7 @@ s32 CALLBACK GSinit()
{
FUNCLOG
if (ZZLog::Open() == false) return -1;
ZZLog::Open();
ZZLog::WriteLn("Calling GSinit.");
WriteTempRegs();

View File

@ -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
// Reload previously open log file
if (gsLog) {
Close();
Open();
}
}
void WriteToScreen(const char* pstr, u32 ms)

View File

@ -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, ...);