diff options
| author | néo Luigi <85024393+neoluigi4123@users.noreply.github.com> | 2026-11-03 00:49:36 +0100 |
|---|---|---|
| committer | néo Luigi <85024393+neoluigi4123@users.noreply.github.com> | 2026-11-03 00:49:36 +0100 |
| commit | c84e5caf82a786f748c233e27b7f4ed9aaad9f44 (patch) | |
| tree | 3ec9cab90d74292445d0a076370933bac946fc4d /src/core/core.cpp | |
| parent | 2b413a46a2820f0a646baaa8dbd683009f096f32 (diff) | |
| parent | efa7c19e59839f0d464c2e9bd41f9ca8f867fef0 (diff) | |
Merge remote-tracking branch 'origin/nx2' into neo.ai/vibration-fix
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
# src/core/hle/service/hid/hid_server.cpp
# src/core/hle/service/hid/hid_server.h
Diffstat (limited to 'src/core/core.cpp')
| -rw-r--r-- | src/core/core.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 41871df870..3842ee25a8 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -25,6 +25,7 @@ #include "core/debugger/debugger.h" #include "core/device_memory.h" #include "core/file_sys/fs_filesystem.h" +#include "core/file_sys/nup_container.h" #include "core/file_sys/patch_manager.h" #include "core/file_sys/program_metadata.h" #include "core/file_sys/registered_cache.h" @@ -116,9 +117,27 @@ namespace { // Switch 2 titles boot as a loose ExeFS, with main.npdm next to main. bool IsSwitch2Program(const FileSys::VirtualFile& file) { + FileSys::ProgramMetadata metadata; + if (FileSys::NupContainer::IsNupFile(file)) { + FileSys::NupContainer nup{file}; + if (nup.GetStatus() != Loader::ResultStatus::Success) { + return false; + } + std::optional<std::size_t> program; + if (const auto base = nup.FindBasePackage(); + base && nup.GetExeFSDir(*base) != nullptr) { + program = base; + } else if (const auto update = nup.FindBestUpdatePackage(); + update && nup.GetExeFSDir(*update) != nullptr) { + program = update; + } + const auto exefs = program ? nup.GetExeFSDir(*program) : nullptr; + const auto npdm = exefs != nullptr ? exefs->GetFile("main.npdm") : nullptr; + return npdm != nullptr && metadata.Load(npdm) == Loader::ResultStatus::Success && + metadata.IsSwitch2(); + } const auto dir = file != nullptr ? file->GetContainingDirectory() : nullptr; const auto npdm = dir != nullptr ? dir->GetFile("main.npdm") : nullptr; - FileSys::ProgramMetadata metadata; return npdm != nullptr && metadata.Load(npdm) == Loader::ResultStatus::Success && metadata.IsSwitch2(); } |
