summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-02-10 18:57:58 +0100
committerJosJuice <josjuice@gmail.com>2017-02-12 09:37:39 +0100
commit49ec22bc42c7a1cf12f2b1ad181dc5efe46f97b5 (patch)
tree4271d15295062c7193b330e1386e48c03e77c0b1 /Source/Core/DiscIO
parentc96bcace2f64796a5098b58ae620a158e9d3e9dc (diff)
DVDInterface: Translate Wii partition offsets for timing purposes
Until now, Dolphin has been using the wrong values for calculating DVD timing for decrypted Wii reads (which Wii games essentially always use).
Diffstat (limited to 'Source/Core/DiscIO')
-rw-r--r--Source/Core/DiscIO/Volume.h1
-rw-r--r--Source/Core/DiscIO/VolumeWiiCrypted.cpp6
-rw-r--r--Source/Core/DiscIO/VolumeWiiCrypted.h3
3 files changed, 9 insertions, 1 deletions
diff --git a/Source/Core/DiscIO/Volume.h b/Source/Core/DiscIO/Volume.h
index 6f4a6defe4..966bbe2ae1 100644
--- a/Source/Core/DiscIO/Volume.h
+++ b/Source/Core/DiscIO/Volume.h
@@ -37,6 +37,7 @@ public:
virtual bool GetTitleID(u64*) const { return false; }
virtual std::vector<u8> GetTMD() const { return {}; }
+ virtual u64 PartitionOffsetToRawOffset(u64 offset) const { return offset; }
virtual std::string GetGameID() const = 0;
virtual std::string GetMakerID() const = 0;
virtual u16 GetRevision() const = 0;
diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.cpp b/Source/Core/DiscIO/VolumeWiiCrypted.cpp
index cb5fe4464f..ae174604cc 100644
--- a/Source/Core/DiscIO/VolumeWiiCrypted.cpp
+++ b/Source/Core/DiscIO/VolumeWiiCrypted.cpp
@@ -140,6 +140,12 @@ std::vector<u8> CVolumeWiiCrypted::GetTMD() const
return buffer;
}
+u64 CVolumeWiiCrypted::PartitionOffsetToRawOffset(u64 offset) const
+{
+ return m_VolumeOffset + m_dataOffset + (offset / BLOCK_DATA_SIZE * BLOCK_TOTAL_SIZE) +
+ (offset % BLOCK_DATA_SIZE);
+}
+
std::string CVolumeWiiCrypted::GetGameID() const
{
if (m_pReader == nullptr)
diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.h b/Source/Core/DiscIO/VolumeWiiCrypted.h
index 623ce5366f..93c289cc43 100644
--- a/Source/Core/DiscIO/VolumeWiiCrypted.h
+++ b/Source/Core/DiscIO/VolumeWiiCrypted.h
@@ -32,6 +32,7 @@ public:
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const override;
bool GetTitleID(u64* buffer) const override;
std::vector<u8> GetTMD() const override;
+ u64 PartitionOffsetToRawOffset(u64 offset) const override;
std::string GetGameID() const override;
std::string GetMakerID() const override;
u16 GetRevision() const override;
@@ -53,11 +54,11 @@ public:
u64 GetSize() const override;
u64 GetRawSize() const override;
-private:
static constexpr unsigned int BLOCK_HEADER_SIZE = 0x0400;
static constexpr unsigned int BLOCK_DATA_SIZE = 0x7C00;
static constexpr unsigned int BLOCK_TOTAL_SIZE = BLOCK_HEADER_SIZE + BLOCK_DATA_SIZE;
+private:
std::unique_ptr<IBlobReader> m_pReader;
std::unique_ptr<mbedtls_aes_context> m_AES_ctx;