DolphinQt: Show a warning when launching an NKit disc image

It is my opinion that nobody should use NKit disc images without
being aware of the drawbacks of them. Since it seems like almost
nobody who is using NKit disc images knows what NKit is (hmm, now
how could that have happened...?), I am adding a warning to Dolphin
so that you can't run NKit disc images without finding out about the
drawbacks. In case someone really does want to use NKit disc images,
the warning has a "Don't show this again" option. Unfortunately, I
can't retroactively add the warning where it's most needed:
in Dolphin 5.0, which does not support Wii NKit disc images.
This commit is contained in:
JosJuice
2020-06-15 13:16:01 +02:00
parent b354e343a7
commit 2e8c5b4521
14 changed files with 160 additions and 15 deletions

View File

@ -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,

View File

@ -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

View File

@ -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;

View File

@ -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()

View File

@ -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()))

View File

@ -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;