From b430d66cdcf92fe2517ef689c75d19ef9aa31b47 Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Thu, 24 Dec 2020 23:38:59 -0600 Subject: [PATCH] Split OSREPORT logging type The enumerated LOG_TYPE "OSREPORT" is currently used in both EXI_DeviceIPL.cpp and HLE_OS.cpp. In many games, the multitude of game functions detected by HLE_OS.cpp for OSREPORT logging results in poor log readability. This Pull Request remedies that by adding a new enumerated LOG_TYPE "OSREPORT_HLE" for log usage in HLE_OS.cpp. In the future, further changing how logging in HLE_OS.cpp works may be desirable. As it is, game functions are detected that send a single character to the log. This is a major source of poor readability. --- Source/Core/Common/Logging/Log.h | 1 + Source/Core/Common/Logging/LogManager.cpp | 3 ++- Source/Core/Core/HLE/HLE_OS.cpp | 16 ++++++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Source/Core/Common/Logging/Log.h b/Source/Core/Common/Logging/Log.h index 7d762b504c..ce136b2c0b 100644 --- a/Source/Core/Common/Logging/Log.h +++ b/Source/Core/Common/Logging/Log.h @@ -52,6 +52,7 @@ enum LOG_TYPE NETPLAY, OSHLE, OSREPORT, + OSREPORT_HLE, PAD, PIXELENGINE, PROCESSORINTERFACE, diff --git a/Source/Core/Common/Logging/LogManager.cpp b/Source/Core/Common/Logging/LogManager.cpp index d882093adf..b03255ca9e 100644 --- a/Source/Core/Common/Logging/LogManager.cpp +++ b/Source/Core/Common/Logging/LogManager.cpp @@ -154,7 +154,8 @@ LogManager::LogManager() m_log[MEMMAP] = {"MI", "Memory Interface & Memory Map"}; m_log[NETPLAY] = {"NETPLAY", "Netplay"}; m_log[OSHLE] = {"HLE", "OSHLE"}; - m_log[OSREPORT] = {"OSREPORT", "OSReport"}; + m_log[OSREPORT] = {"OSREPORT", "OSReport EXI"}; + m_log[OSREPORT_HLE] = {"OSREPORT_HLE", "OSReport HLE"}; m_log[PAD] = {"PAD", "Pad"}; m_log[PIXELENGINE] = {"PE", "Pixel Engine"}; m_log[PROCESSORINTERFACE] = {"PI", "Processor Interface"}; diff --git a/Source/Core/Core/HLE/HLE_OS.cpp b/Source/Core/Core/HLE/HLE_OS.cpp index 6049ddedde..8a1195c830 100644 --- a/Source/Core/Core/HLE/HLE_OS.cpp +++ b/Source/Core/Core/HLE/HLE_OS.cpp @@ -38,7 +38,7 @@ void HLE_OSPanic() StringPopBackIf(&msg, '\n'); PanicAlertFmt("OSPanic: {}: {}", error, msg); - ERROR_LOG_FMT(OSREPORT, "{:08x}->{:08x}| OSPanic: {}: {}", LR, PC, error, msg); + ERROR_LOG_FMT(OSREPORT_HLE, "{:08x}->{:08x}| OSPanic: {}: {}", LR, PC, error, msg); NPC = LR; } @@ -82,7 +82,7 @@ void HLE_GeneralDebugPrint(ParameterType parameter_type) NPC = LR; - NOTICE_LOG_FMT(OSREPORT, "{:08x}->{:08x}| {}", LR, PC, SHIFTJISToUTF8(report_message)); + NOTICE_LOG_FMT(OSREPORT_HLE, "{:08x}->{:08x}| {}", LR, PC, SHIFTJISToUTF8(report_message)); } // Generalized function for printing formatted string using parameter list. @@ -105,22 +105,22 @@ void HLE_write_console() { const u32 size = PowerPC::Read_U32(GPR(5)); if (size > report_message.size()) - WARN_LOG_FMT(OSREPORT, "__write_console uses an invalid size of {:#010x}", size); + WARN_LOG_FMT(OSREPORT_HLE, "__write_console uses an invalid size of {:#010x}", size); else if (size == 0) - WARN_LOG_FMT(OSREPORT, "__write_console uses a size of zero"); + WARN_LOG_FMT(OSREPORT_HLE, "__write_console uses a size of zero"); else report_message = report_message.substr(0, size); } else { - ERROR_LOG_FMT(OSREPORT, "__write_console uses an unreachable size pointer"); + ERROR_LOG_FMT(OSREPORT_HLE, "__write_console uses an unreachable size pointer"); } StringPopBackIf(&report_message, '\n'); NPC = LR; - NOTICE_LOG_FMT(OSREPORT, "{:08x}->{:08x}| {}", LR, PC, SHIFTJISToUTF8(report_message)); + NOTICE_LOG_FMT(OSREPORT_HLE, "{:08x}->{:08x}| {}", LR, PC, SHIFTJISToUTF8(report_message)); } // Log (v)dprintf message if fd is 1 (stdout) or 2 (stderr) @@ -133,7 +133,7 @@ void HLE_LogDPrint(ParameterType parameter_type) std::string report_message = GetStringVA(4, parameter_type); StringPopBackIf(&report_message, '\n'); - NOTICE_LOG_FMT(OSREPORT, "{:08x}->{:08x}| {}", LR, PC, SHIFTJISToUTF8(report_message)); + NOTICE_LOG_FMT(OSREPORT_HLE, "{:08x}->{:08x}| {}", LR, PC, SHIFTJISToUTF8(report_message)); } // Log dprintf message @@ -173,7 +173,7 @@ void HLE_LogFPrint(ParameterType parameter_type) std::string report_message = GetStringVA(4, parameter_type); StringPopBackIf(&report_message, '\n'); - NOTICE_LOG_FMT(OSREPORT, "{:08x}->{:08x}| {}", LR, PC, SHIFTJISToUTF8(report_message)); + NOTICE_LOG_FMT(OSREPORT_HLE, "{:08x}->{:08x}| {}", LR, PC, SHIFTJISToUTF8(report_message)); } // Log fprintf message