diff options
Diffstat (limited to 'src/core/loader')
-rw-r--r-- | src/core/loader/deconstructed_rom_directory.cpp | 5 | ||||
-rw-r--r-- | src/core/loader/loader.cpp | 4 | ||||
-rw-r--r-- | src/core/loader/loader.h | 12 | ||||
-rw-r--r-- | src/core/loader/nsp.cpp | 4 | ||||
-rw-r--r-- | src/core/loader/nsp.h | 2 | ||||
-rw-r--r-- | src/core/loader/xci.cpp | 5 | ||||
-rw-r--r-- | src/core/loader/xci.h | 2 |
7 files changed, 23 insertions, 11 deletions
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp index ac04d72d7..07aa7a1cd 100644 --- a/src/core/loader/deconstructed_rom_directory.cpp +++ b/src/core/loader/deconstructed_rom_directory.cpp @@ -129,7 +129,10 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(Kernel::Process& process) return ResultStatus::Error32BitISA; } - process.LoadFromMetadata(metadata); + if (process.LoadFromMetadata(metadata).IsError()) { + return ResultStatus::ErrorUnableToParseKernelMetadata; + } + const FileSys::PatchManager pm(metadata.GetTitleID()); // Load NSO modules diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index 9cd0b0ccd..d8cc30959 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp @@ -93,7 +93,7 @@ std::string GetFileTypeString(FileType type) { return "unknown"; } -constexpr std::array<const char*, 60> RESULT_MESSAGES{ +constexpr std::array<const char*, 62> RESULT_MESSAGES{ "The operation completed successfully.", "The loader requested to load is already loaded.", "The operation is not implemented.", @@ -103,6 +103,7 @@ constexpr std::array<const char*, 60> RESULT_MESSAGES{ "The NPDM has a bad ACI header,", "The NPDM file has a bad file access control.", "The NPDM has a bad file access header.", + "The NPDM has bad kernel capability descriptors.", "The PFS/HFS partition has a bad header.", "The PFS/HFS partition has incorrect size as determined by the header.", "The NCA file has a bad header.", @@ -125,6 +126,7 @@ constexpr std::array<const char*, 60> RESULT_MESSAGES{ "The file could not be found or does not exist.", "The game is missing a program metadata file (main.npdm).", "The game uses the currently-unimplemented 32-bit architecture.", + "Unable to completely parse the kernel metadata when loading the emulated process", "The RomFS could not be found.", "The ELF file has incorrect size as determined by the header.", "There was a general error loading the NRO into emulated memory.", diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 0838e303b..30eacd803 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h @@ -15,6 +15,10 @@ #include "core/file_sys/control_metadata.h" #include "core/file_sys/vfs.h" +namespace FileSys { +class NACP; +} // namespace FileSys + namespace Kernel { struct AddressMapping; class Process; @@ -67,6 +71,7 @@ enum class ResultStatus : u16 { ErrorBadACIHeader, ErrorBadFileAccessControl, ErrorBadFileAccessHeader, + ErrorBadKernelCapabilityDescriptors, ErrorBadPFSHeader, ErrorIncorrectPFSFileSize, ErrorBadNCAHeader, @@ -89,6 +94,7 @@ enum class ResultStatus : u16 { ErrorNullFile, ErrorMissingNPDM, Error32BitISA, + ErrorUnableToParseKernelMetadata, ErrorNoRomFS, ErrorIncorrectELFFileSize, ErrorLoadingNRO, @@ -245,11 +251,11 @@ public: } /** - * Get the developer of the application - * @param developer Reference to store the application developer into + * Get the control data (CNMT) of the application + * @param control Reference to store the application control data into * @return ResultStatus result of function */ - virtual ResultStatus ReadDeveloper(std::string& developer) { + virtual ResultStatus ReadControlData(FileSys::NACP& control) { return ResultStatus::ErrorNotImplemented; } diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp index b4ab88ae8..4d4b44571 100644 --- a/src/core/loader/nsp.cpp +++ b/src/core/loader/nsp.cpp @@ -152,10 +152,10 @@ ResultStatus AppLoader_NSP::ReadTitle(std::string& title) { return ResultStatus::Success; } -ResultStatus AppLoader_NSP::ReadDeveloper(std::string& developer) { +ResultStatus AppLoader_NSP::ReadControlData(FileSys::NACP& nacp) { if (nacp_file == nullptr) return ResultStatus::ErrorNoControl; - developer = nacp_file->GetDeveloperName(); + nacp = *nacp_file; return ResultStatus::Success; } } // namespace Loader diff --git a/src/core/loader/nsp.h b/src/core/loader/nsp.h index 2b1e0719b..32eb0193d 100644 --- a/src/core/loader/nsp.h +++ b/src/core/loader/nsp.h @@ -43,7 +43,7 @@ public: ResultStatus ReadProgramId(u64& out_program_id) override; ResultStatus ReadIcon(std::vector<u8>& buffer) override; ResultStatus ReadTitle(std::string& title) override; - ResultStatus ReadDeveloper(std::string& developer) override; + ResultStatus ReadControlData(FileSys::NACP& nacp) override; private: std::unique_ptr<FileSys::NSP> nsp; diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp index bd5a83b49..e67e43c69 100644 --- a/src/core/loader/xci.cpp +++ b/src/core/loader/xci.cpp @@ -121,10 +121,11 @@ ResultStatus AppLoader_XCI::ReadTitle(std::string& title) { return ResultStatus::Success; } -ResultStatus AppLoader_XCI::ReadDeveloper(std::string& developer) { +ResultStatus AppLoader_XCI::ReadControlData(FileSys::NACP& control) { if (nacp_file == nullptr) return ResultStatus::ErrorNoControl; - developer = nacp_file->GetDeveloperName(); + control = *nacp_file; return ResultStatus::Success; } + } // namespace Loader diff --git a/src/core/loader/xci.h b/src/core/loader/xci.h index 15d1b1a23..9d3923f62 100644 --- a/src/core/loader/xci.h +++ b/src/core/loader/xci.h @@ -43,7 +43,7 @@ public: ResultStatus ReadProgramId(u64& out_program_id) override; ResultStatus ReadIcon(std::vector<u8>& buffer) override; ResultStatus ReadTitle(std::string& title) override; - ResultStatus ReadDeveloper(std::string& developer) override; + ResultStatus ReadControlData(FileSys::NACP& control) override; private: std::unique_ptr<FileSys::XCI> xci; |