loader: Add NSP file type and NSP-specific errors
This commit is contained in:
parent
d770c60205
commit
b555311438
@ -15,6 +15,7 @@
|
|||||||
#include "core/loader/nca.h"
|
#include "core/loader/nca.h"
|
||||||
#include "core/loader/nro.h"
|
#include "core/loader/nro.h"
|
||||||
#include "core/loader/nso.h"
|
#include "core/loader/nso.h"
|
||||||
|
#include "core/loader/nsp.h"
|
||||||
#include "core/loader/xci.h"
|
#include "core/loader/xci.h"
|
||||||
|
|
||||||
namespace Loader {
|
namespace Loader {
|
||||||
@ -34,6 +35,7 @@ FileType IdentifyFile(FileSys::VirtualFile file) {
|
|||||||
CHECK_TYPE(NCA)
|
CHECK_TYPE(NCA)
|
||||||
CHECK_TYPE(XCI)
|
CHECK_TYPE(XCI)
|
||||||
CHECK_TYPE(NAX)
|
CHECK_TYPE(NAX)
|
||||||
|
CHECK_TYPE(NSP)
|
||||||
|
|
||||||
#undef CHECK_TYPE
|
#undef CHECK_TYPE
|
||||||
|
|
||||||
@ -59,6 +61,8 @@ FileType GuessFromFilename(const std::string& name) {
|
|||||||
return FileType::NCA;
|
return FileType::NCA;
|
||||||
if (extension == "xci")
|
if (extension == "xci")
|
||||||
return FileType::XCI;
|
return FileType::XCI;
|
||||||
|
if (extension == "nsp")
|
||||||
|
return FileType::NSP;
|
||||||
|
|
||||||
return FileType::Unknown;
|
return FileType::Unknown;
|
||||||
}
|
}
|
||||||
@ -77,6 +81,8 @@ std::string GetFileTypeString(FileType type) {
|
|||||||
return "XCI";
|
return "XCI";
|
||||||
case FileType::NAX:
|
case FileType::NAX:
|
||||||
return "NAX";
|
return "NAX";
|
||||||
|
case FileType::NSP:
|
||||||
|
return "NSP";
|
||||||
case FileType::DeconstructedRomDirectory:
|
case FileType::DeconstructedRomDirectory:
|
||||||
return "Directory";
|
return "Directory";
|
||||||
case FileType::Error:
|
case FileType::Error:
|
||||||
@ -87,7 +93,7 @@ std::string GetFileTypeString(FileType type) {
|
|||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr std::array<const char*, 49> RESULT_MESSAGES{
|
constexpr std::array<const char*, 50> RESULT_MESSAGES{
|
||||||
"The operation completed successfully.",
|
"The operation completed successfully.",
|
||||||
"The loader requested to load is already loaded.",
|
"The loader requested to load is already loaded.",
|
||||||
"The operation is not implemented.",
|
"The operation is not implemented.",
|
||||||
@ -137,7 +143,7 @@ constexpr std::array<const char*, 49> RESULT_MESSAGES{
|
|||||||
"The AES Key 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 Save Key Source could not be found.",
|
||||||
"The SD NCA Key Source could not be found.",
|
"The SD NCA Key Source could not be found.",
|
||||||
};
|
"The NSP file is missing a Program-type NCA."};
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, ResultStatus status) {
|
std::ostream& operator<<(std::ostream& os, ResultStatus status) {
|
||||||
os << RESULT_MESSAGES.at(static_cast<size_t>(status));
|
os << RESULT_MESSAGES.at(static_cast<size_t>(status));
|
||||||
@ -182,6 +188,10 @@ static std::unique_ptr<AppLoader> GetFileLoader(FileSys::VirtualFile file, FileT
|
|||||||
case FileType::NAX:
|
case FileType::NAX:
|
||||||
return std::make_unique<AppLoader_NAX>(std::move(file));
|
return std::make_unique<AppLoader_NAX>(std::move(file));
|
||||||
|
|
||||||
|
// NX NSP (Nintendo Submission Package) file format
|
||||||
|
case FileType::NSP:
|
||||||
|
return std::make_unique<AppLoader_NSP>(std::move(file));
|
||||||
|
|
||||||
// NX deconstructed ROM directory.
|
// NX deconstructed ROM directory.
|
||||||
case FileType::DeconstructedRomDirectory:
|
case FileType::DeconstructedRomDirectory:
|
||||||
return std::make_unique<AppLoader_DeconstructedRomDirectory>(std::move(file));
|
return std::make_unique<AppLoader_DeconstructedRomDirectory>(std::move(file));
|
||||||
|
@ -29,6 +29,7 @@ enum class FileType {
|
|||||||
NSO,
|
NSO,
|
||||||
NRO,
|
NRO,
|
||||||
NCA,
|
NCA,
|
||||||
|
NSP,
|
||||||
XCI,
|
XCI,
|
||||||
NAX,
|
NAX,
|
||||||
DeconstructedRomDirectory,
|
DeconstructedRomDirectory,
|
||||||
@ -105,6 +106,7 @@ enum class ResultStatus : u16 {
|
|||||||
ErrorMissingAESKeyGenerationSource,
|
ErrorMissingAESKeyGenerationSource,
|
||||||
ErrorMissingSDSaveKeySource,
|
ErrorMissingSDSaveKeySource,
|
||||||
ErrorMissingSDNCAKeySource,
|
ErrorMissingSDNCAKeySource,
|
||||||
|
ErrorNSPMissingProgramNCA,
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, ResultStatus status);
|
std::ostream& operator<<(std::ostream& os, ResultStatus status);
|
||||||
|
Loading…
Reference in New Issue
Block a user