IOS/ES: Keep track of the active title properly

This changes ES to keep track of the active title properly,
just like IOS:

* It is NOT changed on resource manager open/close.
* It is reset on IOS reload.
* It is changed by ES_DIVerify and ES_Launch.

IOS stores the active title in a structure like this:

    struct ESTitleContext
    {
      Ticket* ticket;
      TMD* tmd;
      u32 active;
    };

With this commit, we also do keep the Ticket and TMD around. This
makes some of the DI ioctlvs (which return data about the current
active title) trivial to implement in the future.

This fixes the System Menu not being able to see update partitions
and also allows us to change Dolphin's active game info in the future.
This commit is contained in:
Léo Lam committed 2017-03-02 20:28:01 +01:00
1 parent 78e7f4aae3
commit 4d776ffa8f
13 files changed
+128 -75

No files matched your search

-2
View File
@@ -278,8 +278,6 @@ bool CBoot::BootUp()
PanicAlertT("Warning - starting ISO in wrong console mode!");
}
IOS::HLE::ES_DIVerify(pVolume.GetTMD());
_StartupPara.bWii = pVolume.GetVolumeType() == DiscIO::Platform::WII_DISC;
// HLE BS2 or not
+8 -10
View File
@@ -311,6 +311,11 @@ bool CBoot::EmulatedBS2_Wii()
if (DVDInterface::GetVolume().GetVolumeType() != DiscIO::Platform::WII_DISC)
return false;
const IOS::ES::TMDReader tmd = DVDInterface::GetVolume().GetTMD();
if (!SetupWiiMemory(tmd.GetIOSId()))
return false;
// This is some kind of consistency check that is compared to the 0x00
// values as the game boots. This location keeps the 4 byte ID for as long
// as the game is running. The 6 byte ID at 0x00 is overwritten sometime
@@ -346,11 +351,6 @@ bool CBoot::EmulatedBS2_Wii()
PowerPC::ppcState.gpr[1] = 0x816ffff0; // StackPointer
IOS::ES::TMDReader tmd = DVDInterface::GetVolume().GetTMD();
if (!SetupWiiMemory(tmd.GetIOSId()))
return false;
// Execute the apploader
const u32 apploader_offset = 0x2440; // 0x1c40;
@@ -383,11 +383,7 @@ bool CBoot::EmulatedBS2_Wii()
PowerPC::ppcState.gpr[3] = 0x81300000;
RunFunction(iAppLoaderInit);
// Let the apploader load the exe to memory. At this point I get an unknown IPC command
// (command zero) when I load Wii Sports or other games a second time. I don't notice
// any side effects however. It's a little disconcerting however that Start after Stop
// behaves differently than the first Start after starting Dolphin. It means something
// was not reset correctly.
// Let the apploader load the exe to memory
DEBUG_LOG(BOOT, "Run iAppLoaderMain");
do
{
@@ -413,6 +409,8 @@ bool CBoot::EmulatedBS2_Wii()
// Load patches and run startup patches
PatchEngine::LoadPatches();
IOS::HLE::ES_DIVerify(tmd, DVDInterface::GetVolume().GetTicket());
// return
PC = PowerPC::ppcState.gpr[3];
return true;