From d38f2b7180614228dd1b441184b8370ad8ba0111 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sun, 29 Mar 2026 12:02:30 +0200 Subject: [PATCH] fix: exclude save_dir paths from pack multi-dest --- emulators/panda3ds.yml | 2 ++ scripts/generate_pack.py | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/emulators/panda3ds.yml b/emulators/panda3ds.yml index b5268062..edaad3d4 100644 --- a/emulators/panda3ds.yml +++ b/emulators/panda3ds.yml @@ -24,6 +24,7 @@ notes: | files: - name: "aes_keys.txt" path: "Emulator Files/sysdata/aes_keys.txt" + mode: standalone description: "AES encryption keys for decrypting encrypted ROMs" required: false source_ref: "src/emulator.cpp:229,237-238, src/core/crypto/aes_engine.cpp:13-92" @@ -36,6 +37,7 @@ files: - name: "seeddb.bin" path: "Emulator Files/sysdata/seeddb.bin" + mode: standalone description: "Seed database for seed-encrypted games" required: false source_ref: "src/emulator.cpp:230,241-242, src/core/loader/ncch.cpp:78-93" diff --git a/scripts/generate_pack.py b/scripts/generate_pack.py index 55c137bb..7d35a95c 100644 --- a/scripts/generate_pack.py +++ b/scripts/generate_pack.py @@ -364,12 +364,24 @@ def _collect_emulator_extras( # Second pass: find alternative destinations for files already in the pack. # A file declared by the platform or emitted above may also be needed at a # different path by another core (e.g. neocd/ vs root, same_cdi/bios/ vs root). + # Only adds a copy when the file is ALREADY covered at a different path — + # never introduces a file that wasn't selected by the first pass. profiles = emu_profiles if emu_profiles is not None else load_emulator_profiles(emulators_dir) relevant = resolve_platform_cores(config, profiles, target_cores=target_cores) standalone_set = {str(c) for c in config.get("standalone_cores", [])} by_name = db.get("indexes", {}).get("by_name", {}) by_path_suffix = db.get("indexes", {}).get("by_path_suffix", {}) + # Build set of filenames already covered (platform baseline + first pass extras) + covered_names: set[str] = set() + for sys_id, system in config.get("systems", {}).items(): + for fe in system.get("files", []): + n = fe.get("name", "") + if n: + covered_names.add(n) + for e in extras: + covered_names.add(e["name"]) + for emu_name, profile in sorted(profiles.items()): if profile.get("type") in ("launcher", "alias"): continue @@ -382,6 +394,9 @@ def _collect_emulator_extras( fname = f.get("name", "") if not fname: continue + # Only duplicate files already covered at another destination + if fname not in covered_names: + continue file_mode = f.get("mode") if file_mode == "standalone" and not is_standalone: continue @@ -396,7 +411,7 @@ def _collect_emulator_extras( full_dest = f"{base_dest}/{dest}" if base_dest else dest if full_dest in seen_dests: continue - # Check file exists in repo + # Check file exists in repo or data dirs if not (by_name.get(fname) or by_name.get(dest.rsplit("/", 1)[-1]) or by_path_suffix.get(dest)): continue