summaryrefslogtreecommitdiffstats
path: root/src/core/loader
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/loader/deconstructed_rom_directory.cpp5
-rw-r--r--src/core/loader/nso.cpp4
-rw-r--r--src/core/loader/nso.h2
3 files changed, 5 insertions, 6 deletions
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp
index 338f6b01b..9a86e5824 100644
--- a/src/core/loader/deconstructed_rom_directory.cpp
+++ b/src/core/loader/deconstructed_rom_directory.cpp
@@ -130,6 +130,7 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(Kernel::Process& process)
}
process.LoadFromMetadata(metadata);
+ const FileSys::PatchManager pm(metadata.GetTitleID());
// Load NSO modules
const VAddr base_address = process.VMManager().GetCodeRegionBaseAddress();
@@ -139,9 +140,7 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(Kernel::Process& process)
const FileSys::VirtualFile module_file = dir->GetFile(module);
if (module_file != nullptr) {
const VAddr load_addr = next_load_addr;
- next_load_addr = AppLoader_NSO::LoadModule(
- module_file, load_addr,
- std::make_shared<FileSys::PatchManager>(metadata.GetTitleID()));
+ next_load_addr = AppLoader_NSO::LoadModule(module_file, load_addr, pm);
LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", module, load_addr);
// Register module with GDBStub
GDBStub::RegisterModule(module, load_addr, next_load_addr - 1, false);
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index d22a88af1..2186b02af 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -94,7 +94,7 @@ static constexpr u32 PageAlignSize(u32 size) {
}
VAddr AppLoader_NSO::LoadModule(FileSys::VirtualFile file, VAddr load_base,
- std::shared_ptr<FileSys::PatchManager> pm) {
+ boost::optional<FileSys::PatchManager> pm) {
if (file == nullptr)
return {};
@@ -144,7 +144,7 @@ VAddr AppLoader_NSO::LoadModule(FileSys::VirtualFile file, VAddr load_base,
program_image.resize(image_size);
// Apply patches if necessary
- if (pm != nullptr && pm->HasNSOPatch(nso_header.build_id)) {
+ if (pm != boost::none && pm->HasNSOPatch(nso_header.build_id)) {
std::vector<u8> pi_header(program_image.size() + 0x100);
std::memcpy(pi_header.data(), &nso_header, sizeof(NsoHeader));
std::memcpy(pi_header.data() + 0x100, program_image.data(), program_image.size());
diff --git a/src/core/loader/nso.h b/src/core/loader/nso.h
index 7c26aa4ba..05353d4d9 100644
--- a/src/core/loader/nso.h
+++ b/src/core/loader/nso.h
@@ -28,7 +28,7 @@ public:
}
static VAddr LoadModule(FileSys::VirtualFile file, VAddr load_base,
- std::shared_ptr<FileSys::PatchManager> pm = nullptr);
+ boost::optional<FileSys::PatchManager> pm = boost::none);
ResultStatus Load(Kernel::Process& process) override;
};