mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
fsmitm_romfsbuild: Add support for stubbing and IPS patches in LFS
This commit is contained in:
parent
f85f2b3728
commit
bc4bec8a60
1 changed files with 14 additions and 0 deletions
|
@ -26,6 +26,7 @@
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "core/file_sys/fsmitm_romfsbuild.h"
|
#include "core/file_sys/fsmitm_romfsbuild.h"
|
||||||
|
#include "core/file_sys/ips_layer.h"
|
||||||
#include "core/file_sys/vfs.h"
|
#include "core/file_sys/vfs.h"
|
||||||
#include "core/file_sys/vfs_vector.h"
|
#include "core/file_sys/vfs_vector.h"
|
||||||
|
|
||||||
|
@ -138,6 +139,9 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs,
|
||||||
|
|
||||||
for (const auto& kv : entries) {
|
for (const auto& kv : entries) {
|
||||||
if (kv.second == VfsEntryType::Directory) {
|
if (kv.second == VfsEntryType::Directory) {
|
||||||
|
if (dir->GetSubdirectory(kv.first + ".stub") != nullptr)
|
||||||
|
continue;
|
||||||
|
|
||||||
const auto child = std::make_shared<RomFSBuildDirectoryContext>();
|
const auto child = std::make_shared<RomFSBuildDirectoryContext>();
|
||||||
// Set child's path.
|
// Set child's path.
|
||||||
child->cur_path_ofs = parent->path_len + 1;
|
child->cur_path_ofs = parent->path_len + 1;
|
||||||
|
@ -151,6 +155,9 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs,
|
||||||
child_dirs.push_back(child);
|
child_dirs.push_back(child);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (dir->GetFile(kv.first + ".stub") != nullptr)
|
||||||
|
continue;
|
||||||
|
|
||||||
const auto child = std::make_shared<RomFSBuildFileContext>();
|
const auto child = std::make_shared<RomFSBuildFileContext>();
|
||||||
// Set child's path.
|
// Set child's path.
|
||||||
child->cur_path_ofs = parent->path_len + 1;
|
child->cur_path_ofs = parent->path_len + 1;
|
||||||
|
@ -162,6 +169,13 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs,
|
||||||
|
|
||||||
child->source = root_romfs->GetFileRelative(child->path);
|
child->source = root_romfs->GetFileRelative(child->path);
|
||||||
|
|
||||||
|
if (dir->GetFile(kv.first + ".ips") != nullptr) {
|
||||||
|
const auto ips = dir->GetFile(kv.first + ".ips");
|
||||||
|
auto patched = PatchIPS(child->source, ips);
|
||||||
|
if (patched != nullptr)
|
||||||
|
child->source = std::move(patched);
|
||||||
|
}
|
||||||
|
|
||||||
child->size = child->source->GetSize();
|
child->size = child->source->GetSize();
|
||||||
|
|
||||||
AddFile(parent, child);
|
AddFile(parent, child);
|
||||||
|
|
Loading…
Reference in a new issue