summaryrefslogtreecommitdiff
path: root/src/core/loader/loader.cpp
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-08-25 11:44:14 -0400
committerGravatar Zach Hilman2018-09-04 14:25:54 -0400
commitb555311438ae1e2ad1e9caea55cc9f77c9ed4661 (patch)
tree40f5cad8d049e67e1a189cae1e5f4063c7b555d7 /src/core/loader/loader.cpp
parentkey_manager: Avoid autogeneration if key exists (diff)
downloadyuzu-b555311438ae1e2ad1e9caea55cc9f77c9ed4661.tar.gz
yuzu-b555311438ae1e2ad1e9caea55cc9f77c9ed4661.tar.xz
yuzu-b555311438ae1e2ad1e9caea55cc9f77c9ed4661.zip
loader: Add NSP file type and NSP-specific errors
Diffstat (limited to 'src/core/loader/loader.cpp')
-rw-r--r--src/core/loader/loader.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index 5980cdb25..446adf557 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -15,6 +15,7 @@
15#include "core/loader/nca.h" 15#include "core/loader/nca.h"
16#include "core/loader/nro.h" 16#include "core/loader/nro.h"
17#include "core/loader/nso.h" 17#include "core/loader/nso.h"
18#include "core/loader/nsp.h"
18#include "core/loader/xci.h" 19#include "core/loader/xci.h"
19 20
20namespace Loader { 21namespace Loader {
@@ -34,6 +35,7 @@ FileType IdentifyFile(FileSys::VirtualFile file) {
34 CHECK_TYPE(NCA) 35 CHECK_TYPE(NCA)
35 CHECK_TYPE(XCI) 36 CHECK_TYPE(XCI)
36 CHECK_TYPE(NAX) 37 CHECK_TYPE(NAX)
38 CHECK_TYPE(NSP)
37 39
38#undef CHECK_TYPE 40#undef CHECK_TYPE
39 41
@@ -59,6 +61,8 @@ FileType GuessFromFilename(const std::string& name) {
59 return FileType::NCA; 61 return FileType::NCA;
60 if (extension == "xci") 62 if (extension == "xci")
61 return FileType::XCI; 63 return FileType::XCI;
64 if (extension == "nsp")
65 return FileType::NSP;
62 66
63 return FileType::Unknown; 67 return FileType::Unknown;
64} 68}
@@ -77,6 +81,8 @@ std::string GetFileTypeString(FileType type) {
77 return "XCI"; 81 return "XCI";
78 case FileType::NAX: 82 case FileType::NAX:
79 return "NAX"; 83 return "NAX";
84 case FileType::NSP:
85 return "NSP";
80 case FileType::DeconstructedRomDirectory: 86 case FileType::DeconstructedRomDirectory:
81 return "Directory"; 87 return "Directory";
82 case FileType::Error: 88 case FileType::Error:
@@ -87,7 +93,7 @@ std::string GetFileTypeString(FileType type) {
87 return "unknown"; 93 return "unknown";
88} 94}
89 95
90constexpr std::array<const char*, 49> RESULT_MESSAGES{ 96constexpr std::array<const char*, 50> RESULT_MESSAGES{
91 "The operation completed successfully.", 97 "The operation completed successfully.",
92 "The loader requested to load is already loaded.", 98 "The loader requested to load is already loaded.",
93 "The operation is not implemented.", 99 "The operation is not implemented.",
@@ -137,7 +143,7 @@ constexpr std::array<const char*, 49> RESULT_MESSAGES{
137 "The AES Key Generation Source could not be found.", 143 "The AES Key Generation Source could not be found.",
138 "The SD Save Key Source could not be found.", 144 "The SD Save Key Source could not be found.",
139 "The SD NCA Key Source could not be found.", 145 "The SD NCA Key Source could not be found.",
140}; 146 "The NSP file is missing a Program-type NCA."};
141 147
142std::ostream& operator<<(std::ostream& os, ResultStatus status) { 148std::ostream& operator<<(std::ostream& os, ResultStatus status) {
143 os << RESULT_MESSAGES.at(static_cast<size_t>(status)); 149 os << RESULT_MESSAGES.at(static_cast<size_t>(status));
@@ -182,6 +188,10 @@ static std::unique_ptr<AppLoader> GetFileLoader(FileSys::VirtualFile file, FileT
182 case FileType::NAX: 188 case FileType::NAX:
183 return std::make_unique<AppLoader_NAX>(std::move(file)); 189 return std::make_unique<AppLoader_NAX>(std::move(file));
184 190
191 // NX NSP (Nintendo Submission Package) file format
192 case FileType::NSP:
193 return std::make_unique<AppLoader_NSP>(std::move(file));
194
185 // NX deconstructed ROM directory. 195 // NX deconstructed ROM directory.
186 case FileType::DeconstructedRomDirectory: 196 case FileType::DeconstructedRomDirectory:
187 return std::make_unique<AppLoader_DeconstructedRomDirectory>(std::move(file)); 197 return std::make_unique<AppLoader_DeconstructedRomDirectory>(std::move(file));