summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2022-06-09 00:25:11 +0200
committerAdmiral H. Curtiss <pikachu025@gmail.com>2022-07-19 00:55:04 +0200
commitcc315cb7afa26693979d6faf43bedd6dd50722e1 (patch)
treef694a8ad1718892f04ea3dd278a20126f33cd66a /Source/Core
parentf5c132580ced295a5e795be8cf4c65de7d4624a3 (diff)
DiscIO/Riivolution: Add dolphin-specific extensions "dolphin_sys_file" and "dolphin_sys_folder" to patch sys files like you would patch regular files.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Boot/Boot.cpp3
-rw-r--r--Source/Core/DiscIO/RiivolutionParser.cpp11
-rw-r--r--Source/Core/DiscIO/RiivolutionParser.h2
-rw-r--r--Source/Core/DiscIO/RiivolutionPatcher.cpp11
-rw-r--r--Source/Core/DiscIO/RiivolutionPatcher.h8
5 files changed, 26 insertions, 9 deletions
diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp
index 86ea8e2179..94b66bd687 100644
--- a/Source/Core/Core/Boot/Boot.cpp
+++ b/Source/Core/Core/Boot/Boot.cpp
@@ -701,7 +701,8 @@ void AddRiivolutionPatches(BootParameters* boot_params,
disc.volume = DiscIO::CreateDisc(DiscIO::DirectoryBlobReader::Create(
std::move(disc.volume),
[&](std::vector<DiscIO::FSTBuilderNode>* fst, DiscIO::FSTBuilderNode* dol_node) {
- DiscIO::Riivolution::ApplyPatchesToFiles(riivolution_patches, fst, dol_node);
+ DiscIO::Riivolution::ApplyPatchesToFiles(
+ riivolution_patches, DiscIO::Riivolution::PatchIndex::FileSystem, fst, dol_node);
}));
boot_params->riivolution_patches = std::move(riivolution_patches);
}
diff --git a/Source/Core/DiscIO/RiivolutionParser.cpp b/Source/Core/DiscIO/RiivolutionParser.cpp
index 283e5876df..dacbbbcfc5 100644
--- a/Source/Core/DiscIO/RiivolutionParser.cpp
+++ b/Source/Core/DiscIO/RiivolutionParser.cpp
@@ -172,9 +172,10 @@ std::optional<Disc> ParseString(std::string_view xml, std::string xml_path)
for (const auto& patch_subnode : patch_node.children())
{
const std::string_view patch_name(patch_subnode.name());
- if (patch_name == "file")
+ if (patch_name == "file" || patch_name == "dolphin_sys_file")
{
- auto& file = patch.m_file_patches.emplace_back();
+ auto& file = patch_name == "dolphin_sys_file" ? patch.m_sys_file_patches.emplace_back() :
+ patch.m_file_patches.emplace_back();
file.m_disc = patch_subnode.attribute("disc").as_string();
file.m_external = patch_subnode.attribute("external").as_string();
file.m_resize = patch_subnode.attribute("resize").as_bool(true);
@@ -183,9 +184,11 @@ std::optional<Disc> ParseString(std::string_view xml, std::string xml_path)
file.m_fileoffset = patch_subnode.attribute("fileoffset").as_uint(0);
file.m_length = patch_subnode.attribute("length").as_uint(0);
}
- else if (patch_name == "folder")
+ else if (patch_name == "folder" || patch_name == "dolphin_sys_folder")
{
- auto& folder = patch.m_folder_patches.emplace_back();
+ auto& folder = patch_name == "dolphin_sys_folder" ?
+ patch.m_sys_folder_patches.emplace_back() :
+ patch.m_folder_patches.emplace_back();
folder.m_disc = patch_subnode.attribute("disc").as_string();
folder.m_external = patch_subnode.attribute("external").as_string();
folder.m_resize = patch_subnode.attribute("resize").as_bool(true);
diff --git a/Source/Core/DiscIO/RiivolutionParser.h b/Source/Core/DiscIO/RiivolutionParser.h
index f9f03f67c1..9ec6c92959 100644
--- a/Source/Core/DiscIO/RiivolutionParser.h
+++ b/Source/Core/DiscIO/RiivolutionParser.h
@@ -166,6 +166,8 @@ struct Patch
std::vector<File> m_file_patches;
std::vector<Folder> m_folder_patches;
+ std::vector<File> m_sys_file_patches;
+ std::vector<Folder> m_sys_folder_patches;
std::vector<Savegame> m_savegame_patches;
std::vector<Memory> m_memory_patches;
diff --git a/Source/Core/DiscIO/RiivolutionPatcher.cpp b/Source/Core/DiscIO/RiivolutionPatcher.cpp
index a9593dddcd..8ad65f8c57 100644
--- a/Source/Core/DiscIO/RiivolutionPatcher.cpp
+++ b/Source/Core/DiscIO/RiivolutionPatcher.cpp
@@ -458,15 +458,20 @@ static void ApplyFolderPatchToFST(const Patch& patch, const Folder& folder,
ApplyFolderPatchToFST(patch, folder, fst, dol_node, folder.m_disc, folder.m_external);
}
-void ApplyPatchesToFiles(const std::vector<Patch>& patches,
+void ApplyPatchesToFiles(const std::vector<Patch>& patches, PatchIndex index,
std::vector<DiscIO::FSTBuilderNode>* fst, DiscIO::FSTBuilderNode* dol_node)
{
for (const auto& patch : patches)
{
- for (const auto& file : patch.m_file_patches)
+ const auto& file_patches =
+ index == PatchIndex::DolphinSysFiles ? patch.m_sys_file_patches : patch.m_file_patches;
+ const auto& folder_patches =
+ index == PatchIndex::DolphinSysFiles ? patch.m_sys_folder_patches : patch.m_folder_patches;
+
+ for (const auto& file : file_patches)
ApplyFilePatchToFST(patch, file, fst, dol_node);
- for (const auto& folder : patch.m_folder_patches)
+ for (const auto& folder : folder_patches)
ApplyFolderPatchToFST(patch, folder, fst, dol_node);
}
}
diff --git a/Source/Core/DiscIO/RiivolutionPatcher.h b/Source/Core/DiscIO/RiivolutionPatcher.h
index 0f3de33caf..0a83ba9d13 100644
--- a/Source/Core/DiscIO/RiivolutionPatcher.h
+++ b/Source/Core/DiscIO/RiivolutionPatcher.h
@@ -65,7 +65,13 @@ private:
std::string m_patch_root;
};
-void ApplyPatchesToFiles(const std::vector<Patch>& patches,
+enum class PatchIndex
+{
+ FileSystem,
+ DolphinSysFiles,
+};
+
+void ApplyPatchesToFiles(const std::vector<Patch>& patches, PatchIndex index,
std::vector<DiscIO::FSTBuilderNode>* fst,
DiscIO::FSTBuilderNode* dol_node);
void ApplyGeneralMemoryPatches(const std::vector<Patch>& patches);