From d16ca2e5c877fb2129c38b81a938c5002cf592d8 Mon Sep 17 00:00:00 2001 From: booto Date: Wed, 25 Jan 2017 01:06:24 -0500 Subject: [PATCH] Load IOS from TMD when launching non-IOS title. --- Source/Core/Core/IOS/ES/ES.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Source/Core/Core/IOS/ES/ES.cpp b/Source/Core/Core/IOS/ES/ES.cpp index 048b1a84c5..1cac5ee73c 100644 --- a/Source/Core/Core/IOS/ES/ES.cpp +++ b/Source/Core/Core/IOS/ES/ES.cpp @@ -1043,12 +1043,20 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request) // (supposedly when trying to re-open those files). DiscIO::CNANDContentManager::Access().ClearCache(); + u64 ios_to_load = 0; std::string tContentFile; - if ((u32)(TitleID >> 32) != 0x00000001 || TitleID == TITLEID_SYSMENU) + if ((u32)(TitleID >> 32) == 0x00000001 && TitleID != TITLEID_SYSMENU) + { + ios_to_load = TitleID; + bSuccess = true; + } + else { const DiscIO::CNANDContentLoader& ContentLoader = AccessContentDevice(TitleID); if (ContentLoader.IsValid()) { + ios_to_load = 0x0000000100000000ULL | ContentLoader.GetIosVersion(); + u32 bootInd = ContentLoader.GetBootIndex(); const DiscIO::SNANDContent* pContent = ContentLoader.GetContentByIndex(bootInd); if (pContent) @@ -1059,7 +1067,8 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request) if (pDolLoader->IsValid()) { - pDolLoader->Load(); // TODO: Check why sysmenu does not load the DOL correctly + pDolLoader->Load(); + // TODO: Check why sysmenu does not load the DOL correctly // NAND titles start with address translation off at 0x3400 (via the PPC bootstub) // // The state of other CPU registers (like the BAT registers) doesn't matter much @@ -1067,25 +1076,15 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request) MSR = 0; PC = 0x3400; bSuccess = true; - bReset = true; } else { PanicAlertT("IOCTL_ES_LAUNCH: The DOL file is invalid!"); - bSuccess = false; } } } } - else // IOS, MIOS, BC etc - { - // We need to reset any open resources and do the memory setup - // IOS does on launch. - if (SetupMemory(TitleID)) - { - bSuccess = true; - } - } + if (!bSuccess) { PanicAlertT( @@ -1105,6 +1104,8 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request) Reset(true); Reinit(); + SetupMemory(ios_to_load); + bReset = true; if (!SConfig::GetInstance().m_bt_passthrough_enabled) {