From 5e53c9b2c86ce5169cd60b451c2bd9cf67e948dc Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sat, 29 May 2010 10:46:48 +0000 Subject: [PATCH] FWnull, USBnull, and dev9null now use SetLogFolder. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3114 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/FWnull/FW.cpp | 23 ++++++++++++++++++++--- plugins/USBnull/USB.cpp | 21 +++++++++++++++++++-- plugins/dev9null/DEV9.cpp | 22 ++++++++++++++++++++-- 3 files changed, 59 insertions(+), 7 deletions(-) diff --git a/plugins/FWnull/FW.cpp b/plugins/FWnull/FW.cpp index 1788937970..2744df3e8b 100644 --- a/plugins/FWnull/FW.cpp +++ b/plugins/FWnull/FW.cpp @@ -29,13 +29,31 @@ const u8 build = 6; // increase that with each version static char *libraryName = "FWnull Driver"; string s_strIniPath="inis/"; - +string s_strLogPath = "logs/"; + s8 *fwregs; Config conf; PluginLog FWLog; void (*FWirq)(); +void LogInit() +{ + const std::string LogFile(s_strLogPath + "/FWnull.log"); + setLoggingState(); + FWLog.Open(LogFile); +} + +EXPORT_C_(void) PADSetLogFolder(const char* dir) +{ + // Get the path to the log directory. + s_strLogPath = (dir==NULL) ? "logs/" : dir; + + // Reload the log file after updated the path + FWLog.Close(); + LogInit(); +} + EXPORT_C_(u32) PS2EgetLibType() { return PS2E_LT_FW; @@ -54,8 +72,7 @@ EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) EXPORT_C_(s32) FWinit() { LoadConfig(); - setLoggingState(); - FWLog.Open("logs/FWnull.log"); + LogInit(); FWLog.WriteLn("FWnull plugin version %d,%d", revision, build); FWLog.WriteLn("Initializing FWnull"); diff --git a/plugins/USBnull/USB.cpp b/plugins/USBnull/USB.cpp index 952a8b22ad..afe86b6e5b 100644 --- a/plugins/USBnull/USB.cpp +++ b/plugins/USBnull/USB.cpp @@ -19,6 +19,7 @@ using namespace std; #include "USB.h" string s_strIniPath="inis/"; +string s_strLogPath="logs/"; const unsigned char version = PS2E_USB_VERSION; const unsigned char revision = 0; @@ -32,6 +33,23 @@ PluginLog USBLog; s8 *usbregs, *ram; +void LogInit() +{ + const std::string LogFile(s_strLogPath + "/USBnull.log"); + setLoggingState(); + USBLog.Open(LogFile); +} + +EXPORT_C_(void) PADSetLogFolder(const char* dir) +{ + // Get the path to the log directory. + s_strLogPath = (dir==NULL) ? "logs/" : dir; + + // Reload the log file after updated the path + USBLog.Close(); + LogInit(); +} + EXPORT_C_(u32) PS2EgetLibType() { return PS2E_LT_USB; @@ -50,8 +68,7 @@ EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) EXPORT_C_(s32) USBinit() { LoadConfig(); - setLoggingState(); - USBLog.Open("logs/USBnull.log"); + LogInit(); USBLog.WriteLn("USBnull plugin version %d,%d", revision, build); USBLog.WriteLn("Initializing USBnull"); diff --git a/plugins/dev9null/DEV9.cpp b/plugins/dev9null/DEV9.cpp index 87734eeaed..d8ab0c79b5 100644 --- a/plugins/dev9null/DEV9.cpp +++ b/plugins/dev9null/DEV9.cpp @@ -44,9 +44,28 @@ void (*DEV9irq)(int); __aligned16 s8 dev9regs[0x10000]; string s_strIniPath = "inis/"; +string s_strLogPath="logs/"; + PluginLog Dev9Log; Config conf; +void LogInit() +{ + const std::string LogFile(s_strLogPath + "/dev9null.log"); + setLoggingState(); + Dev9Log.Open(LogFile); +} + +EXPORT_C_(void) PADSetLogFolder(const char* dir) +{ + // Get the path to the log directory. + s_strLogPath = (dir==NULL) ? "logs/" : dir; + + // Reload the log file after updated the path + Dev9Log.Close(); + LogInit(); +} + EXPORT_C_(u32) PS2EgetLibType() { return PS2E_LT_DEV9; @@ -66,8 +85,7 @@ EXPORT_C_(s32) DEV9init() { LoadConfig(); setLoggingState(); - - Dev9Log.Open("logs/dev9null.log"); + LogInit(); Dev9Log.WriteLn("dev9null plugin version %d,%d", revision, build); Dev9Log.WriteLn("Initializing dev9null"); // Initialize anything that needs to be initialized.