aboutsummaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-30 11:40:50 -0400
committerTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-30 11:40:59 -0400
commitf669bbbfff7069207ec07a96c0417f152901a18c (patch)
treedcb5734985a3862aab6170afef292d9c3e9b0249 /src/core/file_sys
parentc96d1e01931f947e43a12aefeb0de0883f04aeba (diff)
file_sys: serve an empty archive for missing Switch 2 system data
Switch 2 system data (ids 04...) is not part of Switch 1 firmware, and a title aborts when it cannot mount it: Nintendo Switch Sports Resort asks for 0400000000000849 right after boot. Synthesize an empty archive for such ids (logged), so it boots to its first screens. EDEN_NX2_EMPTY_SYSTEM_DATA=0 fails the request as before.
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/system_archive/system_archive.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/file_sys/system_archive/system_archive.cpp b/src/core/file_sys/system_archive/system_archive.cpp
index d47332a9d0..c3931b6f62 100644
--- a/src/core/file_sys/system_archive/system_archive.cpp
+++ b/src/core/file_sys/system_archive/system_archive.cpp
@@ -4,6 +4,8 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include <cstdlib>
+
#include "common/logging.h"
#include "core/file_sys/romfs.h"
#include "core/file_sys/system_archive/mii_model.h"
@@ -12,6 +14,7 @@
#include "core/file_sys/system_archive/system_archive.h"
#include "core/file_sys/system_archive/system_version.h"
#include "core/file_sys/system_archive/time_zone_binary.h"
+#include "core/file_sys/vfs/vfs_vector.h"
namespace FileSys::SystemArchive {
@@ -78,6 +81,17 @@ VirtualFile SynthesizeSystemArchive(const u64 title_id) {
auto const desc = GetSystemArchive(title_id);
if (desc.name == nullptr) {
// Not a system archive Eden knows (fmt throws on a null string, ending the process).
+ // Switch 2 system data (ids 04...) is not installed with Switch 1 firmware, and titles
+ // abort when it cannot be mounted (Nintendo Switch Sports Resort, 0400000000000849):
+ // serve an empty archive. EDEN_NX2_EMPTY_SYSTEM_DATA=0 fails the request instead.
+ static const bool empty_nx2 = [] {
+ const char* setting = std::getenv("EDEN_NX2_EMPTY_SYSTEM_DATA");
+ return setting == nullptr || setting[0] != '0';
+ }();
+ if (empty_nx2 && (title_id >> 56) == 0x04) {
+ LOG_WARNING(Service_FS, "Empty archive for Switch 2 system data {:#016x}", title_id);
+ return CreateRomFS(std::make_shared<VectorVfsDirectory>());
+ }
LOG_WARNING(Service_FS, "No system archive {:#016x} to synthesize", title_id);
return nullptr;
}