mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 07:45:33 +01:00
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:
parent
2642c3f73b
commit
1e5762b163
@ -324,58 +324,33 @@ bool CBoot::BootUp()
|
|||||||
// ELF
|
// ELF
|
||||||
case SCoreStartupParameter::BOOT_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
|
// load image or create virtual drive from directory
|
||||||
if (!_StartupPara.m_strDVDRoot.empty())
|
if (!_StartupPara.m_strDVDRoot.empty())
|
||||||
{
|
{
|
||||||
NOTICE_LOG(BOOT, "Setting DVDRoot %s", _StartupPara.m_strDVDRoot.c_str());
|
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, _StartupPara.bWii);
|
||||||
VolumeHandler::SetVolumeDirectory(_StartupPara.m_strDVDRoot, elfWii);
|
|
||||||
BS2Success = EmulatedBS2(elfWii);
|
|
||||||
}
|
}
|
||||||
else if (!_StartupPara.m_strDefaultISO.empty())
|
else if (!_StartupPara.m_strDefaultISO.empty())
|
||||||
{
|
{
|
||||||
NOTICE_LOG(BOOT, "Loading default ISO %s", _StartupPara.m_strDefaultISO.c_str());
|
NOTICE_LOG(BOOT, "Loading default ISO %s", _StartupPara.m_strDefaultISO.c_str());
|
||||||
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultISO);
|
VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultISO);
|
||||||
}
|
}
|
||||||
else VolumeHandler::SetVolumeDirectory(_StartupPara.m_strFilename, elfWii);
|
else
|
||||||
|
{
|
||||||
|
VolumeHandler::SetVolumeDirectory(_StartupPara.m_strFilename, _StartupPara.bWii);
|
||||||
|
}
|
||||||
|
|
||||||
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
|
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
|
||||||
|
|
||||||
if (BS2Success)
|
// Poor man's bootup
|
||||||
{
|
if(_StartupPara.bWii)
|
||||||
HLE::PatchFunctions();
|
SetupWiiMemory(DiscIO::IVolume::COUNTRY_UNKNOWN);
|
||||||
}
|
else
|
||||||
else // Poor man's bootup
|
EmulatedBS2_GC(true);
|
||||||
{
|
|
||||||
Load_FST(elfWii);
|
Load_FST(_StartupPara.bWii);
|
||||||
Boot_ELF(_StartupPara.m_strFilename);
|
Boot_ELF(_StartupPara.m_strFilename);
|
||||||
}
|
|
||||||
UpdateDebugger_MapLoaded();
|
UpdateDebugger_MapLoaded();
|
||||||
Dolphin_Debugger::AddAutoBreakpoints();
|
Dolphin_Debugger::AddAutoBreakpoints();
|
||||||
break;
|
break;
|
||||||
|
@ -52,7 +52,7 @@ private:
|
|||||||
static bool Boot_ELF(const std::string& filename);
|
static bool Boot_ELF(const std::string& filename);
|
||||||
static bool Boot_WiiWAD(const std::string& filename);
|
static bool Boot_WiiWAD(const std::string& filename);
|
||||||
|
|
||||||
static bool EmulatedBS2_GC();
|
static bool EmulatedBS2_GC(bool skipAppLoader = false);
|
||||||
static bool EmulatedBS2_Wii();
|
static bool EmulatedBS2_Wii();
|
||||||
static bool EmulatedBS2(bool _bIsWii);
|
static bool EmulatedBS2(bool _bIsWii);
|
||||||
static bool Load_BS2(const std::string& _rBootROMFilename);
|
static bool Load_BS2(const std::string& _rBootROMFilename);
|
||||||
|
@ -34,7 +34,7 @@ void CBoot::RunFunction(u32 _iAddr)
|
|||||||
// GameCube Bootstrap 2 HLE:
|
// GameCube Bootstrap 2 HLE:
|
||||||
// copy the apploader to 0x81200000
|
// copy the apploader to 0x81200000
|
||||||
// execute the apploader, function by function, using the above utility.
|
// execute the apploader, function by function, using the above utility.
|
||||||
bool CBoot::EmulatedBS2_GC()
|
bool CBoot::EmulatedBS2_GC(bool skipAppLoader)
|
||||||
{
|
{
|
||||||
INFO_LOG(BOOT, "Faking GC BS2...");
|
INFO_LOG(BOOT, "Faking GC BS2...");
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ bool CBoot::EmulatedBS2_GC()
|
|||||||
u32 iAppLoaderOffset = 0x2440;
|
u32 iAppLoaderOffset = 0x2440;
|
||||||
u32 iAppLoaderEntry = VolumeHandler::Read32(iAppLoaderOffset + 0x10, false);
|
u32 iAppLoaderEntry = VolumeHandler::Read32(iAppLoaderOffset + 0x10, false);
|
||||||
u32 iAppLoaderSize = VolumeHandler::Read32(iAppLoaderOffset + 0x14, false) + VolumeHandler::Read32(iAppLoaderOffset + 0x18, false);
|
u32 iAppLoaderSize = VolumeHandler::Read32(iAppLoaderOffset + 0x14, false) + VolumeHandler::Read32(iAppLoaderOffset + 0x18, false);
|
||||||
if ((iAppLoaderEntry == (u32)-1) || (iAppLoaderSize == (u32)-1))
|
if ((iAppLoaderEntry == (u32)-1) || (iAppLoaderSize == (u32)-1) || skipAppLoader)
|
||||||
{
|
{
|
||||||
INFO_LOG(BOOT, "GC BS2: Not running apploader!");
|
INFO_LOG(BOOT, "GC BS2: Not running apploader!");
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user