Merge fce3e73ce8
into 1ae0b23265
This commit is contained in:
commit
83e1f43eab
|
@ -354,7 +354,7 @@ std::unique_ptr<DirectoryBlobReader> DirectoryBlobReader::Create(const std::stri
|
|||
}
|
||||
|
||||
std::unique_ptr<DirectoryBlobReader> DirectoryBlobReader::Create(
|
||||
std::unique_ptr<DiscIO::VolumeDisc> volume,
|
||||
std::unique_ptr<VolumeDisc> volume,
|
||||
const std::function<void(std::vector<FSTBuilderNode>* fst_nodes)>& sys_callback,
|
||||
const std::function<void(std::vector<FSTBuilderNode>* fst_nodes, FSTBuilderNode* dol_node)>&
|
||||
fst_callback)
|
||||
|
@ -414,7 +414,7 @@ DirectoryBlobReader::DirectoryBlobReader(const std::string& game_partition_root,
|
|||
}
|
||||
|
||||
DirectoryBlobReader::DirectoryBlobReader(
|
||||
std::unique_ptr<DiscIO::VolumeDisc> volume,
|
||||
std::unique_ptr<VolumeDisc> volume,
|
||||
const std::function<void(std::vector<FSTBuilderNode>* fst_nodes)>& sys_callback,
|
||||
const std::function<void(std::vector<FSTBuilderNode>* fst_nodes, FSTBuilderNode* dol_node)>&
|
||||
fst_callback)
|
||||
|
@ -699,7 +699,7 @@ void DirectoryBlobReader::SetPartitionHeader(DirectoryBlobPartition* partition,
|
|||
constexpr u32 TMD_OFFSET = 0x2c0;
|
||||
constexpr u32 H3_OFFSET = 0x4000;
|
||||
|
||||
const std::optional<DiscIO::Partition>& wrapped_partition = partition->GetWrappedPartition();
|
||||
const std::optional<Partition>& wrapped_partition = partition->GetWrappedPartition();
|
||||
const std::string& partition_root = partition->GetRootDirectory();
|
||||
|
||||
u64 ticket_size;
|
||||
|
@ -797,8 +797,7 @@ void DirectoryBlobReader::SetPartitionHeader(DirectoryBlobPartition* partition,
|
|||
partition->SetKey(ticket.GetTitleKey());
|
||||
}
|
||||
|
||||
static void GenerateBuilderNodesFromFileSystem(const DiscIO::VolumeDisc& volume,
|
||||
const DiscIO::Partition& partition,
|
||||
static void GenerateBuilderNodesFromFileSystem(const VolumeDisc& volume, const Partition& partition,
|
||||
std::vector<FSTBuilderNode>* nodes,
|
||||
const FileInfo& parent_info)
|
||||
{
|
||||
|
@ -875,7 +874,7 @@ static std::vector<u8> ExtractNodeToVector(std::vector<FSTBuilderNode>* nodes, v
|
|||
}
|
||||
|
||||
DirectoryBlobPartition::DirectoryBlobPartition(
|
||||
DiscIO::VolumeDisc* volume, const DiscIO::Partition& partition, std::optional<bool> is_wii,
|
||||
VolumeDisc* volume, const Partition& partition, std::optional<bool> is_wii,
|
||||
const std::function<void(std::vector<FSTBuilderNode>* fst_nodes)>& sys_callback,
|
||||
const std::function<void(std::vector<FSTBuilderNode>* fst_nodes, FSTBuilderNode* dol_node)>&
|
||||
fst_callback,
|
||||
|
|
|
@ -180,7 +180,7 @@ public:
|
|||
DirectoryBlobPartition() = default;
|
||||
DirectoryBlobPartition(const std::string& root_directory, std::optional<bool> is_wii);
|
||||
DirectoryBlobPartition(
|
||||
DiscIO::VolumeDisc* volume, const DiscIO::Partition& partition, std::optional<bool> is_wii,
|
||||
VolumeDisc* volume, const Partition& partition, std::optional<bool> is_wii,
|
||||
const std::function<void(std::vector<FSTBuilderNode>* fst_nodes)>& sys_callback,
|
||||
const std::function<void(std::vector<FSTBuilderNode>* fst_nodes, FSTBuilderNode* dol_node)>&
|
||||
fst_callback,
|
||||
|
@ -196,10 +196,7 @@ public:
|
|||
void SetDataSize(u64 size) { m_data_size = size; }
|
||||
const std::string& GetRootDirectory() const { return m_root_directory; }
|
||||
const DiscContentContainer& GetContents() const { return m_contents; }
|
||||
const std::optional<DiscIO::Partition>& GetWrappedPartition() const
|
||||
{
|
||||
return m_wrapped_partition;
|
||||
}
|
||||
const std::optional<Partition>& GetWrappedPartition() const { return m_wrapped_partition; }
|
||||
|
||||
const std::array<u8, VolumeWii::AES_KEY_SIZE>& GetKey() const { return m_key; }
|
||||
void SetKey(std::array<u8, VolumeWii::AES_KEY_SIZE> key) { m_key = key; }
|
||||
|
@ -241,7 +238,7 @@ private:
|
|||
|
||||
u64 m_data_size = 0;
|
||||
|
||||
std::optional<DiscIO::Partition> m_wrapped_partition = std::nullopt;
|
||||
std::optional<Partition> m_wrapped_partition = std::nullopt;
|
||||
};
|
||||
|
||||
class DirectoryBlobReader : public BlobReader
|
||||
|
@ -251,7 +248,7 @@ class DirectoryBlobReader : public BlobReader
|
|||
public:
|
||||
static std::unique_ptr<DirectoryBlobReader> Create(const std::string& dol_path);
|
||||
static std::unique_ptr<DirectoryBlobReader> Create(
|
||||
std::unique_ptr<DiscIO::VolumeDisc> volume,
|
||||
std::unique_ptr<VolumeDisc> volume,
|
||||
const std::function<void(std::vector<FSTBuilderNode>* fst_nodes)>& sys_callback,
|
||||
const std::function<void(std::vector<FSTBuilderNode>* fst_nodes, FSTBuilderNode* dol_node)>&
|
||||
fst_callback);
|
||||
|
@ -290,7 +287,7 @@ private:
|
|||
explicit DirectoryBlobReader(const std::string& game_partition_root,
|
||||
const std::string& true_root);
|
||||
explicit DirectoryBlobReader(
|
||||
std::unique_ptr<DiscIO::VolumeDisc> volume,
|
||||
std::unique_ptr<VolumeDisc> volume,
|
||||
const std::function<void(std::vector<FSTBuilderNode>* fst_nodes)>& sys_callback,
|
||||
const std::function<void(std::vector<FSTBuilderNode>* fst_nodes, FSTBuilderNode* dol_node)>&
|
||||
fst_callback);
|
||||
|
@ -310,7 +307,7 @@ private:
|
|||
void SetPartitions(std::vector<PartitionWithType>&& partitions);
|
||||
void SetPartitionHeader(DirectoryBlobPartition* partition, u64 partition_address);
|
||||
|
||||
DiscIO::VolumeDisc* GetWrappedVolume() { return m_wrapped_volume.get(); }
|
||||
VolumeDisc* GetWrappedVolume() { return m_wrapped_volume.get(); }
|
||||
|
||||
// For GameCube:
|
||||
DirectoryBlobPartition m_gamecube_pseudopartition;
|
||||
|
@ -325,7 +322,7 @@ private:
|
|||
|
||||
u64 m_data_size;
|
||||
|
||||
std::unique_ptr<DiscIO::VolumeDisc> m_wrapped_volume;
|
||||
std::unique_ptr<VolumeDisc> m_wrapped_volume;
|
||||
};
|
||||
|
||||
} // namespace DiscIO
|
||||
|
|
|
@ -125,7 +125,7 @@ bool DiscScrubber::ParseDisc(const Volume& disc)
|
|||
// Mark the header as used - it's mostly 0s anyways
|
||||
MarkAsUsed(0, 0x50000);
|
||||
|
||||
for (const DiscIO::Partition& partition : disc.GetPartitions())
|
||||
for (const Partition& partition : disc.GetPartitions())
|
||||
{
|
||||
u32 tmd_size;
|
||||
u64 tmd_offset;
|
||||
|
@ -222,7 +222,7 @@ bool DiscScrubber::ParsePartitionData(const Volume& disc, const Partition& parti
|
|||
|
||||
void DiscScrubber::ParseFileSystemData(u64 partition_data_offset, const FileInfo& directory)
|
||||
{
|
||||
for (const DiscIO::FileInfo& file_info : directory)
|
||||
for (const FileInfo& file_info : directory)
|
||||
{
|
||||
DEBUG_LOG_FMT(DISCIO, "Scrubbing {}", file_info.GetPath());
|
||||
if (file_info.IsDirectory())
|
||||
|
|
|
@ -207,23 +207,23 @@ bool IsGCZBlockSizeLegacyCompatible(int block_size, u64 file_size)
|
|||
return file_size % block_size == 0 && file_size % (block_size * 32) != 0;
|
||||
}
|
||||
|
||||
bool IsDiscImageBlockSizeValid(int block_size, DiscIO::BlobType format)
|
||||
bool IsDiscImageBlockSizeValid(int block_size, BlobType format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case DiscIO::BlobType::GCZ:
|
||||
case BlobType::GCZ:
|
||||
// Block size "must" be a power of 2
|
||||
if (!MathUtil::IsPow2(block_size))
|
||||
return false;
|
||||
|
||||
break;
|
||||
case DiscIO::BlobType::WIA:
|
||||
case BlobType::WIA:
|
||||
// Block size must not be less than the minimum, and must be a multiple of it
|
||||
if (block_size < WIA_MIN_BLOCK_SIZE || block_size % WIA_MIN_BLOCK_SIZE != 0)
|
||||
return false;
|
||||
|
||||
break;
|
||||
case DiscIO::BlobType::RVZ:
|
||||
case BlobType::RVZ:
|
||||
// Block size must not be smaller than the minimum
|
||||
// Block sizes smaller than the large block size threshold must be a power of 2
|
||||
// Block sizes larger than that threshold must be a multiple of the threshold
|
||||
|
|
|
@ -87,5 +87,5 @@ u64 GetBiggestReferencedOffset(const Volume& volume);
|
|||
u64 GetBiggestReferencedOffset(const Volume& volume, const std::vector<Partition>& partitions);
|
||||
|
||||
bool IsGCZBlockSizeLegacyCompatible(int block_size, u64 file_size);
|
||||
bool IsDiscImageBlockSizeValid(int block_size, DiscIO::BlobType format);
|
||||
bool IsDiscImageBlockSizeValid(int block_size, BlobType format);
|
||||
} // namespace DiscIO
|
||||
|
|
|
@ -117,16 +117,16 @@ std::string GetName(Region region, bool translate)
|
|||
|
||||
switch (region)
|
||||
{
|
||||
case DiscIO::Region::NTSC_J:
|
||||
case Region::NTSC_J:
|
||||
name = _trans("NTSC-J");
|
||||
break;
|
||||
case DiscIO::Region::NTSC_U:
|
||||
case Region::NTSC_U:
|
||||
name = _trans("NTSC-U");
|
||||
break;
|
||||
case DiscIO::Region::PAL:
|
||||
case Region::PAL:
|
||||
name = _trans("PAL");
|
||||
break;
|
||||
case DiscIO::Region::NTSC_K:
|
||||
case Region::NTSC_K:
|
||||
name = _trans("NTSC-K");
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -23,7 +23,7 @@ static std::string MakeAbsolute(const std::string& directory, const std::string&
|
|||
|
||||
std::optional<GameModDescriptor> ParseGameModDescriptorFile(const std::string& filename)
|
||||
{
|
||||
::File::IOFile f(filename, "rb");
|
||||
File::IOFile f(filename, "rb");
|
||||
if (!f)
|
||||
return std::nullopt;
|
||||
|
||||
|
@ -212,7 +212,7 @@ bool WriteGameModDescriptorFile(const std::string& filename, const GameModDescri
|
|||
if (json.empty())
|
||||
return false;
|
||||
|
||||
::File::IOFile f(filename, "wb");
|
||||
File::IOFile f(filename, "wb");
|
||||
if (!f)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -197,10 +197,10 @@ FileDataLoaderHostFS::GetFolderContents(std::string_view external_relative_path)
|
|||
if (!path)
|
||||
return {};
|
||||
::File::FSTEntry external_files = ::File::ScanDirectoryTree(*path, false);
|
||||
std::vector<FileDataLoader::Node> nodes;
|
||||
std::vector<Node> nodes;
|
||||
nodes.reserve(external_files.children.size());
|
||||
for (auto& file : external_files.children)
|
||||
nodes.emplace_back(FileDataLoader::Node{std::move(file.virtualName), file.isDirectory});
|
||||
nodes.emplace_back(Node{std::move(file.virtualName), file.isDirectory});
|
||||
return nodes;
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ static void SplitAt(BuilderContentSource* before, BuilderContentSource* after, u
|
|||
}
|
||||
}
|
||||
|
||||
static void ApplyPatchToFile(const Patch& patch, DiscIO::FSTBuilderNode* file_node,
|
||||
static void ApplyPatchToFile(const Patch& patch, FSTBuilderNode* file_node,
|
||||
std::string_view external_filename, u64 file_patch_offset,
|
||||
u64 raw_external_file_offset, u64 file_patch_length, bool resize)
|
||||
{
|
||||
|
@ -352,8 +352,7 @@ static void ApplyPatchToFile(const Patch& patch, DiscIO::FSTBuilderNode* file_no
|
|||
content.pop_back();
|
||||
}
|
||||
|
||||
static void ApplyPatchToFile(const Patch& patch, const File& file_patch,
|
||||
DiscIO::FSTBuilderNode* file_node)
|
||||
static void ApplyPatchToFile(const Patch& patch, const File& file_patch, FSTBuilderNode* file_node)
|
||||
{
|
||||
// The last two bits of the offset seem to be ignored by actual Riivolution.
|
||||
ApplyPatchToFile(patch, file_node, file_patch.m_external, file_patch.m_offset & ~u64(3),
|
||||
|
@ -378,11 +377,11 @@ static FSTBuilderNode* FindFileNodeInFST(std::string_view path, std::vector<FSTB
|
|||
if (is_file)
|
||||
{
|
||||
return &fst->emplace_back(
|
||||
DiscIO::FSTBuilderNode{std::string(name), 0, std::vector<BuilderContentSource>()});
|
||||
FSTBuilderNode{std::string(name), 0, std::vector<BuilderContentSource>()});
|
||||
}
|
||||
|
||||
auto& new_folder = fst->emplace_back(
|
||||
DiscIO::FSTBuilderNode{std::string(name), 0, std::vector<FSTBuilderNode>()});
|
||||
auto& new_folder =
|
||||
fst->emplace_back(FSTBuilderNode{std::string(name), 0, std::vector<FSTBuilderNode>()});
|
||||
return FindFileNodeInFST(path.substr(path_separator + 1),
|
||||
&std::get<std::vector<FSTBuilderNode>>(new_folder.m_content), true);
|
||||
}
|
||||
|
@ -398,14 +397,14 @@ static FSTBuilderNode* FindFileNodeInFST(std::string_view path, std::vector<FSTB
|
|||
create_if_not_exists);
|
||||
}
|
||||
|
||||
static DiscIO::FSTBuilderNode* FindFilenameNodeInFST(std::string_view filename,
|
||||
std::vector<FSTBuilderNode>& fst)
|
||||
static FSTBuilderNode* FindFilenameNodeInFST(std::string_view filename,
|
||||
std::vector<FSTBuilderNode>& fst)
|
||||
{
|
||||
for (FSTBuilderNode& node : fst)
|
||||
{
|
||||
if (node.IsFolder())
|
||||
{
|
||||
DiscIO::FSTBuilderNode* result = FindFilenameNodeInFST(filename, node.GetFolderContent());
|
||||
FSTBuilderNode* result = FindFilenameNodeInFST(filename, node.GetFolderContent());
|
||||
if (result)
|
||||
return result;
|
||||
}
|
||||
|
@ -419,13 +418,12 @@ static DiscIO::FSTBuilderNode* FindFilenameNodeInFST(std::string_view filename,
|
|||
}
|
||||
|
||||
static void ApplyFilePatchToFST(const Patch& patch, const File& file,
|
||||
std::vector<DiscIO::FSTBuilderNode>* fst,
|
||||
DiscIO::FSTBuilderNode* dol_node)
|
||||
std::vector<FSTBuilderNode>* fst, FSTBuilderNode* dol_node)
|
||||
{
|
||||
if (!file.m_disc.empty() && file.m_disc[0] == '/')
|
||||
{
|
||||
// If the disc path starts with a / then we should patch that specific disc path.
|
||||
DiscIO::FSTBuilderNode* node =
|
||||
FSTBuilderNode* node =
|
||||
FindFileNodeInFST(std::string_view(file.m_disc).substr(1), fst, file.m_create);
|
||||
if (node)
|
||||
ApplyPatchToFile(patch, file, node);
|
||||
|
@ -438,16 +436,15 @@ static void ApplyFilePatchToFST(const Patch& patch, const File& file,
|
|||
else
|
||||
{
|
||||
// Otherwise we want to patch the first file in the FST that matches that filename.
|
||||
DiscIO::FSTBuilderNode* node = FindFilenameNodeInFST(file.m_disc, *fst);
|
||||
FSTBuilderNode* node = FindFilenameNodeInFST(file.m_disc, *fst);
|
||||
if (node)
|
||||
ApplyPatchToFile(patch, file, node);
|
||||
}
|
||||
}
|
||||
|
||||
static void ApplyFolderPatchToFST(const Patch& patch, const Folder& folder,
|
||||
std::vector<DiscIO::FSTBuilderNode>* fst,
|
||||
DiscIO::FSTBuilderNode* dol_node, std::string_view disc_path,
|
||||
std::string_view external_path)
|
||||
std::vector<FSTBuilderNode>* fst, FSTBuilderNode* dol_node,
|
||||
std::string_view disc_path, std::string_view external_path)
|
||||
{
|
||||
const auto external_files = patch.m_file_data_loader->GetFolderContents(external_path);
|
||||
for (const auto& child : external_files)
|
||||
|
@ -485,8 +482,7 @@ static void ApplyFolderPatchToFST(const Patch& patch, const Folder& folder,
|
|||
}
|
||||
|
||||
static void ApplyFolderPatchToFST(const Patch& patch, const Folder& folder,
|
||||
std::vector<DiscIO::FSTBuilderNode>* fst,
|
||||
DiscIO::FSTBuilderNode* dol_node)
|
||||
std::vector<FSTBuilderNode>* fst, FSTBuilderNode* dol_node)
|
||||
{
|
||||
ApplyFolderPatchToFST(patch, folder, fst, dol_node, folder.m_disc, folder.m_external);
|
||||
}
|
||||
|
|
|
@ -56,8 +56,7 @@ public:
|
|||
|
||||
std::optional<u64> GetExternalFileSize(std::string_view external_relative_path) override;
|
||||
std::vector<u8> GetFileContents(std::string_view external_relative_path) override;
|
||||
std::vector<FileDataLoader::Node>
|
||||
GetFolderContents(std::string_view external_relative_path) override;
|
||||
std::vector<Node> GetFolderContents(std::string_view external_relative_path) override;
|
||||
BuilderContentSource MakeContentSource(std::string_view external_relative_path,
|
||||
u64 external_offset, u64 external_size,
|
||||
u64 disc_offset) override;
|
||||
|
|
|
@ -65,7 +65,7 @@ void RedumpVerifier::Start(const Volume& volume)
|
|||
m_disc_number = volume.GetDiscNumber().value_or(0);
|
||||
m_size = volume.GetDataSize();
|
||||
|
||||
const DiscIO::Platform platform = volume.GetVolumeType();
|
||||
const Platform platform = volume.GetVolumeType();
|
||||
|
||||
m_future = std::async(std::launch::async, [this, platform]() -> std::vector<PotentialMatch> {
|
||||
std::string system;
|
||||
|
@ -624,7 +624,7 @@ bool VolumeVerifier::CheckPartition(const Partition& partition)
|
|||
if (blank_contents)
|
||||
return false;
|
||||
|
||||
const DiscIO::FileSystem* filesystem = m_volume.GetFileSystem(partition);
|
||||
const FileSystem* filesystem = m_volume.GetFileSystem(partition);
|
||||
if (!filesystem)
|
||||
{
|
||||
if (m_is_datel)
|
||||
|
@ -755,7 +755,7 @@ void VolumeVerifier::CheckVolumeSize()
|
|||
u64 volume_size = m_volume.GetDataSize();
|
||||
const bool is_disc = IsDisc(m_volume.GetVolumeType());
|
||||
const bool should_be_dual_layer = is_disc && ShouldBeDualLayer();
|
||||
bool volume_size_roughly_known = m_data_size_type != DiscIO::DataSizeType::UpperBound;
|
||||
bool volume_size_roughly_known = m_data_size_type != DataSizeType::UpperBound;
|
||||
|
||||
if (should_be_dual_layer && m_biggest_referenced_offset <= SL_DVD_R_SIZE)
|
||||
{
|
||||
|
@ -766,7 +766,7 @@ void VolumeVerifier::CheckVolumeSize()
|
|||
"This problem generally only exists in illegal copies of games."));
|
||||
}
|
||||
|
||||
if (m_data_size_type != DiscIO::DataSizeType::Accurate)
|
||||
if (m_data_size_type != DataSizeType::Accurate)
|
||||
{
|
||||
AddProblem(Severity::Low,
|
||||
Common::GetStringT("The format that the disc image is saved in does not "
|
||||
|
@ -799,7 +799,7 @@ void VolumeVerifier::CheckVolumeSize()
|
|||
// The reason why this condition is checking for m_data_size_type != UpperBound instead of
|
||||
// m_data_size_type == Accurate is because we want to show the warning about input recordings and
|
||||
// NetPlay for NFS disc images (which are the only disc images that have it set to LowerBound).
|
||||
if (is_disc && m_data_size_type != DiscIO::DataSizeType::UpperBound && !m_is_tgc)
|
||||
if (is_disc && m_data_size_type != DataSizeType::UpperBound && !m_is_tgc)
|
||||
{
|
||||
const Platform platform = m_volume.GetVolumeType();
|
||||
const bool should_be_gc_size = platform == Platform::GameCubeDisc || m_is_datel;
|
||||
|
@ -1018,7 +1018,7 @@ void VolumeVerifier::CheckSuperPaperMario()
|
|||
// bytes are zeroes like in good dumps, the game works correctly, but otherwise it can freeze
|
||||
// (depending on the exact values of the extra bytes). https://bugs.dolphin-emu.org/issues/11900
|
||||
|
||||
const DiscIO::Partition partition = m_volume.GetGamePartition();
|
||||
const Partition partition = m_volume.GetGamePartition();
|
||||
const FileSystem* fs = m_volume.GetFileSystem(partition);
|
||||
if (!fs)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue