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.