diff options
Diffstat (limited to 'src/core/loader/loader.cpp')
| -rw-r--r-- | src/core/loader/loader.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index 70ef5d240..c13fb49b8 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include "core/hle/kernel/process.h" | 11 | #include "core/hle/kernel/process.h" |
| 12 | #include "core/loader/deconstructed_rom_directory.h" | 12 | #include "core/loader/deconstructed_rom_directory.h" |
| 13 | #include "core/loader/elf.h" | 13 | #include "core/loader/elf.h" |
| 14 | #include "core/loader/nax.h" | ||
| 14 | #include "core/loader/nca.h" | 15 | #include "core/loader/nca.h" |
| 15 | #include "core/loader/nro.h" | 16 | #include "core/loader/nro.h" |
| 16 | #include "core/loader/nso.h" | 17 | #include "core/loader/nso.h" |
| @@ -32,6 +33,7 @@ FileType IdentifyFile(FileSys::VirtualFile file) { | |||
| 32 | CHECK_TYPE(NRO) | 33 | CHECK_TYPE(NRO) |
| 33 | CHECK_TYPE(NCA) | 34 | CHECK_TYPE(NCA) |
| 34 | CHECK_TYPE(XCI) | 35 | CHECK_TYPE(XCI) |
| 36 | CHECK_TYPE(NAX) | ||
| 35 | 37 | ||
| 36 | #undef CHECK_TYPE | 38 | #undef CHECK_TYPE |
| 37 | 39 | ||
| @@ -73,6 +75,8 @@ std::string GetFileTypeString(FileType type) { | |||
| 73 | return "NCA"; | 75 | return "NCA"; |
| 74 | case FileType::XCI: | 76 | case FileType::XCI: |
| 75 | return "XCI"; | 77 | return "XCI"; |
| 78 | case FileType::NAX: | ||
| 79 | return "NAX"; | ||
| 76 | case FileType::DeconstructedRomDirectory: | 80 | case FileType::DeconstructedRomDirectory: |
| 77 | return "Directory"; | 81 | return "Directory"; |
| 78 | case FileType::Error: | 82 | case FileType::Error: |
| @@ -83,7 +87,7 @@ std::string GetFileTypeString(FileType type) { | |||
| 83 | return "unknown"; | 87 | return "unknown"; |
| 84 | } | 88 | } |
| 85 | 89 | ||
| 86 | constexpr std::array<const char*, 36> RESULT_MESSAGES{ | 90 | constexpr std::array<const char*, 49> RESULT_MESSAGES{ |
| 87 | "The operation completed successfully.", | 91 | "The operation completed successfully.", |
| 88 | "The loader requested to load is already loaded.", | 92 | "The loader requested to load is already loaded.", |
| 89 | "The operation is not implemented.", | 93 | "The operation is not implemented.", |
| @@ -120,6 +124,19 @@ constexpr std::array<const char*, 36> RESULT_MESSAGES{ | |||
| 120 | "There was a general error loading the NRO into emulated memory.", | 124 | "There was a general error loading the NRO into emulated memory.", |
| 121 | "There is no icon available.", | 125 | "There is no icon available.", |
| 122 | "There is no control data available.", | 126 | "There is no control data available.", |
| 127 | "The NAX file has a bad header.", | ||
| 128 | "The NAX file has incorrect size as determined by the header.", | ||
| 129 | "The HMAC to generated the NAX decryption keys failed.", | ||
| 130 | "The HMAC to validate the NAX decryption keys failed.", | ||
| 131 | "The NAX key derivation failed.", | ||
| 132 | "The NAX file cannot be interpreted as an NCA file.", | ||
| 133 | "The NAX file has an incorrect path.", | ||
| 134 | "The SD seed could not be found or derived.", | ||
| 135 | "The SD KEK Source could not be found.", | ||
| 136 | "The AES KEK Generation Source could not be found.", | ||
| 137 | "The AES Key Generation Source could not be found.", | ||
| 138 | "The SD Save Key Source could not be found.", | ||
| 139 | "The SD NCA Key Source could not be found.", | ||
| 123 | }; | 140 | }; |
| 124 | 141 | ||
| 125 | std::ostream& operator<<(std::ostream& os, ResultStatus status) { | 142 | std::ostream& operator<<(std::ostream& os, ResultStatus status) { |
| @@ -150,13 +167,18 @@ static std::unique_ptr<AppLoader> GetFileLoader(FileSys::VirtualFile file, FileT | |||
| 150 | case FileType::NRO: | 167 | case FileType::NRO: |
| 151 | return std::make_unique<AppLoader_NRO>(std::move(file)); | 168 | return std::make_unique<AppLoader_NRO>(std::move(file)); |
| 152 | 169 | ||
| 153 | // NX NCA file format. | 170 | // NX NCA (Nintendo Content Archive) file format. |
| 154 | case FileType::NCA: | 171 | case FileType::NCA: |
| 155 | return std::make_unique<AppLoader_NCA>(std::move(file)); | 172 | return std::make_unique<AppLoader_NCA>(std::move(file)); |
| 156 | 173 | ||
| 174 | // NX XCI (nX Card Image) file format. | ||
| 157 | case FileType::XCI: | 175 | case FileType::XCI: |
| 158 | return std::make_unique<AppLoader_XCI>(std::move(file)); | 176 | return std::make_unique<AppLoader_XCI>(std::move(file)); |
| 159 | 177 | ||
| 178 | // NX NAX (NintendoAesXts) file format. | ||
| 179 | case FileType::NAX: | ||
| 180 | return std::make_unique<AppLoader_NAX>(std::move(file)); | ||
| 181 | |||
| 160 | // NX deconstructed ROM directory. | 182 | // NX deconstructed ROM directory. |
| 161 | case FileType::DeconstructedRomDirectory: | 183 | case FileType::DeconstructedRomDirectory: |
| 162 | return std::make_unique<AppLoader_DeconstructedRomDirectory>(std::move(file)); | 184 | return std::make_unique<AppLoader_DeconstructedRomDirectory>(std::move(file)); |
| @@ -170,7 +192,8 @@ std::unique_ptr<AppLoader> GetLoader(FileSys::VirtualFile file) { | |||
| 170 | FileType type = IdentifyFile(file); | 192 | FileType type = IdentifyFile(file); |
| 171 | FileType filename_type = GuessFromFilename(file->GetName()); | 193 | FileType filename_type = GuessFromFilename(file->GetName()); |
| 172 | 194 | ||
| 173 | if (type != filename_type) { | 195 | // Special case: 00 is either a NCA or NAX. |
| 196 | if (type != filename_type && !(file->GetName() == "00" && type == FileType::NAX)) { | ||
| 174 | LOG_WARNING(Loader, "File {} has a different type than its extension.", file->GetName()); | 197 | LOG_WARNING(Loader, "File {} has a different type than its extension.", file->GetName()); |
| 175 | if (FileType::Unknown == type) | 198 | if (FileType::Unknown == type) |
| 176 | type = filename_type; | 199 | type = filename_type; |