summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2020-07-30 12:19:41 +0200
committerGitHub <noreply@github.com>2020-07-30 12:19:41 +0200
commit9d44df0f0bd8076df89077a2a8cd650ddd798dc5 (patch)
treee9a1d74c418366f2e1e19e851ff0cbfb24710471 /Source/Core/DiscIO
parent3d680ff2f68a52c8330de4f70620b5a0d30e3fdd (diff)
parent2e8c5b4521d7a483d9895cd4294acd51636046d4 (diff)
Merge pull request #8875 from JosJuice/nkit-warning
DolphinQt: Show a warning when launching an NKit disc image
Diffstat (limited to 'Source/Core/DiscIO')
-rw-r--r--Source/Core/DiscIO/Volume.h1
-rw-r--r--Source/Core/DiscIO/VolumeDisc.cpp6
-rw-r--r--Source/Core/DiscIO/VolumeDisc.h1
-rw-r--r--Source/Core/DiscIO/VolumeVerifier.cpp24
-rw-r--r--Source/Core/DiscIO/VolumeWad.cpp5
-rw-r--r--Source/Core/DiscIO/VolumeWad.h1
6 files changed, 24 insertions, 14 deletions
diff --git a/Source/Core/DiscIO/Volume.h b/Source/Core/DiscIO/Volume.h
index a5c4e6be14..e176c5d72a 100644
--- a/Source/Core/DiscIO/Volume.h
+++ b/Source/Core/DiscIO/Volume.h
@@ -116,6 +116,7 @@ public:
}
virtual Platform GetVolumeType() const = 0;
virtual bool IsDatelDisc() const = 0;
+ virtual bool IsNKit() const = 0;
virtual bool SupportsIntegrityCheck() const { return false; }
virtual bool CheckH3TableIntegrity(const Partition& partition) const { return false; }
virtual bool CheckBlockIntegrity(u64 block_index, const std::vector<u8>& encrypted_data,
diff --git a/Source/Core/DiscIO/VolumeDisc.cpp b/Source/Core/DiscIO/VolumeDisc.cpp
index bf622bb8fb..fed82a8067 100644
--- a/Source/Core/DiscIO/VolumeDisc.cpp
+++ b/Source/Core/DiscIO/VolumeDisc.cpp
@@ -84,4 +84,10 @@ std::optional<u8> VolumeDisc::GetDiscNumber(const Partition& partition) const
return ReadSwapped<u8>(6, partition);
}
+bool VolumeDisc::IsNKit() const
+{
+ constexpr u32 NKIT_MAGIC = 0x4E4B4954; // "NKIT"
+ return ReadSwapped<u32>(0x200, PARTITION_NONE) == NKIT_MAGIC;
+}
+
} // namespace DiscIO
diff --git a/Source/Core/DiscIO/VolumeDisc.h b/Source/Core/DiscIO/VolumeDisc.h
index 333ea7d4aa..680bbf83b0 100644
--- a/Source/Core/DiscIO/VolumeDisc.h
+++ b/Source/Core/DiscIO/VolumeDisc.h
@@ -22,6 +22,7 @@ public:
std::string GetInternalName(const Partition& partition = PARTITION_NONE) const override;
std::string GetApploaderDate(const Partition& partition) const override;
std::optional<u8> GetDiscNumber(const Partition& partition = PARTITION_NONE) const override;
+ bool IsNKit() const override;
protected:
Region RegionCodeToRegion(std::optional<u32> region_code) const;
diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp
index 00e850071a..c1a2bcbd90 100644
--- a/Source/Core/DiscIO/VolumeVerifier.cpp
+++ b/Source/Core/DiscIO/VolumeVerifier.cpp
@@ -988,22 +988,18 @@ void VolumeVerifier::CheckMisc()
}
}
- if (IsDisc(m_volume.GetVolumeType()))
+ if (m_volume.IsNKit())
{
- constexpr u32 NKIT_MAGIC = 0x4E4B4954; // "NKIT"
- if (m_volume.ReadSwapped<u32>(0x200, PARTITION_NONE) == NKIT_MAGIC)
- {
- AddProblem(
- Severity::Low,
- Common::GetStringT("This disc image is in the NKit format. It is not a good dump in its "
- "current form, but it might become a good dump if converted back. "
- "The CRC32 of this file might match the CRC32 of a good dump even "
- "though the files are not identical."));
- }
-
- if (StringBeginsWith(game_id_unencrypted, "R8P"))
- CheckSuperPaperMario();
+ AddProblem(
+ Severity::Low,
+ Common::GetStringT("This disc image is in the NKit format. It is not a good dump in its "
+ "current form, but it might become a good dump if converted back. "
+ "The CRC32 of this file might match the CRC32 of a good dump even "
+ "though the files are not identical."));
}
+
+ if (IsDisc(m_volume.GetVolumeType()) && StringBeginsWith(game_id_unencrypted, "R8P"))
+ CheckSuperPaperMario();
}
void VolumeVerifier::CheckSuperPaperMario()
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp
index 61b772ec31..b7b8fa35cd 100644
--- a/Source/Core/DiscIO/VolumeWad.cpp
+++ b/Source/Core/DiscIO/VolumeWad.cpp
@@ -289,6 +289,11 @@ bool VolumeWAD::IsDatelDisc() const
return false;
}
+bool VolumeWAD::IsNKit() const
+{
+ return false;
+}
+
std::map<Language, std::string> VolumeWAD::GetLongNames() const
{
if (!m_tmd.IsValid() || !IOS::ES::IsChannel(m_tmd.GetTitleId()))
diff --git a/Source/Core/DiscIO/VolumeWad.h b/Source/Core/DiscIO/VolumeWad.h
index d76b8853ec..a4c311da78 100644
--- a/Source/Core/DiscIO/VolumeWad.h
+++ b/Source/Core/DiscIO/VolumeWad.h
@@ -60,6 +60,7 @@ public:
}
Platform GetVolumeType() const override;
bool IsDatelDisc() const override;
+ bool IsNKit() const override;
Region GetRegion() const override;
Country GetCountry(const Partition& partition = PARTITION_NONE) const override;