diff --git a/Source/Project64-rsp-core/cpu/RspLog.cpp b/Source/Project64-rsp-core/cpu/RspLog.cpp index f891bfba1..86623971b 100644 --- a/Source/Project64-rsp-core/cpu/RspLog.cpp +++ b/Source/Project64-rsp-core/cpu/RspLog.cpp @@ -8,17 +8,28 @@ #include #include -CLog * RDPLog = NULL; -CLog * CPULog = NULL; +CLog * RDPLog = nullptr; +CLog * CPULog = nullptr; void StartCPULog(void) { - if (CPULog == NULL) + if (CPULog != nullptr) { - char LogDir[260]; - CPath LogFilePath(GetSystemSettingSz(Set_DirectoryLog, LogDir, sizeof(LogDir)), "RSP_x86Log.txt"); - CPULog = new CLog; - CPULog->Open(LogFilePath); + return; + } + char LogDir[260]; + CPath LogFilePath(GetSystemSettingSz(Set_DirectoryLog, LogDir, sizeof(LogDir)), "RSP_x86Log.txt"); + CPULog = new CLog; + if (CPULog != nullptr) + { + if (CPULog->Open(LogFilePath)) + { + CPULog->SetMaxFileSize(300 * CLog::MB); + } + else + { + StopCPULog(); + } } }