summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorDentomologist <dentomologist@gmail.com>2024-04-26 12:23:12 -0700
committerDentomologist <dentomologist@gmail.com>2024-04-28 11:00:47 -0700
commit628ab51b4bdc31af8a4b959a810fc7703f06dd2c (patch)
treeb7a4628b2ef1b15f9305ad9b423a119d69fe9e0d /Source
parente69486d2cb4e3e01dd622d760350b26d6cbd59f5 (diff)
CheatSearch: Use two's complement for negative hex values
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/CheatSearch.cpp14
1 files 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<T>::GetResultValueAsString(size_t index,
if (hex)
{
if constexpr (std::is_same_v<T, float>)
- return fmt::format("0x{0:08x}", Common::BitCast<u32>(m_search_results[index].m_value));
+ {
+ return fmt::format("0x{0:08x}", Common::BitCast<s32>(m_search_results[index].m_value));
+ }
else if constexpr (std::is_same_v<T, double>)
- return fmt::format("0x{0:016x}", Common::BitCast<u64>(m_search_results[index].m_value));
+ {
+ return fmt::format("0x{0:016x}", Common::BitCast<s64>(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<std::make_unsigned_t<T>>(m_search_results[index].m_value),
+ sizeof(T) * 2);
+ }
}
return fmt::format("{}", m_search_results[index].m_value);