EXI: Always try to load IPL in GameCube mode

I don't see any reason to disable loading the IPL if bHLE_BS2 is
disabled. bHLE_BS2 should only cause us not to run the IPL, but not
skip loading it in the first place. More importantly, without always
loading it, this causes issues when trying to launch only the GC IPL
while having bHLE_BS2 = false.
This commit is contained in:
Léo Lam 2017-06-05 00:08:58 +02:00
parent d0169fe8db
commit 9a3fb858f3
2 changed files with 17 additions and 14 deletions

View File

@ -98,9 +98,18 @@ CEXIIPL::CEXIIPL() : m_uPosition(0), m_uAddress(0), m_uRWOffset(0), m_FontsLoade
// Create the IPL
m_pIPL = static_cast<u8*>(Common::AllocateMemoryPages(ROM_SIZE));
// The Wii doesn't have a copy of the IPL, only fonts.
if (SConfig::GetInstance().bWii || SConfig::GetInstance().bHLE_BS2)
// Load whole ROM dump
// Note: The Wii doesn't have a copy of the IPL, only fonts.
if (!SConfig::GetInstance().bWii && LoadFileToIPL(SConfig::GetInstance().m_strBootROM, 0))
{
// Descramble the encrypted section (contains BS1 and BS2)
Descrambler(m_pIPL + 0x100, 0x1afe00);
INFO_LOG(BOOT, "Loaded bootrom: %s", m_pIPL); // yay for null-terminated strings ;p
}
else
{
// If we are in Wii mode or if loading the GC IPL fails, we should still try to load fonts.
// Copy header
if (DiscIO::IsNTSC(SConfig::GetInstance().m_region))
memcpy(m_pIPL, iplverNTSC, sizeof(iplverNTSC));
@ -111,14 +120,6 @@ CEXIIPL::CEXIIPL() : m_uPosition(0), m_uAddress(0), m_uRWOffset(0), m_FontsLoade
LoadFontFile((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + FONT_SHIFT_JIS), 0x1aff00);
LoadFontFile((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + FONT_WINDOWS_1252), 0x1fcf00);
}
else
{
// Load whole ROM dump
LoadFileToIPL(SConfig::GetInstance().m_strBootROM, 0);
// Descramble the encrypted section (contains BS1 and BS2)
Descrambler(m_pIPL + 0x100, 0x1afe00);
INFO_LOG(BOOT, "Loaded bootrom: %s", m_pIPL); // yay for null-terminated strings ;p
}
// Clear RTC
memset(m_RTC, 0, sizeof(m_RTC));
@ -158,17 +159,19 @@ void CEXIIPL::DoState(PointerWrap& p)
p.Do(m_FontsLoaded);
}
void CEXIIPL::LoadFileToIPL(const std::string& filename, u32 offset)
bool CEXIIPL::LoadFileToIPL(const std::string& filename, u32 offset)
{
File::IOFile stream(filename, "rb");
if (!stream)
return;
return false;
u64 filesize = stream.GetSize();
stream.ReadBytes(m_pIPL + offset, filesize);
if (!stream.ReadBytes(m_pIPL + offset, filesize))
return false;
m_FontsLoaded = true;
return true;
}
std::string CEXIIPL::FindIPLDump(const std::string& path_prefix)

View File

@ -74,7 +74,7 @@ private:
void TransferByte(u8& _uByte) override;
bool IsWriteCommand() const { return !!(m_uAddress & (1 << 31)); }
u32 CommandRegion() const { return (m_uAddress & ~(1 << 31)) >> 8; }
void LoadFileToIPL(const std::string& filename, u32 offset);
bool LoadFileToIPL(const std::string& filename, u32 offset);
void LoadFontFile(const std::string& filename, u32 offset);
std::string FindIPLDump(const std::string& path_prefix);
};