HW/SI: Adjust logging verbosity in RunSIBuffer and minor cleanups.

This commit is contained in:
Jordan Woyak 2025-11-15 15:55:49 -06:00
parent cd45dcea94
commit a3b1445e04

View File

@ -3,13 +3,15 @@
#include "Core/HW/SI/SI.h"
#include <algorithm>
#include <array>
#include <atomic>
#include <cstring>
#include <iomanip>
#include <memory>
#include <sstream>
#if defined(_DEBUG)
#include <vector>
#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<u8> request_copy(m_si_buffer.data(), m_si_buffer.data() + request_length);
const std::unique_ptr<ISIDevice>& device = m_channel[m_com_csr.CHANNEL].device;
#if defined(_DEBUG)
const std::vector<u8> 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: