diff options
author | Lioncash <mathew1800@gmail.com> | 2018-10-15 03:41:58 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-10-15 23:02:11 +0200 |
commit | bed872ed38e19d34c6c2e3d1a3d35a9f72e46970 (patch) | |
tree | 6533551afe9c5432fa8789a1517a97111d0041c6 /src/core/loader/nso.cpp | |
parent | nso: Make LoadModule take a VfsFile by const reference (diff) | |
download | yuzu-bed872ed38e19d34c6c2e3d1a3d35a9f72e46970.tar yuzu-bed872ed38e19d34c6c2e3d1a3d35a9f72e46970.tar.gz yuzu-bed872ed38e19d34c6c2e3d1a3d35a9f72e46970.tar.bz2 yuzu-bed872ed38e19d34c6c2e3d1a3d35a9f72e46970.tar.lz yuzu-bed872ed38e19d34c6c2e3d1a3d35a9f72e46970.tar.xz yuzu-bed872ed38e19d34c6c2e3d1a3d35a9f72e46970.tar.zst yuzu-bed872ed38e19d34c6c2e3d1a3d35a9f72e46970.zip |
Diffstat (limited to 'src/core/loader/nso.cpp')
-rw-r--r-- | src/core/loader/nso.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index d26fa482c..68efca5c0 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp @@ -93,9 +93,9 @@ static constexpr u32 PageAlignSize(u32 size) { return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK; } -VAddr AppLoader_NSO::LoadModule(const FileSys::VfsFile& file, VAddr load_base, - bool should_pass_arguments, - boost::optional<FileSys::PatchManager> pm) { +std::optional<VAddr> AppLoader_NSO::LoadModule(const FileSys::VfsFile& file, VAddr load_base, + bool should_pass_arguments, + std::optional<FileSys::PatchManager> pm) { if (file.GetSize() < sizeof(NsoHeader)) return {}; @@ -154,7 +154,7 @@ VAddr AppLoader_NSO::LoadModule(const FileSys::VfsFile& file, VAddr load_base, program_image.resize(image_size); // Apply patches if necessary - if (pm != boost::none && pm->HasNSOPatch(nso_header.build_id)) { + if (pm && 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()); @@ -181,7 +181,9 @@ ResultStatus AppLoader_NSO::Load(Kernel::Process& process) { // Load module const VAddr base_address = process.VMManager().GetCodeRegionBaseAddress(); - LoadModule(*file, base_address, true); + if (!LoadModule(*file, base_address, true)) { + return ResultStatus::ErrorLoadingNSO; + } LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", file->GetName(), base_address); process.Run(base_address, Kernel::THREADPRIO_DEFAULT, Memory::DEFAULT_STACK_SIZE); |