diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-27 12:00:22 -0400 |
|---|---|---|
| committer | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-27 12:00:22 -0400 |
| commit | 5456aa4331c768caf9b34780f2ad6bec372b63f3 (patch) | |
| tree | 5b7dc846a62c684aa373dadba8e0ae997dadbfba /src | |
| parent | 11aac324010eb2fe3c0fc9dca3c196f33aaef10c (diff) | |
loader: load a loose ExeFS when given its main
'main' is also a valid NSO, so IdentifyFile picked the single-NSO loader,
which skips main.npdm, rtld and the sdk modules and then crashes writing
into an uninitialised process. Prefer the ExeFS directory loader when the
file is named main and sits in an ExeFS.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/loader/loader.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index 92e2e2f602..5871ac412f 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp @@ -393,6 +393,13 @@ std::unique_ptr<AppLoader> GetLoader(Core::System& system, FileSys::VirtualFile FileType type = IdentifyFile(file); const FileType filename_type = GuessFromFilename(file->GetName()); + // A "main" inside an ExeFS directory is also a valid NSO, but loading it alone skips + // main.npdm, rtld and the sdk/subsdk modules. Load the whole directory instead. + if (type == FileType::NSO && filename_type == FileType::DeconstructedRomDirectory && + IdentifyFileLoader<AppLoader_DeconstructedRomDirectory>(file)) { + type = FileType::DeconstructedRomDirectory; + } + // 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.", |
