From fd99a5db9a0e740394fd736f9e109e660a74b8b6 Mon Sep 17 00:00:00 2001 From: LillyJadeKatrin Date: Mon, 29 Jan 2024 11:37:08 -0500 Subject: [PATCH] Reverse endianness of achievement memory peeks rcheevos expects these multi-byte peeks to have the opposite endianness so they need to be swapped before rcheevos gets them. --- Source/Core/Core/AchievementManager.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Source/Core/Core/AchievementManager.cpp b/Source/Core/Core/AchievementManager.cpp index eb5bc2a891..01e60edb82 100644 --- a/Source/Core/Core/AchievementManager.cpp +++ b/Source/Core/Core/AchievementManager.cpp @@ -711,15 +711,17 @@ u32 AchievementManager::MemoryPeeker(u32 address, u32 num_bytes, void* ud) .value_or(PowerPC::ReadResult(false, 0u)) .value; case 2: - return m_system->GetMMU() - .HostTryReadU16(threadguard, address, PowerPC::RequestedAddressSpace::Physical) - .value_or(PowerPC::ReadResult(false, 0u)) - .value; + return Common::swap16( + m_system->GetMMU() + .HostTryReadU16(threadguard, address, PowerPC::RequestedAddressSpace::Physical) + .value_or(PowerPC::ReadResult(false, 0u)) + .value); case 4: - return m_system->GetMMU() - .HostTryReadU32(threadguard, address, PowerPC::RequestedAddressSpace::Physical) - .value_or(PowerPC::ReadResult(false, 0u)) - .value; + return Common::swap32( + m_system->GetMMU() + .HostTryReadU32(threadguard, address, PowerPC::RequestedAddressSpace::Physical) + .value_or(PowerPC::ReadResult(false, 0u)) + .value); default: ASSERT(false); return 0u;