From 628ab51b4bdc31af8a4b959a810fc7703f06dd2c Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Fri, 26 Apr 2024 12:23:12 -0700 Subject: [PATCH] CheatSearch: Use two's complement for negative hex values --- Source/Core/Core/CheatSearch.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/CheatSearch.cpp b/Source/Core/Core/CheatSearch.cpp index 2f51c4f9e8..dd5e21ac7b 100644 --- a/Source/Core/Core/CheatSearch.cpp +++ b/Source/Core/Core/CheatSearch.cpp @@ -572,11 +572,19 @@ std::string Cheats::CheatSearchSession::GetResultValueAsString(size_t index, if (hex) { if constexpr (std::is_same_v) - return fmt::format("0x{0:08x}", Common::BitCast(m_search_results[index].m_value)); + { + return fmt::format("0x{0:08x}", Common::BitCast(m_search_results[index].m_value)); + } else if constexpr (std::is_same_v) - return fmt::format("0x{0:016x}", Common::BitCast(m_search_results[index].m_value)); + { + return fmt::format("0x{0:016x}", Common::BitCast(m_search_results[index].m_value)); + } else - return fmt::format("0x{0:0{1}x}", m_search_results[index].m_value, sizeof(T) * 2); + { + return fmt::format("0x{0:0{1}x}", + Common::BitCast>(m_search_results[index].m_value), + sizeof(T) * 2); + } } return fmt::format("{}", m_search_results[index].m_value);