summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/FileSystemGCWii.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2015-10-17 20:52:26 +0200
committerJosJuice <josjuice@gmail.com>2015-10-17 20:52:26 +0200
commit618ccf6109076f5a88bd1fb9aff188de0884ff68 (patch)
treef246110ab5f36c1463f1b511aec9c0aa2695bf8b /Source/Core/DiscIO/FileSystemGCWii.cpp
parent05e339a605be5f5ccd0f710af774fa08eadd65a2 (diff)
Remove DiscScrubber::GetDOLSize in favor of IFileSystem::GetBootDOLSize
IFileSystem::GetBootDOLSize acts the same. The only difference is that it reads the DOL offset on its own, but this change makes that optional.
Diffstat (limited to 'Source/Core/DiscIO/FileSystemGCWii.cpp')
-rw-r--r--Source/Core/DiscIO/FileSystemGCWii.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/Source/Core/DiscIO/FileSystemGCWii.cpp b/Source/Core/DiscIO/FileSystemGCWii.cpp
index 439a80af99..e20d633f35 100644
--- a/Source/Core/DiscIO/FileSystemGCWii.cpp
+++ b/Source/Core/DiscIO/FileSystemGCWii.cpp
@@ -150,27 +150,32 @@ bool CFileSystemGCWii::ExportApploader(const std::string& _rExportFolder) const
u32 CFileSystemGCWii::GetBootDOLSize() const
{
- u32 DolOffset = m_rVolume->Read32(0x420, m_Wii) << GetOffsetShift();
- u32 DolSize = 0, offset = 0, size = 0;
+ return GetBootDOLSize((u64)m_rVolume->Read32(0x420, m_Wii) << GetOffsetShift());
+}
+
+u32 CFileSystemGCWii::GetBootDOLSize(u64 dol_offset) const
+{
+ u32 dol_size = 0;
+ u32 offset = 0;
+ u32 size = 0;
// Iterate through the 7 code segments
for (u8 i = 0; i < 7; i++)
{
- offset = m_rVolume->Read32(DolOffset + 0x00 + i * 4, m_Wii);
- size = m_rVolume->Read32(DolOffset + 0x90 + i * 4, m_Wii);
- if (offset + size > DolSize)
- DolSize = offset + size;
+ offset = m_rVolume->Read32(dol_offset + 0x00 + i * 4, m_Wii);
+ size = m_rVolume->Read32(dol_offset + 0x90 + i * 4, m_Wii);
+ dol_size = std::max(offset + size, dol_size);
}
// Iterate through the 11 data segments
for (u8 i = 0; i < 11; i++)
{
- offset = m_rVolume->Read32(DolOffset + 0x1c + i * 4, m_Wii);
- size = m_rVolume->Read32(DolOffset + 0xac + i * 4, m_Wii);
- if (offset + size > DolSize)
- DolSize = offset + size;
+ offset = m_rVolume->Read32(dol_offset + 0x1c + i * 4, m_Wii);
+ size = m_rVolume->Read32(dol_offset + 0xac + i * 4, m_Wii);
+ dol_size = std::max(offset + size, dol_size);
}
- return DolSize;
+
+ return dol_size;
}
bool CFileSystemGCWii::GetBootDOL(u8* &buffer, u32 DolSize) const