RiivolutionPatcher: Load external files with a layer of indirection during the patching process to properly resolve the paths given in the XML.

This also may eventually allow loading patches from sources other than the 1:1 expected file structure host file system, such as memory or an archive file.
This commit is contained in:
Admiral H. Curtiss 2021-09-28 06:12:45 +02:00
parent 175f225ac1
commit 6ec4af7ea4
No known key found for this signature in database
GPG key ID: F051B4C4044F33FB
5 changed files with 260 additions and 51 deletions

View file

@ -16,8 +16,8 @@
#include "Common/FileSearch.h"
#include "Common/FileUtil.h"
#include "Common/StringUtil.h"
#include "DiscIO/RiivolutionParser.h"
#include "DiscIO/RiivolutionPatcher.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
struct GuiRiivolutionPatchIndex
@ -178,13 +178,11 @@ void RiivolutionBootWidget::BootGame()
{
auto patches = disc.GeneratePatches(m_game_id);
// set the root path for each patch
// set the file loader for each patch
for (auto& patch : patches)
{
if (patch.m_root.empty())
SplitPath(disc.m_xml_path, &patch.m_root, nullptr, nullptr);
else
patch.m_root = riivolution_dir + "/" + patch.m_root;
patch.m_file_data_loader = std::make_shared<DiscIO::Riivolution::FileDataLoaderHostFS>(
riivolution_dir, disc.m_xml_path, patch.m_root);
}
m_patches.insert(m_patches.end(), patches.begin(), patches.end());