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
Export: one IPA per game with the game data inside (#540)
v0lumehi5b4ea22d3b39
diff --git a/frontend/Sources/NXCore/OneGameIPA.swift b/frontend/Sources/NXCore/OneGameIPA.swiftnew file mode 100644index 00000000..668c3981--- /dev/null+++ b/frontend/Sources/NXCore/OneGameIPA.swift@@ -0,0 +1,18 @@+import Foundation++/// One game's own IPA with its game data inside (LNPANDY/NX2Apple#540), the second kind of the export next to the shared app. It is+/// the engine's one-game app as build_ipa_from_nsp.py makes it without `--shell-framework`: the RomFS goes to `<App>/romfs` (or+/// `romfs.img`) and the add-on content to `<App>/aoc`, which the app reads when its Documents hold no image (dm/ios main.m). The+/// fork's build_ipa.sh leaves the game data out by default (patch 0004, the slim IPA), so `DM_FULL_ROMFS=1` asks for it. pack_ipa.py+/// writes zip64 records when a file, an offset or the count passes the 32-bit fields. The bundle ID is the script's default,+/// `org.nxnative.<title ID>`: its own app, apart from the shared app and its saves.+package enum OneGameIPA {+ /// `<folder>/<title ID>.ipa`, next to the game's build folder.+ package static func path(folder: String, titleID: String) -> String { folder + "/" + titleID + ".ipa" }++ /// The script's arguments for the IPA, in place of the shared app's `--shell-framework`.+ package static func arguments(ipa: String) -> [String] { ["--platform", "ios", "--romfs", "bundle", "-o", ipa] }++ /// What build_ipa.sh needs to pack the game data into the IPA.+ package static let environment = ["DM_FULL_ROMFS": "1"]+}diff --git a/frontend/Sources/NXLauncher/ExportSteps.swift b/frontend/Sources/NXLauncher/ExportSteps.swiftindex 098b97e5..15da01d8 100644--- a/frontend/Sources/NXLauncher/ExportSteps.swift+++ b/frontend/Sources/NXLauncher/ExportSteps.swift@@ -3,7 +3,8 @@ import NXCoreimport NXModel/// The export of the shared app as an IPA, in three steps (LNPANDY/NX2Apple#416): export it, install it with another tool, send the-/// game data. Shown by the Install card when its switch says "Export as IPA". Observes the build store (the steps' state) and the+/// game data. Shown by the Install card when its switch says "Export as IPA". One game's own IPA (#540) holds its game data, so it has+/// the first two steps only. Observes the build store (the steps' state) and the/// device store (the device and the place the data goes to).////// The grid (ExportGrid): a step's number sits where a card row's dot sits, and everything that belongs to the step (its title, text,@@ -30,11 +31,13 @@ package struct ExportSteps: View {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 oneGame: Bool { devices.exportOneGame }package var body: some View {VStack(spacing: 0) {step(1, exported ? .done : .current, title: loc.t("shell.step1Title"),- sub: exported ? String(format: loc.t("shell.step1Done"), build.exportedIPAText) : loc.t("shell.step1Sub")) {+ sub: exported ? String(format: loc.t(oneGame ? "shell.oneGameDone" : "shell.step1Done"), build.exportedIPAText)+ : loc.t(oneGame ? "shell.oneGameSub" : "shell.step1Sub")) {if exported {action(loc.t("shell.showInFinder")) { revealInFinder(build.exportedIPAPath) }} else {@@ -42,24 +45,29 @@ package struct ExportSteps: View {}}CardDivider()- step(2, sentDone ? .done : exported ? .current : .upcoming, title: loc.t("shell.step2Title"), sub: loc.t("shell.step2Sub")) { EmptyView() }- CardDivider()- VStack(alignment: .leading, spacing: 0) {- step(3, sentDone ? .done : exported ? .current : .upcoming, title: loc.t("shell.step3Title"), sub: loc.t("shell.step3Sub")) {- LauncherSegmented(options: [(SendWhere.device, loc.t("shell.whereDevice")), (SendWhere.drive, loc.t("shell.whereDrive"))],- selection: devices.sendWhere) { devices.sendWhere = $0; build.refreshDrive() }- .frame(width: ExportGrid.switchWidth)- .opacity(inert ? ExportGrid.quiet : 1)- }- VStack(alignment: .leading, spacing: ExportGrid.noteGap) {- if toDrive { driveRow; driveStatus } else { deviceRow; deviceStatus }- }- .padding(.leading, ExportGrid.axis).padding(.trailing, ExportGrid.inset).padding(.bottom, ExportGrid.inset)- .frame(maxWidth: .infinity, alignment: .leading)- .animation(.easeInOut(duration: 0.18), value: statusKind)+ step(2, sentDone ? .done : exported ? .current : .upcoming, title: loc.t("shell.step2Title"),+ sub: loc.t(oneGame ? "shell.oneGameStep2Sub" : "shell.step2Sub")) { EmptyView() }+ if !oneGame { CardDivider(); sendStep }+ }+ }++ /// Step 3, the game data to the device or a drive: only for the shared app, whose IPA leaves the data out.+ private var sendStep: some View {+ VStack(alignment: .leading, spacing: 0) {+ step(3, sentDone ? .done : exported ? .current : .upcoming, title: loc.t("shell.step3Title"), sub: loc.t("shell.step3Sub")) {+ LauncherSegmented(options: [(SendWhere.device, loc.t("shell.whereDevice")), (SendWhere.drive, loc.t("shell.whereDrive"))],+ selection: devices.sendWhere) { devices.sendWhere = $0; build.refreshDrive() }+ .frame(width: ExportGrid.switchWidth)+ .opacity(inert ? ExportGrid.quiet : 1)+ }+ VStack(alignment: .leading, spacing: ExportGrid.noteGap) {+ if toDrive { driveRow; driveStatus } else { deviceRow; deviceStatus }}- .disabled(inert)+ .padding(.leading, ExportGrid.axis).padding(.trailing, ExportGrid.inset).padding(.bottom, ExportGrid.inset)+ .frame(maxWidth: .infinity, alignment: .leading)+ .animation(.easeInOut(duration: 0.18), value: statusKind)}+ .disabled(inert)}// MARK: A stepdiff --git a/frontend/Sources/NXLauncher/InstallCard.swift b/frontend/Sources/NXLauncher/InstallCard.swiftindex 41086043..42c597a4 100644--- a/frontend/Sources/NXLauncher/InstallCard.swift+++ b/frontend/Sources/NXLauncher/InstallCard.swift@@ -41,6 +41,13 @@ package struct InstallCard: View {}CardDivider()if devices.exportIPA {+ // What the IPA holds: the shared app by default, one game with its data inside as the other choice (#540)+ CardRow(loc.t("shell.ipaKind"), detail: devices.exportOneGame ? loc.t("shell.ipaOneGameNote") : loc.t("shell.ipaSharedNote")) {+ LauncherSegmented(options: [("shared", loc.t("shell.ipaShared")), ("one", loc.t("shell.ipaOneGame"))],+ selection: devices.exportOneGame ? "one" : "shared") { pickKind($0 == "one") }+ .frame(width: ExportGrid.switchWidth)+ }+ CardDivider()ExportSteps(build: build, devices: devices)} else {CardRow(loc.t("dev.target"), detail: devices.checked && devices.devices.isEmpty ? loc.t("dev.noDevices") : "") {@@ -61,4 +68,12 @@ package struct InstallCard: View {}.onAppear { if !devices.checked { _ = devices.refresh() } }}++ /// The other kind of IPA: the IPA of the last export is not the one this choice makes, so step 1 starts again.+ private func pickKind(_ oneGame: Bool) {+ guard oneGame != devices.exportOneGame else { return }+ devices.exportOneGame = oneGame+ build.exportedIPAPath = ""+ build.send = .idle+ }}diff --git a/frontend/Sources/NXModel/BuildStore+OneGame.swift b/frontend/Sources/NXModel/BuildStore+OneGame.swiftnew file mode 100644index 00000000..c52a45b3--- /dev/null+++ b/frontend/Sources/NXModel/BuildStore+OneGame.swift@@ -0,0 +1,18 @@+import Foundation+import NXCore++// One game's own IPA with its game data inside (LNPANDY/NX2Apple#540). The build script makes it whole, so after the script there is+// no archive step, no shared app and nothing to send: the IPA is step 1 of the export card, and step 2 installs it with another tool.++extension BuildStore {+ /// The script ended well: the IPA is the export's result, or the build says that it is missing.+ func finishOneGameIPA() {+ let ipa = oneGameIPAPath+ let made = FileManager.default.fileExists(atPath: ipa)+ exportedIPAPath = made ? ipa : ""+ done = made+ doneNote = String(format: t(made ? "shell.exportDone" : "shell.oneGameMissing"), ipa)+ running = false+ cleanupStaging()+ }+}diff --git a/frontend/Sources/NXModel/BuildStore+Run.swift b/frontend/Sources/NXModel/BuildStore+Run.swiftindex 6f6aa8f7..d5706b51 100644--- a/frontend/Sources/NXModel/BuildStore+Run.swift+++ b/frontend/Sources/NXModel/BuildStore+Run.swift@@ -14,7 +14,7 @@ extension BuildStore {return}shellDeviceChecked = false- if target != BuildTarget.mac, askAboutStaleFrameworks() { return } // StaleFrameworksPrompt.swift (#449)+ if target != BuildTarget.mac, !exportsOneGame, askAboutStaleFrameworks() { return } // StaleFrameworksPrompt.swift (#449)stopping = falserunning = true; done = false; doneNote = ""; stages = []; log.clear(); chainNoteShown = falsefailure = nil; confirmingOverride = nil@@ -83,7 +83,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, let why = shellRootProblem() { fail(why); return }+ if target != BuildTarget.mac, !exportsOneGame, let why = shellRootProblem() { fail(why); return }var inputDir = baseDirif dirs.count > 1 || !unpicked.isEmpty {// A stable folder per game (#132): the script's fingerprints name its files and its profile path.@@ -142,7 +142,12 @@ extension BuildStore {}if hasWorkDir { args += ["--work-dir", workDir] }let macApp = target == BuildTarget.mac- if macApp {+ oneGameIPAPath = ""+ if exportsOneGame {+ // One game's own IPA with its game data inside (BuildStore+OneGame.swift, #540)+ oneGameIPAPath = OneGameIPA.path(folder: outDir.isEmpty ? baseDir : outDir, titleID: tidHex)+ args += OneGameIPA.arguments(ipa: oneGameIPAPath)+ } else if macApp {// -o names the .app; the RomFS goes inside it, so the archive step is skipped below.args += ["--platform", "mac-app"]macAppPath = (outDir.isEmpty ? baseDir : outDir) + "/" + tidHex + ".app"@@ -177,6 +182,7 @@ extension BuildStore {// The bundled Python lives inside the signed app: a .pyc written there would change what the signature seals// (the packages are compiled at bundle time), and a user site must not shadow its pinned packages.denv.merge(BundledTools.environment(for: py)) { $1 }+ if !oneGameIPAPath.isEmpty { denv.merge(OneGameIPA.environment) { $1 } }let launch = ProcessLaunch(executable: py, arguments: args, environment: denv, directory: engine, groupPython: py)let onExit: @Sendable (Int32) -> Void = { [weak self] status inhop {@@ -192,7 +198,9 @@ extension BuildStore {}if status == 0 {self.markAllDone()- if self.target == BuildTarget.mac {+ if !self.oneGameIPAPath.isEmpty {+ self.finishOneGameIPA()+ } else if self.target == BuildTarget.mac {// The .app is self-contained (its RomFS is inside), and the marker file// beside it (.nx2apple-library, a dot file the Finder hides) tells the// game's launcher that this folder is a library: its saves and log livediff --git a/frontend/Sources/NXModel/BuildStore.swift b/frontend/Sources/NXModel/BuildStore.swiftindex 615bbad3..6f142ab2 100644--- a/frontend/Sources/NXModel/BuildStore.swift+++ b/frontend/Sources/NXModel/BuildStore.swift@@ -34,6 +34,8 @@ package struct FilePick: Equatable {var signingTeam: String { get }/// The build exports the shared app as an IPA instead of installing it.var exportIPA: Bool { get }+ /// The export makes one game's own IPA with its game data inside (#540).+ var exportOneGame: Bool { get }/// The folder the game data is copied to (a drive), empty when none is chosen.var driveFolder: String { get set }var xcrun: String { get }@@ -103,6 +105,7 @@ func hop(_ body: @escaping @MainActor () -> Void) {/// The one-off `--allow-*` of a confirmed "Build anyway": taken by the next build and never stored.package var armedOverride: BuildFailureKind?@Published package var macAppPath = "" // --platform mac-app: the .app this build produced+ package var oneGameIPAPath = "" // the IPA a one-game export writes (#540), empty for any other build/// BuildTarget.ios = the game's framework in the one shared app on an iPhone or iPad; BuildTarget.mac = a double-clickable/// Mac app (upstream's --platform mac-app). A Mac app is a different output of the same pipeline, not a/// different pipeline: same extraction, rewrite and shaders, then dm/mac/pack_app.py.@@ -197,6 +200,8 @@ func hop(_ body: @escaping @MainActor () -> Void) {/// This iPhone build goes straight to a device./// An iPhone or iPad build that makes the shared app as an unsigned IPA (#416): no device, no team.package var exportsShell: Bool { target != BuildTarget.mac && devices.exportIPA }+ /// An export of one game's own IPA with the game data inside (#540): the engine's one-game app, no shared app, nothing to send.+ package var exportsOneGame: Bool { exportsShell && devices.exportOneGame }package var installsDirectly: Bool { target != BuildTarget.mac && !devices.installDevice.isEmpty && !devices.signingTeam.isEmpty }/// Home shown as ~ (shorter in a one-line row, and it keeps the account name out of screenshots).diff --git a/frontend/Sources/NXModel/DeviceStore.swift b/frontend/Sources/NXModel/DeviceStore.swiftindex 491a6e95..2e951eab 100644--- a/frontend/Sources/NXModel/DeviceStore.swift+++ b/frontend/Sources/NXModel/DeviceStore.swift@@ -25,6 +25,7 @@ package enum SendWhere {nonisolated package static let deviceKey = "installDevice"nonisolated package static let teamKey = "signingTeam"nonisolated package static let exportKey = "exportIPA"+ nonisolated package static let oneGameKey = "exportOneGame"nonisolated package static let sendWhereKey = "sendWhere"nonisolated package static let driveFolderKey = "driveFolder"@@ -44,6 +45,10 @@ package enum SendWhere {@Published package var exportIPA: Bool {didSet { defaults.set(exportIPA, forKey: Self.exportKey) }}+ /// The export makes one game's own IPA with its game data inside, instead of the shared app (#540). Off unless the player picks it.+ @Published package var exportOneGame: Bool {+ didSet { defaults.set(exportOneGame, forKey: Self.oneGameKey) }+ }/// Where step 3 of the export sends the game data: `SendWhere.device` or `.drive`. Saved when it changes.@Published package var sendWhere: String {didSet { defaults.set(sendWhere, forKey: Self.sendWhereKey) }@@ -80,6 +85,7 @@ package enum SendWhere {self.installDevice = defaults.string(forKey: Self.deviceKey) ?? ""self.signingTeam = defaults.string(forKey: Self.teamKey) ?? ""self.exportIPA = defaults.bool(forKey: Self.exportKey)+ self.exportOneGame = defaults.bool(forKey: Self.oneGameKey)self.sendWhere = defaults.string(forKey: Self.sendWhereKey) ?? SendWhere.deviceself.driveFolder = defaults.string(forKey: Self.driveFolderKey) ?? ""}diff --git a/frontend/Tests/NX2AppleTests/ShellExportCaptureTests.swift b/frontend/Tests/NX2AppleTests/ShellExportCaptureTests.swiftindex 9015395d..d7e85ef6 100644--- a/frontend/Tests/NX2AppleTests/ShellExportCaptureTests.swift+++ b/frontend/Tests/NX2AppleTests/ShellExportCaptureTests.swift@@ -16,7 +16,7 @@ final class ShellExportCaptureTests: XCTestCase {let fm = FileManager.defaulttry fm.createDirectory(at: output, withIntermediateDirectories: true)let lang = ProcessInfo.processInfo.environment["NX_CAPTURE_LANG"].flatMap { Lang.find($0) } ?? .en- let saved = ["buildTarget", "installDevice", "exportIPA", "sendWhere", "driveFolder", "shellRoot"].map { ($0, UserDefaults.standard.object(forKey: $0)) }+ let saved = ["buildTarget", "installDevice", "exportIPA", "exportOneGame", "sendWhere", "driveFolder", "shellRoot"].map { ($0, UserDefaults.standard.object(forKey: $0)) }defer { for (key, value) in saved { UserDefaults.standard.set(value, forKey: key) } }let shellFolder = fm.temporaryDirectory.appendingPathComponent("NX2Apple-capture-\(UUID().uuidString)")try fm.createDirectory(at: shellFolder, withIntermediateDirectories: true)@@ -35,11 +35,15 @@ final class ShellExportCaptureTests: XCTestCase {stores.deviceStore.checked = truestores.deviceStore.installDevice = "DEV-1"stores.deviceStore.sendWhere = SendWhere.device+ stores.deviceStore.exportOneGame = falsefunc shot<V: View>(_ name: String, _ view: V) throws {let framed = view.environmentObject(stores.localizer).padding(24).frame(width: 760).background(Color(white: 0.09)).environment(\.colorScheme, .dark)NSApplication.shared.setActivationPolicy(.accessory)let host = NSHostingView(rootView: framed)host.frame = NSRect(origin: .zero, size: host.fittingSize)+ // the fitting size can round above the laid-out card: the page colour, not white, fills the rest+ host.wantsLayer = true+ host.layer?.backgroundColor = NSColor(white: 0.09, alpha: 1).cgColorlet window = OffscreenWindow(size: host.frame.size)window.contentView = hostwindow.orderFront(nil)@@ -88,5 +92,15 @@ final class ShellExportCaptureTests: XCTestCase {stores.deviceStore.driveFolder = ""model.drive = niltry shot("11-drive-before-export", card())+ // One game's own IPA with its game data inside (#540): two steps, no step 3+ stores.deviceStore.exportOneGame = true+ try shot("12-one-game-ready", card())+ let oneGame = shellFolder.appendingPathComponent("0100000000010000.ipa") // the name a one-game export writes+ fm.createFile(atPath: oneGame.path, contents: nil)+ let big = try FileHandle(forWritingTo: oneGame)+ try big.truncate(atOffset: 5_900_000_000)+ try big.close()+ model.exportedIPAPath = oneGame.path+ try shot("13-one-game-exported", card())}}diff --git a/frontend/Tests/NX2AppleTests/ShellExportTests.swift b/frontend/Tests/NX2AppleTests/ShellExportTests.swiftindex 9d214b72..732b959a 100644--- a/frontend/Tests/NX2AppleTests/ShellExportTests.swift+++ b/frontend/Tests/NX2AppleTests/ShellExportTests.swift@@ -588,7 +588,7 @@ import NXModel// ---- the choice in the build ----- private let savedKeys = ["repoPath", "buildTarget", "buildOutputDirectory", "installDevice", "signingTeam", "shellRoot", "exportIPA"]+ private let savedKeys = ["repoPath", "buildTarget", "buildOutputDirectory", "installDevice", "signingTeam", "shellRoot", "exportIPA", "exportOneGame"]/// An iPhone build with the export chosen and no device and no team runs the script without `--team-id`, then ends with the IPA/// instead of the "needs a device and a signing team" stop.@@ -647,6 +647,79 @@ import NXModelXCTAssertFalse(try entries(ofZip: model.exportedIPAPath).contains { $0.hasSuffix("romfs.img") })}+ /// One game's own IPA (#540): the script runs without `--shell-framework`, packs the game data into the IPA it names, and the+ /// build ends with that IPA. No shared app, no archive, no shell.json, no stale prompt.+ @MainActor func testOneGameExportBuildsTheGamesOwnIPAWithItsDataInside() throws {+ let f = try makeFixture()+ let saved = savedKeys.map { ($0, UserDefaults.standard.object(forKey: $0)) }+ defer { for (key, value) in saved { UserDefaults.standard.set(value, forKey: key) } }+ UserDefaults.standard.set(f.root, forKey: "shellRoot")+ let stores = LauncherStores(xcrun: f.xcrun); let model = stores.build+ stores.repo.path = f.repo+ model.target = "ios"+ model.outDir = path("out")+ stores.dependencies.pythonPath = "/usr/bin/python3"+ stores.dependencies.dotnetPath = "/usr/bin/true"+ stores.dependencies.checked = true+ stores.dependencies.deps = [Dep(id: "test", name: "test", hint: "", present: true, installCmd: [])]+ stores.deviceStore.installDevice = ""+ stores.deviceStore.signingTeam = ""+ stores.deviceStore.exportIPA = true+ stores.deviceStore.exportOneGame = true+ XCTAssertTrue(model.exportsOneGame)+ try write(f.repo + "/dm/tools/nx_extract/Program.cs", "")+ for tool in RepoLayout.requiredTools.filter({ $0 != RepoLayout.buildScript }) { try write(f.repo + "/" + tool, "") }+ try write(f.repo + "/scripts/build_ipa_from_nsp.py", """+ import sys, os, json, pathlib+ open('\(state)/script.txt', 'w').write(' '.join(sys.argv[1:]))+ open('\(state)/full-romfs.txt', 'w').write(os.environ.get('DM_FULL_ROMFS', ''))+ ipa = pathlib.Path(sys.argv[sys.argv.index('-o') + 1]); ipa.parent.mkdir(parents=True, exist_ok=True); ipa.write_bytes(b'ipa')+ print(json.dumps(dict(ev='stage', k=1, n=1, name='ipa')), flush=True)+ print(json.dumps(dict(ev='stage_end', k=1, name='ipa', ok=True, summary='', elapsed=1)), flush=True)+ """)+ let base = temporary.appendingPathComponent("Test [\(titleID)].nsp"), keys = temporary.appendingPathComponent("prod.keys")+ try Data([0]).write(to: base); try Data().write(to: keys)+ model.slots[0].paths = [base.path]; model.slots[3].paths = [keys.path]++ let finished = expectation(description: "Exported")+ let token = model.$done.filter { $0 }.prefix(1).sink { _ in finished.fulfill() }+ model.startBuild()+ wait(for: [finished], timeout: 30)+ withExtendedLifetime(token) {}++ let script = try String(contentsOfFile: state + "/script.txt")+ let ipa = path("out", "\(titleID).ipa")+ XCTAssertTrue(script.contains("--platform ios --romfs bundle -o " + ipa), script)+ XCTAssertFalse(script.contains("--shell-framework") || script.contains("--team-id"), script)+ XCTAssertEqual(try String(contentsOfFile: state + "/full-romfs.txt"), "1", "the fork's build_ipa.sh packs the game data only with DM_FULL_ROMFS=1")+ XCTAssertEqual(model.exportedIPAPath, ipa)+ XCTAssertEqual(model.doneNote, String(format: model.t("shell.exportDone"), ipa))+ XCTAssertFalse(model.running)+ XCTAssertTrue(model.staleFrameworks.isEmpty)+ XCTAssertFalse(fm.fileExists(atPath: ShellLibrary.stateFile(root: f.root)), "the shared app is not touched")+ XCTAssertTrue(calls.isEmpty, "no xcodebuild for a shared app and no device")+ XCTAssertEqual(model.archivePath, "", "the game data is inside the IPA, nothing is packed beside it")+ }++ func testOneGameChoiceIsOffAtFirstSavedAndOnlyCountsForAnExport() throws {+ let saved = savedKeys.map { ($0, UserDefaults.standard.object(forKey: $0)) }+ defer { for (key, value) in saved { UserDefaults.standard.set(value, forKey: key) } }+ UserDefaults.standard.removeObject(forKey: DeviceStore.oneGameKey)+ let stores = LauncherStores(); let model = stores.build+ XCTAssertFalse(stores.deviceStore.exportOneGame, "the shared app stays the default")+ model.target = "ios"+ stores.deviceStore.exportOneGame = true+ XCTAssertTrue(UserDefaults.standard.bool(forKey: DeviceStore.oneGameKey))+ stores.deviceStore.exportIPA = false+ XCTAssertFalse(model.exportsOneGame, "installing on a device is always the shared app")+ stores.deviceStore.exportIPA = true+ XCTAssertTrue(model.exportsOneGame)+ model.target = BuildTarget.mac+ XCTAssertFalse(model.exportsOneGame)+ XCTAssertEqual(OneGameIPA.arguments(ipa: "/O/0100.ipa"), ["--platform", "ios", "--romfs", "bundle", "-o", "/O/0100.ipa"])+ XCTAssertEqual(OneGameIPA.path(folder: "/O", titleID: "0100"), "/O/0100.ipa")+ }+/// The choice is saved and a build without it still asks for a device and a team.@MainActor func testTheChoiceIsSavedAndWithoutItTheDeviceIsStillNeeded() throws {let saved = savedKeys.map { ($0, UserDefaults.standard.object(forKey: $0)) }diff --git a/frontend/Tests/NXModelTests/BuildStoreTests.swift b/frontend/Tests/NXModelTests/BuildStoreTests.swiftindex 24ba6971..db95e7a6 100644--- a/frontend/Tests/NXModelTests/BuildStoreTests.swift+++ b/frontend/Tests/NXModelTests/BuildStoreTests.swift@@ -34,6 +34,7 @@ import XCTestvar installDevice = ""var signingTeam = ""var exportIPA = false+ var exportOneGame = falsevar driveFolder = ""var devices: [AppleDevice] = []var xcrun = "/usr/bin/true"diff --git a/frontend/l10n/de.json b/frontend/l10n/de.jsonindex 2d9a1e30..557c3f3f 100644--- a/frontend/l10n/de.json+++ b/frontend/l10n/de.json@@ -976,6 +976,11 @@"shell.exportPackStage": "IPA-Datei packen","shell.frameworkIncomplete": "Die Dateien von %1$@ sind unvollständig, %2$@ fehlt. Baue das Spiel erneut.","shell.gameLeftOut": "%1$@ ist nicht in der gemeinsamen App, weil seine Dateien unvollständig sind (%2$@ fehlt). Baue dieses Spiel erneut, um es wieder hinzuzufügen.",+ "shell.ipaKind": "Inhalt der IPA",+ "shell.ipaOneGame": "Ein Spiel, alles drin",+ "shell.ipaOneGameNote": "Eine IPA mit diesem Spiel und seinen Daten. Seine Spielstände bleiben in dieser App.",+ "shell.ipaShared": "Gemeinsame App",+ "shell.ipaSharedNote": "Alle deine Spiele in einer App. Die Spieldaten folgen in Schritt 3.","shell.modeExport": "Als IPA exportieren","shell.modeInstall": "Auf Gerät installieren","shell.modeTitle": "Installieren oder exportieren",@@ -983,6 +988,10 @@"shell.noFramework": "Das Framework des Spiels wurde nicht gefunden: %@","shell.noSpace": "Nicht genug Platz auf %@: Die Spieldaten brauchen %.1f GB und auf dem Gerät sind %.1f GB frei. Gib Speicher frei und installiere dann erneut","shell.notPaired": "%@ ist nicht mit diesem Mac gekoppelt. Schließe es mit einem Kabel an, tippe auf dem Gerät auf Vertrauen und gib den Code ein. Starte dann erneut.",+ "shell.oneGameDone": "%@, nicht signiert. Die Spieldaten sind enthalten.",+ "shell.oneGameMissing": "Der Build ist fertig, aber die IPA fehlt unter %@.",+ "shell.oneGameStep2Sub": "AltStore, SideStore oder ein anderes Signier-Tool. Eine sehr große IPA lässt sich eventuell nicht installieren.",+ "shell.oneGameSub": "Baut dieses Spiel mit seinen Spieldaten. Kein Gerät und kein Team nötig.","shell.projectFailed": "Die gemeinsame App konnte nicht vorbereitet werden: %@","shell.projectStage": "Gemeinsame App vorbereiten","shell.retry": "Erneut versuchen",diff --git a/frontend/l10n/en.json b/frontend/l10n/en.jsonindex 84294c5d..1b55f69a 100644--- a/frontend/l10n/en.json+++ b/frontend/l10n/en.json@@ -1100,6 +1100,11 @@"shell.exportPackStage": "Pack the IPA","shell.frameworkIncomplete": "The files of %1$@ are incomplete, %2$@ is missing. Build the game again.","shell.gameLeftOut": "%1$@ was left out of the shared app because its files are incomplete (%2$@ is missing). Build that game again to add it back.",+ "shell.ipaKind": "What the IPA holds",+ "shell.ipaOneGame": "One game, all inside",+ "shell.ipaOneGameNote": "One IPA with this game and its data. Its saves stay in that app.",+ "shell.ipaShared": "Shared app",+ "shell.ipaSharedNote": "All your games in one app. The game data follows in step 3.","shell.modeExport": "Export as IPA","shell.modeInstall": "Install on device","shell.modeTitle": "Install or export",@@ -1107,6 +1112,10 @@"shell.noFramework": "The game's framework was not found: %@","shell.noSpace": "Not enough space on %@: the game data needs %.1f GB and the device has %.1f GB free. Free up space, then install again","shell.notPaired": "%@ is not paired with this Mac. Connect it with a cable, tap Trust on the device and enter its passcode. Then start again.",+ "shell.oneGameDone": "%@, unsigned. The game data is inside.",+ "shell.oneGameMissing": "The build ended, but the IPA is not at %@.",+ "shell.oneGameStep2Sub": "AltStore, SideStore or another signing tool. A very large IPA can fail to install.",+ "shell.oneGameSub": "Builds this game with its game data inside. No device or team needed.","shell.projectFailed": "The shared app could not be prepared: %@","shell.projectStage": "Prepare the shared app","shell.retry": "Retry",diff --git a/frontend/l10n/fr.json b/frontend/l10n/fr.jsonindex 4ae18465..ede484df 100644--- a/frontend/l10n/fr.json+++ b/frontend/l10n/fr.json@@ -975,6 +975,11 @@"shell.exportPackStage": "Empaqueter l’IPA","shell.frameworkIncomplete": "Les fichiers de %1$@ sont incomplets, %2$@ manque. Reconstruisez le jeu.","shell.gameLeftOut": "%1$@ a été laissé hors de l’app partagée car ses fichiers sont incomplets (%2$@ manque). Reconstruisez ce jeu pour le rajouter.",+ "shell.ipaKind": "Contenu de l’IPA",+ "shell.ipaOneGame": "Un jeu, tout inclus",+ "shell.ipaOneGameNote": "Une IPA avec ce jeu et ses données. Ses sauvegardes restent dans cette app.",+ "shell.ipaShared": "App partagée",+ "shell.ipaSharedNote": "Tous vos jeux dans une seule app. Les données du jeu suivent à l’étape 3.","shell.modeExport": "Exporter en IPA","shell.modeInstall": "Installer sur l’appareil","shell.modeTitle": "Installer ou exporter",@@ -982,6 +987,10 @@"shell.noFramework": "Le framework du jeu est introuvable : %@","shell.noSpace": "Pas assez d’espace sur %@ : les données du jeu demandent %.1f Go et l’appareil en a %.1f Go de libres. Libérez de l’espace, puis réinstallez","shell.notPaired": "%@ n’est pas associé à ce Mac. Branchez-le avec un câble, touchez Se fier sur l’appareil et saisissez son code. Puis recommencez.",+ "shell.oneGameDone": "%@, non signé. Les données du jeu sont incluses.",+ "shell.oneGameMissing": "La compilation est terminée, mais l’IPA est introuvable à %@.",+ "shell.oneGameStep2Sub": "AltStore, SideStore ou un autre outil de signature. Une IPA très grande peut ne pas s’installer.",+ "shell.oneGameSub": "Compile ce jeu avec ses données incluses. Aucun appareil ni équipe requis.","shell.projectFailed": "L’app partagée n’a pas pu être préparée : %@","shell.projectStage": "Préparation de l’app partagée","shell.retry": "Réessayer",diff --git a/frontend/l10n/it.json b/frontend/l10n/it.jsonindex 611c32c7..d78d33fc 100644--- a/frontend/l10n/it.json+++ b/frontend/l10n/it.json@@ -975,6 +975,11 @@"shell.exportPackStage": "Crea il pacchetto IPA","shell.frameworkIncomplete": "I file di %1$@ sono incompleti, manca %2$@. Compila di nuovo il gioco.","shell.gameLeftOut": "%1$@ è stato escluso dall’app condivisa perché i suoi file sono incompleti (manca %2$@). Compila di nuovo quel gioco per aggiungerlo.",+ "shell.ipaKind": "Contenuto dell’IPA",+ "shell.ipaOneGame": "Un gioco, tutto incluso",+ "shell.ipaOneGameNote": "Un’IPA con questo gioco e i suoi dati. I salvataggi restano in quell’app.",+ "shell.ipaShared": "App condivisa",+ "shell.ipaSharedNote": "Tutti i tuoi giochi in un’unica app. I dati di gioco seguono al passaggio 3.","shell.modeExport": "Esporta come IPA","shell.modeInstall": "Installa sul dispositivo","shell.modeTitle": "Installa o esporta",@@ -982,6 +987,10 @@"shell.noFramework": "Framework del gioco non trovato: %@","shell.noSpace": "Spazio insufficiente su %@: i dati di gioco richiedono %.1f GB e il dispositivo ha %.1f GB liberi. Libera spazio, poi installa di nuovo","shell.notPaired": "%@ non è abbinato a questo Mac. Collegalo con un cavo, tocca Autorizza sul dispositivo e inserisci il codice. Poi ricomincia.",+ "shell.oneGameDone": "%@, non firmata. I dati di gioco sono inclusi.",+ "shell.oneGameMissing": "La compilazione è terminata, ma l’IPA non si trova in %@.",+ "shell.oneGameStep2Sub": "AltStore, SideStore o un altro strumento di firma. Un’IPA molto grande può non installarsi.",+ "shell.oneGameSub": "Crea questo gioco con i suoi dati inclusi. Non servono dispositivo né team.","shell.projectFailed": "Impossibile preparare l’app condivisa: %@","shell.projectStage": "Preparazione dell’app condivisa","shell.retry": "Riprova",diff --git a/frontend/l10n/sv.json b/frontend/l10n/sv.jsonindex 8d1b6ce6..b8e8795d 100644--- a/frontend/l10n/sv.json+++ b/frontend/l10n/sv.json@@ -812,6 +812,11 @@"shell.exportPackStage": "Paketera IPA-filen","shell.frameworkIncomplete": "Filerna för %1$@ är ofullständiga, %2$@ saknas. Bygg spelet igen.","shell.gameLeftOut": "%1$@ togs inte med i den gemensamma appen eftersom dess filer är ofullständiga (%2$@ saknas). Bygg spelet igen för att lägga till det.",+ "shell.ipaKind": "Vad IPA:n innehåller",+ "shell.ipaOneGame": "Ett spel, allt med",+ "shell.ipaOneGameNote": "En IPA med det här spelet och dess data. Sparfilerna stannar i den appen.",+ "shell.ipaShared": "Gemensam app",+ "shell.ipaSharedNote": "Alla dina spel i en app. Speldata följer i steg 3.","shell.modeExport": "Exportera som IPA","shell.modeInstall": "Installera på enheten","shell.modeTitle": "Installera eller exportera",@@ -819,6 +824,10 @@"shell.noFramework": "Spelets ramverk hittades inte: %@","shell.noSpace": "Inte tillräckligt med utrymme på %@: speldatan behöver %.1f GB och enheten har %.1f GB ledigt. Frigör utrymme och installera igen","shell.notPaired": "%@ är inte ihopparad med den här Mac-datorn. Anslut den med kabel, tryck på Lita på i enheten och ange enhetens lösenkod. Starta sedan om.",+ "shell.oneGameDone": "%@, osignerad. Speldata finns med.",+ "shell.oneGameMissing": "Bygget är klart, men IPA:n finns inte på %@.",+ "shell.oneGameStep2Sub": "AltStore, SideStore eller ett annat signeringsverktyg. En mycket stor IPA kan misslyckas att installeras.",+ "shell.oneGameSub": "Bygger det här spelet med sina speldata. Ingen enhet eller team behövs.","shell.projectFailed": "Den gemensamma appen kunde inte förberedas: %@","shell.projectStage": "Förbereder den gemensamma appen","shell.retry": "Försök igen",diff --git a/frontend/l10n/zh.json b/frontend/l10n/zh.jsonindex abaf234c..42b30e10 100644--- a/frontend/l10n/zh.json+++ b/frontend/l10n/zh.json@@ -1101,6 +1101,11 @@"shell.exportPackStage": "打包 IPA","shell.frameworkIncomplete": "%1$@ 的文件不完整,缺少 %2$@。请重新构建这个游戏。","shell.gameLeftOut": "%1$@ 的文件不完整(缺少 %2$@),已从共用应用中移除。重新构建这个游戏即可将它加回来。",+ "shell.ipaKind": "IPA 包含的内容",+ "shell.ipaOneGame": "单个游戏,全部打包",+ "shell.ipaOneGameNote": "一个 IPA 包含这个游戏和它的数据。存档留在那个应用里。",+ "shell.ipaShared": "共用应用",+ "shell.ipaSharedNote": "你所有的游戏都在一个应用里。游戏数据在第 3 步发送。","shell.modeExport": "导出为 IPA","shell.modeInstall": "安装到设备","shell.modeTitle": "安装或导出",@@ -1108,6 +1113,10 @@"shell.noFramework": "没有找到游戏的框架:%@","shell.noSpace": "%@ 上空间不足:游戏数据需要 %.1f GB,设备只剩 %.1f GB。请先释放空间再安装","shell.notPaired": "这台 Mac 还没有与 %@ 配对。请用数据线连接,在设备上点「信任」并输入设备密码,然后重新开始。",+ "shell.oneGameDone": "%@,未签名。已包含游戏数据。",+ "shell.oneGameMissing": "构建已结束,但在 %@ 没有找到 IPA。",+ "shell.oneGameStep2Sub": "AltStore、SideStore 或其他签名工具。非常大的 IPA 可能无法安装。",+ "shell.oneGameSub": "构建这个游戏并把游戏数据打包进去。不需要设备或团队。","shell.projectFailed": "无法准备共用应用:%@","shell.projectStage": "准备共用应用","shell.retry": "重试",