From a3b1445e04931eea2fcf9f5cf7e78e0f92084591 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sat, 15 Nov 2025 15:55:49 -0600 Subject: [PATCH] HW/SI: Adjust logging verbosity in RunSIBuffer and minor cleanups. --- Source/Core/Core/HW/SI/SI.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Source/Core/Core/HW/SI/SI.cpp b/Source/Core/Core/HW/SI/SI.cpp index c869ed0e3df..f451be328da 100644 --- a/Source/Core/Core/HW/SI/SI.cpp +++ b/Source/Core/Core/HW/SI/SI.cpp @@ -3,13 +3,15 @@ #include "Core/HW/SI/SI.h" -#include #include -#include #include -#include #include -#include + +#if defined(_DEBUG) +#include + +#include "Common/StringUtil.h" +#endif #include "Common/BitField.h" #include "Common/ChunkFile.h" @@ -147,9 +149,12 @@ void SerialInterfaceManager::RunSIBuffer(u64 user_data, s64 cycles_late) { const s32 request_length = ConvertSILengthField(m_com_csr.OUTLNGTH); const s32 expected_response_length = ConvertSILengthField(m_com_csr.INLNGTH); - const std::vector request_copy(m_si_buffer.data(), m_si_buffer.data() + request_length); - const std::unique_ptr& device = m_channel[m_com_csr.CHANNEL].device; +#if defined(_DEBUG) + const std::vector request_copy(m_si_buffer.data(), m_si_buffer.data() + request_length); +#endif + + auto* const device = m_channel[m_com_csr.CHANNEL].device.get(); const s32 actual_response_length = device->RunBuffer(m_si_buffer.data(), request_length); DEBUG_LOG_FMT(SERIALINTERFACE, @@ -159,15 +164,16 @@ void SerialInterfaceManager::RunSIBuffer(u64 user_data, s64 cycles_late) actual_response_length); if (actual_response_length > 0 && expected_response_length != actual_response_length) { - std::ostringstream ss; - for (const u8 b : request_copy) - { - ss << std::hex << std::setw(2) << std::setfill('0') << (int)b << ' '; - } - DEBUG_LOG_FMT( +#if defined(_DEBUG) + WARN_LOG_FMT( SERIALINTERFACE, "RunSIBuffer: expected_response_length({}) != actual_response_length({}): request: {}", - expected_response_length, actual_response_length, ss.str()); + expected_response_length, actual_response_length, Common::BytesToHexString(request_copy)); +#else + WARN_LOG_FMT(SERIALINTERFACE, + "RunSIBuffer: expected_response_length({}) != actual_response_length({})", + expected_response_length, actual_response_length); +#endif } // TODO: