Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.
Swift apple-siliconcustom-formathomebrewiosipaipadipadosiphonemetalnative-portnintendo-switchnxnativeromfsswitch-games
Mac launcher: build a Switch 2 game from a NUP file
v0lumehif36096ee5928
diff --git a/frontend/Sources/NX2Apple/Library.swift b/frontend/Sources/NX2Apple/Library.swiftindex 7e1cfc09..b07aec31 100644--- a/frontend/Sources/NX2Apple/Library.swift+++ b/frontend/Sources/NX2Apple/Library.swift@@ -400,6 +400,15 @@ final class GameLibrary: ObservableObject {if e.level >= 4 || name.hasSuffix(".app") || name.hasSuffix("_build") || name.hasSuffix("-work") || name.hasSuffix("_survey") || ["romfs", "extract", "tools", "venv", "archive", "harness", "runs", "shader", "node_modules"].contains(name) { e.skipDescendants() }continue}+ // A NUP file is one game with its updates and DLC (GameFolder.readNUP): a folder that holds one was taken above+ if url.pathExtension.lowercased() == "nup", case .success(let f) = GameFolder.readNUP(url.path), f.hasTitleID, result[f.titleIDHex] == nil {+ var game = LibraryGame(titleID: f.titleIDHex, name: title(for: url.path, repo: repo, titleID: f.titleIDHex))+ game.inputs = [GameLibrary.folderInput: [url.path], "base": [url.path]]+ game.sourceFolder = f.folder+ game.outputDirectory = f.folder+ result[f.titleIDHex] = game+ continue+ }guard packages.contains(url.pathExtension.lowercased()),let id = TitleID.parse(url.lastPathComponent), id & 0xfff == 0 else { continue }let tid = String(format: "%016llX", id)@@ -510,7 +519,7 @@ final class GameLibrary: ObservableObject {var game = games.first { $0.titleID == titleID } ?? LibraryGame(titleID: titleID, name: Self.title(for: model.gameFolder?.folder ?? model.basePath, repo: model.repo.path, titleID: titleID))game.inputs = Dictionary(uniqueKeysWithValues: model.slots.map { ($0.id, $0.paths) })// A game folder is kept as the folder: Build again reads it anew (LauncherView.configureBuild).- if let folder = model.gameFolder { game.inputs[GameLibrary.folderInput] = [folder.folder] }+ if let folder = model.gameFolder { game.inputs[GameLibrary.folderInput] = [folder.scriptInput] }game.outputDirectory = model.outDirif !model.gameDir.isEmpty { game.sourceFolder = model.gameDir }game.lastTarget = model.targetdiff --git a/frontend/Sources/NXCore/GameFolder.swift b/frontend/Sources/NXCore/GameFolder.swiftindex 952e0a6b..83810467 100644--- a/frontend/Sources/NXCore/GameFolder.swift+++ b/frontend/Sources/NXCore/GameFolder.swift@@ -12,6 +12,10 @@ import Foundation/// The rules here are pack_dump.py's `is_dump` and `scan`, and build_ipa_from_nsp.py's `dump_folder`, so the launcher refuses/// what the script would refuse, and names the missing piece instead of "no NSP in this folder". Reads only names, and the/// first bytes of main.npdm: never the game's data.+///+/// The same game can come as one NUP container (a `.nup` file, https://github.com/a55uka/nup, SPEC v1): base, updates and DLC+/// as the same trees in one file, not encrypted either. The engine reads one from seedds/nxnative 423a674 (`scripts/pack_nup.py`),+/// given the file or a folder that holds it. The launcher reads only its header and package table (`readNUP`).package enum GameFolder {/// What a game folder holds.package struct Contents: Equatable {@@ -22,14 +26,20 @@ package enum GameFolder {package let updates: [(version: Int, path: String)]/// The DLC folders (dlc/<title ID>) with their title IDs, sorted by title ID.package let dlc: [(titleID: UInt64, path: String)]+ /// The NUP file the game is in, nil for a folder of files.+ package var nup: String? = nilpackage var titleIDHex: String { String(format: "%016llX", titleID) }- package var basePath: String { folder + "/base" }+ package var basePath: String { nup ?? folder + "/base" }+ /// What the script is given: the NUP file, else the folder.+ package var scriptInput: String { nup ?? folder }+ /// The title ID is known (a NUP whose package table names none leaves it to the script, from the code in the container).+ package var hasTitleID: Bool { titleID != 0 }/// The script packs the newest update (the version to pack defaults to the newest in the folder).package var newestUpdate: (version: Int, path: String)? { updates.last }package static func == (a: Self, b: Self) -> Bool {- a.folder == b.folder && a.titleID == b.titleID+ a.folder == b.folder && a.titleID == b.titleID && a.nup == b.nup&& a.updates.map(\.version) == b.updates.map(\.version) && a.updates.map(\.path) == b.updates.map(\.path)&& a.dlc.map(\.titleID) == b.dlc.map(\.titleID) && a.dlc.map(\.path) == b.dlc.map(\.path)}@@ -53,21 +63,37 @@ package enum GameFolder {case notDLC(String, UInt64)/// A DLC folder without exactly one `<n>/romfs` (or `romfs`) folder: the name and how many there were.case dlcRomFS(String, Int)+ /// The file is not a NUP of format version 1: its name.+ case notNUP(String)+ /// The NUP is shorter or longer than its header says (copied or downloaded in part): its name.+ case nupPartial(String)+ /// More than one NUP in the folder: how many. The script takes one game per folder.+ case severalNUPs(Int)}- /// Packages that make the script take the folder as a folder of packages. A `.nup` (a newer engine reads one) is taken first too.- private static let packages: Set<String> = ["nsp", "xci", "nsz", "xcz", "nup"]+ /// Packages that make the script take the folder as a folder of packages.+ private static let packages: Set<String> = ["nsp", "xci", "nsz", "xcz"]++ /// The NUP files at the top of a folder (build_ipa_from_nsp.py `nup_file` looks there only), by name.+ package static func nupFiles(in folder: String) -> [String] {+ ((try? FileManager.default.contentsOfDirectory(atPath: folder)) ?? []).filter {+ !$0.hasPrefix("._") && ($0 as NSString).pathExtension.lowercased() == "nup" && isFile(folder + "/" + $0)+ }.sorted()+ }- /// Whether the folder is meant as a game folder: it has `base/exefs/main.npdm`, or `exefs/main.npdm` with no `base/` (the- /// files one level too high). Cheap: the folder picker asks this before it walks a folder that may hold 80,000 files.- package static func isCandidate(_ folder: String) -> Bool {+ /// Whether the path is meant as a game folder or a NUP: a `.nup` file, a folder with a `.nup` at its top, a folder with+ /// `base/exefs/main.npdm`, or `exefs/main.npdm` with no `base/` (the files one level too high). Cheap: the folder picker asks+ /// this before it walks a folder that may hold 80,000 files.+ package static func isCandidate(_ path: String) -> Bool {let fm = FileManager.default- if isFile(folder + "/base/exefs/main.npdm") { return true }- return isFile(folder + "/exefs/main.npdm") && !fm.fileExists(atPath: folder + "/base")+ if (path as NSString).pathExtension.lowercased() == "nup" && isFile(path) { return true }+ if isFile(path + "/base/exefs/main.npdm") || !nupFiles(in: path).isEmpty { return true }+ return isFile(path + "/exefs/main.npdm") && !fm.fileExists(atPath: path + "/base")}/// What the folder holds, or the first reason it cannot be built, in the order the script finds them.package static func scan(_ folder: String) -> Result<Contents, Problem> {+ if (folder as NSString).pathExtension.lowercased() == "nup" && isFile(folder) { return readNUP(folder) }let fm = FileManager.defaultfunc isDir(_ p: String) -> Bool { var d: ObjCBool = false; return fm.fileExists(atPath: p, isDirectory: &d) && d.boolValue }func dirs(_ p: String) -> [String] {@@ -77,6 +103,10 @@ package enum GameFolder {if let pkg = top.first(where: { !$0.hasPrefix("._") && packages.contains(($0 as NSString).pathExtension.lowercased()) && isFile(folder + "/" + $0) }) {return .failure(.packageBeside(pkg))}+ // A NUP in the folder is what the script builds, before any folders beside it+ let nups = nupFiles(in: folder)+ if nups.count > 1 { return .failure(.severalNUPs(nups.count)) }+ if let nup = nups.first { return readNUP(folder + "/" + nup) }let npdm = folder + "/base/exefs/main.npdm"if !isFile(npdm) {if isFile(folder + "/exefs/main.npdm") && !fm.fileExists(atPath: folder + "/base") { return .failure(.noBaseFolder) }@@ -103,6 +133,39 @@ package enum GameFolder {return .success(Contents(folder: folder, titleID: app, updates: updates, dlc: dlc.sorted { $0.titleID < $1.titleID }))}+ /// A NUP's title ID, updates and DLC from its header and package table (SPEC v1, pack_nup.py `Nup` and `scan`). The title ID+ /// is the base package's, else an update's with the low 12 bits cleared (a base may be an empty placeholder, Pokémon Pokopia),+ /// else 0: the script then reads it from the code. Checks the magic, the version and the file size, not the SHA-256s (the+ /// script checks every file it reads).+ package static func readNUP(_ path: String) -> Result<Contents, Problem> {+ let name = (path as NSString).lastPathComponent+ guard let h = FileHandle(forReadingAtPath: path) else { return .failure(.notNUP(name)) }+ defer { try? h.close() }+ func u(_ b: [UInt8], _ o: Int, _ n: Int) -> UInt64 { (0..<n).reduce(UInt64(0)) { $0 | UInt64(b[o + $1]) << (8 * UInt64($1)) } }+ let head = [UInt8](h.readData(ofLength: 0x80))+ guard head.count == 0x80, head[0..<3].elementsEqual("NUP".utf8), head[3] == 1 else { return .failure(.notNUP(name)) }+ let size = (try? FileManager.default.attributesOfItem(atPath: path))?[.size] as? UInt64 ?? 0+ if u(head, 0x40, 8) != size { return .failure(.nupPartial(name)) }+ let toc = u(head, 0x08, 8), count = Int(u(head, 0x48, 4))+ guard count > 0, count < 100_000, toc + 0x30 + UInt64(count) * 0x40 <= size else { return .failure(.notNUP(name)) }+ try? h.seek(toOffset: toc)+ let table = [UInt8](h.readData(ofLength: 0x30 + count * 0x40))+ guard table.count == 0x30 + count * 0x40, table[0..<4].elementsEqual([0x54, 0x4F, 0x43, 0x01]) else { return .failure(.notNUP(name)) }+ var base: UInt64 = 0, updates: [(version: Int, path: String)] = [], addons: [UInt64] = [], updateTitle: UInt64 = 0+ for i in 0..<count {+ let o = 0x30 + i * 0x40, tid = u(table, o, 8), version = Int(u(table, o + 20, 4))+ switch table[o + 24] {+ case 0: base = tid+ case 1: updates.append((version: version, path: path)); if updateTitle == 0 { updateTitle = tid & ~0xFFF }+ case 2: addons.append(tid)+ default: break+ }+ }+ let app = base != 0 && base & 0xFFF == 0 ? base : updateTitle+ return .success(Contents(folder: (path as NSString).deletingLastPathComponent, titleID: app,+ updates: updates.sorted { $0.version < $1.version }, dlc: addons.sorted().map { (titleID: $0, path: path) }, nup: path))+ }+/// The ACI0 program ID of an NPDM (pack_dump.py `program_id`): the ACI0 offset and size at 0x70, the ID at ACI0 + 0x10.package static func programID(npdm d: Data) -> UInt64? {let b = [UInt8](d)@@ -117,6 +180,11 @@ package enum GameFolder {!engineRoot.isEmpty && FileManager.default.fileExists(atPath: engineRoot + "/scripts/pack_dump.py")}+ /// Whether the engine builds NUP files: it has `scripts/pack_nup.py` (seedds/nxnative 423a674, in the pin from 641d148).+ package static func engineBuildsNUPs(_ engineRoot: String) -> Bool {+ !engineRoot.isEmpty && FileManager.default.fileExists(atPath: engineRoot + "/scripts/pack_nup.py")+ }+/// Whether the engine has a profile for the game. The script packs a game folder only for a game with a profile: the survey/// that makes a provisional one reads NSPs.package static func engineHasProfile(_ titleID: UInt64, engineRoot: String) -> Bool {diff --git a/frontend/Sources/NXCore/GameInputs.swift b/frontend/Sources/NXCore/GameInputs.swiftindex fc56171d..99107c6e 100644--- a/frontend/Sources/NXCore/GameInputs.swift+++ b/frontend/Sources/NXCore/GameInputs.swift@@ -110,7 +110,8 @@ package enum GameInputs {/// script like their plain forms. DLC ships as NSP (or NSZ), never as a cartridge image.package static func allowedFileTypes(for kind: InputKind) -> [String] {switch kind {- case .base, .update: return ["nsp", "xci", "nsz", "xcz"]+ case .base: return ["nsp", "xci", "nsz", "xcz", "nup"] // a NUP holds the whole game (GameFolder.readNUP)+ case .update: return ["nsp", "xci", "nsz", "xcz"]case .dlc: return ["nsp", "nsz"]case .keys: return ["keys"]}diff --git a/frontend/Sources/NXModel/BuildStore+DropFiles.swift b/frontend/Sources/NXModel/BuildStore+DropFiles.swiftindex e354c7bb..4f972947 100644--- a/frontend/Sources/NXModel/BuildStore+DropFiles.swift+++ b/frontend/Sources/NXModel/BuildStore+DropFiles.swift@@ -13,7 +13,7 @@ extension BuildStore {var d: ObjCBool = falsereturn FileManager.default.fileExists(atPath: p, isDirectory: &d) && d.boolValue}- if paths.count == 1, isFolder(paths[0]) { scan(folder: paths[0]); return }+ if paths.count == 1, isFolder(paths[0]) || GameFolder.isCandidate(paths[0]) { scan(folder: paths[0]); return } // a folder, or one .nup fileleaveGameFolder() // packages dropped after a game folder start over: the two never mixvar found = GameInputs.classify(paths.flatMap { isFolder($0) ? GameInputs.inputFiles(in: $0) : [$0] })// update and add-on files of another game than the base (the dropped one, else the one already chosen)diff --git a/frontend/Sources/NXModel/BuildStore+GameFolder.swift b/frontend/Sources/NXModel/BuildStore+GameFolder.swiftindex 79cfe1ed..3cb77955 100644--- a/frontend/Sources/NXModel/BuildStore+GameFolder.swift+++ b/frontend/Sources/NXModel/BuildStore+GameFolder.swift@@ -8,7 +8,7 @@ import NXCoreextension BuildStore {/// The folder's rows, or the reason on the base row. Called by `scan(folder:)` when `GameFolder.isCandidate` says so.package func takeGameFolder(_ folder: String) {- gameDir = folder+ gameDir = (folder as NSString).pathExtension.lowercased() == "nup" ? (folder as NSString).deletingLastPathComponent : folder // a NUP: its foldergameFolder = nilgameFolderRefused = falsefor i in slots.indices { slots[i].paths = []; slots[i].problem = ""; slots[i].note = "" }@@ -42,8 +42,11 @@ extension BuildStore {package func gameFolderEngineProblem(_ contents: GameFolder.Contents) -> String? {let engine = EngineLayout.root(repo.path)guard !engine.isEmpty, FileManager.default.fileExists(atPath: engine + "/dm") else { return nil }- if !GameFolder.engineBuildsFolders(engine) { return t("folder.engineOld") }- if !GameFolder.engineHasProfile(contents.titleID, engineRoot: engine) { return String(format: t("folder.noProfile"), contents.titleIDHex) }+ if contents.nup != nil ? !GameFolder.engineBuildsNUPs(engine) : !GameFolder.engineBuildsFolders(engine) {+ return t(contents.nup != nil ? "folder.engineOldNUP" : "folder.engineOld")+ }+ // A NUP whose package table names no title ID: the script reads it from the code, and checks the profile itself+ if contents.hasTitleID, !GameFolder.engineHasProfile(contents.titleID, engineRoot: engine) { return String(format: t("folder.noProfile"), contents.titleIDHex) }return nil}@@ -58,6 +61,9 @@ extension BuildStore {case .dlcName(let name): return String(format: t("folder.problem.dlcName"), name)case .notDLC(let name, _): return String(format: t("folder.problem.notDLC"), name)case .dlcRomFS(let name, let count): return String(format: t("folder.problem.dlcRomFS"), name, count)+ case .notNUP(let name): return String(format: t("folder.problem.notNUP"), name)+ case .nupPartial(let name): return String(format: t("folder.problem.nupPartial"), name)+ case .severalNUPs(let count): return String(format: t("folder.problem.severalNUPs"), count)}}@@ -65,7 +71,9 @@ extension BuildStore {package func gameFolderRowText(_ id: String) -> String? {guard let f = gameFolder else { return nil }switch id {- case "base": return String(format: t("folder.base"), f.titleIDHex)+ case "base":+ if f.nup == nil { return String(format: t("folder.base"), f.titleIDHex) }+ return f.hasTitleID ? String(format: t("folder.nupBase"), f.titleIDHex) : t("folder.nupBaseNoID")case "update":guard let newest = f.newestUpdate else { return t("data.notSelectedOptional") }return f.updates.count > 1 ? String(format: t("folder.updates"), newest.version, f.updates.count) : String(format: t("folder.update"), newest.version)@@ -79,13 +87,19 @@ extension BuildStore {package var inputsReady: Bool { gameFolder != nil ? slot("base").ok : slot("base").ok && slot("keys").ok }/// The key of the build folder and the app (`<key>_build`, `<key>.app`): the folder's title ID, else the base package's (TitleID.buildKey).- package var buildKey: String { gameFolder?.titleIDHex ?? TitleID.buildKey(basePath) }+ package var buildKey: String {+ guard let f = gameFolder else { return TitleID.buildKey(basePath) }+ return f.hasTitleID ? f.titleIDHex : TitleID.buildKey(f.scriptInput)+ }/// The folder the build's output goes beside when no Save to folder is chosen: the game folder, else the base package's folder.package var inputFolder: String { gameFolder?.folder ?? (basePath as NSString).deletingLastPathComponent }/// The game's title ID as 16 hex digits, when the inputs tell it.- package var gameTitleID: String? { gameFolder?.titleIDHex ?? TitleID.parse(basePath).map { String(format: "%016llX", $0) } }+ package var gameTitleID: String? {+ if let f = gameFolder { return f.hasTitleID ? f.titleIDHex : nil }+ return TitleID.parse(basePath).map { String(format: "%016llX", $0) }+ }/// The chosen game is a Switch 2 game by its engine profile (GameFolder.profileIsSwitch2): the Builds page says how far the engine's support goes.package var isSwitch2Game: Bool {@@ -96,7 +110,8 @@ extension BuildStore {/// A name for the game in messages and the shared app: the profile's for a game folder (it has no control data), else the base package's file name.package var gameName: String {if let f = gameFolder {- return GameFolder.profileName(f.titleID, engineRoot: EngineLayout.root(repo.path)) ?? (f.folder as NSString).lastPathComponent+ let fallback = f.nup.map { (($0 as NSString).lastPathComponent as NSString).deletingPathExtension } ?? (f.folder as NSString).lastPathComponent+ return f.hasTitleID ? GameFolder.profileName(f.titleID, engineRoot: EngineLayout.root(repo.path)) ?? fallback : fallback}return ((basePath as NSString).lastPathComponent as NSString).deletingPathExtension}diff --git a/frontend/Sources/NXModel/BuildStore+Inputs.swift b/frontend/Sources/NXModel/BuildStore+Inputs.swiftindex a0ac807d..d14ddec8 100644--- a/frontend/Sources/NXModel/BuildStore+Inputs.swift+++ b/frontend/Sources/NXModel/BuildStore+Inputs.swift@@ -59,6 +59,7 @@ extension BuildStore {/// Files chosen for one row: those that fit it are taken, the first that does not is named on the row/// and left out (it is not moved to another row: the row the user chose stays as they set it).package func take(picked: [String], kind: InputKind) {+ if kind == .base, picked.count == 1, GameFolder.isCandidate(picked[0]) { scan(folder: picked[0]); return } // a .nup file is one gameleaveGameFolder() // a package picked for a row ends a game folder: the two never mixlet id = kind == .base ? "base" : kind == .update ? "update" : kind == .dlc ? "dlc" : "keys"let baseName = kind == .base ? nil : (basePath as NSString).lastPathComponentdiff --git a/frontend/Sources/NXModel/BuildStore+Run.swift b/frontend/Sources/NXModel/BuildStore+Run.swiftindex 195051e2..aff181a2 100644--- a/frontend/Sources/NXModel/BuildStore+Run.swift+++ b/frontend/Sources/NXModel/BuildStore+Run.swift@@ -87,7 +87,7 @@ extension BuildStore {// The shared app's own folder is decided before the long steps too: one on a read-only volume (a saved// /NX2Apple-shell, a DMG chosen as Save to) failed at the last step after the whole build (#492).if target != BuildTarget.mac, !exportsOneGame, let why = shellRootProblem() { fail(why); return }- var inputDir = baseDir+ var inputDir = folder?.scriptInput ?? baseDir // a NUP goes to the script as the fileif dirs.count > 1 || !unpicked.isEmpty {// A stable folder per game (#132): the script's fingerprints name its files and its profile path.let tmp = InputStaging.folder(workDir: workDir)diff --git a/frontend/Tests/NX2AppleTests/GameFolderCaptureTests.swift b/frontend/Tests/NX2AppleTests/GameFolderCaptureTests.swiftindex a5ec6e2a..b59f906c 100644--- a/frontend/Tests/NX2AppleTests/GameFolderCaptureTests.swift+++ b/frontend/Tests/NX2AppleTests/GameFolderCaptureTests.swift@@ -18,7 +18,16 @@ final class GameFolderCaptureTests: IsolatedDefaultsTestCase {}let engine = root + "/engine", game = root + "/Donkey Kong Bananza"write(engine + "/" + EngineLayout.marker)- if packer { write(engine + "/scripts/pack_dump.py") }+ if packer { write(engine + "/scripts/pack_dump.py"); write(engine + "/scripts/pack_nup.py") }+ // The same game as one NUP file in a folder of its own: its header and package table only (SPEC v1), base, update, DLC+ var nup = [UInt8](repeating: 0, count: 0x80 + 0x30 + 3 * 0x40)+ func put(_ o: Int, _ v: UInt64, _ n: Int) { for i in 0..<n { nup[o + i] = UInt8(v >> (8 * UInt64(i)) & 0xFF) } }+ nup.replaceSubrange(0..<4, with: [0x4E, 0x55, 0x50, 0x01]); put(0x08, 0x80, 8); put(0x40, UInt64(nup.count), 8); put(0x48, 3, 4)+ nup.replaceSubrange(0x80..<0x84, with: [0x54, 0x4F, 0x43, 0x01])+ put(0xB0, 0x040074A01BF12000, 8)+ put(0xF0, 0x040074A01BF12800, 8); put(0xF0 + 20, 458752, 4); nup[0xF0 + 24] = 1+ put(0x130, 0x040074A01BF13001, 8); nup[0x130 + 24] = 2+ write(root + "/NUP/Donkey Kong Bananza.nup", Data(nup))if profile {write(engine + "/dm/games/040074A01BF12000/game.tsv",Data("# Donkey Kong Bananza (Switch 2, update v458752). In bring-up\ntitle_id\t040074A01BF12000\nname\tDonkey Kong Bananza\n".utf8))@@ -51,8 +60,13 @@ final class GameFolderCaptureTests: IsolatedDefaultsTestCase {XCTAssertEqual(games.map(\.titleID), ["040074A01BF12000"])XCTAssertEqual(games.first?.name, "Donkey Kong Bananza", "the profile's name")let real = { (p: String) in URL(fileURLWithPath: p).resolvingSymlinksInPath().path } // the enumerator hands out /private/var/…- XCTAssertEqual(games.first?.inputs[GameLibrary.folderInput]?.map(real), [real(folders.game)])- XCTAssertEqual(games.first.map { real($0.sourceFolder) }, real(folders.game))+ // the folder of files and the NUP beside it are the same game: one entry, from whichever the scan meets first+ let found = games.first?.inputs[GameLibrary.folderInput]?.map(real) ?? []+ XCTAssertTrue(found == [real(folders.game)] || found == [real(root + "/NUP")], "\(found)")+ try? FileManager.default.removeItem(atPath: root + "/NUP")+ let again = GameLibrary.sourceGames(in: URL(fileURLWithPath: root), repo: folders.engine)+ XCTAssertEqual(again.first?.inputs[GameLibrary.folderInput]?.map(real), [real(folders.game)])+ XCTAssertEqual(again.first.map { real($0.sourceFolder) }, real(folders.game))}// MARK: Visual QA (matched by --filter testRenderLauncherForVisualQA)@@ -99,9 +113,10 @@ final class GameFolderCaptureTests: IsolatedDefaultsTestCase {MainActor.assumeIsolated { stores.dependencies.checked = true }MainActor.assumeIsolated { stores.dependencies.deps = [Dep(id: "test", name: "Xcode", hint: "", present: true, installCmd: [])] }let library = GameLibrary(file: URL(fileURLWithPath: root + "/preview.json"))+ var folderToScan = folders.gamefunc capture(_ name: String, target: String) throws {model.target = target- model.scan(folder: folders.game)+ model.scan(folder: folderToScan)let host = NSHostingView(rootView: LauncherView(stores: stores, library: library, initialPage: .builds, performStartupChecks: false))let window = OffscreenWindow(size: NSSize(width: 1440, height: 1024), styleMask: [.titled, .closable, .resizable])window.contentView = host@@ -115,6 +130,9 @@ final class GameFolderCaptureTests: IsolatedDefaultsTestCase {}try capture("build-game-folder-mac", target: BuildTarget.mac)try capture("build-game-folder-ios", target: BuildTarget.ios)+ folderToScan = root + "/NUP/Donkey Kong Bananza.nup"+ try capture("build-nup-mac", target: BuildTarget.mac)+ folderToScan = folders.game// The stages of a game folder's build: "-raw" shows the pack stages as the script writes them (how they looked before this// change), the other in the player's languagemodel.target = BuildTarget.macdiff --git a/frontend/Tests/NXCoreTests/GameFolderTests.swift b/frontend/Tests/NXCoreTests/GameFolderTests.swiftindex 31350e20..ed7fca42 100644--- a/frontend/Tests/NXCoreTests/GameFolderTests.swift+++ b/frontend/Tests/NXCoreTests/GameFolderTests.swift@@ -147,6 +147,68 @@ extension GameFolderTests {}}+/// A NUP's header and package table (SPEC v1), as pack_nup.py reads them: enough for `readNUP`, no folders, files or data.+/// packages: (kind 0 base / 1 update / 2 add-on, title ID, version).+func syntheticNUP(_ packages: [(kind: UInt8, titleID: UInt64, version: UInt32)], size: Int? = nil) -> Data {+ func put(_ d: inout [UInt8], _ o: Int, _ v: UInt64, _ n: Int) { for i in 0..<n { d[o + i] = UInt8(v >> (8 * UInt64(i)) & 0xFF) } }+ let total = 0x80 + 0x30 + packages.count * 0x40+ var d = [UInt8](repeating: 0, count: total)+ d.replaceSubrange(0..<4, with: [0x4E, 0x55, 0x50, 0x01]) // "NUP" version 1+ put(&d, 0x04, 0x80, 2); put(&d, 0x08, 0x80, 8); put(&d, 0x10, UInt64(0x30 + packages.count * 0x40), 8)+ put(&d, 0x40, UInt64(size ?? total), 8); put(&d, 0x48, UInt64(packages.count), 4)+ d.replaceSubrange(0x80..<0x84, with: [0x54, 0x4F, 0x43, 0x01]) // "TOC" 1+ put(&d, 0x84, UInt64(packages.count), 4)+ for (i, p) in packages.enumerated() {+ let o = 0x80 + 0x30 + i * 0x40+ put(&d, o, p.titleID, 8); put(&d, o + 20, UInt64(p.version), 4); d[o + 24] = p.kind+ }+ return Data(d)+}++extension GameFolderTests {+ /// seedds/nxnative 423a674: a game in one NUP file (Hyrule Warriors: Age of Imprisonment is played this way). The launcher+ /// reads its title ID, updates and DLC from the package table.+ func testANUPFileIsReadFromItsPackageTable() throws {+ write("Bananza.nup", syntheticNUP([(0, 0x040074A01BF12000, 0), (1, 0x040074A01BF12800, 458752), (1, 0x040074A01BF12800, 65536), (2, 0x040074A01BF13001, 0)]))+ let path = root + "/Bananza.nup"+ XCTAssertTrue(GameFolder.isCandidate(path))+ XCTAssertTrue(GameFolder.isCandidate(root), "a folder that holds one")+ let c = try GameFolder.scan(path).get()+ XCTAssertEqual(c.titleIDHex, "040074A01BF12000")+ XCTAssertEqual(c.updates.map(\.version), [65536, 458752])+ XCTAssertEqual(c.dlc.map(\.titleID), [0x040074A01BF13001])+ XCTAssertEqual(c.scriptInput, path, "the script is given the file")+ XCTAssertEqual(c.folder, root)+ XCTAssertEqual(try GameFolder.scan(root).get(), c, "the folder that holds it reads the same")+ }++ /// pack_nup.py: a base may be an empty placeholder with title ID 0 when an update holds the whole game (Pokémon Pokopia).+ func testAPlaceholderBaseTakesTheUpdatesTitleID() throws {+ write("Pokopia.nup", syntheticNUP([(0, 0, 0), (1, 0x0400A3A01EE4C800, 655360)]))+ XCTAssertEqual(try GameFolder.scan(root + "/Pokopia.nup").get().titleIDHex, "0400A3A01EE4C000")+ write("None.nup", syntheticNUP([(0, 0, 0)]))+ let none = try GameFolder.readNUP(root + "/None.nup").get()+ XCTAssertFalse(none.hasTitleID, "left to the script, which reads it from the code")+ }++ func testABrokenNUPIsNamed() {+ write("Other.nup", Data("not a nup at all, just some bytes".utf8))+ XCTAssertEqual(GameFolder.scan(root + "/Other.nup").failureValue, .notNUP("Other.nup"))+ write("Half.nup", syntheticNUP([(0, 0x040074A01BF12000, 0)], size: 1 << 30))+ XCTAssertEqual(GameFolder.scan(root + "/Half.nup").failureValue, .nupPartial("Half.nup"))+ XCTAssertEqual(GameFolder.scan(root).failureValue, .severalNUPs(2))+ }++ /// build_ipa_from_nsp.py `nup_file`: a NUP in the folder is built before any game folders beside it, a package beside it is not.+ func testANUPBesideTheFoldersIsWhatTheScriptBuilds() throws {+ makeGame()+ write("Bananza.nup", syntheticNUP([(0, 0x040074A01BF12000, 0)]))+ XCTAssertEqual(try GameFolder.scan(root).get().nup, root + "/Bananza.nup")+ write("Game.nsp")+ XCTAssertEqual(GameFolder.scan(root).failureValue, .packageBeside("Game.nsp"))+ }+}+extension Result {var failureValue: Failure? { if case .failure(let e) = self { return e }; return nil }}diff --git a/frontend/Tests/NXCoreTests/GameInputsTests.swift b/frontend/Tests/NXCoreTests/GameInputsTests.swiftindex 15c785cb..a6ce843d 100644--- a/frontend/Tests/NXCoreTests/GameInputsTests.swift+++ b/frontend/Tests/NXCoreTests/GameInputsTests.swift@@ -24,8 +24,8 @@ final class GameInputsTests: XCTestCase {/// The per-row Choose… dialog must not grey out compressed dumps (issue #236).func testChooseDialogOffersCompressedDumps() {- XCTAssertEqual(Set(GameInputs.allowedFileTypes(for: .base)), ["nsp", "xci", "nsz", "xcz"])- XCTAssertEqual(GameInputs.allowedFileTypes(for: .update), GameInputs.allowedFileTypes(for: .base))+ XCTAssertEqual(Set(GameInputs.allowedFileTypes(for: .base)), ["nsp", "xci", "nsz", "xcz", "nup"], "a NUP holds a whole game (#445)")+ XCTAssertEqual(Set(GameInputs.allowedFileTypes(for: .update)), ["nsp", "xci", "nsz", "xcz"])XCTAssertEqual(Set(GameInputs.allowedFileTypes(for: .dlc)), ["nsp", "nsz"])XCTAssertEqual(GameInputs.allowedFileTypes(for: .keys), ["keys"])}diff --git a/frontend/Tests/NXModelTests/GameFolderStoreTests.swift b/frontend/Tests/NXModelTests/GameFolderStoreTests.swiftindex 7b59bb1e..6806e397 100644--- a/frontend/Tests/NXModelTests/GameFolderStoreTests.swift+++ b/frontend/Tests/NXModelTests/GameFolderStoreTests.swift@@ -79,7 +79,7 @@ import XCTestlet engine = root + "/engine", game = root + "/Bananza"write(engine + "/" + EngineLayout.marker)for tool in RepoLayout.requiredTools { write(engine + "/" + tool, Data("ap.add_argument('--work-dir')".utf8)) }- if packer { write(engine + "/scripts/pack_dump.py") }+ if packer { write(engine + "/scripts/pack_dump.py"); write(engine + "/scripts/pack_nup.py") }if profile { write(engine + "/dm/games/040074A01BF12000/game.tsv", Data("name\tDonkey Kong Bananza\n".utf8)) }write(game + "/base/exefs/main.npdm", npdm(0x040074A01BF12000)); mkdir(game + "/base/romfs")mkdir(game + "/updates/458752/romfs"); mkdir(game + "/updates/65536/romfs")@@ -162,6 +162,52 @@ import XCTestXCTAssertTrue(store.slots.allSatisfy(\.paths.isEmpty))}+ /// A NUP file (seedds/nxnative 423a674): one game, no keys, the file is the script's input, the build folder beside it.+ func testANUPFileIsOneGameAndTheScriptGetsTheFile() throws {+ let (store, _) = makeStore()+ let nup = root + "/Games/Bananza.nup"+ write(nup, nupData())+ store.take(picked: [nup], kind: .base)+ XCTAssertEqual(store.gameFolder?.nup, nup)+ XCTAssertEqual(store.gameFolderRowText("base"), String(format: store.t("folder.nupBase"), "040074A01BF12000"))+ XCTAssertEqual(store.gameFolderRowText("update"), String(format: store.t("folder.update"), 458752))+ XCTAssertEqual(store.gameDir, root + "/Games")+ XCTAssertTrue(store.canBuild)+ store.startBuild()+ let args = store.lastBuildCommand+ XCTAssertEqual(args.dropFirst(2).first, nup)+ XCTAssertFalse(args.contains("-k"))+ XCTAssertEqual(args.firstIndex(of: "--work-dir").map { args[$0 + 1] }, root + "/Games/040074A01BF12000_build")+ // dropped, and its folder chosen, it is the same game+ store.running = false+ store.leaveGameFolder()+ store.take(dropped: [nup])+ XCTAssertEqual(store.gameFolder?.nup, nup)+ store.scan(folder: root + "/Games")+ XCTAssertEqual(store.gameFolder?.nup, nup)+ }++ func testAnEngineWithoutTheNUPPackerSaysToUpdateIt() throws {+ let (store, _) = makeStore()+ try FileManager.default.removeItem(atPath: root + "/engine/scripts/pack_nup.py")+ let nup = root + "/Bananza.nup"+ write(nup, nupData())+ store.scan(folder: nup)+ XCTAssertEqual(store.slot("base").problem, store.t("folder.engineOldNUP"))+ }++ /// A NUP's header and package table: base, one update, no data (as syntheticNUP in NXCoreTests).+ private func nupData() -> Data {+ func put(_ d: inout [UInt8], _ o: Int, _ v: UInt64, _ n: Int) { for i in 0..<n { d[o + i] = UInt8(v >> (8 * UInt64(i)) & 0xFF) } }+ var d = [UInt8](repeating: 0, count: 0x80 + 0x30 + 2 * 0x40)+ d.replaceSubrange(0..<4, with: [0x4E, 0x55, 0x50, 0x01])+ put(&d, 0x08, 0x80, 8); put(&d, 0x40, UInt64(d.count), 8); put(&d, 0x48, 2, 4)+ d.replaceSubrange(0x80..<0x84, with: [0x54, 0x4F, 0x43, 0x01])+ put(&d, 0xB0, 0x040074A01BF12000, 8)+ put(&d, 0xF0, 0x040074A01BF12800, 8); put(&d, 0xF0 + 20, 458752, 4); d[0xF0 + 24] = 1+ return Data(d)+ }+func testAFolderOfPackagesIsScannedAsBefore() {let (store, _) = makeStore()let folder = root + "/Mario"diff --git a/frontend/l10n/de.json b/frontend/l10n/de.jsonindex 3e061134..52a7f7ae 100644--- a/frontend/l10n/de.json+++ b/frontend/l10n/de.json@@ -542,7 +542,7 @@"fail.keysOld.next": "Das Spiel braucht einen Schlüssel, der mit einer neueren Switch-Systemversion kam. Aktualisiere deine eigene Switch, hole prod.keys erneut von ihr, wähle die neue Datei und baue dann erneut. Das Protokoll nennt den Schlüssel und die Systemversion.","fail.keysOld.what": "Deine prod.keys-Datei ist älter als das Spiel.","fail.noProfile.next": "Switch 2-Spiele lassen sich nur bauen, wenn die Engine sie kennt. Aktualisiere die Engine oder warte, bis sie ein Profil für dieses Spiel hat.",- "fail.noProfile.what": "Die Engine hat kein Profil für dieses Spiel, und ein Spielordner baut nur ein Spiel mit Profil.",+ "fail.noProfile.what": "Die Engine hat kein Profil für dieses Spiel, und ein Spielordner oder eine NUP-Datei baut nur ein Spiel mit Profil.","fail.noSigningAccount.next": "Öffne in Xcode „Settings → Accounts“, melde dich mit deiner Apple-ID an und stelle sicher, dass das Team aufgeführt ist. Baue dann erneut. Eine kostenlose Apple-ID genügt, und Xcode erstellt das Zertifikat selbst.","fail.noSigningAccount.what": "Xcode hat kein Signierkonto für das gewählte Team.","fail.noTitleID.next": "Benenne die Datei so um, dass sie ihre Title-ID enthält, etwa Spielname [0100XXXXXXXXXXXX].nsp, und verwende die ID genau dieses Pakets, denn Basisspiel, Update und DLC haben jeweils eine eigene. Baue dann erneut.\nEs kann auch sein, dass der Ordner keine .nsp-, .xci-, .nsz- oder .xcz-Dateien enthält (geteilte oder archivierte Teile wie .00 oder .rar werden nicht gelesen) oder dass die Dateien noch in iCloud liegen und nicht geladen sind. Wähle „Ordner zeigen“, um nachzusehen.",@@ -577,16 +577,22 @@"folder.base": "Spielordner, Title-ID %@ aus main.npdm","folder.dlc": "Ordner mit Zusatzinhalten: %d","folder.engineOld": "Diese Engine baut keine Spielordner. Aktualisiere zuerst die Engine.",- "folder.keys": "Nicht nötig. Die Dateien in einem Spielordner sind nicht verschlüsselt.",+ "folder.engineOldNUP": "Diese Engine baut keine NUP-Dateien. Aktualisiere zuerst die Engine.",+ "folder.keys": "Nicht nötig. Ein Spielordner oder eine NUP-Datei ist nicht verschlüsselt.","folder.noProfile": "Die Engine hat kein Profil für %@. Ein Spielordner baut nur ein Spiel, das die Engine kennt.",+ "folder.nupBase": "NUP-Datei, Title-ID %@",+ "folder.nupBaseNoID": "NUP-Datei. Der Build liest ihre Title-ID.","folder.problem.dlcName": "dlc/%@ ist nicht nach einer Title-ID benannt.","folder.problem.dlcRomFS": "dlc/%1$@ braucht einen romfs-Ordner und hat %2$d.","folder.problem.missing": "In diesem Spielordner fehlt %@.","folder.problem.noBase": "Lege exefs und romfs in einen Ordner namens base und wähle diesen Ordner dann erneut.","folder.problem.notBase": "main.npdm nennt %@, das ist kein Basisspiel.","folder.problem.notDLC": "dlc/%@ ist kein Zusatzinhalt dieses Spiels.",+ "folder.problem.notNUP": "%@ ist keine NUP-Datei im Format Version 1.","folder.problem.npdm": "base/exefs/main.npdm lässt sich nicht als NPDM-Datei lesen.",+ "folder.problem.nupPartial": "%@ hat nicht die Größe, die ihr Kopf angibt. Sie wurde wohl nur zum Teil kopiert oder geladen.","folder.problem.package": "%@ liegt neben den Ordnern des Spiels. Behalte die Pakete oder die Ordner, nicht beides.",+ "folder.problem.severalNUPs": "Dieser Ordner enthält %d NUP-Dateien. Lege ein Spiel pro Ordner ab oder wähle die NUP-Datei selbst.","folder.update": "Update-Version %d","folder.updates": "Update-Version %1$d, die neueste von %2$d","free.clones": "Eine Mac-App auf demselben Laufwerk teilt Spieldateien und Shader mit diesem Ordner (APFS-Klone), daher wird womöglich weniger frei als angezeigt.",diff --git a/frontend/l10n/en.json b/frontend/l10n/en.jsonindex f9c7fbd3..1e23bcf2 100644--- a/frontend/l10n/en.json+++ b/frontend/l10n/en.json@@ -540,7 +540,7 @@"fail.keysOld.next": "The game needs a key that came with a newer Switch system version. Update your own Switch, take prod.keys from it again, choose the new file and build again. The log names the key and the system version.","fail.keysOld.what": "Your prod.keys file is older than the game.","fail.noProfile.next": "Switch 2 games build only when the engine knows them. Update the engine, or wait until the engine has a profile for this game.",- "fail.noProfile.what": "The engine has no profile for this game, and a game folder builds only a game with one.",+ "fail.noProfile.what": "The engine has no profile for this game, and a game folder or a NUP file builds only a game with one.","fail.noSigningAccount.next": "Open Xcode > Settings > Accounts, sign in with your Apple ID and make sure the team is listed, then build again. A free Apple ID is enough and Xcode creates the certificate itself.","fail.noSigningAccount.what": "Xcode has no signing account for the chosen team.","fail.noTitleID.next": "Rename the file to include its title ID, like Game Name [0100XXXXXXXXXXXX].nsp, using the ID of that exact package, since the base game, an update and DLC each have their own. Then build again.\nIt can also be that the folder has no .nsp, .xci, .nsz or .xcz files (split or archived parts such as .00 or .rar are not read), or that the files are still in iCloud and not downloaded. Choose Show folder to check.",@@ -575,16 +575,22 @@"folder.base": "Game folder, title ID %@ from main.npdm","folder.dlc": "Add-on content folders: %d","folder.engineOld": "This engine does not build game folders. Update the engine first.",- "folder.keys": "Not needed. The files in a game folder are not encrypted.",+ "folder.engineOldNUP": "This engine does not build NUP files. Update the engine first.",+ "folder.keys": "Not needed. A game folder or a NUP file is not encrypted.","folder.noProfile": "The engine has no profile for %@. A game folder builds only a game the engine knows.",+ "folder.nupBase": "NUP file, title ID %@",+ "folder.nupBaseNoID": "NUP file. The build reads its title ID.","folder.problem.dlcName": "dlc/%@ is not named with a title ID.","folder.problem.dlcRomFS": "dlc/%1$@ needs one romfs folder and has %2$d.","folder.problem.missing": "This game folder has no %@.","folder.problem.noBase": "Put exefs and romfs into a folder named base, then choose this folder again.","folder.problem.notBase": "main.npdm names %@, which is not a base game.","folder.problem.notDLC": "dlc/%@ is not add-on content of this game.",+ "folder.problem.notNUP": "%@ is not a NUP file of format version 1.","folder.problem.npdm": "base/exefs/main.npdm cannot be read as an NPDM file.",+ "folder.problem.nupPartial": "%@ is not the size its header says. It was probably copied or downloaded only in part.","folder.problem.package": "%@ is next to the game's folders. Keep the packages or the folders, not both.",+ "folder.problem.severalNUPs": "This folder holds %d NUP files. Keep one game per folder, or choose the NUP file itself.","folder.update": "Update version %d","folder.updates": "Update version %1$d, the newest of %2$d","free.clones": "A Mac app built on the same drive shares its game files and shaders with this folder (APFS clones), so removing them can free less than shown.",diff --git a/frontend/l10n/fr.json b/frontend/l10n/fr.jsonindex d035cd47..68846de2 100644--- a/frontend/l10n/fr.json+++ b/frontend/l10n/fr.json@@ -541,7 +541,7 @@"fail.keysOld.next": "Le jeu a besoin d'une clé arrivée avec une version plus récente du système de la Switch. Mettez à jour votre propre Switch, récupérez à nouveau prod.keys, choisissez le nouveau fichier puis compilez à nouveau. Le journal indique la clé et la version du système.","fail.keysOld.what": "Votre fichier prod.keys est plus ancien que le jeu.","fail.noProfile.next": "Les jeux Switch 2 ne se compilent que si le moteur les connaît. Mettez le moteur à jour, ou attendez qu'il ait un profil pour ce jeu.",- "fail.noProfile.what": "Le moteur n'a pas de profil pour ce jeu, et un dossier de jeu ne se compile que pour un jeu qui en a un.",+ "fail.noProfile.what": "Le moteur n'a pas de profil pour ce jeu, et un dossier de jeu ou un fichier NUP ne se compile que pour un jeu qui en a un.","fail.noSigningAccount.next": "Ouvrez Xcode > Settings > Accounts, connectez-vous avec votre identifiant Apple et vérifiez que l’équipe figure dans la liste, puis compilez à nouveau. Un identifiant Apple gratuit suffit et Xcode crée lui-même le certificat.","fail.noSigningAccount.what": "Xcode n’a pas de compte de signature pour l’équipe choisie.","fail.noTitleID.next": "Renommez le fichier pour y inclure son title ID, par exemple Nom du jeu [0100XXXXXXXXXXXX].nsp, avec l’ID de ce paquet précis, car le jeu de base, une mise à jour et un DLC ont chacun le leur. Puis compilez à nouveau.\nIl se peut aussi que le dossier ne contienne aucun fichier .nsp, .xci, .nsz ou .xcz (les parties découpées ou archivées comme .00 ou .rar ne sont pas lues), ou que les fichiers soient encore dans iCloud et non téléchargés. Choisissez Afficher le dossier pour vérifier.",@@ -576,16 +576,22 @@"folder.base": "Dossier du jeu, ID de titre %@ lu dans main.npdm","folder.dlc": "Dossiers de contenu additionnel : %d","folder.engineOld": "Ce moteur ne compile pas les dossiers de jeu. Mettez d'abord le moteur à jour.",- "folder.keys": "Pas nécessaire. Les fichiers d'un dossier de jeu ne sont pas chiffrés.",+ "folder.engineOldNUP": "Ce moteur ne compile pas les fichiers NUP. Mettez d'abord le moteur à jour.",+ "folder.keys": "Pas nécessaire. Un dossier de jeu ou un fichier NUP n'est pas chiffré.","folder.noProfile": "Le moteur n'a pas de profil pour %@. Un dossier de jeu ne se compile que pour un jeu que le moteur connaît.",+ "folder.nupBase": "Fichier NUP, ID de titre %@",+ "folder.nupBaseNoID": "Fichier NUP. La compilation lit son ID de titre.","folder.problem.dlcName": "dlc/%@ ne porte pas le nom d'un ID de titre.","folder.problem.dlcRomFS": "dlc/%1$@ doit contenir un dossier romfs et en contient %2$d.","folder.problem.missing": "Il manque %@ dans ce dossier de jeu.","folder.problem.noBase": "Placez exefs et romfs dans un dossier nommé base, puis choisissez à nouveau ce dossier.","folder.problem.notBase": "main.npdm indique %@, qui n'est pas un jeu de base.","folder.problem.notDLC": "dlc/%@ n'est pas un contenu additionnel de ce jeu.",+ "folder.problem.notNUP": "%@ n'est pas un fichier NUP au format version 1.","folder.problem.npdm": "base/exefs/main.npdm ne peut pas être lu comme un fichier NPDM.",+ "folder.problem.nupPartial": "%@ n'a pas la taille indiquée par son en-tête. Il a sans doute été copié ou téléchargé en partie seulement.","folder.problem.package": "%@ se trouve à côté des dossiers du jeu. Gardez les paquets ou les dossiers, pas les deux.",+ "folder.problem.severalNUPs": "Ce dossier contient %d fichiers NUP. Gardez un seul jeu par dossier, ou choisissez le fichier NUP lui-même.","folder.update": "Mise à jour version %d","folder.updates": "Mise à jour version %1$d, la plus récente des %2$d","free.clones": "Une app Mac compilée sur le même disque partage ses fichiers de jeu et ses shaders avec ce dossier (clones APFS) : leur suppression peut donc libérer moins que ce qui est indiqué.",diff --git a/frontend/l10n/it.json b/frontend/l10n/it.jsonindex d23020ed..e079e4a7 100644--- a/frontend/l10n/it.json+++ b/frontend/l10n/it.json@@ -541,7 +541,7 @@"fail.keysOld.next": "Il gioco ha bisogno di una chiave arrivata con una versione più recente del sistema della Switch. Aggiorna la tua Switch, prendi di nuovo prod.keys da lei, scegli il nuovo file e compila di nuovo. Il log indica la chiave e la versione del sistema.","fail.keysOld.what": "Il tuo file prod.keys è più vecchio del gioco.","fail.noProfile.next": "I giochi Switch 2 si compilano solo se il motore li conosce. Aggiorna il motore, o aspetta che abbia un profilo per questo gioco.",- "fail.noProfile.what": "Il motore non ha un profilo per questo gioco, e una cartella del gioco si compila solo per un gioco che ne ha uno.",+ "fail.noProfile.what": "Il motore non ha un profilo per questo gioco, e una cartella del gioco o un file NUP si compila solo per un gioco che ne ha uno.","fail.noSigningAccount.next": "Apri Xcode > Settings > Accounts, accedi con il tuo Apple ID e verifica che il team compaia nell’elenco, poi compila di nuovo. Basta un Apple ID gratuito e Xcode crea il certificato da solo.","fail.noSigningAccount.what": "Xcode non ha un account di firma per il team scelto.","fail.noTitleID.next": "Rinomina il file in modo che includa il suo title ID, come Nome del gioco [0100XXXXXXXXXXXX].nsp, usando l’ID di quel pacchetto specifico, perché gioco base, aggiornamento e DLC hanno ciascuno il proprio. Poi compila di nuovo.\nPuò anche darsi che la cartella non contenga file .nsp, .xci, .nsz o .xcz (le parti divise o archiviate come .00 o .rar non vengono lette), o che i file siano ancora in iCloud e non scaricati. Scegli Mostra cartella per controllare.",@@ -576,16 +576,22 @@"folder.base": "Cartella del gioco, ID titolo %@ da main.npdm","folder.dlc": "Cartelle di contenuti aggiuntivi: %d","folder.engineOld": "Questo motore non compila le cartelle dei giochi. Aggiorna prima il motore.",- "folder.keys": "Non serve. I file di una cartella del gioco non sono cifrati.",+ "folder.engineOldNUP": "Questo motore non compila i file NUP. Aggiorna prima il motore.",+ "folder.keys": "Non serve. Una cartella del gioco o un file NUP non è cifrato.","folder.noProfile": "Il motore non ha un profilo per %@. Una cartella del gioco si compila solo per un gioco che il motore conosce.",+ "folder.nupBase": "File NUP, ID titolo %@",+ "folder.nupBaseNoID": "File NUP. La build legge il suo ID titolo.","folder.problem.dlcName": "dlc/%@ non ha come nome un ID titolo.","folder.problem.dlcRomFS": "dlc/%1$@ deve avere una cartella romfs e ne ha %2$d.","folder.problem.missing": "In questa cartella del gioco manca %@.","folder.problem.noBase": "Metti exefs e romfs in una cartella chiamata base, poi scegli di nuovo questa cartella.","folder.problem.notBase": "main.npdm indica %@, che non è un gioco base.","folder.problem.notDLC": "dlc/%@ non è un contenuto aggiuntivo di questo gioco.",+ "folder.problem.notNUP": "%@ non è un file NUP nel formato versione 1.","folder.problem.npdm": "base/exefs/main.npdm non si legge come file NPDM.",+ "folder.problem.nupPartial": "%@ non ha la dimensione indicata nella sua intestazione. Probabilmente è stato copiato o scaricato solo in parte.","folder.problem.package": "%@ si trova accanto alle cartelle del gioco. Tieni i pacchetti o le cartelle, non entrambi.",+ "folder.problem.severalNUPs": "Questa cartella contiene %d file NUP. Tieni un gioco per cartella, o scegli direttamente il file NUP.","folder.update": "Aggiornamento versione %d","folder.updates": "Aggiornamento versione %1$d, il più recente di %2$d","free.clones": "Un’app per Mac compilata sullo stesso disco condivide file di gioco e shader con questa cartella (cloni APFS), quindi rimuoverli può liberare meno spazio di quanto indicato.",diff --git a/frontend/l10n/sv.json b/frontend/l10n/sv.jsonindex 7e74757d..6672abe0 100644--- a/frontend/l10n/sv.json+++ b/frontend/l10n/sv.json@@ -396,7 +396,7 @@"fail.keysOld.next": "Spelet behöver en nyckel som kom med en nyare systemversion för Switch. Uppdatera din egen Switch, hämta prod.keys från den igen, välj den nya filen och bygg sedan igen. Loggen anger nyckeln och systemversionen.","fail.keysOld.what": "Din prod.keys-fil är äldre än spelet.","fail.noProfile.next": "Switch 2-spel går bara att bygga när motorn känner till dem. Uppdatera motorn eller vänta tills den har en profil för det här spelet.",- "fail.noProfile.what": "Motorn har ingen profil för det här spelet, och en spelmapp bygger bara ett spel med profil.",+ "fail.noProfile.what": "Motorn har ingen profil för det här spelet, och en spelmapp eller en NUP-fil bygger bara ett spel med profil.","fail.noSigningAccount.next": "Öppna Xcode > Inställningar > Konton, logga in med ditt Apple-ID och kontrollera att teamet finns i listan. Bygg sedan igen. Ett gratis Apple-ID räcker och Xcode skapar certifikatet själv.","fail.noSigningAccount.what": "Xcode har inget signeringskonto för det valda teamet.","fail.noTitleID.next": "Byt namn på filen så att den innehåller sitt titel-ID, till exempel Game Name [0100XXXXXXXXXXXX].nsp, med ID:t för just det paketet, eftersom basspelet, en uppdatering och DLC har varsitt. Bygg sedan igen.\nDet kan också vara att mappen saknar .nsp-, .xci-, .nsz- eller .xcz-filer (delade eller arkiverade delar som .00 eller .rar läses inte), eller att filerna ligger kvar i iCloud och inte är nedladdade. Välj Visa mapp för att kontrollera.",@@ -418,16 +418,22 @@"folder.base": "Spelmapp, titel-ID %@ från main.npdm","folder.dlc": "Mappar med tillägg: %d","folder.engineOld": "Den här motorn bygger inte spelmappar. Uppdatera motorn först.",- "folder.keys": "Behövs inte. Filerna i en spelmapp är inte krypterade.",+ "folder.engineOldNUP": "Den här motorn bygger inte NUP-filer. Uppdatera motorn först.",+ "folder.keys": "Behövs inte. En spelmapp eller en NUP-fil är inte krypterad.","folder.noProfile": "Motorn har ingen profil för %@. En spelmapp bygger bara ett spel som motorn känner till.",+ "folder.nupBase": "NUP-fil, titel-ID %@",+ "folder.nupBaseNoID": "NUP-fil. Bygget läser dess titel-ID.","folder.problem.dlcName": "dlc/%@ har inte ett titel-ID som namn.","folder.problem.dlcRomFS": "dlc/%1$@ behöver en romfs-mapp och har %2$d.","folder.problem.missing": "Den här spelmappen saknar %@.","folder.problem.noBase": "Lägg exefs och romfs i en mapp som heter base och välj sedan den här mappen igen.","folder.problem.notBase": "main.npdm anger %@, som inte är ett grundspel.","folder.problem.notDLC": "dlc/%@ är inte ett tillägg till det här spelet.",+ "folder.problem.notNUP": "%@ är inte en NUP-fil i formatversion 1.","folder.problem.npdm": "base/exefs/main.npdm går inte att läsa som en NPDM-fil.",+ "folder.problem.nupPartial": "%@ har inte den storlek som dess huvud anger. Den kopierades eller laddades nog bara ner delvis.","folder.problem.package": "%@ ligger bredvid spelets mappar. Behåll paketen eller mapparna, inte båda.",+ "folder.problem.severalNUPs": "Den här mappen innehåller %d NUP-filer. Ha ett spel per mapp, eller välj själva NUP-filen.","folder.update": "Uppdateringsversion %d","folder.updates": "Uppdateringsversion %1$d, den nyaste av %2$d","free.clones": "En Mac-app som byggts på samma enhet delar spelfiler och shaders med den här mappen genom APFS-kloner. Därför kan mindre utrymme frigöras än vad som visas.",diff --git a/frontend/l10n/zh.json b/frontend/l10n/zh.jsonindex 0bb99510..54ecea76 100644--- a/frontend/l10n/zh.json+++ b/frontend/l10n/zh.json@@ -541,7 +541,7 @@"fail.keysOld.next": "这个游戏需要更新版本的 Switch 系统才带有的密钥。请更新你自己的 Switch,重新从它导出 prod.keys,选择新的文件后再构建。日志里写明了缺少的密钥和对应的系统版本。","fail.keysOld.what": "你的 prod.keys 文件比这个游戏旧。","fail.noProfile.next": "Switch 2 游戏只有在引擎认识它时才能构建。请更新引擎,或等待引擎加入这个游戏的配置。",- "fail.noProfile.what": "引擎没有这个游戏的配置,而游戏文件夹只能构建有配置的游戏。",+ "fail.noProfile.what": "引擎没有这个游戏的配置,而游戏文件夹和 NUP 文件只能构建有配置的游戏。","fail.noSigningAccount.next": "请打开 Xcode > 设置 > 账户,登录你的 Apple ID,确认团队已列出,然后再构建。免费的 Apple ID 就够用,证书由 Xcode 自己创建。","fail.noSigningAccount.what": "Xcode 里没有所选团队的签名账户。","fail.noTitleID.next": "请把文件改名,加上它的标题 ID,例如 Game Name [0100XXXXXXXXXXXX].nsp,并使用这个安装包自己的 ID,因为本体、更新和 DLC 各有各的 ID。然后再构建。\n也可能是文件夹里没有 .nsp、.xci、.nsz 或 .xcz 文件(分卷或压缩包,例如 .00、.rar,不会被读取),或者文件还在 iCloud 里没有下载。点「显示文件夹」可以查看。",@@ -576,16 +576,22 @@"folder.base": "游戏文件夹,标题 ID %@(来自 main.npdm)","folder.dlc": "追加内容文件夹:%d 个","folder.engineOld": "这个引擎不能构建游戏文件夹。请先更新引擎。",- "folder.keys": "不需要。游戏文件夹里的文件没有加密。",+ "folder.engineOldNUP": "这个引擎不能构建 NUP 文件。请先更新引擎。",+ "folder.keys": "不需要。游戏文件夹和 NUP 文件都没有加密。","folder.noProfile": "引擎没有 %@ 的游戏配置。游戏文件夹只能构建引擎已有配置的游戏。",+ "folder.nupBase": "NUP 文件,标题 ID %@",+ "folder.nupBaseNoID": "NUP 文件。构建时会读取它的标题 ID。","folder.problem.dlcName": "dlc/%@ 的名称不是标题 ID。","folder.problem.dlcRomFS": "dlc/%1$@ 需要一个 romfs 文件夹,现在有 %2$d 个。","folder.problem.missing": "这个游戏文件夹缺少 %@。","folder.problem.noBase": "请把 exefs 和 romfs 放进名为 base 的文件夹,然后重新选择这个文件夹。","folder.problem.notBase": "main.npdm 写的是 %@,这不是游戏本体。","folder.problem.notDLC": "dlc/%@ 不是这个游戏的追加内容。",+ "folder.problem.notNUP": "%@ 不是格式版本 1 的 NUP 文件。","folder.problem.npdm": "base/exefs/main.npdm 无法作为 NPDM 文件读取。",+ "folder.problem.nupPartial": "%@ 的大小和文件头写的不一致。它可能只复制或下载了一部分。","folder.problem.package": "%@ 和游戏的文件夹放在一起。请只保留安装包或文件夹其中一种。",+ "folder.problem.severalNUPs": "这个文件夹里有 %d 个 NUP 文件。每个文件夹只放一个游戏,或者直接选择那个 NUP 文件。","folder.update": "更新版本 %d","folder.updates": "更新版本 %1$d,%2$d 个中最新的","free.clones": "在同一个磁盘上构建的 Mac 应用与这里的游戏文件和着色器共享数据(APFS 克隆),因此实际释放的空间可能少于显示的大小。",