summaryrefslogtreecommitdiffstats
path: root/src/core/loader/loader.cpp
diff options
context:
space:
mode:
authorMat M <mathew1800@gmail.com>2018-08-25 05:47:46 +0200
committerGitHub <noreply@github.com>2018-08-25 05:47:46 +0200
commit6426b0f5514d6a7c5cc369368947eceb380bfc85 (patch)
treeb7acdc39a4344570a6f2c098c30ad20114bf84db /src/core/loader/loader.cpp
parentMerge pull request #1065 from DarkLordZach/window-title (diff)
parentfile_sys/crypto: Fix missing/unnecessary includes (diff)
downloadyuzu-6426b0f5514d6a7c5cc369368947eceb380bfc85.tar
yuzu-6426b0f5514d6a7c5cc369368947eceb380bfc85.tar.gz
yuzu-6426b0f5514d6a7c5cc369368947eceb380bfc85.tar.bz2
yuzu-6426b0f5514d6a7c5cc369368947eceb380bfc85.tar.lz
yuzu-6426b0f5514d6a7c5cc369368947eceb380bfc85.tar.xz
yuzu-6426b0f5514d6a7c5cc369368947eceb380bfc85.tar.zst
yuzu-6426b0f5514d6a7c5cc369368947eceb380bfc85.zip
Diffstat (limited to 'src/core/loader/loader.cpp')
-rw-r--r--src/core/loader/loader.cpp29
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 @@
#include "core/hle/kernel/process.h"
#include "core/loader/deconstructed_rom_directory.h"
#include "core/loader/elf.h"
+#include "core/loader/nax.h"
#include "core/loader/nca.h"
#include "core/loader/nro.h"
#include "core/loader/nso.h"
@@ -32,6 +33,7 @@ FileType IdentifyFile(FileSys::VirtualFile file) {
CHECK_TYPE(NRO)
CHECK_TYPE(NCA)
CHECK_TYPE(XCI)
+ CHECK_TYPE(NAX)
#undef CHECK_TYPE
@@ -73,6 +75,8 @@ std::string GetFileTypeString(FileType type) {
return "NCA";
case FileType::XCI:
return "XCI";
+ case FileType::NAX:
+ return "NAX";
case FileType::DeconstructedRomDirectory:
return "Directory";
case FileType::Error:
@@ -83,7 +87,7 @@ std::string GetFileTypeString(FileType type) {
return "unknown";
}
-constexpr std::array<const char*, 36> RESULT_MESSAGES{
+constexpr std::array<const char*, 49> RESULT_MESSAGES{
"The operation completed successfully.",
"The loader requested to load is already loaded.",
"The operation is not implemented.",
@@ -120,6 +124,19 @@ constexpr std::array<const char*, 36> RESULT_MESSAGES{
"There was a general error loading the NRO into emulated memory.",
"There is no icon available.",
"There is no control data available.",
+ "The NAX file has a bad header.",
+ "The NAX file has incorrect size as determined by the header.",
+ "The HMAC to generated the NAX decryption keys failed.",
+ "The HMAC to validate the NAX decryption keys failed.",
+ "The NAX key derivation failed.",
+ "The NAX file cannot be interpreted as an NCA file.",
+ "The NAX file has an incorrect path.",
+ "The SD seed could not be found or derived.",
+ "The SD KEK Source could not be found.",
+ "The AES KEK Generation Source could not be found.",
+ "The AES Key Generation Source could not be found.",
+ "The SD Save Key Source could not be found.",
+ "The SD NCA Key Source could not be found.",
};
std::ostream& operator<<(std::ostream& os, ResultStatus status) {
@@ -150,13 +167,18 @@ static std::unique_ptr<AppLoader> GetFileLoader(FileSys::VirtualFile file, FileT
case FileType::NRO:
return std::make_unique<AppLoader_NRO>(std::move(file));
- // NX NCA file format.
+ // NX NCA (Nintendo Content Archive) file format.
case FileType::NCA:
return std::make_unique<AppLoader_NCA>(std::move(file));
+ // NX XCI (nX Card Image) file format.
case FileType::XCI:
return std::make_unique<AppLoader_XCI>(std::move(file));
+ // NX NAX (NintendoAesXts) file format.
+ case FileType::NAX:
+ return std::make_unique<AppLoader_NAX>(std::move(file));
+
// NX deconstructed ROM directory.
case FileType::DeconstructedRomDirectory:
return std::make_unique<AppLoader_DeconstructedRomDirectory>(std::move(file));
@@ -170,7 +192,8 @@ std::unique_ptr<AppLoader> GetLoader(FileSys::VirtualFile file) {
FileType type = IdentifyFile(file);
FileType filename_type = GuessFromFilename(file->GetName());
- if (type != filename_type) {
+ // Special case: 00 is either a NCA or NAX.
+ if (type != filename_type && !(file->GetName() == "00" && type == FileType::NAX)) {
LOG_WARNING(Loader, "File {} has a different type than its extension.", file->GetName());
if (FileType::Unknown == type)
type = filename_type;