loader: probe common file types first

This commit is contained in:
Liam 2024-02-26 21:02:06 -05:00
parent ff217a9651
commit f5cc94f054
1 changed files with 9 additions and 8 deletions

View File

@ -36,22 +36,23 @@ std::optional<FileType> IdentifyFileLoader(FileSys::VirtualFile file) {
} // namespace } // namespace
FileType IdentifyFile(FileSys::VirtualFile file) { FileType IdentifyFile(FileSys::VirtualFile file) {
if (const auto romdir_type = IdentifyFileLoader<AppLoader_DeconstructedRomDirectory>(file)) { if (const auto nsp_type = IdentifyFileLoader<AppLoader_NSP>(file)) {
return *romdir_type; return *nsp_type;
} else if (const auto nso_type = IdentifyFileLoader<AppLoader_NSO>(file)) { } else if (const auto xci_type = IdentifyFileLoader<AppLoader_XCI>(file)) {
return *nso_type; return *xci_type;
} else if (const auto nro_type = IdentifyFileLoader<AppLoader_NRO>(file)) { } else if (const auto nro_type = IdentifyFileLoader<AppLoader_NRO>(file)) {
return *nro_type; return *nro_type;
} else if (const auto nca_type = IdentifyFileLoader<AppLoader_NCA>(file)) { } else if (const auto nca_type = IdentifyFileLoader<AppLoader_NCA>(file)) {
return *nca_type; return *nca_type;
} else if (const auto xci_type = IdentifyFileLoader<AppLoader_XCI>(file)) {
return *xci_type;
} else if (const auto nax_type = IdentifyFileLoader<AppLoader_NAX>(file)) { } else if (const auto nax_type = IdentifyFileLoader<AppLoader_NAX>(file)) {
return *nax_type; return *nax_type;
} else if (const auto nsp_type = IdentifyFileLoader<AppLoader_NSP>(file)) {
return *nsp_type;
} else if (const auto kip_type = IdentifyFileLoader<AppLoader_KIP>(file)) { } else if (const auto kip_type = IdentifyFileLoader<AppLoader_KIP>(file)) {
return *kip_type; return *kip_type;
} else if (const auto nso_type = IdentifyFileLoader<AppLoader_NSO>(file)) {
return *nso_type;
} else if (const auto romdir_type =
IdentifyFileLoader<AppLoader_DeconstructedRomDirectory>(file)) {
return *romdir_type;
} else { } else {
return FileType::Unknown; return FileType::Unknown;
} }