From 3ffa15cfa39098eb11e8862551e9e93df3a72bff Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Tue, 20 Oct 2020 02:40:02 -0700 Subject: [PATCH] Implement CMemoryCardSys::GetAreaAndWorldIdForSave --- Runtime/CMemoryCardSys.cpp | 12 +++++++++++- Runtime/CMemoryCardSys.hpp | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Runtime/CMemoryCardSys.cpp b/Runtime/CMemoryCardSys.cpp index c0b57895b..7d4f7e78b 100644 --- a/Runtime/CMemoryCardSys.cpp +++ b/Runtime/CMemoryCardSys.cpp @@ -148,7 +148,17 @@ bool CMemoryCardSys::InitializePump() { return false; } -std::pair CMemoryCardSys::GetAreaAndWorldIdForSaveId(s32 saveId) const { return {kInvalidAreaId, -1}; } +std::pair CMemoryCardSys::GetAreaAndWorldIdForSaveId(s32 saveId) const { + for (const auto& [mlvl, saveWorld] : xc_memoryWorlds) { + for (TAreaId areaId = 0; areaId < saveWorld.xc_areaIds.size(); ++areaId) { + if (saveWorld.xc_areaIds[areaId] == saveId) { + return {mlvl, areaId}; + } + } + } + + return {{}, kInvalidAreaId}; +} void CMemoryCardSys::CCardFileInfo::LockBannerToken(CAssetId bannerTxtr, CSimplePool& sp) { x3c_bannerTex = bannerTxtr; diff --git a/Runtime/CMemoryCardSys.hpp b/Runtime/CMemoryCardSys.hpp index 6281ca773..ca4a74105 100644 --- a/Runtime/CMemoryCardSys.hpp +++ b/Runtime/CMemoryCardSys.hpp @@ -151,7 +151,7 @@ public: } }; - std::pair GetAreaAndWorldIdForSaveId(s32 saveId) const; + std::pair GetAreaAndWorldIdForSaveId(s32 saveId) const; static kabufuda::ProbeResults CardProbe(kabufuda::ECardSlot port); static ECardResult MountCard(kabufuda::ECardSlot port); static ECardResult UnmountCard(kabufuda::ECardSlot port);