Boot: Load DOL/ELF after memory setup

I recently talked to a homebrew developer who was trying to add exception
handlers at link time but found out that Dolphin was overwriting their
exception handlers. I figure that's not the usual way to do exception
handlers, but... making us load the executable after setting up memory
rather than before is easy, and matches what we do when booting discs,
so I suppose there's no reason not to do it. It also matches the intent
of why Dolphin is writing default exception handlers – we're writing
them because some homebrew relies on exception handlers being left
around from whatever program was running before it (see 3dd777be70).
This commit is contained in:
JosJuice 2022-11-05 13:55:17 +01:00
parent 0210d115c2
commit fb916a4c33
1 changed files with 6 additions and 6 deletions

View File

@ -540,12 +540,6 @@ bool CBoot::BootUp(std::unique_ptr<BootParameters> boot)
if (!executable.reader->IsValid())
return false;
if (!executable.reader->LoadIntoMemory())
{
PanicAlertFmtT("Failed to load the executable to memory.");
return false;
}
SetDefaultDisc();
SetupMSR();
@ -569,6 +563,12 @@ bool CBoot::BootUp(std::unique_ptr<BootParameters> boot)
SetupGCMemory();
}
if (!executable.reader->LoadIntoMemory())
{
PanicAlertFmtT("Failed to load the executable to memory.");
return false;
}
SConfig::OnNewTitleLoad();
PC = executable.reader->GetEntryPoint();