BootUp: Clean up elf BootUp code.

* The file already exsists, otherwise we wouldn't have gotten
   this far in the boot.
 * We have already checked if it's a Wii or GameCube elf,
   besides, it's too late to change our minds now anyway.
 * On Wii - Don't call EmulatedBS2, it can never succeed as
   it knows nothing about booting elfs. Just call the
   SetupWiiMemory directly if needed.
 * On GameCube - We still call EmulatedBS2_GC, but we stop
   it from running Apploader, which might boot something
   unexpected from the default iso or DVD root folder.
This commit is contained in:
Scott Mansell
2014-11-01 22:20:56 +13:00
parent 2642c3f73b
commit 1e5762b163
3 changed files with 17 additions and 42 deletions

View File

@ -324,58 +324,33 @@ bool CBoot::BootUp()
// ELF
case SCoreStartupParameter::BOOT_ELF:
{
if (!File::Exists(_StartupPara.m_strFilename))
{
PanicAlertT("The file you specified (%s) does not exist",
_StartupPara.m_strFilename.c_str());
return false;
}
// Check if we have gotten a Wii file or not
bool elfWii = IsElfWii(_StartupPara.m_strFilename);
if (elfWii != _StartupPara.bWii)
{
PanicAlertT("Warning - starting ELF in wrong console mode!");
}
bool BS2Success = false;
if (elfWii)
{
BS2Success = EmulatedBS2(elfWii);
}
else if (!VolumeHandler::IsWiiDisc() && !_StartupPara.m_strDefaultISO.empty())
{
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultISO);
BS2Success = EmulatedBS2(elfWii);
}
// load image or create virtual drive from directory
if (!_StartupPara.m_strDVDRoot.empty())
{
NOTICE_LOG(BOOT, "Setting DVDRoot %s", _StartupPara.m_strDVDRoot.c_str());
// TODO: auto-convert elf to dol, so we can load them :)
VolumeHandler::SetVolumeDirectory(_StartupPara.m_strDVDRoot, elfWii);
BS2Success = EmulatedBS2(elfWii);
VolumeHandler::SetVolumeDirectory(_StartupPara.m_strDVDRoot, _StartupPara.bWii);
}
else if (!_StartupPara.m_strDefaultISO.empty())
{
NOTICE_LOG(BOOT, "Loading default ISO %s", _StartupPara.m_strDefaultISO.c_str());
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultISO);
}
else VolumeHandler::SetVolumeDirectory(_StartupPara.m_strFilename, elfWii);
else
{
VolumeHandler::SetVolumeDirectory(_StartupPara.m_strFilename, _StartupPara.bWii);
}
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
if (BS2Success)
{
HLE::PatchFunctions();
}
else // Poor man's bootup
{
Load_FST(elfWii);
Boot_ELF(_StartupPara.m_strFilename);
}
// Poor man's bootup
if(_StartupPara.bWii)
SetupWiiMemory(DiscIO::IVolume::COUNTRY_UNKNOWN);
else
EmulatedBS2_GC(true);
Load_FST(_StartupPara.bWii);
Boot_ELF(_StartupPara.m_strFilename);
UpdateDebugger_MapLoaded();
Dolphin_Debugger::AddAutoBreakpoints();
break;