diff --git a/Source/Core/Core/AchievementManager.cpp b/Source/Core/Core/AchievementManager.cpp index c0f45d3c21..86f65a716a 100644 --- a/Source/Core/Core/AchievementManager.cpp +++ b/Source/Core/Core/AchievementManager.cpp @@ -1749,4 +1749,21 @@ void AchievementManager::RequestV2(const rc_api_request_t* request, }); } +u32 AchievementManager::MemoryPeekerV2(u32 address, u8* buffer, u32 num_bytes, rc_client_t* client) +{ + if (buffer == nullptr) + return 0u; + auto& system = Core::System::GetInstance(); + Core::CPUThreadGuard threadguard(system); + for (u32 num_read = 0; num_read < num_bytes; num_read++) + { + auto value = system.GetMMU().HostTryReadU8(threadguard, address + num_read, + PowerPC::RequestedAddressSpace::Physical); + if (!value.has_value()) + return num_read; + buffer[num_read] = value.value().value; + } + return num_bytes; +} + #endif // USE_RETRO_ACHIEVEMENTS diff --git a/Source/Core/Core/AchievementManager.h b/Source/Core/Core/AchievementManager.h index 81ffd44be6..4429b07bff 100644 --- a/Source/Core/Core/AchievementManager.h +++ b/Source/Core/Core/AchievementManager.h @@ -204,8 +204,10 @@ private: const std::function& init_request, const std::function& process_response); ResponseType RequestImage(rc_api_fetch_image_request_t rc_request, Badge* rc_response); + static void RequestV2(const rc_api_request_t* request, rc_client_server_callback_t callback, void* callback_data, rc_client_t* client); + static u32 MemoryPeekerV2(u32 address, u8* buffer, u32 num_bytes, rc_client_t* client); rc_runtime_t m_runtime{}; Core::System* m_system{};