summaryrefslogtreecommitdiff
path: root/src/core/loader/xci.cpp
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-09-25 09:18:55 -0400
committerGravatar Zach Hilman2018-10-05 08:46:31 -0400
commit504574882914902f0648e30078038472ae985570 (patch)
treebfa46c9144c1f0f1a5e2375c74996fd1065dbec6 /src/core/loader/xci.cpp
parentloader: Add ReadRomFSIVFCOffset to NSP, XCI, and NAX loaders (diff)
downloadyuzu-504574882914902f0648e30078038472ae985570.tar.gz
yuzu-504574882914902f0648e30078038472ae985570.tar.xz
yuzu-504574882914902f0648e30078038472ae985570.zip
loader: Add getter for packed update
Reads the update included with the game if it has one and adds the new ErrorNoPackedUpdate status.
Diffstat (limited to 'src/core/loader/xci.cpp')
-rw-r--r--src/core/loader/xci.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp
index 12d589fab..9d91ef03a 100644
--- a/src/core/loader/xci.cpp
+++ b/src/core/loader/xci.cpp
@@ -9,6 +9,9 @@
9#include "core/file_sys/content_archive.h" 9#include "core/file_sys/content_archive.h"
10#include "core/file_sys/control_metadata.h" 10#include "core/file_sys/control_metadata.h"
11#include "core/file_sys/patch_manager.h" 11#include "core/file_sys/patch_manager.h"
12#include "core/file_sys/registered_cache.h"
13#include "core/file_sys/romfs.h"
14#include "core/file_sys/submission_package.h"
12#include "core/hle/kernel/process.h" 15#include "core/hle/kernel/process.h"
13#include "core/loader/nca.h" 16#include "core/loader/nca.h"
14#include "core/loader/xci.h" 17#include "core/loader/xci.h"
@@ -75,6 +78,27 @@ ResultStatus AppLoader_XCI::ReadRomFS(FileSys::VirtualFile& file) {
75u64 AppLoader_XCI::ReadRomFSIVFCOffset() const { 78u64 AppLoader_XCI::ReadRomFSIVFCOffset() const {
76 return nca_loader->ReadRomFSIVFCOffset(); 79 return nca_loader->ReadRomFSIVFCOffset();
77} 80}
81
82ResultStatus AppLoader_XCI::ReadUpdateRaw(FileSys::VirtualFile& file) {
83 u64 program_id{};
84 nca_loader->ReadProgramId(program_id);
85 if (program_id == 0)
86 return ResultStatus::ErrorXCIMissingProgramNCA;
87
88 const auto read = xci->GetSecurePartitionNSP()->GetNCAFile(
89 FileSys::GetUpdateTitleID(program_id), FileSys::ContentRecordType::Program);
90
91 if (read == nullptr)
92 return ResultStatus::ErrorNoPackedUpdate;
93 const auto nca_test = std::make_shared<FileSys::NCA>(read);
94
95 if (nca_test->GetStatus() != ResultStatus::ErrorMissingBKTRBaseRomFS)
96 return nca_test->GetStatus();
97
98 file = read;
99 return ResultStatus::Success;
100}
101
78ResultStatus AppLoader_XCI::ReadProgramId(u64& out_program_id) { 102ResultStatus AppLoader_XCI::ReadProgramId(u64& out_program_id) {
79 return nca_loader->ReadProgramId(out_program_id); 103 return nca_loader->ReadProgramId(out_program_id);
80} 104}