From c65a6f5fb04c5bf20c0701ec73456144869b4f38 Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Mon, 23 Jun 2014 18:17:15 -0700 Subject: [PATCH] GCI Folder: correctly identify region of sysmenu --- Source/Core/Common/NandPaths.h | 1 + Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/NandPaths.h b/Source/Core/Common/NandPaths.h index bf5ebc41c5..60e78615a0 100644 --- a/Source/Core/Common/NandPaths.h +++ b/Source/Core/Common/NandPaths.h @@ -11,6 +11,7 @@ #include "Common/CommonTypes.h" #define TITLEID_SYSMENU 0x0000000100000002ull +const static std::string TITLEID_SYSMENU_STRING = "0000000100000002"; namespace Common { diff --git a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp index fde8868cb3..84a32f13e7 100644 --- a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp +++ b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp @@ -4,6 +4,7 @@ #include "Common/Common.h" #include "Common/FileUtil.h" +#include "Common/NandPaths.h" #include "Common/StringUtil.h" #include "Core/ConfigManager.h" #include "Core/Core.h" @@ -17,6 +18,7 @@ #include "Core/HW/GCMemcardRaw.h" #include "Core/HW/Memmap.h" #include "Core/HW/Sram.h" +#include "DiscIO/NANDContentLoader.h" #define MC_STATUS_BUSY 0x80 #define MC_STATUS_UNLOCKED 0x40 @@ -100,8 +102,17 @@ void CEXIMemoryCard::setupGciFolder(u16 sizeMb) DiscIO::IVolume::ECountry CountryCode = DiscIO::IVolume::COUNTRY_UNKNOWN; auto strUniqueID = Core::g_CoreStartupParameter.m_strUniqueID; + u32 CurrentGameId = 0; - if (strUniqueID.length() >= 4) + if (strUniqueID == TITLEID_SYSMENU_STRING) + { + const DiscIO::INANDContentLoader & SysMenu_Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU, true); + if (SysMenu_Loader.IsValid()) + { + CountryCode = DiscIO::CountrySwitch(SysMenu_Loader.GetCountryChar()); + } + } + else if (strUniqueID.length() >= 4) { CountryCode = DiscIO::CountrySwitch(strUniqueID.at(3)); memcpy((u8 *)&CurrentGameId, strUniqueID.c_str(), 4);