Skip to content
Permalink
Browse files

VolumeVerifier: Don't show problems with good dumps of Wii Freeloaders

  • Loading branch information...
JosJuice committed Oct 22, 2019
1 parent c6da1f0 commit 742aa765c6859c22c8e294f31aca10e1a9606701
Showing with 36 additions and 31 deletions.
  1. +0 −4 Source/Core/DiscIO/DiscScrubber.cpp
  2. +36 −27 Source/Core/DiscIO/VolumeVerifier.cpp
@@ -47,10 +47,6 @@ bool DiscScrubber::SetupScrub(const Volume* disc, int block_size)
// Round up when diving by CLUSTER_SIZE, otherwise MarkAsUsed might write out of bounds
const size_t num_clusters = static_cast<size_t>((m_file_size + CLUSTER_SIZE - 1) / CLUSTER_SIZE);

// Warn if not DVD5 or DVD9 size
if (num_clusters != 0x23048 && num_clusters != 0x46090)
WARN_LOG(DISCIO, "Not a standard sized Wii disc! (%zx blocks)", num_clusters);

// Table of free blocks
m_free_table.resize(num_clusters, 1);

@@ -416,7 +416,9 @@ void VolumeVerifier::CheckPartitions()
if (std::find(types.cbegin(), types.cend(), PARTITION_UPDATE) == types.cend())
AddProblem(Severity::Low, Common::GetStringT("The update partition is missing."));

if (std::find(types.cbegin(), types.cend(), PARTITION_DATA) == types.cend())
const bool has_data_partition =
std::find(types.cbegin(), types.cend(), PARTITION_DATA) == types.cend();
if (!m_is_datel && !has_data_partition)
AddProblem(Severity::High, Common::GetStringT("The data partition is missing."));

const bool has_channel_partition =
@@ -493,10 +495,13 @@ bool VolumeVerifier::CheckPartition(const Partition& partition)
name.c_str()));
}

CheckCorrectlySigned(
partition,
StringFromFormat(Common::GetStringT("The %s partition is not correctly signed.").c_str(),
name.c_str()));
if (!m_is_datel)
{
CheckCorrectlySigned(
partition,
StringFromFormat(Common::GetStringT("The %s partition is not correctly signed.").c_str(),
name.c_str()));
}

if (m_volume.SupportsIntegrityCheck() && !m_volume.CheckH3TableIntegrity(partition))
{
@@ -541,9 +546,29 @@ bool VolumeVerifier::CheckPartition(const Partition& partition)
return false;
}

// Prepare for hash verification in the Process step
if (m_volume.SupportsIntegrityCheck())
{
u64 offset = m_volume.PartitionOffsetToRawOffset(0, partition);
const std::optional<u64> size =
m_volume.ReadSwappedAndShifted(partition.offset + 0x2bc, PARTITION_NONE);
const u64 end_offset = offset + size.value_or(0);

for (size_t i = 0; offset < end_offset; ++i, offset += VolumeWii::BLOCK_TOTAL_SIZE)
m_blocks.emplace_back(BlockToVerify{partition, offset, i});

m_block_errors.emplace(partition, 0);
}

const DiscIO::FileSystem* filesystem = m_volume.GetFileSystem(partition);
if (!filesystem)
{
if (m_is_datel)
{
// Datel's Wii Freeloader has an invalid FST in its only partition
return true;
}

std::string text = StringFromFormat(
Common::GetStringT("The %s partition does not have a valid file system.").c_str(),
name.c_str());
@@ -582,20 +607,6 @@ bool VolumeVerifier::CheckPartition(const Partition& partition)
}
}

// Prepare for hash verification in the Process step
if (m_volume.SupportsIntegrityCheck())
{
u64 offset = m_volume.PartitionOffsetToRawOffset(0, partition);
const std::optional<u64> size =
m_volume.ReadSwappedAndShifted(partition.offset + 0x2bc, PARTITION_NONE);
const u64 end_offset = offset + size.value_or(0);

for (size_t i = 0; offset < end_offset; ++i, offset += VolumeWii::BLOCK_TOTAL_SIZE)
m_blocks.emplace_back(BlockToVerify{partition, offset, i});

m_block_errors.emplace(partition, 0);
}

return true;
}

@@ -704,15 +715,16 @@ void VolumeVerifier::CheckDiscSize()
else if (!m_is_tgc)
{
const Platform platform = m_volume.GetVolumeType();
const bool is_gc_size = platform == Platform::GameCubeDisc || m_is_datel;
const u64 size = m_volume.GetSize();

const bool valid_gamecube = size == MINI_DVD_SIZE;
const bool valid_retail_wii = size == SL_DVD_SIZE || size == DL_DVD_SIZE;
const bool valid_debug_wii = size == SL_DVD_R_SIZE || size == DL_DVD_R_SIZE;

const bool debug = IsDebugSigned();
if ((platform == Platform::GameCubeDisc && !valid_gamecube) ||
(platform == Platform::WiiDisc && (debug ? !valid_debug_wii : !valid_retail_wii)))
if ((is_gc_size && !valid_gamecube) ||
(!is_gc_size && (debug ? !valid_debug_wii : !valid_retail_wii)))
{
if (debug && valid_retail_wii)
{
@@ -722,11 +734,7 @@ void VolumeVerifier::CheckDiscSize()
}
else
{
const bool small =
(m_volume.GetVolumeType() == Platform::GameCubeDisc && size < MINI_DVD_SIZE) ||
(m_volume.GetVolumeType() == Platform::WiiDisc && size < SL_DVD_SIZE);

if (small)
if ((is_gc_size && size < MINI_DVD_SIZE) || (!is_gc_size && size < SL_DVD_SIZE))
{
AddProblem(
Severity::Low,
@@ -849,7 +857,8 @@ void VolumeVerifier::CheckMisc()
{
AddProblem(Severity::Low, Common::GetStringT("The game ID is unusually short."));
}
else if (game_id_encrypted != GAMECUBE_PLACEHOLDER_ID && game_id_encrypted != WII_PLACEHOLDER_ID)
else if (!m_is_datel && game_id_encrypted != GAMECUBE_PLACEHOLDER_ID &&
game_id_encrypted != WII_PLACEHOLDER_ID)
{
char country_code;
if (IsDisc(m_volume.GetVolumeType()))

0 comments on commit 742aa76

Please sign in to comment.
You can’t perform that action at this time.