mirror of https://github.com/PCSX2/pcsx2.git
[spu2null, padnull, gsnull, zzogl]: use the setLogDir API to select the log path.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3203 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
b43d8b650f
commit
1e9be9eab2
|
@ -38,6 +38,7 @@ u32 GSKeyEvent = 0;
|
|||
bool GSShift = false, GSAlt = false;
|
||||
|
||||
string s_strIniPath="inis";
|
||||
std::string s_strLogPath("logs/");
|
||||
const char* s_iniFilename = "GSnull.ini";
|
||||
|
||||
// Because I haven't bothered to get GSOpen2 working in Windows yet in GSNull.
|
||||
|
@ -62,6 +63,24 @@ EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)
|
|||
return (version<<16) | (revision<<8) | build;
|
||||
}
|
||||
|
||||
bool OpenLog() {
|
||||
bool result = true;
|
||||
#ifdef GS_LOG
|
||||
const std::string LogFile(s_strLogPath + "GSnull.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;
|
||||
}
|
||||
GS_LOG("GSnull plugin version %d,%d\n",revision,build);
|
||||
GS_LOG("GS init\n");
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
void __Log(char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
|
@ -105,16 +124,21 @@ EXPORT_C_(void) GSsetSettingsDir(const char* dir)
|
|||
s_strIniPath = (dir == NULL) ? "inis/" : dir;
|
||||
}
|
||||
|
||||
EXPORT_C_(void) GSsetLogDir(const char* dir)
|
||||
{
|
||||
// Get the path to the log directory.
|
||||
s_strLogPath = (dir==NULL) ? "logs/" : dir;
|
||||
|
||||
// Reload the log file after updated the path
|
||||
if (gsLog != NULL) fclose(gsLog);
|
||||
OpenLog();
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) GSinit()
|
||||
{
|
||||
LoadConfig();
|
||||
|
||||
#ifdef GS_LOG
|
||||
gsLog = fopen("logs/gsLog.txt", "w");
|
||||
if (gsLog) setvbuf(gsLog, NULL, _IONBF, 0);
|
||||
GS_LOG("GSnull plugin version %d,%d\n",revision,build);
|
||||
GS_LOG("GS init\n");
|
||||
#endif
|
||||
OpenLog();
|
||||
|
||||
SysPrintf("Initializing GSnull\n");
|
||||
return 0;
|
||||
|
|
|
@ -27,6 +27,7 @@ const u8 build = 1; // increase that with each version
|
|||
|
||||
static char *libraryName = "Padnull Driver";
|
||||
string s_strIniPath="inis/";
|
||||
string s_strLogPath="logs/";
|
||||
|
||||
FILE *padLog;
|
||||
Config conf;
|
||||
|
@ -76,18 +77,40 @@ EXPORT_C_(void) PADsetSettingsDir(const char* dir)
|
|||
s_strIniPath = (dir == NULL) ? "inis/" : dir;
|
||||
}
|
||||
|
||||
bool OpenLog() {
|
||||
bool result = true;
|
||||
#ifdef PAD_LOG
|
||||
if(padLog) return result;
|
||||
|
||||
const std::string LogFile(s_strLogPath + "/padnull.log");
|
||||
|
||||
padLog = fopen(LogFile.c_str(), "w");
|
||||
if (padLog != NULL)
|
||||
setvbuf(padLog, NULL, _IONBF, 0);
|
||||
else {
|
||||
SysMessage("Can't create log file %s\n", LogFile.c_str());
|
||||
result = false;
|
||||
}
|
||||
PAD_LOG("PADinit\n");
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
EXPORT_C_(void) PADsetLogDir(const char* dir)
|
||||
{
|
||||
// Get the path to the log directory.
|
||||
s_strLogPath = (dir==NULL) ? "logs/" : dir;
|
||||
|
||||
// Reload the log file after updated the path
|
||||
if (padLog) fclose(padLog);
|
||||
OpenLog();
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) PADinit(u32 flags)
|
||||
{
|
||||
LoadConfig();
|
||||
|
||||
#ifdef PAD_LOG
|
||||
if (padLog == NULL)
|
||||
{
|
||||
padLog = fopen("logs/padLog.txt", "w");
|
||||
if (padLog) setvbuf(padLog, NULL, _IONBF, 0);
|
||||
}
|
||||
PAD_LOG("PADinit\n");
|
||||
#endif
|
||||
OpenLog();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ char *libraryName = "SPU2null (Debug)";
|
|||
char *libraryName = "SPU2null ";
|
||||
#endif
|
||||
string s_strIniPath="inis/";
|
||||
string s_strLogPath="logs/";
|
||||
|
||||
FILE *spu2Log;
|
||||
Config conf;
|
||||
|
@ -114,14 +115,40 @@ EXPORT_C_(void) SPU2setSettingsDir(const char* dir)
|
|||
s_strIniPath = (dir == NULL) ? "inis/" : dir;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) SPU2init()
|
||||
{
|
||||
bool OpenLog() {
|
||||
bool result = true;
|
||||
#ifdef SPU2_LOG
|
||||
spu2Log = fopen("logs/spu2.txt", "w");
|
||||
if (spu2Log) setvbuf(spu2Log, NULL, _IONBF, 0);
|
||||
if(spu2Log) return result;
|
||||
|
||||
const std::string LogFile(s_strLogPath + "/spu2null.log");
|
||||
|
||||
spu2Log = fopen(LogFile.c_str(), "w");
|
||||
if (spu2Log != NULL)
|
||||
setvbuf(spu2Log, NULL, _IONBF, 0);
|
||||
else {
|
||||
SysMessage("Can't create log file %s\n", LogFile.c_str());
|
||||
result = false;
|
||||
}
|
||||
SPU2_LOG("Spu2 null version %d,%d\n", revision, build);
|
||||
SPU2_LOG("SPU2init\n");
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
EXPORT_C_(void) SPU2setLogDir(const char* dir)
|
||||
{
|
||||
// Get the path to the log directory.
|
||||
s_strLogPath = (dir==NULL) ? "logs/" : dir;
|
||||
|
||||
// Reload the log file after updated the path
|
||||
if (spu2Log) fclose(spu2Log);
|
||||
OpenLog();
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) SPU2init()
|
||||
{
|
||||
OpenLog();
|
||||
|
||||
spu2regs = (s8*)malloc(0x10000);
|
||||
if (spu2regs == NULL)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,7 @@ void (*GSirq)();
|
|||
u8* g_pBasePS2Mem = NULL;
|
||||
int g_TransferredToGPU = 0;
|
||||
std::string s_strIniPath("inis/"); // Air's new ini path (r2361)
|
||||
std::string s_strLogPath("logs/");
|
||||
|
||||
int g_GameSettings = 0;
|
||||
int CurrentSavestate = 0; // Number of SaveSlot. Default is 0
|
||||
|
@ -124,6 +125,21 @@ bool IsLogging()
|
|||
return (gsLog != NULL && conf.log);
|
||||
}
|
||||
|
||||
bool OpenLog() {
|
||||
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 WriteToScreen(const char* pstr, u32 ms)
|
||||
{
|
||||
ZeroGS::AddMessage(pstr, ms);
|
||||
|
@ -333,6 +349,16 @@ void CALLBACK GSsetSettingsDir(const char* dir)
|
|||
s_strIniPath = (dir == NULL) ? "inis/" : dir;
|
||||
}
|
||||
|
||||
void CALLBACK GSsetLogDir(const char* dir)
|
||||
{
|
||||
// Get the path to the log directory.
|
||||
s_strLogPath = (dir==NULL) ? "logs/" : dir;
|
||||
|
||||
// Reload the log file after updated the path
|
||||
if (gsLog != NULL) fclose(gsLog);
|
||||
ZZLog::OpenLog();
|
||||
}
|
||||
|
||||
extern int VALIDATE_THRESH;
|
||||
extern u32 TEXDESTROY_THRESH;
|
||||
|
||||
|
@ -465,20 +491,8 @@ s32 CALLBACK GSinit()
|
|||
|
||||
memcpy(g_GIFTempRegHandlers, g_GIFPackedRegHandlers, sizeof(g_GIFTempRegHandlers));
|
||||
|
||||
gsLog = fopen("logs/gsLog.txt", "w");
|
||||
|
||||
if (gsLog == NULL)
|
||||
{
|
||||
gsLog = fopen("gsLog.txt", "w");
|
||||
|
||||
if (gsLog == NULL)
|
||||
{
|
||||
SysMessage("Can't create gsLog.txt");
|
||||
if (ZZLog::OpenLog() == false)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
setvbuf(gsLog, NULL, _IONBF, 0);
|
||||
|
||||
ZZLog::GS_Log("Calling GSinit.");
|
||||
|
||||
|
|
Loading…
Reference in New Issue