summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2017-06-05 00:08:58 +0200
committerLéo Lam <leo@innovatetechnologi.es>2017-06-06 16:31:17 +0200
commit9a3fb858f31e159ab76bee4cb8944489997a44fa (patch)
treec2e33d4b821d28e39bddb2f2ed591fed6b7775eb /Source/Core
parentd0169fe8db0f11c7837f704241ac7e3f4b327724 (diff)
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.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp29
-rw-r--r--Source/Core/Core/HW/EXI/EXI_DeviceIPL.h2
2 files changed, 17 insertions, 14 deletions
diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp
index 528ed351f5..0cf6bbfc38 100644
--- a/Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp
+++ b/Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp
@@ -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)
diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceIPL.h b/Source/Core/Core/HW/EXI/EXI_DeviceIPL.h
index 031001e6f6..ea2d7093e2 100644
--- a/Source/Core/Core/HW/EXI/EXI_DeviceIPL.h
+++ b/Source/Core/Core/HW/EXI/EXI_DeviceIPL.h
@@ -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);
};