summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeDirectory.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2015-01-17 13:21:02 +0100
committerJosJuice <josjuice@gmail.com>2015-01-17 13:21:02 +0100
commitace060748b572063b33acee13c19000783a6cdde (patch)
tree0569a779c5d7fec8f954e09ef732b1972f4021a5 /Source/Core/DiscIO/VolumeDirectory.cpp
parent11a36ca8e28b233f34f5c48be19fabeea92f6d38 (diff)
Don't read from disk when checking volume type
Should be faster than relying on the OS to cache the magic words. Also gets rid of the odd recursive call in VolumeDirectory.
Diffstat (limited to 'Source/Core/DiscIO/VolumeDirectory.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeDirectory.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/Source/Core/DiscIO/VolumeDirectory.cpp b/Source/Core/DiscIO/VolumeDirectory.cpp
index 10a3e51f05..385dd73e7d 100644
--- a/Source/Core/DiscIO/VolumeDirectory.cpp
+++ b/Source/Core/DiscIO/VolumeDirectory.cpp
@@ -66,12 +66,7 @@ bool CVolumeDirectory::IsValidDirectory(const std::string& _rDirectory)
bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const
{
- // VolumeHandler::IsWii is used here to check whether a Wii disc is used.
- // That function calls this function to check a magic word in the disc header,
- // so it is important that VolumeHandler::IsWii is not called when the header
- // is being read with decrypt=false, as it would result in a stack overflow.
-
- if (!decrypt && (_Offset + _Length >= 0x400) && VolumeHandler::IsWii())
+ if (!decrypt && (_Offset + _Length >= 0x400) && m_is_wii)
{
// Fully supporting this would require re-encrypting every file that's read.
// Only supporting the areas that IOS allows software to read could be more feasible.
@@ -81,7 +76,7 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt
return false;
}
- if (decrypt && !VolumeHandler::IsWii())
+ if (decrypt && !m_is_wii)
PanicAlertT("Tried to decrypt data from a non-Wii volume");
// header
@@ -210,6 +205,11 @@ std::string CVolumeDirectory::GetApploaderDate() const
return "VOID";
}
+bool CVolumeDirectory::IsWiiDisc() const
+{
+ return m_is_wii;
+}
+
u64 CVolumeDirectory::GetSize() const
{
return 0;
@@ -253,6 +253,7 @@ void CVolumeDirectory::SetDiskTypeWii()
m_diskHeader[0x1b] = 0xa3;
memset(&m_diskHeader[0x1c], 0, 4);
+ m_is_wii = true;
m_addressShift = 2;
}
@@ -264,6 +265,7 @@ void CVolumeDirectory::SetDiskTypeGC()
m_diskHeader[0x1e] = 0x9f;
m_diskHeader[0x1f] = 0x3d;
+ m_is_wii = false;
m_addressShift = 0;
}