summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-10-03 07:43:34 +0200
committerLioncash <mathew1800@gmail.com>2018-10-03 07:46:07 +0200
commitccf0a9cb381cad75878c79b962ac61ded0466d08 (patch)
treec0726d59aec1bf8f887e7b3b466743007d81e79f
parentsubmission_package: Move NCA reading code to its own function (diff)
downloadyuzu-ccf0a9cb381cad75878c79b962ac61ded0466d08.tar
yuzu-ccf0a9cb381cad75878c79b962ac61ded0466d08.tar.gz
yuzu-ccf0a9cb381cad75878c79b962ac61ded0466d08.tar.bz2
yuzu-ccf0a9cb381cad75878c79b962ac61ded0466d08.tar.lz
yuzu-ccf0a9cb381cad75878c79b962ac61ded0466d08.tar.xz
yuzu-ccf0a9cb381cad75878c79b962ac61ded0466d08.tar.zst
yuzu-ccf0a9cb381cad75878c79b962ac61ded0466d08.zip
-rw-r--r--src/core/file_sys/submission_package.cpp27
-rw-r--r--src/core/file_sys/submission_package.h1
2 files changed, 18 insertions, 10 deletions
diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp
index b4d738d94..5ebae1503 100644
--- a/src/core/file_sys/submission_package.cpp
+++ b/src/core/file_sys/submission_package.cpp
@@ -53,22 +53,15 @@ NSP::NSP(VirtualFile file_)
return;
}
+ const auto files = pfs->GetFiles();
+
if (IsDirectoryExeFS(pfs)) {
extracted = true;
- exefs = pfs;
-
- const auto& files = pfs->GetFiles();
- const auto romfs_iter =
- std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& file) {
- return file->GetName().find(".romfs") != std::string::npos;
- });
- if (romfs_iter != files.end())
- romfs = *romfs_iter;
+ InitializeExeFSAndRomFS(files);
return;
}
extracted = false;
- const auto files = pfs->GetFiles();
SetTicketKeys(files);
ReadNCAs(files);
@@ -212,6 +205,20 @@ bool NSP::ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) {
return false;
}
+void NSP::InitializeExeFSAndRomFS(const std::vector<VirtualFile>& files) {
+ exefs = pfs;
+
+ const auto romfs_iter = std::find_if(files.begin(), files.end(), [](const VirtualFile& file) {
+ return file->GetName().find(".romfs") != std::string::npos;
+ });
+
+ if (romfs_iter == files.end()) {
+ return;
+ }
+
+ romfs = *romfs_iter;
+}
+
void NSP::ReadNCAs(const std::vector<VirtualFile>& files) {
for (const auto& outer_file : files) {
if (outer_file->GetName().substr(outer_file->GetName().size() - 9) != ".cnmt.nca") {
diff --git a/src/core/file_sys/submission_package.h b/src/core/file_sys/submission_package.h
index 7c7cebf33..297821522 100644
--- a/src/core/file_sys/submission_package.h
+++ b/src/core/file_sys/submission_package.h
@@ -59,6 +59,7 @@ protected:
bool ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) override;
private:
+ void InitializeExeFSAndRomFS(const std::vector<VirtualFile>& files);
void ReadNCAs(const std::vector<VirtualFile>& files);
VirtualFile file;