aboutsummaryrefslogtreecommitdiff
path: root/src/core/loader/nsp.cpp
diff options
context:
space:
mode:
authorxbzk <xbzk@eden-emu.dev>2026-03-04 22:51:35 +0100
committercrueter <crueter@eden-emu.dev>2026-03-04 22:51:35 +0100
commit7f5de6bcd651f8145e4746c76d0531b6560fd5e4 (patch)
treecaefce3d338f65309db1725ac84257c99c14784e /src/core/loader/nsp.cpp
parentc682306788055c57953aea38fdded95a0c6dfc09 (diff)
[android/fs] external content loader + nca/xci patches (#3596)
Foreword: WHY DON'T EVERYBODY USE ONE FOLDER FOR EACH GAME+CONTENTS? AIN'T THIS THE FORMAT GAMES COME WHEN YOU BUE THEM? DO YOU LIVE WITH ALL YOUR FRIENDS AND HAVE A 2ND HOUSE FOR ALL THE CHILDREN? Nice, i feel better now. This feat extends Maufeat's work on external content loading. It harmonically additions: "...also, if in each game folder X, you find a folder Y, and in this folder Y you detect ONLY a single game, then mount all external content for that game found in that folder Y and its subfolders." Permanent (not toggleable). External Content folders are supported equally. Also: -Reworked several routines for preserving single source of truth between android and other systems; -Fixed the annoying unknown format error for content files, by providing proper format detection. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3596 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: Lizzie <lizzie@eden-emu.dev> Co-authored-by: xbzk <xbzk@eden-emu.dev> Co-committed-by: xbzk <xbzk@eden-emu.dev>
Diffstat (limited to 'src/core/loader/nsp.cpp')
-rw-r--r--src/core/loader/nsp.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp
index 3016d5f25f..4333acb70c 100644
--- a/src/core/loader/nsp.cpp
+++ b/src/core/loader/nsp.cpp
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -55,19 +58,30 @@ AppLoader_NSP::~AppLoader_NSP() = default;
FileType AppLoader_NSP::IdentifyType(const FileSys::VirtualFile& nsp_file) {
const FileSys::NSP nsp(nsp_file);
- if (nsp.GetStatus() == ResultStatus::Success) {
- // Extracted Type case
- if (nsp.IsExtractedType() && nsp.GetExeFS() != nullptr &&
- FileSys::IsDirectoryExeFS(nsp.GetExeFS())) {
- return FileType::NSP;
+ if (nsp.GetStatus() != ResultStatus::Success) {
+ return FileType::Error;
+ }
+
+ // Extracted Type case
+ if (nsp.IsExtractedType() && nsp.GetExeFS() != nullptr &&
+ FileSys::IsDirectoryExeFS(nsp.GetExeFS())) {
+ return FileType::NSP;
+ }
+
+ // Non-extracted NSPs can legitimately contain only update/DLC content.
+ // Identify the container format itself; bootability is validated by Load().
+ if (!nsp.GetNCAs().empty()) {
+ return FileType::NSP;
+ }
+
+ // Fallback when NCAs couldn't be parsed (e.g. missing keys) but the PFS still contains NCAs.
+ for (const auto& entry : nsp.GetFiles()) {
+ if (entry == nullptr) {
+ continue;
}
- // Non-Extracted Type case
- const auto program_id = nsp.GetProgramTitleID();
- if (!nsp.IsExtractedType() &&
- nsp.GetNCA(program_id, FileSys::ContentRecordType::Program) != nullptr &&
- AppLoader_NCA::IdentifyType(
- nsp.GetNCAFile(program_id, FileSys::ContentRecordType::Program)) == FileType::NCA) {
+ const auto& name = entry->GetName();
+ if (name.size() >= 4 && name.substr(name.size() - 4) == ".nca") {
return FileType::NSP;
}
}