Load IOS from TMD when launching non-IOS title.

This commit is contained in:
booto 2017-01-25 01:06:24 -05:00
parent 3ba388138d
commit d16ca2e5c8
1 changed files with 14 additions and 13 deletions

View File

@ -1043,12 +1043,20 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
// (supposedly when trying to re-open those files). // (supposedly when trying to re-open those files).
DiscIO::CNANDContentManager::Access().ClearCache(); DiscIO::CNANDContentManager::Access().ClearCache();
u64 ios_to_load = 0;
std::string tContentFile; 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); const DiscIO::CNANDContentLoader& ContentLoader = AccessContentDevice(TitleID);
if (ContentLoader.IsValid()) if (ContentLoader.IsValid())
{ {
ios_to_load = 0x0000000100000000ULL | ContentLoader.GetIosVersion();
u32 bootInd = ContentLoader.GetBootIndex(); u32 bootInd = ContentLoader.GetBootIndex();
const DiscIO::SNANDContent* pContent = ContentLoader.GetContentByIndex(bootInd); const DiscIO::SNANDContent* pContent = ContentLoader.GetContentByIndex(bootInd);
if (pContent) if (pContent)
@ -1059,7 +1067,8 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
if (pDolLoader->IsValid()) 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) // 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 // 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; MSR = 0;
PC = 0x3400; PC = 0x3400;
bSuccess = true; bSuccess = true;
bReset = true;
} }
else else
{ {
PanicAlertT("IOCTL_ES_LAUNCH: The DOL file is invalid!"); 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) if (!bSuccess)
{ {
PanicAlertT( PanicAlertT(
@ -1105,6 +1104,8 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
Reset(true); Reset(true);
Reinit(); Reinit();
SetupMemory(ios_to_load);
bReset = true;
if (!SConfig::GetInstance().m_bt_passthrough_enabled) if (!SConfig::GetInstance().m_bt_passthrough_enabled)
{ {