Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

Mac launcher: build a Switch 2 game from its folder

v0lumehi034add22fcf4
diff --git a/frontend/Sources/NX2Apple/BuildNotifications.swift b/frontend/Sources/NX2Apple/BuildNotifications.swift
index af960574..bd25d924 100644
--- a/frontend/Sources/NX2Apple/BuildNotifications.swift
+++ b/frontend/Sources/NX2Apple/BuildNotifications.swift
@@ -94,9 +94,9 @@ final class BuildNotifier: NSObject, ObservableObject, UNUserNotificationCenterD
}
@MainActor private func post(_ outcome: BuildNotice.Outcome, m: BuildStore, library: GameLibrary) {
- let titleID = TitleID.parse(m.basePath).map { String(format: "%016llX", $0) } ?? ""
+ let titleID = m.gameTitleID ?? ""
let game = library.games.first { $0.titleID == titleID }
- let name = game?.name ?? GameLibrary.title(for: m.basePath, repo: m.repo.path, titleID: titleID)
+ let name = game?.name ?? GameLibrary.title(for: m.gameFolder?.folder ?? m.basePath, repo: m.repo.path, titleID: titleID)
let text = BuildNotice.text(outcome, game: name, target: m.target, device: m.installedOn.isEmpty ? nil : m.devices.deviceName(m.installedOn), m.t)
let content = UNMutableNotificationContent()
content.title = text.title
diff --git a/frontend/Sources/NX2Apple/FilesCard.swift b/frontend/Sources/NX2Apple/FilesCard.swift
index 9eb6305e..dd02ce89 100644
--- a/frontend/Sources/NX2Apple/FilesCard.swift
+++ b/frontend/Sources/NX2Apple/FilesCard.swift
@@ -30,7 +30,7 @@ struct FilesCard: View {
.buttonStyle(.plain)
ForEach(build.slots.filter { !$0.optional }, id: \.id) { s in
CardDivider(); slotRow(s)
- if s.id == "keys", let keyCheck { KeyCheckLine(outcome: keyCheck, t: loc.t) }
+ if s.id == "keys", build.gameFolder == nil, let keyCheck { KeyCheckLine(outcome: keyCheck, t: loc.t) }
}
CardDivider()
CardDisclosure(loc.t("build.options"), isOpen: extrasOpen) { extrasOpen.toggle() }
@@ -49,14 +49,19 @@ struct FilesCard: View {
}
private func slotRow(_ s: Slot) -> some View {
- // An empty prod.keys row says where the file comes from.
- CardRow(loc.t(s.title), detail: s.id == "keys" && s.paths.isEmpty ? loc.t("build.keyHint") : s.summary(loc.t), dot: s.ok ? LauncherPalette.ready : LauncherPalette.unbuilt,
- help: s.paths.joined(separator: "\n")) {
- if !s.paths.isEmpty {
+ // A game folder (a Switch 2 game) fills the rows from its folders: they say what it holds, the keys row that none are
+ // needed, and only the base row can be cleared (which clears the folder). An empty prod.keys row says where the file comes from.
+ let folderText = build.gameFolderRowText(s.id)
+ let ready = folderText != nil ? (s.id == "keys" || s.ok) : s.ok
+ return CardRow(loc.t(s.title), detail: folderText ?? (s.id == "keys" && s.paths.isEmpty ? loc.t("build.keyHint") : s.summary(loc.t)),
+ dot: ready ? LauncherPalette.ready : LauncherPalette.unbuilt, help: s.paths.joined(separator: "\n")) {
+ if !s.paths.isEmpty && (folderText == nil || s.id == "base") {
Button(loc.t("data.clear")) { build.clear(s.id) }.buttonStyle(.plain)
.font(.manrope(13)).foregroundStyle(.secondary)
}
- Button(s.paths.isEmpty ? loc.t("data.choose") : loc.t("data.change")) { build.pickFiles(kind: s.kind) }
+ if folderText == nil {
+ Button(s.paths.isEmpty ? loc.t("data.choose") : loc.t("data.change")) { build.pickFiles(kind: s.kind) }
+ }
}
}
diff --git a/frontend/Sources/NX2Apple/LauncherView.swift b/frontend/Sources/NX2Apple/LauncherView.swift
index fb1db289..5d055ee9 100644
--- a/frontend/Sources/NX2Apple/LauncherView.swift
+++ b/frontend/Sources/NX2Apple/LauncherView.swift
@@ -470,6 +470,7 @@ struct LauncherView: View {
func newBuild() {
guard !m.running else { page = .builds; return }
+ m.leaveGameFolder()
for index in m.slots.indices { m.slots[index].paths = []; m.slots[index].problem = "" }
m.gameDir = ""; m.done = false; m.doneNote = ""; m.macAppPath = ""; m.stages = []
if m.outDir.isEmpty && !library.folder.isEmpty { m.outDir = library.folder }
@@ -478,13 +479,18 @@ struct LauncherView: View {
func configureBuild(_ game: LibraryGame) {
guard !m.running else { page = .builds; return }
- for index in m.slots.indices {
- m.slots[index].paths = game.inputs[m.slots[index].id] ?? []
- m.slots[index].problem = ""
+ if let folder = game.inputs[GameLibrary.folderInput]?.first {
+ m.scan(folder: folder) // a game folder is read again: its updates and DLC may have changed since
+ } else {
+ m.leaveGameFolder()
+ for index in m.slots.indices {
+ m.slots[index].paths = game.inputs[m.slots[index].id] ?? []
+ m.slots[index].problem = ""
+ }
+ // The folder the game's files were found in (a base package may sit one level down in its own folder) — from the
+ // scan, or from the last build. Falling back to the base's folder would put the update and DLC out of reach.
+ m.gameDir = game.sourceFolder.isEmpty ? (m.basePath as NSString).deletingLastPathComponent : game.sourceFolder
}
- // The folder the game's files were found in (a base package may sit one level down in its own folder) — from the
- // scan, or from the last build. Falling back to the base's folder would put the update and DLC out of reach.
- m.gameDir = game.sourceFolder.isEmpty ? (m.basePath as NSString).deletingLastPathComponent : game.sourceFolder
m.outDir = game.outputDirectory
m.done = false; m.doneNote = ""; m.stages = []
m.target = game.lastTarget
diff --git a/frontend/Sources/NX2Apple/Library.swift b/frontend/Sources/NX2Apple/Library.swift
index 345a78f1..b1baffbc 100644
--- a/frontend/Sources/NX2Apple/Library.swift
+++ b/frontend/Sources/NX2Apple/Library.swift
@@ -266,6 +266,8 @@ struct MacGameBundle {
}
final class GameLibrary: ObservableObject {
+ /// The key of `LibraryGame.inputs` that holds a game folder (a Switch 2 game's base/, updates/, dlc/), read again on Build.
+ static let folderInput = "folder"
@Published private(set) var games: [LibraryGame] = []
@Published var selectedID: UUID?
@Published var error: String?
@@ -491,15 +493,16 @@ final class GameLibrary: ObservableObject {
@MainActor @discardableResult func rememberInputs(_ model: BuildStore) -> UUID? {
guard !model.basePath.isEmpty else { return nil }
- let titleID = TitleID.parse(model.basePath).map { String(format: "%016llX", $0) }
- ?? URL(fileURLWithPath: model.basePath).standardizedFileURL.path
- var game = games.first { $0.titleID == titleID } ?? LibraryGame(titleID: titleID, name: Self.title(for: model.basePath, repo: model.repo.path, titleID: titleID))
+ let titleID = model.gameTitleID ?? URL(fileURLWithPath: model.basePath).standardizedFileURL.path
+ 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] }
game.outputDirectory = model.outDir
if !model.gameDir.isEmpty { game.sourceFolder = model.gameDir }
game.lastTarget = model.target
// An existing output is linked only after validating its metadata and executables.
- let dir = model.outDir.isEmpty ? URL(fileURLWithPath: model.basePath).deletingLastPathComponent().path : model.outDir
+ let dir = model.outDir.isEmpty ? model.inputFolder : model.outDir
let expected = URL(fileURLWithPath: dir).appendingPathComponent(titleID + ".app")
if let app = try? MacGameBundle.read(expected), app.titleID == titleID { game.appPath = expected.path }
upsert(game)
diff --git a/frontend/Sources/NXCore/GameFolder.swift b/frontend/Sources/NXCore/GameFolder.swift
index 1fef7f6e..f970aef5 100644
--- a/frontend/Sources/NXCore/GameFolder.swift
+++ b/frontend/Sources/NXCore/GameFolder.swift
@@ -123,6 +123,15 @@ package enum GameFolder {
!engineRoot.isEmpty && FileManager.default.fileExists(atPath: engineRoot + "/dm/games/" + String(format: "%016llX", titleID) + "/game.tsv")
}
+ /// The `name` row of the game's profile: a game folder has no control data, so the script names the app after it too.
+ package static func profileName(_ titleID: UInt64, engineRoot: String) -> String? {
+ guard !engineRoot.isEmpty,
+ let text = try? String(contentsOfFile: engineRoot + "/dm/games/" + String(format: "%016llX", titleID) + "/game.tsv", encoding: .utf8),
+ let row = text.split(separator: "\n").first(where: { $0.hasPrefix("name\t") }) else { return nil }
+ let name = row.dropFirst(5).trimmingCharacters(in: .whitespaces)
+ return name.isEmpty ? nil : name
+ }
+
private static func isFile(_ path: String) -> Bool {
var d: ObjCBool = false
return FileManager.default.fileExists(atPath: path, isDirectory: &d) && !d.boolValue
diff --git a/frontend/Sources/NXLauncher/ActionCard.swift b/frontend/Sources/NXLauncher/ActionCard.swift
index e5678e36..16905485 100644
--- a/frontend/Sources/NXLauncher/ActionCard.swift
+++ b/frontend/Sources/NXLauncher/ActionCard.swift
@@ -47,10 +47,12 @@ package struct ActionCard: View {
Text(loc.t("status.installFirst")).font(.manrope(13)).foregroundStyle(LauncherPalette.building)
} else if !repo.isRepo {
Text(loc.t("status.chooseRepo")).font(.manrope(13)).foregroundStyle(LauncherPalette.building)
- } else if !build.slot("base").ok || !build.slot("keys").ok {
+ } else if build.gameFolderRefused {
+ Text(loc.t("status.fixFolder")).font(.manrope(13)).foregroundStyle(.secondary)
+ } else if !build.inputsReady {
Text(loc.t("status.needInputs")).font(.manrope(13)).foregroundStyle(.secondary)
} else {
- Text(String(format: loc.t("status.output"), build.shortPath(build.outDir.isEmpty ? (build.basePath as NSString).deletingLastPathComponent : build.outDir)))
+ Text(String(format: loc.t("status.output"), build.shortPath(build.outDir.isEmpty ? build.inputFolder : build.outDir)))
.font(.manrope(13)).foregroundStyle(.secondary).lineLimit(1).truncationMode(.head)
}
}
diff --git a/frontend/Sources/NXLauncher/ExportSteps.swift b/frontend/Sources/NXLauncher/ExportSteps.swift
index b7fad066..dc460043 100644
--- a/frontend/Sources/NXLauncher/ExportSteps.swift
+++ b/frontend/Sources/NXLauncher/ExportSteps.swift
@@ -30,7 +30,7 @@ package struct ExportSteps: View {
/// Step 3 waits for step 1: until the IPA exists its controls are shown, but all of them quieter and inert.
private var inert: Bool { !exported && !sentDone }
private var toDrive: Bool { devices.sendWhere == SendWhere.drive }
- private var gameName: String { ((build.basePath as NSString).lastPathComponent as NSString).deletingPathExtension }
+ private var gameName: String { build.gameName }
private var oneGame: Bool { devices.exportOneGame }
package var body: some View {
diff --git a/frontend/Sources/NXModel/BuildStore+Archive.swift b/frontend/Sources/NXModel/BuildStore+Archive.swift
index 1f2d0486..6359b8ec 100644
--- a/frontend/Sources/NXModel/BuildStore+Archive.swift
+++ b/frontend/Sources/NXModel/BuildStore+Archive.swift
@@ -42,8 +42,8 @@ extension BuildStore {
// first. Copying the whole `games` folder onto the phone (or into a folder the Files app
// exposes on an external drive) then needs no renaming, and several games' folders can sit
// side by side in one app.
- let gamesRoot = (outDir.isEmpty ? (basePath as NSString).deletingLastPathComponent : outDir) + "/games"
- let tid = titleID.flatMap { $0.isEmpty ? nil : $0 } ?? TitleID.buildKey(basePath)
+ let gamesRoot = (outDir.isEmpty ? inputFolder : outDir) + "/games"
+ let tid = titleID.flatMap { $0.isEmpty ? nil : $0 } ?? buildKey
// games/<id>/ holds romfs.img and aoc/ side by side: main.m's per-game lookup takes the
// image, and the host mounts DLC from aoc/<index>.img (hle_fs.c aoc_dir). One folder, which
// the user copies to the phone or keeps on an external drive as a whole.
diff --git a/frontend/Sources/NXModel/BuildStore+DropFiles.swift b/frontend/Sources/NXModel/BuildStore+DropFiles.swift
index 9d23713c..e354c7bb 100644
--- a/frontend/Sources/NXModel/BuildStore+DropFiles.swift
+++ b/frontend/Sources/NXModel/BuildStore+DropFiles.swift
@@ -14,6 +14,7 @@ extension BuildStore {
return FileManager.default.fileExists(atPath: p, isDirectory: &d) && d.boolValue
}
if paths.count == 1, isFolder(paths[0]) { scan(folder: paths[0]); return }
+ leaveGameFolder() // packages dropped after a game folder start over: the two never mix
var 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)
let baseName = (found.base ?? (basePath.isEmpty ? nil : basePath)).map { ($0 as NSString).lastPathComponent }
diff --git a/frontend/Sources/NXModel/BuildStore+GameFolder.swift b/frontend/Sources/NXModel/BuildStore+GameFolder.swift
new file mode 100644
index 00000000..bc5ac803
--- /dev/null
+++ b/frontend/Sources/NXModel/BuildStore+GameFolder.swift
@@ -0,0 +1,97 @@
+import Foundation
+import NXCore
+
+// A game chosen as a folder of its files (GameFolder, LNPANDY/NX2Apple#512 and #445): how Switch 2 games come. The rows show what the
+// folder holds and are not picked one by one, the keys row says no keys are needed, and the build passes the folder to the script
+// with no -k (BuildStore+Run.swift).
+
+extension 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
+ gameFolder = nil
+ gameFolderRefused = false
+ for i in slots.indices { slots[i].paths = []; slots[i].problem = ""; slots[i].note = "" }
+ switch GameFolder.scan(folder) {
+ case .failure(let problem):
+ refuseGameFolder(gameFolderProblemText(problem))
+ case .success(let contents):
+ if let why = gameFolderEngineProblem(contents) { refuseGameFolder(why); return }
+ gameFolder = contents
+ updateSlot("base") { $0.paths = [contents.basePath] }
+ updateSlot("update") { $0.paths = contents.newestUpdate.map { [$0.path] } ?? [] }
+ updateSlot("dlc") { $0.paths = contents.dlc.map(\.path) }
+ }
+ }
+
+ /// Back to packages: the folder's rows are emptied, so a picked or dropped package never mixes with them.
+ package func leaveGameFolder() {
+ guard gameFolder != nil || gameFolderRefused else { return }
+ gameFolder = nil
+ gameFolderRefused = false
+ for i in slots.indices { slots[i].paths = []; slots[i].problem = ""; slots[i].note = "" }
+ }
+
+ private func refuseGameFolder(_ why: String) {
+ gameFolderRefused = true
+ updateSlot("base") { $0.problem = why }
+ }
+
+ /// What the engine lacks for this folder: the packer (an older engine), or a profile for the game. nil without an engine yet:
+ /// the build asks again before it starts.
+ 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) }
+ return nil
+ }
+
+ /// The problem as a finished sentence in the current language, with the missing piece named.
+ package func gameFolderProblemText(_ problem: GameFolder.Problem) -> String {
+ switch problem {
+ case .missing(let piece): return String(format: t("folder.problem.missing"), piece)
+ case .noBaseFolder: return t("folder.problem.noBase")
+ case .unreadableNPDM: return t("folder.problem.npdm")
+ case .notBaseTitle(let tid): return String(format: t("folder.problem.notBase"), String(format: "%016llX", tid))
+ case .packageBeside(let name): return String(format: t("folder.problem.package"), name)
+ 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)
+ }
+ }
+
+ /// A row's text while a game folder is chosen, nil otherwise (the row then shows its files as for packages).
+ 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 "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)
+ case "dlc": return f.dlc.isEmpty ? t("data.notSelectedDlc") : String(format: t("folder.dlc"), f.dlc.count)
+ case "keys": return t("folder.keys")
+ default: return nil
+ }
+ }
+
+ /// The base game and the keys are there, or a game folder that needs no keys.
+ 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) }
+
+ /// 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) } }
+
+ /// 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
+ }
+ return ((basePath as NSString).lastPathComponent as NSString).deletingPathExtension
+ }
+}
diff --git a/frontend/Sources/NXModel/BuildStore+Inputs.swift b/frontend/Sources/NXModel/BuildStore+Inputs.swift
index 19d4d701..a0ac807d 100644
--- a/frontend/Sources/NXModel/BuildStore+Inputs.swift
+++ b/frontend/Sources/NXModel/BuildStore+Inputs.swift
@@ -9,7 +9,10 @@ extension BuildStore {
/// …800 update, anything above base+0x1000 add-on content), plus prod.keys.
/// Subfolders are scanned too — a dump usually arrives as 本体/ 更新/ DLC/ folders —
/// pruning the build folders this pipeline itself writes so a rescan is not slow.
+ /// A folder of the game's files (base/, updates/, dlc/: a Switch 2 game) is read as one game instead (BuildStore+GameFolder.swift).
package func scan(folder: String) {
+ if GameFolder.isCandidate(folder) { takeGameFolder(folder); return }
+ leaveGameFolder()
gameDir = folder
let found = GameInputs.classify(GameInputs.inputFiles(in: folder))
updateSlot("base") { $0.paths = found.base.map { [$0] } ?? []; $0.problem = found.base == nil ? "data.noBase" : "" }
@@ -56,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) {
+ leaveGameFolder() // a package picked for a row ends a game folder: the two never mix
let id = kind == .base ? "base" : kind == .update ? "update" : kind == .dlc ? "dlc" : "keys"
let baseName = kind == .base ? nil : (basePath as NSString).lastPathComponent
var fitting: [String] = [], problem = ""
@@ -75,5 +79,9 @@ extension BuildStore {
if kind == .base, let first = fitting.first { gameDir = (first as NSString).deletingLastPathComponent }
}
- package func clear(_ id: String) { updateSlot(id) { $0.paths = []; $0.problem = "" } }
+ /// Clearing a row of a game folder clears the folder: its rows are one game.
+ package func clear(_ id: String) {
+ if gameFolder != nil || gameFolderRefused { leaveGameFolder(); return }
+ updateSlot(id) { $0.paths = []; $0.problem = "" }
+ }
}
diff --git a/frontend/Sources/NXModel/BuildStore+Run.swift b/frontend/Sources/NXModel/BuildStore+Run.swift
index 9fd66138..195051e2 100644
--- a/frontend/Sources/NXModel/BuildStore+Run.swift
+++ b/frontend/Sources/NXModel/BuildStore+Run.swift
@@ -49,11 +49,14 @@ extension BuildStore {
// that holds other games too (a ROMs folder with one file per game) is staged as well: the
// script takes one game per folder and refuses one with several ("more than one game in the
// folder"), even when only the base game was picked (issue #58; ufooer's PR #31).
- let baseDir = (basePath as NSString).deletingLastPathComponent
- let allPaths = [basePath, updatePath] + dlcPaths
+ // A game folder (BuildStore+GameFolder.swift) goes to the script as it is: the engine must have its packer and the game's profile.
+ let folder = gameFolder
+ if let folder, let why = gameFolderEngineProblem(folder) { fail(why); return }
+ let baseDir = inputFolder
+ let allPaths = folder != nil ? [] : [basePath, updatePath] + dlcPaths
let dirs = Set(allPaths.filter { !$0.isEmpty }.map { ($0 as NSString).deletingLastPathComponent })
let picked = Set(allPaths.filter { !$0.isEmpty }.map { ($0 as NSString).lastPathComponent })
- let unpicked = ((try? FileManager.default.contentsOfDirectory(atPath: baseDir)) ?? []).filter {
+ let unpicked = folder != nil ? [] : ((try? FileManager.default.contentsOfDirectory(atPath: baseDir)) ?? []).filter {
["nsp", "xci", "nsz", "xcz"].contains(($0 as NSString).pathExtension.lowercased()) && !picked.contains($0)
}
// Staged, the folder's own update and add-on content would be left behind, where the script
@@ -61,7 +64,7 @@ extension BuildStore {
// exactly as build_ipa_from_nsp.py:445 reads it: the low 12 bits are 0x000 for a base game,
// 0x800 for its update, and anything else is add-on content below the base.
var staged = allPaths
- if let base = TitleID.parse((basePath as NSString).lastPathComponent) {
+ if folder == nil, let base = TitleID.parse((basePath as NSString).lastPathComponent) {
let app = base & ~0xFFF
for f in unpicked {
guard let tid = TitleID.parse(f) else { continue }
@@ -73,7 +76,7 @@ extension BuildStore {
staged.append(baseDir + "/" + f)
}
}
- let tidHex = TitleID.buildKey(basePath)
+ let tidHex = buildKey
let workDir = (outDir.isEmpty ? baseDir : outDir) + "/" + tidHex + "_build"
// The build's signing step refuses the attributes a cloud folder adds, after the long steps: stop here instead.
if cloudFolderCheck(workDir) {
@@ -125,8 +128,8 @@ extension BuildStore {
}
}
let engine = EngineLayout.root(repo.path) // the checkout's engine/ (#214)
- var args = [engine + "/" + RepoLayout.buildScript, inputDir, "-k", keysPath,
- "--progress", "json"]
+ // A game folder's files are not encrypted: the script ignores -k for it, and the launcher does not ask for the keys.
+ var args = [engine + "/" + RepoLayout.buildScript, inputDir] + (folder != nil ? [] : ["-k", keysPath]) + ["--progress", "json"]
// A compatibility switch the player turned on: written to a small env file the pipeline
// copies into the app bundle (main.m sets one variable per line at boot). Only for an iPhone or iPad build;
// a Mac app runs on this Mac's GPU, which always has BC support.
@@ -221,8 +224,8 @@ extension BuildStore {
// The game's archive, then its framework into the one shared app on the device
// The framework the build wrote, and the title ID in its name: the script names it after the game
// data's title ID, which the build key lacks when the file name has none (#515)
- let key = TitleID.buildKey(self.basePath)
- let name = ((self.basePath as NSString).lastPathComponent as NSString).deletingPathExtension
+ let key = self.buildKey
+ let name = self.gameName
let fw = ShellInstall.builtFramework(workDir: self.effectiveWorkDir)
?? ShellInstall.frameworkPath(workDir: self.effectiveWorkDir, titleID: key)
let tid = ShellInstall.titleID(ofFramework: fw)
diff --git a/frontend/Sources/NXModel/BuildStore+ShellRoot.swift b/frontend/Sources/NXModel/BuildStore+ShellRoot.swift
index 56cedba8..a85838c2 100644
--- a/frontend/Sources/NXModel/BuildStore+ShellRoot.swift
+++ b/frontend/Sources/NXModel/BuildStore+ShellRoot.swift
@@ -30,7 +30,7 @@ extension BuildStore {
/// The shell folder the cache row shows: the frameworks' mirror, shell.json and the banner cache live here.
package var shellCachePath: String { ShellLibrary.previewRoot(defaults: defaults, parent: shellRootParent, home: home) }
/// The folder a first shell root would sit in: the output folder, else the game's folder.
- package var shellRootParent: String { outDir.isEmpty ? (basePath as NSString).deletingLastPathComponent : outDir }
+ package var shellRootParent: String { outDir.isEmpty ? inputFolder : outDir }
/// The shell folder of the install: the saved one, else next to the output folder (or the game's folder).
package var shellRoot: String { ShellLibrary.resolveRoot(defaults: defaults, parent: shellRootParent, home: home) }
diff --git a/frontend/Sources/NXModel/BuildStore+Stale.swift b/frontend/Sources/NXModel/BuildStore+Stale.swift
index 36ae0b4c..cdf4ee96 100644
--- a/frontend/Sources/NXModel/BuildStore+Stale.swift
+++ b/frontend/Sources/NXModel/BuildStore+Stale.swift
@@ -12,7 +12,7 @@ extension BuildStore {
guard let chain = StaleFrameworks.currentChain(engineRoot: EngineLayout.root(repo.path)) else { return [] }
let root = shellRoot
let known = ShellLibrary.load(root: root).games.map { (titleID: $0.titleID, name: $0.name, framework: $0.framework) }
- return StaleFrameworks.find(root: root, chain: chain, known: known, except: TitleID.buildKey(basePath))
+ return StaleFrameworks.find(root: root, chain: chain, known: known, except: buildKey)
}
/// True when the build must wait for the player's answer: the prompt is showing (`staleFrameworks` is set).
diff --git a/frontend/Sources/NXModel/BuildStore.swift b/frontend/Sources/NXModel/BuildStore.swift
index 3f517f6f..d7b55cf1 100644
--- a/frontend/Sources/NXModel/BuildStore.swift
+++ b/frontend/Sources/NXModel/BuildStore.swift
@@ -80,6 +80,10 @@ func hop(_ body: @escaping @MainActor () -> Void) {
Slot(id: "dlc", kind: .dlc, title: "data.dlc", optional: true),
Slot(id: "keys", kind: .keys, title: "data.keys", optional: false),
]
+ /// The game folder the rows came from (BuildStore+GameFolder.swift), nil for packages.
+ @Published package var gameFolder: GameFolder.Contents?
+ /// A folder meant as a game folder was refused: the base row says why.
+ @Published package var gameFolderRefused = false
@Published package var outDir: String {
didSet { defaults.set(outDir, forKey: Self.outputKey) }
}
@@ -227,8 +231,9 @@ func hop(_ body: @escaping @MainActor () -> Void) {
if let i = slots.firstIndex(where: { $0.id == id }) { body(&slots[i]) }
}
- /// A build may start: the repository is usable, the base game and the keys are there, the tools are all present and none runs.
- package var canBuild: Bool { repo.isRepo && slot("base").ok && slot("keys").ok && deps.allPresent && !running }
+ /// A build may start: the repository is usable, the base game and the keys are there (a game folder needs no keys), the tools
+ /// are all present and none runs.
+ package var canBuild: Bool { repo.isRepo && inputsReady && deps.allPresent && !running }
/// A line for the build card's note, from a store that has no card of its own (the dependency store's failed install).
package func note(_ text: String) { doneNote = text }
diff --git a/frontend/Tests/NX2AppleTests/GameFolderCaptureTests.swift b/frontend/Tests/NX2AppleTests/GameFolderCaptureTests.swift
new file mode 100644
index 00000000..1b84a230
--- /dev/null
+++ b/frontend/Tests/NX2AppleTests/GameFolderCaptureTests.swift
@@ -0,0 +1,78 @@
+import AppKit
+import SwiftUI
+import XCTest
+@testable import NX2Apple
+@testable import NXCore
+@testable import NXModel
+
+/// The Builds page with a Switch 2 game folder chosen (LNPANDY/NX2Apple#512, #445). A synthetic folder and a stand-in engine: an
+/// NPDM with only the program ID, empty RomFS folders, a profile with only its name. No game data.
+final class GameFolderCaptureTests: IsolatedDefaultsTestCase {
+ /// A stand-in engine tree (the marker file, pack_dump.py, Donkey Kong Bananza's profile) and the game's folder beside it.
+ static func makeFolders(in root: String, profile: Bool = true, packer: Bool = true) -> (engine: String, game: String) {
+ let fm = FileManager.default
+ func write(_ path: String, _ data: Data = Data([1])) {
+ try? fm.createDirectory(atPath: (path as NSString).deletingLastPathComponent, withIntermediateDirectories: true)
+ fm.createFile(atPath: path, contents: data)
+ }
+ let engine = root + "/engine", game = root + "/Donkey Kong Bananza"
+ write(engine + "/" + EngineLayout.marker)
+ if packer { write(engine + "/scripts/pack_dump.py") }
+ 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))
+ }
+ write(game + "/base/exefs/main.npdm", npdm(programID: 0x040074A01BF12000))
+ write(game + "/base/exefs/main")
+ for dir in ["/base/romfs", "/updates/458752/exefs", "/updates/458752/romfs", "/dlc/040074a01bf13001/0/romfs"] {
+ try? fm.createDirectory(atPath: game + dir, withIntermediateDirectories: true)
+ }
+ return (engine, game)
+ }
+
+ /// A minimal main.npdm, as GameFolderTests (NXCoreTests) makes it.
+ static func npdm(programID: UInt64) -> Data {
+ var d = [UInt8](repeating: 0, count: 0x100)
+ d.replaceSubrange(0..<4, with: Array("META".utf8))
+ let off = 0x80, size = 0x40
+ for i in 0..<4 { d[0x70 + i] = UInt8(off >> (8 * i) & 0xFF); d[0x74 + i] = UInt8(size >> (8 * i) & 0xFF) }
+ d.replaceSubrange(off..<off + 4, with: Array("ACI0".utf8))
+ for i in 0..<8 { d[off + 0x10 + i] = UInt8(programID >> (8 * UInt64(i)) & 0xFF) }
+ return Data(d)
+ }
+
+ // MARK: Visual QA (matched by --filter testRenderLauncherForVisualQA)
+
+ @MainActor func testRenderLauncherForVisualQAGameFolder() throws {
+ guard let directory = ProcessInfo.processInfo.environment["NX_LAUNCHER_CAPTURE_DIR"] else { throw XCTSkip("Set NX_LAUNCHER_CAPTURE_DIR to capture native views") }
+ let output = URL(fileURLWithPath: directory)
+ try FileManager.default.createDirectory(at: output, withIntermediateDirectories: true)
+ let root = NSTemporaryDirectory() + "gamefolder-capture-" + UUID().uuidString
+ defer { try? FileManager.default.removeItem(atPath: root) }
+ let folders = Self.makeFolders(in: root)
+ NSApplication.shared.setActivationPolicy(.accessory)
+ let stores = LauncherStores(defaults: testDefaults); let model = stores.build
+ stores.repo.path = folders.engine
+ model.lang = CaptureLanguage.current(.en)
+ model.outDir = root
+ 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"))
+ func capture(_ name: String, target: String) throws {
+ model.target = target
+ model.scan(folder: folders.game)
+ 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
+ window.orderFront(nil)
+ RunLoop.main.run(until: Date().addingTimeInterval(0.8))
+ host.layoutSubtreeIfNeeded()
+ let rep = try XCTUnwrap(host.bitmapImageRepForCachingDisplay(in: host.bounds))
+ host.cacheDisplay(in: host.bounds, to: rep)
+ try XCTUnwrap(rep.representation(using: .png, properties: [:])).write(to: output.appendingPathComponent(name + ".png"))
+ window.orderOut(nil)
+ }
+ try capture("build-game-folder-mac", target: BuildTarget.mac)
+ try capture("build-game-folder-ios", target: BuildTarget.ios)
+ }
+}
diff --git a/frontend/Tests/NXModelTests/GameFolderStoreTests.swift b/frontend/Tests/NXModelTests/GameFolderStoreTests.swift
new file mode 100644
index 00000000..7b59bb1e
--- /dev/null
+++ b/frontend/Tests/NXModelTests/GameFolderStoreTests.swift
@@ -0,0 +1,174 @@
+import XCTest
+@testable import NXModel
+@testable import NXCore
+
+/// LNPANDY/NX2Apple#512 and #445: a Switch 2 game chosen as a folder of its files. The rows, the keys that are not needed, the
+/// engine checks and the script's command, on a synthetic folder and a stand-in engine tree (no game data, nothing is built).
+@MainActor final class GameFolderStoreTests: XCTestCase {
+ private final class FakeRepo: RepoLocation {
+ var path = ""
+ var isRepo = true
+ var isGit = true
+ }
+
+ private final class FakeDeps: DependencyInstalling {
+ var pythonPath = "/usr/bin/python3"
+ var dotnetPath = "/usr/bin/true"
+ var checked = true
+ var allPresent = true
+ var deps: [Dep] = []
+ func isInstalling(_ id: String) -> Bool { false }
+ func install(_ dep: Dep) -> Task<Void, Never> { Task {} }
+ }
+
+ private final class FakeEngine: EngineSyncing {
+ func syncEngine(then: ((Bool) -> Void)?) -> Task<Void, Never> { then?(true); return Task {} }
+ }
+
+ private final class FakeDevices: InstallTarget {
+ var installDevice = ""
+ var signingTeam = ""
+ var exportIPA = false
+ var exportOneGame = false
+ var driveFolder = ""
+ var devices: [AppleDevice] = []
+ var xcrun = "/usr/bin/true"
+ var readTeams: @Sendable () -> [SigningTeam] = { [] }
+ func deviceName(_ udid: String) -> String { "iPhone" }
+ nonisolated func askCopy(_ plan: ShellCopyPlan) -> ShellCopyDecision { .skip }
+ nonisolated func setWaiting(_ on: Bool) {}
+ nonisolated var waitCancelled: Bool { false }
+ func copyEnded() {}
+ }
+
+ private var root = ""
+ private var suite = ""
+ private let repo = FakeRepo()
+ private let runner = FakeProcessRunner()
+
+ override func setUpWithError() throws {
+ root = NSTemporaryDirectory() + "gamefolder-store-" + UUID().uuidString
+ suite = "nxmodel-gamefolder-" + UUID().uuidString
+ try FileManager.default.createDirectory(atPath: root, withIntermediateDirectories: true)
+ }
+
+ override func tearDownWithError() throws {
+ UserDefaults(suiteName: suite)?.removePersistentDomain(forName: suite)
+ try? FileManager.default.removeItem(atPath: root)
+ }
+
+ private func write(_ path: String, _ data: Data = Data([1])) {
+ try? FileManager.default.createDirectory(atPath: (path as NSString).deletingLastPathComponent, withIntermediateDirectories: true)
+ FileManager.default.createFile(atPath: path, contents: data)
+ }
+
+ private func mkdir(_ path: String) { try? FileManager.default.createDirectory(atPath: path, withIntermediateDirectories: true) }
+
+ /// A minimal main.npdm with only the program ID.
+ private func npdm(_ programID: UInt64) -> Data {
+ var d = [UInt8](repeating: 0, count: 0x100)
+ d.replaceSubrange(0..<4, with: Array("META".utf8))
+ d[0x70] = 0x80; d[0x74] = 0x40
+ d.replaceSubrange(0x80..<0x84, with: Array("ACI0".utf8))
+ for i in 0..<8 { d[0x90 + i] = UInt8(programID >> (8 * UInt64(i)) & 0xFF) }
+ return Data(d)
+ }
+
+ /// An engine tree (its marker, the build tools, pack_dump.py unless `packer` is false, a profile unless `profile` is false) and a game folder.
+ private func makeStore(profile: Bool = true, packer: Bool = true) -> (BuildStore, String) {
+ let 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 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")
+ mkdir(game + "/dlc/040074a01bf13001/0/romfs")
+ repo.path = engine
+ let store = BuildStore(localizer: Localizer(.en), runner: runner, repo: repo, deps: FakeDeps(), engine: FakeEngine(), devices: FakeDevices(),
+ defaults: UserDefaults(suiteName: suite)!)
+ store.cloudFolderCheck = { _ in false }
+ store.target = BuildTarget.mac
+ return (store, game)
+ }
+
+ func testAGameFolderFillsTheRowsAndNeedsNoKeys() {
+ let (store, game) = makeStore()
+ store.scan(folder: game)
+ XCTAssertEqual(store.gameFolder?.titleIDHex, "040074A01BF12000")
+ XCTAssertEqual(store.basePath, game + "/base")
+ XCTAssertEqual(store.updatePath, game + "/updates/458752", "the newest update, as the script packs it")
+ XCTAssertEqual(store.dlcPaths, [game + "/dlc/040074a01bf13001"])
+ XCTAssertTrue(store.keysPath.isEmpty)
+ XCTAssertTrue(store.canBuild, "no prod.keys for a game folder")
+ XCTAssertEqual(store.gameFolderRowText("keys"), store.t("folder.keys"))
+ XCTAssertEqual(store.gameFolderRowText("update"), String(format: store.t("folder.updates"), 458752, 2))
+ XCTAssertEqual(store.gameFolderRowText("base"), String(format: store.t("folder.base"), "040074A01BF12000"))
+ XCTAssertEqual(store.buildKey, "040074A01BF12000")
+ XCTAssertEqual(store.inputFolder, game)
+ XCTAssertEqual(store.gameName, "Donkey Kong Bananza", "the profile's name: a game folder has no control data")
+ }
+
+ func testTheScriptGetsTheFolderAndNoKeys() {
+ let (store, game) = makeStore()
+ store.scan(folder: game)
+ store.startBuild()
+ let args = store.lastBuildCommand
+ XCTAssertEqual(args.dropFirst(2).first, game, "the folder is the script's input, not a staging folder")
+ XCTAssertFalse(args.contains("-k"))
+ XCTAssertEqual(args.firstIndex(of: "--work-dir").map { args[$0 + 1] }, game + "/040074A01BF12000_build")
+ XCTAssertEqual(args.firstIndex(of: "-o").map { args[$0 + 1] }, game + "/040074A01BF12000.app")
+ XCTAssertTrue(args.contains("mac-app"))
+ }
+
+ func testWithoutAProfileTheFolderIsRefusedWithTheTitleID() {
+ let (store, game) = makeStore(profile: false)
+ store.scan(folder: game)
+ XCTAssertNil(store.gameFolder)
+ XCTAssertTrue(store.gameFolderRefused)
+ XCTAssertEqual(store.slot("base").problem, String(format: store.t("folder.noProfile"), "040074A01BF12000"))
+ XCTAssertFalse(store.canBuild)
+ }
+
+ func testAnEngineWithoutThePackerSaysToUpdateIt() {
+ let (store, game) = makeStore(packer: false)
+ store.scan(folder: game)
+ XCTAssertEqual(store.slot("base").problem, store.t("folder.engineOld"))
+ XCTAssertFalse(store.canBuild)
+ }
+
+ func testABrokenFolderNamesTheMissingPiece() {
+ let (store, game) = makeStore()
+ try? FileManager.default.removeItem(atPath: game + "/base/romfs")
+ try? FileManager.default.removeItem(atPath: game + "/updates")
+ store.scan(folder: game)
+ XCTAssertEqual(store.slot("base").problem, String(format: store.t("folder.problem.missing"), "base/romfs"))
+ XCTAssertFalse(store.canBuild)
+ }
+
+ func testAPackageAfterAGameFolderStartsOverAndClearingClearsTheFolder() {
+ let (store, game) = makeStore()
+ store.scan(folder: game)
+ let nsp = root + "/Game [0100000000001000].nsp"
+ write(nsp)
+ store.take(picked: [nsp], kind: .base)
+ XCTAssertNil(store.gameFolder)
+ XCTAssertEqual(store.basePath, nsp)
+ XCTAssertTrue(store.updatePath.isEmpty, "the folder's update does not stay beside a package")
+ XCTAssertFalse(store.canBuild, "a package needs the keys again")
+ store.scan(folder: game)
+ store.clear("base")
+ XCTAssertNil(store.gameFolder)
+ XCTAssertTrue(store.slots.allSatisfy(\.paths.isEmpty))
+ }
+
+ func testAFolderOfPackagesIsScannedAsBefore() {
+ let (store, _) = makeStore()
+ let folder = root + "/Mario"
+ write(folder + "/Mario [010015100B514000][v0].nsp")
+ store.scan(folder: folder)
+ XCTAssertNil(store.gameFolder)
+ XCTAssertEqual((store.basePath as NSString).lastPathComponent, "Mario [010015100B514000][v0].nsp")
+ XCTAssertEqual(store.buildKey, "010015100B514000")
+ }
+}
diff --git a/frontend/l10n/de.json b/frontend/l10n/de.json
index 501d3ecc..10d7fff2 100644
--- a/frontend/l10n/de.json
+++ b/frontend/l10n/de.json
@@ -570,6 +570,21 @@
"fail.zbic.what": "Die Module dieses Spiels nutzen Nintendos zstd-Variante (System 22.0.0 und neuer). Zum Lesen wird das Python-Paket zbic benötigt, das nicht installiert ist.",
"filter.built": "Gebaut",
"filter.owned": "Im Besitz",
+ "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.noProfile": "Die Engine hat kein Profil für %@. Ein Spielordner baut nur ein Spiel, das die Engine kennt.",
+ "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.npdm": "base/exefs/main.npdm lässt sich nicht als NPDM-Datei lesen.",
+ "folder.problem.package": "%@ liegt neben den Ordnern des Spiels. Behalte die Pakete oder die Ordner, nicht beides.",
+ "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.",
"free.confirm": "%@ an Build-Dateien entfernen?",
"free.confirmButton": "Entfernen",
@@ -1236,6 +1251,7 @@
"stale.title": "Die installierten Spiele neu bauen?",
"status.checkingDeps": "Abhängigkeiten werden geprüft …",
"status.chooseRepo": "Wähle zuerst das Projekt-Repository",
+ "status.fixFolder": "Der Spielordner oben lässt sich noch nicht bauen",
"status.installFirst": "Installiere zuerst die oben fehlenden Abhängigkeiten",
"status.needInputs": "Basisspiel und prod.keys fehlen noch",
"status.output": "Ausgabe: %@",
diff --git a/frontend/l10n/en.json b/frontend/l10n/en.json
index a3ff5dd4..51b409b8 100644
--- a/frontend/l10n/en.json
+++ b/frontend/l10n/en.json
@@ -568,6 +568,21 @@
"fail.zbic.what": "This game's modules use Nintendo's zstd variant (system 22.0.0 and later), and reading them needs the Python package zbic, which is not installed.",
"filter.built": "Built",
"filter.owned": "Owned",
+ "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.noProfile": "The engine has no profile for %@. A game folder builds only a game the engine knows.",
+ "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.npdm": "base/exefs/main.npdm cannot be read as an NPDM file.",
+ "folder.problem.package": "%@ is next to the game's folders. Keep the packages or the folders, not both.",
+ "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.",
"free.confirm": "Remove %@ of build files?",
"free.confirmButton": "Remove",
@@ -1362,6 +1377,7 @@
"stale.title": "Build the installed games again?",
"status.checkingDeps": "Checking dependencies…",
"status.chooseRepo": "Choose the project repository first",
+ "status.fixFolder": "The game folder above cannot be built yet",
"status.installFirst": "Install the missing dependencies above first",
"status.needInputs": "Still need the base game and prod.keys",
"status.output": "Output: %@",
diff --git a/frontend/l10n/fr.json b/frontend/l10n/fr.json
index bdde17e6..acd53962 100644
--- a/frontend/l10n/fr.json
+++ b/frontend/l10n/fr.json
@@ -569,6 +569,21 @@
"fail.zbic.what": "Les modules de ce jeu utilisent la variante zstd de Nintendo (système 22.0.0 et ultérieur), et leur lecture nécessite le paquet Python zbic, qui n’est pas installé.",
"filter.built": "Compilés",
"filter.owned": "Possédés",
+ "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.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.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.npdm": "base/exefs/main.npdm ne peut pas être lu comme un fichier NPDM.",
+ "folder.problem.package": "%@ se trouve à côté des dossiers du jeu. Gardez les paquets ou les dossiers, pas les deux.",
+ "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é.",
"free.confirm": "Supprimer %@ de fichiers de compilation ?",
"free.confirmButton": "Supprimer",
@@ -1238,6 +1253,7 @@
"stale.title": "Reconstruire les jeux installés ?",
"status.checkingDeps": "Vérification des dépendances…",
"status.chooseRepo": "Choisissez d’abord le dépôt du projet",
+ "status.fixFolder": "Le dossier de jeu ci-dessus ne peut pas encore être compilé",
"status.installFirst": "Installez d’abord les dépendances manquantes ci-dessus",
"status.needInputs": "Il manque encore le jeu de base et prod.keys",
"status.output": "Sortie : %@",
diff --git a/frontend/l10n/it.json b/frontend/l10n/it.json
index 7ae8a0b0..1c5388d1 100644
--- a/frontend/l10n/it.json
+++ b/frontend/l10n/it.json
@@ -569,6 +569,21 @@
"fail.zbic.what": "I moduli di questo gioco usano la variante zstd di Nintendo (sistema 22.0.0 e successivi) e per leggerli serve il pacchetto Python zbic, che non è installato.",
"filter.built": "Compilati",
"filter.owned": "Posseduti",
+ "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.noProfile": "Il motore non ha un profilo per %@. Una cartella del gioco si compila solo per un gioco che il motore conosce.",
+ "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.npdm": "base/exefs/main.npdm non si legge come file NPDM.",
+ "folder.problem.package": "%@ si trova accanto alle cartelle del gioco. Tieni i pacchetti o le cartelle, non entrambi.",
+ "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.",
"free.confirm": "Rimuovere %@ di file di build?",
"free.confirmButton": "Rimuovi",
@@ -1239,6 +1254,7 @@
"stale.title": "Ricompilare i giochi installati?",
"status.checkingDeps": "Verifica delle dipendenze…",
"status.chooseRepo": "Prima scegli il repository del progetto",
+ "status.fixFolder": "La cartella del gioco qui sopra non si può ancora compilare",
"status.installFirst": "Prima installa le dipendenze mancanti qui sopra",
"status.needInputs": "Mancano ancora il gioco base e prod.keys",
"status.output": "Destinazione: %@",
diff --git a/frontend/l10n/sv.json b/frontend/l10n/sv.json
index 6e419f0f..849d468f 100644
--- a/frontend/l10n/sv.json
+++ b/frontend/l10n/sv.json
@@ -411,6 +411,21 @@
"fail.zbic.what": "Spelets moduler använder Nintendos zstd-variant (system 22.0.0 och senare) och för att läsa dem behövs Python-paketet zbic, som inte är installerat.",
"filter.built": "Byggda",
"filter.owned": "Ägda",
+ "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.noProfile": "Motorn har ingen profil för %@. En spelmapp bygger bara ett spel som motorn känner till.",
+ "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.npdm": "base/exefs/main.npdm går inte att läsa som en NPDM-fil.",
+ "folder.problem.package": "%@ ligger bredvid spelets mappar. Behåll paketen eller mapparna, inte båda.",
+ "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.",
"free.confirm": "Ta bort %@ byggfiler?",
"free.confirmButton": "Ta bort",
@@ -1076,6 +1091,7 @@
"stale.title": "Bygga de installerade spelen igen?",
"status.checkingDeps": "Kontrollerar beroenden …",
"status.chooseRepo": "Välj först projektförrådet.",
+ "status.fixFolder": "Spelmappen ovan går inte att bygga ännu",
"status.installFirst": "Installera först de saknade beroendena ovan.",
"status.needInputs": "Grundspelet och prod.keys saknas fortfarande",
"status.output": "Utdata: %@",
diff --git a/frontend/l10n/zh.json b/frontend/l10n/zh.json
index 5540c892..0e92843c 100644
--- a/frontend/l10n/zh.json
+++ b/frontend/l10n/zh.json
@@ -569,6 +569,21 @@
"fail.zbic.what": "这个游戏的模块用了 Nintendo 的 zstd 变体压缩(系统 22.0.0 起),读取它需要 Python 包 zbic,而它没有安装。",
"filter.built": "已构建",
"filter.owned": "已拥有",
+ "folder.base": "游戏文件夹,标题 ID %@(来自 main.npdm)",
+ "folder.dlc": "追加内容文件夹:%d 个",
+ "folder.engineOld": "这个引擎不能构建游戏文件夹。请先更新引擎。",
+ "folder.keys": "不需要。游戏文件夹里的文件没有加密。",
+ "folder.noProfile": "引擎没有 %@ 的游戏配置。游戏文件夹只能构建引擎已有配置的游戏。",
+ "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.npdm": "base/exefs/main.npdm 无法作为 NPDM 文件读取。",
+ "folder.problem.package": "%@ 和游戏的文件夹放在一起。请只保留安装包或文件夹其中一种。",
+ "folder.update": "更新版本 %d",
+ "folder.updates": "更新版本 %1$d,%2$d 个中最新的",
"free.clones": "在同一个磁盘上构建的 Mac 应用与这里的游戏文件和着色器共享数据(APFS 克隆),因此实际释放的空间可能少于显示的大小。",
"free.confirm": "删除 %@ 的构建文件?",
"free.confirmButton": "删除",
@@ -1363,6 +1378,7 @@
"stale.title": "要重新构建已安装的游戏吗?",
"status.checkingDeps": "正在检测依赖…",
"status.chooseRepo": "先选择项目仓库",
+ "status.fixFolder": "上面的游戏文件夹暂时还不能构建",
"status.installFirst": "先安装上方缺失的依赖",
"status.needInputs": "还需要选择游戏本体和 prod.keys",
"status.output": "输出:%@",