diff options
author | bunnei <bunneidev@gmail.com> | 2018-10-07 05:58:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-07 05:58:24 +0200 |
commit | 6e4d2e672d1083f29186ea0ddcb33cd634e360e3 (patch) | |
tree | cbd20aab8705f8efac340c509ca71b08865a1417 /src/core/loader/nsp.cpp | |
parent | Merge pull request #1446 from bunnei/fast_fermi_copy (diff) | |
parent | romfs_factory: Extract packed update setter to new function (diff) | |
download | yuzu-6e4d2e672d1083f29186ea0ddcb33cd634e360e3.tar yuzu-6e4d2e672d1083f29186ea0ddcb33cd634e360e3.tar.gz yuzu-6e4d2e672d1083f29186ea0ddcb33cd634e360e3.tar.bz2 yuzu-6e4d2e672d1083f29186ea0ddcb33cd634e360e3.tar.lz yuzu-6e4d2e672d1083f29186ea0ddcb33cd634e360e3.tar.xz yuzu-6e4d2e672d1083f29186ea0ddcb33cd634e360e3.tar.zst yuzu-6e4d2e672d1083f29186ea0ddcb33cd634e360e3.zip |
Diffstat (limited to 'src/core/loader/nsp.cpp')
-rw-r--r-- | src/core/loader/nsp.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp index b7ba77ef4..5534ce01c 100644 --- a/src/core/loader/nsp.cpp +++ b/src/core/loader/nsp.cpp @@ -10,8 +10,10 @@ #include "core/file_sys/control_metadata.h" #include "core/file_sys/nca_metadata.h" #include "core/file_sys/patch_manager.h" +#include "core/file_sys/registered_cache.h" #include "core/file_sys/submission_package.h" #include "core/hle/kernel/process.h" +#include "core/hle/service/filesystem/filesystem.h" #include "core/loader/deconstructed_rom_directory.h" #include "core/loader/nca.h" #include "core/loader/nsp.h" @@ -91,13 +93,39 @@ ResultStatus AppLoader_NSP::Load(Kernel::Process& process) { if (result != ResultStatus::Success) return result; + FileSys::VirtualFile update_raw; + if (ReadUpdateRaw(update_raw) == ResultStatus::Success && update_raw != nullptr) + Service::FileSystem::SetPackedUpdate(std::move(update_raw)); + is_loaded = true; return ResultStatus::Success; } -ResultStatus AppLoader_NSP::ReadRomFS(FileSys::VirtualFile& dir) { - return secondary_loader->ReadRomFS(dir); +ResultStatus AppLoader_NSP::ReadRomFS(FileSys::VirtualFile& file) { + return secondary_loader->ReadRomFS(file); +} + +u64 AppLoader_NSP::ReadRomFSIVFCOffset() const { + return secondary_loader->ReadRomFSIVFCOffset(); +} + +ResultStatus AppLoader_NSP::ReadUpdateRaw(FileSys::VirtualFile& file) { + if (nsp->IsExtractedType()) + return ResultStatus::ErrorNoPackedUpdate; + + const auto read = + nsp->GetNCAFile(FileSys::GetUpdateTitleID(title_id), FileSys::ContentRecordType::Program); + + if (read == nullptr) + return ResultStatus::ErrorNoPackedUpdate; + const auto nca_test = std::make_shared<FileSys::NCA>(read); + + if (nca_test->GetStatus() != ResultStatus::ErrorMissingBKTRBaseRomFS) + return nca_test->GetStatus(); + + file = read; + return ResultStatus::Success; } ResultStatus AppLoader_NSP::ReadProgramId(u64& out_program_id) { |