summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeGC.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2020-06-04 20:33:52 +0200
committerJosJuice <josjuice@gmail.com>2020-06-25 16:37:21 +0200
commitd17b8015188e290756fe1842636e33e35b50cea8 (patch)
treea45bbd62a4f681f95f44cb6db8ee3022637b8c63 /Source/Core/DiscIO/VolumeGC.cpp
parent6468978dd02d9949adf2f61713988849d1f4f08e (diff)
DiscIO: Deduplicate some VolumeGC/VolumeWii code
Diffstat (limited to 'Source/Core/DiscIO/VolumeGC.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeGC.cpp72
1 files changed, 1 insertions, 71 deletions
diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp
index 74b612f647..83b0d3dd00 100644
--- a/Source/Core/DiscIO/VolumeGC.cpp
+++ b/Source/Core/DiscIO/VolumeGC.cpp
@@ -57,21 +57,6 @@ const FileSystem* VolumeGC::GetFileSystem(const Partition& partition) const
return m_file_system->get();
}
-std::string VolumeGC::GetGameID(const Partition& partition) const
-{
- static const std::string NO_UID("NO_UID");
-
- char id[6];
-
- if (!Read(0, sizeof(id), reinterpret_cast<u8*>(id), partition))
- {
- PanicAlertT("Failed to read unique ID from disc image");
- return NO_UID;
- }
-
- return DecodeString(id);
-}
-
std::string VolumeGC::GetGameTDBID(const Partition& partition) const
{
// Don't return an ID for Datel discs
@@ -83,48 +68,7 @@ std::string VolumeGC::GetGameTDBID(const Partition& partition) const
Region VolumeGC::GetRegion() const
{
- const std::optional<u32> region_code = ReadSwapped<u32>(0x458, PARTITION_NONE);
- if (!region_code)
- return Region::Unknown;
- const Region region = static_cast<Region>(*region_code);
- return region <= Region::PAL ? region : Region::Unknown;
-}
-
-Country VolumeGC::GetCountry(const Partition& partition) const
-{
- // The 0 that we use as a default value is mapped to Country::Unknown and Region::Unknown
- const u8 country = ReadSwapped<u8>(3, partition).value_or(0);
- const Region region = GetRegion();
- const std::optional<u16> revision = GetRevision();
-
- if (CountryCodeToRegion(country, Platform::GameCubeDisc, region, revision) != region)
- return TypicalCountryForRegion(region);
-
- return CountryCodeToCountry(country, Platform::GameCubeDisc, region, revision);
-}
-
-std::string VolumeGC::GetMakerID(const Partition& partition) const
-{
- char maker_id[2];
- if (!Read(0x4, sizeof(maker_id), reinterpret_cast<u8*>(&maker_id), partition))
- return std::string();
-
- return DecodeString(maker_id);
-}
-
-std::optional<u16> VolumeGC::GetRevision(const Partition& partition) const
-{
- std::optional<u8> revision = ReadSwapped<u8>(7, partition);
- return revision ? *revision : std::optional<u16>();
-}
-
-std::string VolumeGC::GetInternalName(const Partition& partition) const
-{
- char name[0x60];
- if (Read(0x20, sizeof(name), reinterpret_cast<u8*>(name), partition))
- return DecodeString(name);
-
- return "";
+ return RegionCodeToRegion(m_reader->ReadSwapped<u32>(0x458));
}
std::map<Language, std::string> VolumeGC::GetShortNames() const
@@ -159,15 +103,6 @@ std::vector<u32> VolumeGC::GetBanner(u32* width, u32* height) const
return m_converted_banner->image_buffer;
}
-std::string VolumeGC::GetApploaderDate(const Partition& partition) const
-{
- char date[16];
- if (!Read(0x2440, sizeof(date), reinterpret_cast<u8*>(&date), partition))
- return std::string();
-
- return DecodeString(date);
-}
-
BlobType VolumeGC::GetBlobType() const
{
return m_reader->GetBlobType();
@@ -193,11 +128,6 @@ const BlobReader& VolumeGC::GetBlobReader() const
return *m_reader;
}
-std::optional<u8> VolumeGC::GetDiscNumber(const Partition& partition) const
-{
- return ReadSwapped<u8>(6, partition);
-}
-
Platform VolumeGC::GetVolumeType() const
{
return Platform::GameCubeDisc;