summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/RiivolutionPatcher.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2022-07-28 20:29:31 -0400
committerGitHub <noreply@github.com>2022-07-28 20:29:31 -0400
commit3bf1ddc54957d597f9e0d6e8a0f5cafa3c65f82f (patch)
treebd3b2f3760af3386b404b6fcd28eb2675208cd82 /Source/Core/DiscIO/RiivolutionPatcher.cpp
parent000c9c7545dca99f2947d77549a7090d3929f9f2 (diff)
parentec3cfc01c1d87b038c72f162cefaa631cb788981 (diff)
Merge pull request #10730 from AdmiralCurtiss/riivolution-sysfile-patches
Riivolution: Add custom extension to patch boot.bin, bi2.bin, and apploader.img.
Diffstat (limited to 'Source/Core/DiscIO/RiivolutionPatcher.cpp')
-rw-r--r--Source/Core/DiscIO/RiivolutionPatcher.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/Source/Core/DiscIO/RiivolutionPatcher.cpp b/Source/Core/DiscIO/RiivolutionPatcher.cpp
index e3d3d88af9..8ad65f8c57 100644
--- a/Source/Core/DiscIO/RiivolutionPatcher.cpp
+++ b/Source/Core/DiscIO/RiivolutionPatcher.cpp
@@ -397,7 +397,7 @@ static void ApplyFilePatchToFST(const Patch& patch, const File& file,
if (node)
ApplyPatchToFile(patch, file, node);
}
- else if (CaseInsensitiveEquals(file.m_disc, "main.dol"))
+ else if (dol_node && CaseInsensitiveEquals(file.m_disc, "main.dol"))
{
// Special case: If the filename is "main.dol", we want to patch the main executable.
ApplyPatchToFile(patch, file, dol_node);
@@ -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);
}
}