summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeWii.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2021-09-19 22:00:13 +0200
committerAdmiral H. Curtiss <pikachu025@gmail.com>2021-09-19 22:43:52 +0200
commitad410009bb98f1dd849a402ff5ba337cece71c7e (patch)
tree3292a4040e91df313488d54713a50f3938cb513e /Source/Core/DiscIO/VolumeWii.cpp
parent31ca1147210ccb9081a680d8c134f1511cc356d5 (diff)
Core/DiscIO: Extract disc and partition constants to DiscUtils.h.
Diffstat (limited to 'Source/Core/DiscIO/VolumeWii.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeWii.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/Source/Core/DiscIO/VolumeWii.cpp b/Source/Core/DiscIO/VolumeWii.cpp
index fb3b5ac2a8..93287093d5 100644
--- a/Source/Core/DiscIO/VolumeWii.cpp
+++ b/Source/Core/DiscIO/VolumeWii.cpp
@@ -27,6 +27,7 @@
#include "DiscIO/Blob.h"
#include "DiscIO/DiscExtractor.h"
+#include "DiscIO/DiscUtils.h"
#include "DiscIO/Enums.h"
#include "DiscIO/FileSystemGCWii.h"
#include "DiscIO/Filesystem.h"
@@ -81,9 +82,10 @@ VolumeWii::VolumeWii(std::unique_ptr<BlobReader> reader)
};
auto get_tmd = [this, partition]() -> IOS::ES::TMDReader {
- const std::optional<u32> tmd_size = m_reader->ReadSwapped<u32>(partition.offset + 0x2a4);
- const std::optional<u64> tmd_address =
- ReadSwappedAndShifted(partition.offset + 0x2a8, PARTITION_NONE);
+ const std::optional<u32> tmd_size =
+ m_reader->ReadSwapped<u32>(partition.offset + WII_PARTITION_TMD_SIZE_ADDRESS);
+ const std::optional<u64> tmd_address = ReadSwappedAndShifted(
+ partition.offset + WII_PARTITION_TMD_OFFSET_ADDRESS, PARTITION_NONE);
if (!tmd_size || !tmd_address)
return INVALID_TMD;
if (!IOS::ES::IsValidTMDSize(*tmd_size))
@@ -100,9 +102,10 @@ VolumeWii::VolumeWii(std::unique_ptr<BlobReader> reader)
};
auto get_cert_chain = [this, partition]() -> std::vector<u8> {
- const std::optional<u32> size = m_reader->ReadSwapped<u32>(partition.offset + 0x2ac);
- const std::optional<u64> address =
- ReadSwappedAndShifted(partition.offset + 0x2b0, PARTITION_NONE);
+ const std::optional<u32> size =
+ m_reader->ReadSwapped<u32>(partition.offset + WII_PARTITION_CERT_CHAIN_SIZE_ADDRESS);
+ const std::optional<u64> address = ReadSwappedAndShifted(
+ partition.offset + WII_PARTITION_CERT_CHAIN_OFFSET_ADDRESS, PARTITION_NONE);
if (!size || !address)
return {};
std::vector<u8> cert_chain(*size);
@@ -114,12 +117,13 @@ VolumeWii::VolumeWii(std::unique_ptr<BlobReader> reader)
auto get_h3_table = [this, partition]() -> std::vector<u8> {
if (!m_encrypted)
return {};
- const std::optional<u64> h3_table_offset =
- ReadSwappedAndShifted(partition.offset + 0x2b4, PARTITION_NONE);
+ const std::optional<u64> h3_table_offset = ReadSwappedAndShifted(
+ partition.offset + WII_PARTITION_H3_OFFSET_ADDRESS, PARTITION_NONE);
if (!h3_table_offset)
return {};
- std::vector<u8> h3_table(H3_TABLE_SIZE);
- if (!m_reader->Read(partition.offset + *h3_table_offset, H3_TABLE_SIZE, h3_table.data()))
+ std::vector<u8> h3_table(WII_PARTITION_H3_SIZE);
+ if (!m_reader->Read(partition.offset + *h3_table_offset, WII_PARTITION_H3_SIZE,
+ h3_table.data()))
return {};
return h3_table;
};
@@ -395,7 +399,7 @@ bool VolumeWii::CheckH3TableIntegrity(const Partition& partition) const
const PartitionDetails& partition_details = it->second;
const std::vector<u8>& h3_table = *partition_details.h3_table;
- if (h3_table.size() != H3_TABLE_SIZE)
+ if (h3_table.size() != WII_PARTITION_H3_SIZE)
return false;
const IOS::ES::TMDReader& tmd = *partition_details.tmd;