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
Delete a game from the launcher on the Mac and in the iPhone and iPad app (#559)
v0lumehi4da29031bfe1
diff --git a/frontend-ios/Sources/ShellHost/GameDeletion.swift b/frontend-ios/Sources/ShellHost/GameDeletion.swiftnew file mode 100644index 00000000..d389ffd3--- /dev/null+++ b/frontend-ios/Sources/ShellHost/GameDeletion.swift@@ -0,0 +1,45 @@+import Foundation++/// Deleting a game in the shell (#559). The game's code is a framework inside the signed app, and an app cannot change its own+/// bundle: the code signature seals every file in it, and the bundle is read-only on the device. So the game's framework stays+/// until the app is installed again without it. What the shell can delete is the game's folder in `Documents/games/<title ID>/`+/// (game data, add-on content, temp files, its log), and it takes the game off the list.+///+/// The game stays off the list while the app holds the same build of it and its folder has no game data again. A new build of+/// the game in a later install, or game data sent again from the Mac, brings it back.+public enum GameDeletion {+ /// The per-game defaults key that marks the game as deleted. Its value is the build that was deleted (`stamp`).+ public static let deletedKey = "shell.deletedBuild"++ /// The save folders in the game's folder (dm/host/hle_fs.c: `save`, `save_device` for a game with device save data, and+ /// their `.work` and `.new` copies of a session). Every name that starts with `save` stays unless the player chose to delete+ /// the saves too, so no layout of the engine's can lose one.+ public static func isSave(_ name: String) -> Bool { name.hasPrefix("save") }++ /// Which build of the game the app holds: the manifest's build time, else what the manifest says about the build. A+ /// framework that could not be read is named by its folder.+ public static func stamp(_ entry: CatalogueEntry) -> String {+ guard let m = entry.manifest else { return "folder:" + entry.directory.lastPathComponent }+ if let built = m.builtAt, !built.isEmpty { return "built:" + built }+ return ["manifest", m.displayVersion, m.packageVersion, m.chain, m.romfsIdentity, String(m.bytes ?? 0)].joined(separator: ":")+ }++ /// What deleting removes from the game's folder: everything, or everything except the saves. Paths of the folder's+ /// top-level entries, sorted. Empty when the folder does not exist.+ public static func removals(in folder: URL, saves: Bool, fileManager fm: FileManager = .default) -> [URL] {+ let names = (try? fm.contentsOfDirectory(atPath: folder.path)) ?? []+ return names.filter { saves || !isSave($0) }.sorted().map { folder.appendingPathComponent($0) }+ }++ /// Deletes what `removals` names, and the folder itself when nothing is left in it. Returns the paths that could not be+ /// deleted.+ @discardableResult+ public static func delete(in folder: URL, saves: Bool, fileManager fm: FileManager = .default) -> [URL] {+ var failed: [URL] = []+ for url in removals(in: folder, saves: saves, fileManager: fm) {+ do { try fm.removeItem(at: url) } catch { failed.append(url) }+ }+ if ((try? fm.contentsOfDirectory(atPath: folder.path)) ?? ["?"]).isEmpty { try? fm.removeItem(at: folder) }+ return failed+ }+}diff --git a/frontend-ios/Sources/ShellHost/Resources/Localizable.xcstrings b/frontend-ios/Sources/ShellHost/Resources/Localizable.xcstringsindex 964a99f4..e09afe21 100644--- a/frontend-ios/Sources/ShellHost/Resources/Localizable.xcstrings+++ b/frontend-ios/Sources/ShellHost/Resources/Localizable.xcstrings@@ -481,6 +481,46 @@}}},+ "Some files of %@ could not be deleted.": {+ "localizations": {+ "de": {+ "stringUnit": {+ "state": "translated",+ "value": "Einige Dateien von %@ konnten nicht gelöscht werden."+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Some files of %@ could not be deleted."+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Certains fichiers de %@ n’ont pas pu être supprimés."+ }+ },+ "it": {+ "stringUnit": {+ "state": "translated",+ "value": "Alcuni file di %@ non sono stati eliminati."+ }+ },+ "sv": {+ "stringUnit": {+ "state": "translated",+ "value": "Några filer för %@ kunde inte raderas."+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "%@ 的部分文件无法删除。"+ }+ }+ }+ },"That folder could not be remembered. Try a different one.": {"localizations": {"en": {diff --git a/frontend-ios/Sources/ShellHost/ShellHostModel.swift b/frontend-ios/Sources/ShellHost/ShellHostModel.swiftindex fc5d9204..9197795d 100644--- a/frontend-ios/Sources/ShellHost/ShellHostModel.swift+++ b/frontend-ios/Sources/ShellHost/ShellHostModel.swift@@ -147,7 +147,7 @@ public struct ShellHostConfig: Sendable {/// Reads the games folder again and sorts the library (see `LibraryOrder`). Only this and the first load re-sort:/// a change to one game updates it in place.public func reload() {- let scanned = GameCatalogue.scan(root: config.gamesRoot)+ let scanned = GameCatalogue.scan(root: config.gamesRoot).filter { !isDeleted($0) }let built = scanned.map(detail(for:))let order = LibraryOrder.ids(of: built.map(\.game), lastPlayed: Dictionary(uniqueKeysWithValues: scanned.compactMap { e inlastPlayed(e.id).map { (e.id, $0) } }))@@ -284,7 +284,8 @@ public struct ShellHostConfig: Sendable {onPickShellCloud: { [weak self] in self.map { model in Task { await model.pickShellCloudNow() } } },onUseShellCloud: { [weak self] id in self?.useShellCloudSaves(id) },onClearShellData: { [weak self] in self?.clearShellData() },- onClearShellCloud: { [weak self] in self?.clearShellCloud() })+ onClearShellCloud: { [weak self] in self?.clearShellCloud() },+ onDeleteGame: { [weak self] id, saves in self?.deleteGame(id, saves: saves) })}public func change(_ id: String, setting: String, value: String) {@@ -384,6 +385,33 @@ public struct ShellHostConfig: Sendable {log = LogPresentation(gameID: id, title: entry.title, text: found?.text, truncated: found?.truncated ?? false)}+ // MARK: Delete++ /// Deletes the game's folder in this app (its saves only when `saves`), forgets the folder the player picked for its data+ /// (that folder is the player's and is not touched) and when it was played, and takes the game off the list. The game's+ /// framework inside the app stays: see `GameDeletion`.+ public func deleteGame(_ id: String, saves: Bool) {+ guard let entry = entry(id) else { return }+ let failed = GameDeletion.delete(in: appFolder(for: id), saves: saves)+ dataStore(id).clear()+ let defaults = config.defaults(id)+ defaults.removeObject(forKey: LastPlayedStore.key)+ defaults.set(GameDeletion.stamp(entry), forKey: GameDeletion.deletedKey)+ reload()+ if !failed.isEmpty { notice = hostText("Some files of \(entry.title) could not be deleted.") }+ }++ /// Deleted, and still the same build with no game data in its folder. A new build or game data in the folder brings the+ /// game back, and the mark is dropped.+ private func isDeleted(_ entry: CatalogueEntry) -> Bool {+ let defaults = config.defaults(entry.id)+ guard let deleted = defaults.string(forKey: GameDeletion.deletedKey) else { return false }+ let hasData = entry.manifest.map { DataLocator.holder(of: appFolder(for: entry.id), manifest: $0, .default) != nil } ?? false+ if deleted == GameDeletion.stamp(entry) && !hasData { return true }+ defaults.removeObject(forKey: GameDeletion.deletedKey)+ return false+ }+public func appUpdate() {guard let url = config.updateURL else { notice = hostText("No update address is set up for this app."); return }config.openURL(url)diff --git a/frontend-ios/Sources/ShellUI/DeleteGameView.swift b/frontend-ios/Sources/ShellUI/DeleteGameView.swiftnew file mode 100644index 00000000..c8a3e8eb--- /dev/null+++ b/frontend-ios/Sources/ShellUI/DeleteGameView.swift@@ -0,0 +1,79 @@+import SwiftUI++/// The question before a game is deleted (#559), drawn like the How to fix card so a controller can answer it too. It names+/// what goes away, keeps the saves unless the player turns on the switch, and starts on Cancel. The Mac launcher asks the same+/// question with the same words.+struct DeleteGameView: View {+ let game: GameTile+ @Binding var saves: Bool+ let delete: () -> Void+ let cancel: () -> Void++ var body: some View {+ VStack(alignment: .leading, spacing: 16) {+ Text(ShellStrings.text("Delete “\(game.title)”?")).shellType(ShellType.pageTitle)+ .fixedSize(horizontal: false, vertical: true)+ .accessibilityAddTraits(.isHeader).accessibilityIdentifier("delete.title")+ Text(ShellStrings.text("The game’s data on this device is deleted and the game leaves the list. A folder you chose yourself is not touched. Send the game data from your Mac again to bring it back."))+ .shellText(15).foregroundStyle(.white.opacity(0.78)).fixedSize(horizontal: false, vertical: true)+ VStack(alignment: .leading, spacing: 8) {+ Toggle(isOn: $saves) { Text(ShellStrings.text("Also delete saves")).shellText(15, .semibold) }+ .toggleStyle(CreamToggleStyle())+ .accessibilityIdentifier("delete.saves")+ .shellTarget("del.saves") { saves.toggle() }+ Text(saves ? ShellStrings.text("Saves are deleted too and cannot be brought back.")+ : ShellStrings.text("Saves stay unless you choose to delete them too."))+ .shellText(12.5).foregroundStyle(saves ? DeleteStyle.red : .white.opacity(0.5))+ .fixedSize(horizontal: false, vertical: true)+ }+ .padding(14)+ .background(.white.opacity(0.04), in: RoundedRectangle(cornerRadius: 12))+ .overlay(RoundedRectangle(cornerRadius: 12).strokeBorder(.white.opacity(0.08)))+ VStack(spacing: 10) {+ Button(action: delete) {+ Text(saves ? ShellStrings.text("Delete game and saves") : ShellStrings.text("Delete game")).frame(maxWidth: .infinity)+ }+ .buttonStyle(DeletePillStyle())+ .accessibilityIdentifier("delete.confirm")+ .shellTarget("del.confirm", radius: 25, action: delete)+ Button(action: cancel) { Text(ShellStrings.text("Cancel")).frame(maxWidth: .infinity) }+ .buttonStyle(ShellButtonStyle(fills: true))+ .accessibilityIdentifier("delete.cancel")+ .shellTarget("del.cancel", action: cancel)+ }.padding(.top, 4)+ }+ .padding(28)+ .frame(maxWidth: .infinity, alignment: .leading)+ .foregroundStyle(.white)+ }+}++enum DeleteStyle {+ /// The red of a destructive action, the same as the Mac launcher's Manage menu.+ static let red = Color(red: 1, green: 0.42, blue: 0.40)+}++/// The destructive twin of `PrimaryPillStyle`: the same capsule in red with white type.+struct DeletePillStyle: ButtonStyle {+ func makeBody(configuration: Configuration) -> some View {+ configuration.label.shellType(ShellType.primaryButton)+ .lineLimit(1).minimumScaleFactor(0.8)+ .padding(.horizontal, 26).frame(minHeight: 50)+ .foregroundStyle(.white)+ .background(Color(red: 0.86, green: 0.25, blue: 0.24), in: Capsule())+ .opacity(configuration.isPressed ? 0.78 : 1)+ .scaleEffect(configuration.isPressed ? 0.98 : 1)+ .contentShape(Capsule())+ }+}++/// Asks before a game is deleted. The library provides it. Without one, game settings show no Delete button.+private struct ShellAskDeleteKey: EnvironmentKey {+ nonisolated(unsafe) static let defaultValue: ((GameTile) -> Void)? = nil+}+extension EnvironmentValues {+ var shellAskDelete: ((GameTile) -> Void)? {+ get { self[ShellAskDeleteKey.self] }+ set { self[ShellAskDeleteKey.self] = newValue }+ }+}diff --git a/frontend-ios/Sources/ShellUI/GameDetailView.swift b/frontend-ios/Sources/ShellUI/GameDetailView.swiftindex b869d6c5..d1397176 100644--- a/frontend-ios/Sources/ShellUI/GameDetailView.swift+++ b/frontend-ios/Sources/ShellUI/GameDetailView.swift@@ -9,6 +9,7 @@ public struct GameDetailView: View {public var showsPrimaryAction: Bool/// Off where the game's cover and title are already in view, as beside the library's hero.public var showsHeader: Bool+ @Environment(\.shellAskDelete) private var askDeletepublic init(detail: GameDetail, actions: ShellActions = ShellActions(), showsPrimaryAction: Bool = true, showsHeader: Bool = true) {self.detail = detailself.actions = actions@@ -68,6 +69,17 @@ public struct GameDetailView: View {Text(ShellStrings.text("Brings back the settings this game was tested with.")).shellText(12.5).foregroundStyle(.white.opacity(0.45)).fixedSize(horizontal: false, vertical: true)}+ if let askDelete {+ // Last and apart from the rest: the one action here that removes something. It only asks, the question names what goes.+ VStack(alignment: .leading, spacing: 10) {+ Button(ShellStrings.text("Delete game…")) { askDelete(detail.game) }+ .buttonStyle(ShellButtonStyle(fills: true, destructive: true))+ .accessibilityIdentifier("set.delete")+ .shellTarget("set.delete") { askDelete(detail.game) }+ Text(ShellStrings.text("Deletes the game’s data on this device. You choose whether its saves go too."))+ .shellText(12.5).foregroundStyle(.white.opacity(0.45)).fixedSize(horizontal: false, vertical: true)+ }+ }}.foregroundStyle(.white)}diff --git a/frontend-ios/Sources/ShellUI/LibraryView.swift b/frontend-ios/Sources/ShellUI/LibraryView.swiftindex 27b8a353..1e7b9359 100644--- a/frontend-ios/Sources/ShellUI/LibraryView.swift+++ b/frontend-ios/Sources/ShellUI/LibraryView.swift@@ -39,6 +39,9 @@ public struct LibraryView: View {@State private var controllersOpen: Bool/// The game whose How to fix or How to update explanation is open.@State private var helpGameID: String?+ /// The game whose Delete question is open, and whether its saves go too.+ @State private var deleteGameID: String?+ @State private var deleteSaves = false/// The choice whose option list is open.@State private var choice: ChoiceRequest?@State private var focus: FocusAppearance@@ -103,7 +106,7 @@ public struct LibraryView: View {.frame(width: width, height: geometry.size.height).opacity(paneCovers && edgeDrag == 0 ? 0 : 1).allowsHitTesting(!settingsOpen)- .accessibilityHidden(settingsOpen || helpGameID != nil)+ .accessibilityHidden(settingsOpen || helpGameID != nil || deleteGameID != nil).transformPreference(FocusTargets.self) { if settingsOpen { $0.removeAll() } }if panelOverLibrary {// The same dimming and dismissal as the Controllers overlay.@@ -128,7 +131,7 @@ public struct LibraryView: View {.opacity(settingsOpen ? 1 : 0).frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .trailing).allowsHitTesting(settingsOpen)- .accessibilityHidden(!settingsOpen || choice != nil)+ .accessibilityHidden(!settingsOpen || choice != nil || deleteGameID != nil).accessibilityAddTraits(settingsOpen ? .isModal : []).transformPreference(FocusTargets.self) { if !settingsOpen { $0.removeAll() } }}@@ -146,6 +149,20 @@ public struct LibraryView: View {.accessibilityAddTraits(.isModal).transition(.opacity.combined(with: .scale(scale: 0.96)))}+ if let id = deleteGameID, let game = games.first(where: { $0.id == id })?.game {+ Color.black.opacity(0.55).ignoresSafeArea().accessibilityHidden(true)+ .onTapGesture { closeDelete() }+ .transition(.opacity)+ DeleteGameView(game: game, saves: $deleteSaves, delete: { confirmDelete(id) }, cancel: closeDelete)+ .frame(maxWidth: 460)+ .background(Color(red: 0.075, green: 0.075, blue: 0.082), in: RoundedRectangle(cornerRadius: 26))+ .overlay(RoundedRectangle(cornerRadius: 26).strokeBorder(.white.opacity(0.10)))+ .shadow(color: .black.opacity(0.5), radius: 40)+ .padding(16)+ .frame(maxWidth: .infinity, maxHeight: .infinity)+ .accessibilityAddTraits(.isModal)+ .transition(.opacity.combined(with: .scale(scale: 0.96)))+ }if let choice {Color.black.opacity(0.55).ignoresSafeArea().accessibilityHidden(true).onTapGesture { closeChoice() }@@ -187,13 +204,14 @@ public struct LibraryView: View {if controllersOpen { return target.id.hasPrefix("ctl.") }if shellSettingsOpen { return target.id.hasPrefix("shs.") }if helpGameID != nil { return target.id.hasPrefix("help.") }+ if deleteGameID != nil { return target.id.hasPrefix("del.") }if choice != nil { return target.id.hasPrefix("pick.") }- return !target.id.hasPrefix("ctl.") && !target.id.hasPrefix("help.") && !target.id.hasPrefix("pick.") && !target.id.hasPrefix("shs.")+ return !["ctl.", "help.", "pick.", "shs.", "del."].contains { target.id.hasPrefix($0) }}}.coordinateSpace(name: "shell").background {- EdgeSwipeBack(enabled: (settingsOpen || controllersOpen || shellSettingsOpen) && choice == nil && helpGameID == nil,+ EdgeSwipeBack(enabled: (settingsOpen || controllersOpen || shellSettingsOpen) && choice == nil && helpGameID == nil && deleteGameID == nil,changed: { edgeDrag = $0 },ended: { finishEdgeSwipe(travel: $0, velocity: $1, span: controllersOpen || shellSettingsOpen ? min(width, 520) : pane) },cancelled: cancelEdgeSwipe)@@ -207,9 +225,11 @@ public struct LibraryView: View {.animation(reduceMotion ? nil : .smooth(duration: 0.3), value: controllersOpen).animation(reduceMotion ? nil : .smooth(duration: 0.3), value: shellSettingsOpen).animation(reduceMotion ? nil : .smooth(duration: 0.25), value: helpGameID)+ .animation(reduceMotion ? nil : .smooth(duration: 0.25), value: deleteGameID).animation(reduceMotion ? nil : .smooth(duration: 0.25), value: choice).environment(\.shellPickChoice, { request in openChoice(request) }).environment(\.shellShowHelp, { game in openHelp(game.id) })+ .environment(\.shellAskDelete, { game in openDelete(game.id) }).environment(\.shellFocus, focus).environment(\.shellInputDevice, device).foregroundStyle(.white)@@ -353,6 +373,16 @@ public struct LibraryView: View {private func closeShellSettings() { shellSettingsOpen = false; focus.id = "lib.shellSettings" }private func openHelp(_ id: String) { returnFocus = focus.id; helpGameID = id; focus.id = "help.done" }private func closeHelp() { helpGameID = nil; focus.id = returnFocus }+ /// The question starts on Cancel, with the saves kept.+ private func openDelete(_ id: String) { noteTouch(); returnFocus = focus.id; deleteSaves = false; deleteGameID = id; focus.id = "del.cancel" }+ private func closeDelete() { deleteGameID = nil; focus.id = returnFocus }+ private func confirmDelete(_ id: String) {+ let saves = deleteSaves+ deleteGameID = nil+ settingsOpen = false+ focus.id = nil+ actions.onDeleteGame(id, saves)+ }private func openChoice(_ request: ChoiceRequest) {noteTouch()returnFocus = focus.id@@ -376,6 +406,7 @@ public struct LibraryView: View {private func back() {if choice != nil { closeChoice() }else if helpGameID != nil { closeHelp() }+ else if deleteGameID != nil { closeDelete() }else if controllersOpen { controllersOpen = false; focus.id = "lib.controllers" }else if shellSettingsOpen { closeShellSettings() }else if settingsOpen { closeSettings() }@@ -418,6 +449,7 @@ public struct LibraryView: View {private var defaultFocus: String? {if let choice { return "pick.\(choice.row.value)" }if helpGameID != nil { return "help.done" }+ if deleteGameID != nil { return "del.cancel" }if controllersOpen { return "ctl.close" }if shellSettingsOpen { return "shs.close" }if settingsOpen { return "set.back" }diff --git a/frontend-ios/Sources/ShellUI/Resources/Localizable.xcstrings b/frontend-ios/Sources/ShellUI/Resources/Localizable.xcstringsindex 29b11b39..ffe03027 100644--- a/frontend-ios/Sources/ShellUI/Resources/Localizable.xcstrings+++ b/frontend-ios/Sources/ShellUI/Resources/Localizable.xcstrings@@ -153,6 +153,46 @@}}},+ "Also delete saves": {+ "localizations": {+ "de": {+ "stringUnit": {+ "state": "translated",+ "value": "Auch Spielstände löschen"+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Also delete saves"+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Supprimer aussi les sauvegardes"+ }+ },+ "it": {+ "stringUnit": {+ "state": "translated",+ "value": "Elimina anche i salvataggi"+ }+ },+ "sv": {+ "stringUnit": {+ "state": "translated",+ "value": "Radera även sparfiler"+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "同时删除存档"+ }+ }+ }+ },"American English": {"localizations": {"de": {@@ -377,6 +417,46 @@}}},+ "Cancel": {+ "localizations": {+ "de": {+ "stringUnit": {+ "state": "translated",+ "value": "Abbrechen"+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Cancel"+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Annuler"+ }+ },+ "it": {+ "stringUnit": {+ "state": "translated",+ "value": "Annulla"+ }+ },+ "sv": {+ "stringUnit": {+ "state": "translated",+ "value": "Avbryt"+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "取消"+ }+ }+ }+ },"Charging": {"localizations": {"en": {@@ -649,6 +729,206 @@}}},+ "Delete game": {+ "localizations": {+ "de": {+ "stringUnit": {+ "state": "translated",+ "value": "Spiel löschen"+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Delete game"+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Supprimer le jeu"+ }+ },+ "it": {+ "stringUnit": {+ "state": "translated",+ "value": "Elimina gioco"+ }+ },+ "sv": {+ "stringUnit": {+ "state": "translated",+ "value": "Radera spelet"+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "删除游戏"+ }+ }+ }+ },+ "Delete game and saves": {+ "localizations": {+ "de": {+ "stringUnit": {+ "state": "translated",+ "value": "Spiel und Spielstände löschen"+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Delete game and saves"+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Supprimer le jeu et les sauvegardes"+ }+ },+ "it": {+ "stringUnit": {+ "state": "translated",+ "value": "Elimina gioco e salvataggi"+ }+ },+ "sv": {+ "stringUnit": {+ "state": "translated",+ "value": "Radera spelet och sparfilerna"+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "删除游戏和存档"+ }+ }+ }+ },+ "Delete game…": {+ "localizations": {+ "de": {+ "stringUnit": {+ "state": "translated",+ "value": "Spiel löschen …"+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Delete game…"+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Supprimer le jeu…"+ }+ },+ "it": {+ "stringUnit": {+ "state": "translated",+ "value": "Elimina gioco…"+ }+ },+ "sv": {+ "stringUnit": {+ "state": "translated",+ "value": "Radera spelet …"+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "删除游戏…"+ }+ }+ }+ },+ "Delete “%@”?": {+ "localizations": {+ "de": {+ "stringUnit": {+ "state": "translated",+ "value": "„%@“ löschen?"+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Delete “%@”?"+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Supprimer « %@ » ?"+ }+ },+ "it": {+ "stringUnit": {+ "state": "translated",+ "value": "Eliminare “%@”?"+ }+ },+ "sv": {+ "stringUnit": {+ "state": "translated",+ "value": "Radera ”%@”?"+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "删除“%@”?"+ }+ }+ }+ },+ "Deletes the game’s data on this device. You choose whether its saves go too.": {+ "localizations": {+ "de": {+ "stringUnit": {+ "state": "translated",+ "value": "Löscht die Spieldaten auf diesem Gerät. Du entscheidest, ob die Spielstände mitgehen."+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Deletes the game’s data on this device. You choose whether its saves go too."+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Supprime les données du jeu sur cet appareil. Vous choisissez si ses sauvegardes partent aussi."+ }+ },+ "it": {+ "stringUnit": {+ "state": "translated",+ "value": "Elimina i dati del gioco su questo dispositivo. Scegli tu se eliminare anche i salvataggi."+ }+ },+ "sv": {+ "stringUnit": {+ "state": "translated",+ "value": "Raderar speldatan på den här enheten. Du väljer om sparfilerna också ska bort."+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "删除这台设备上的游戏数据。是否一并删除存档由你决定。"+ }+ }+ }+ },"Details": {"localizations": {"en": {@@ -2473,6 +2753,86 @@}}},+ "Saves are deleted too and cannot be brought back.": {+ "localizations": {+ "de": {+ "stringUnit": {+ "state": "translated",+ "value": "Die Spielstände werden auch gelöscht und lassen sich nicht wiederherstellen."+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Saves are deleted too and cannot be brought back."+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Les sauvegardes sont aussi supprimées et ne peuvent pas être récupérées."+ }+ },+ "it": {+ "stringUnit": {+ "state": "translated",+ "value": "Anche i salvataggi vengono eliminati e non si possono recuperare."+ }+ },+ "sv": {+ "stringUnit": {+ "state": "translated",+ "value": "Sparfilerna raderas också och kan inte återställas."+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "存档也会被删除,且无法恢复。"+ }+ }+ }+ },+ "Saves stay unless you choose to delete them too.": {+ "localizations": {+ "de": {+ "stringUnit": {+ "state": "translated",+ "value": "Spielstände bleiben, außer du löschst sie ausdrücklich mit."+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Saves stay unless you choose to delete them too."+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Les sauvegardes restent, sauf si vous choisissez de les supprimer aussi."+ }+ },+ "it": {+ "stringUnit": {+ "state": "translated",+ "value": "I salvataggi restano, a meno che tu non scelga di eliminarli."+ }+ },+ "sv": {+ "stringUnit": {+ "state": "translated",+ "value": "Sparfilerna ligger kvar om du inte väljer att radera dem också."+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "除非你选择一并删除,否则存档会保留。"+ }+ }+ }+ },"Select": {"localizations": {"en": {@@ -2681,6 +3041,46 @@}}},+ "The game’s data on this device is deleted and the game leaves the list. A folder you chose yourself is not touched. Send the game data from your Mac again to bring it back.": {+ "localizations": {+ "de": {+ "stringUnit": {+ "state": "translated",+ "value": "Die Spieldaten auf diesem Gerät werden gelöscht und das Spiel verschwindet aus der Liste. Ein Ordner, den du selbst gewählt hast, bleibt unberührt. Sende die Spieldaten erneut von deinem Mac, um es zurückzuholen."+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "The game’s data on this device is deleted and the game leaves the list. A folder you chose yourself is not touched. Send the game data from your Mac again to bring it back."+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Les données du jeu sur cet appareil sont supprimées et le jeu quitte la liste. Un dossier que vous avez choisi vous-même n’est pas touché. Envoyez à nouveau les données du jeu depuis votre Mac pour le retrouver."+ }+ },+ "it": {+ "stringUnit": {+ "state": "translated",+ "value": "I dati del gioco su questo dispositivo vengono eliminati e il gioco esce dall’elenco. Una cartella scelta da te non viene toccata. Invia di nuovo i dati del gioco dal Mac per riaverlo."+ }+ },+ "sv": {+ "stringUnit": {+ "state": "translated",+ "value": "Speldatan på den här enheten raderas och spelet försvinner från listan. En mapp du själv har valt rörs inte. Skicka speldatan från din Mac igen för att få tillbaka det."+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "这台设备上的游戏数据会被删除,游戏也会从列表中移除。你自己选择的文件夹不受影响。从 Mac 再次发送游戏数据即可恢复。"+ }+ }+ }+ },"This game needs a newer version of this app. Update it with the Mac app on your Mac, then install it on this device again.": {"localizations": {"en": {diff --git a/frontend-ios/Sources/ShellUI/ShellInputs.swift b/frontend-ios/Sources/ShellUI/ShellInputs.swiftindex e2dfc7e0..40f68980 100644--- a/frontend-ios/Sources/ShellUI/ShellInputs.swift+++ b/frontend-ios/Sources/ShellUI/ShellInputs.swift@@ -186,6 +186,8 @@ public struct ShellActions {public var onUseShellCloud: (String) -> Voidpublic var onClearShellData: () -> Voidpublic var onClearShellCloud: () -> Void+ /// Deletes the game's data on this device and takes it off the list. `saves`: its saves go too.+ public var onDeleteGame: (_ gameID: String, _ saves: Bool) -> Voidpublic init(onSelect: @escaping (String) -> Void = { _ in }, onPlay: @escaping (String) -> Void = { _ in },onChange: @escaping (String, String, String) -> Void = { _, _, _ in },onPickGameData: @escaping (String) -> Void = { _ in }, onUseAppData: @escaping (String) -> Void = { _ in },@@ -194,7 +196,7 @@ public struct ShellActions {onAppUpdate: @escaping () -> Void = {}, onBack: @escaping () -> Void = {},onPickShellData: @escaping () -> Void = {}, onPickShellCloud: @escaping () -> Void = {},onUseShellCloud: @escaping (String) -> Void = { _ in }, onClearShellData: @escaping () -> Void = {},- onClearShellCloud: @escaping () -> Void = {}) {+ onClearShellCloud: @escaping () -> Void = {}, onDeleteGame: @escaping (String, Bool) -> Void = { _, _ in }) {self.onSelect = onSelectself.onPlay = onPlayself.onChange = onChange@@ -211,5 +213,6 @@ public struct ShellActions {self.onUseShellCloud = onUseShellCloudself.onClearShellData = onClearShellDataself.onClearShellCloud = onClearShellCloud+ self.onDeleteGame = onDeleteGame}}diff --git a/frontend-ios/Sources/ShellUI/ShellStyle.swift b/frontend-ios/Sources/ShellUI/ShellStyle.swiftindex 08df2601..99ecd78a 100644--- a/frontend-ios/Sources/ShellUI/ShellStyle.swift+++ b/frontend-ios/Sources/ShellUI/ShellStyle.swift@@ -13,7 +13,9 @@ public enum ShellPalette {}enum ShellStrings {- static var bundle: Bundle { .module }+ /// Visual QA renders one language's `.lproj` whatever the Mac's language is. Nil in the app.+ nonisolated(unsafe) static var captureBundle: Bundle?+ static var bundle: Bundle { captureBundle ?? .module }static func text(_ key: String.LocalizationValue) -> String { String(localized: key, bundle: bundle) }/// A text of a game's `launcher.json` (section, label, note, option label) in the player's language. The file is English and@@ -125,11 +127,13 @@ struct SectionHeading: View {struct ShellButtonStyle: ButtonStyle {/// Take all the width offered, as the buttons inside a settings card do.var fills = false+ /// Red type for an action that removes something.+ var destructive = false@Environment(\.isEnabled) private var enabledfunc makeBody(configuration: Configuration) -> some View {configuration.label.shellType(ShellType.button).lineLimit(1).padding(.horizontal, 14).frame(maxWidth: fills ? .infinity : nil, minHeight: 44)- .foregroundStyle(.white.opacity(0.92))+ .foregroundStyle(destructive ? DeleteStyle.red : .white.opacity(0.92)).background(.white.opacity(configuration.isPressed ? 0.13 : 0.055), in: RoundedRectangle(cornerRadius: 9)).overlay(RoundedRectangle(cornerRadius: 9).strokeBorder(.white.opacity(0.10))).opacity(enabled ? 1 : 0.4)diff --git a/frontend-ios/Tests/ShellHostTests/GameDeletionTests.swift b/frontend-ios/Tests/ShellHostTests/GameDeletionTests.swiftnew file mode 100644index 00000000..9acf00b5--- /dev/null+++ b/frontend-ios/Tests/ShellHostTests/GameDeletionTests.swift@@ -0,0 +1,85 @@+import Foundation+import Testing+@testable import ShellHost++/// #559: deleting a game in the shell removes its folder in the app (the saves only when asked), never a folder the player+/// picked, and keeps the game off the list until a new build of it or its game data comes again.+@MainActor @Suite struct GameDeletionTests {+ /// The orbit fixture's folder in the app with game data, add-on content, saves, a temp folder and a log.+ private func fill(_ box: Sandbox) throws -> URL {+ let dir = try box.giveAppData()+ for file in ["aoc/0.img", "save/0/file.bin", "save_device/0/file.bin", "save.work/0/file.bin", "temp/t.bin", "log.txt"] {+ try box.write("x", to: dir.appendingPathComponent(file))+ }+ return dir+ }+ private func names(_ dir: URL) -> [String] { ((try? FileManager.default.contentsOfDirectory(atPath: dir.path)) ?? []).sorted() }+ private func listed(_ model: ShellHostModel) -> Bool { model.details.contains { $0.id == Fixtures.orbit } }++ @Test func deletingKeepsTheSavesAndTakesTheGameOffTheList() throws {+ let box = try Sandbox()+ let dir = try fill(box)+ let model = ShellHostModel(config: box.config())+ let before = model.details.count+ #expect(listed(model))+ model.deleteGame(Fixtures.orbit, saves: false)+ #expect(names(dir) == ["save", "save.work", "save_device"], "game data, add-on content, temp and log are gone, the saves stay")+ #expect(!listed(model) && model.details.count == before - 1)+ #expect(model.notice == nil)+ #expect(!listed(ShellHostModel(config: box.config())), "still off the list when the app opens again")+ }++ @Test func deletingWithSavesRemovesTheWholeFolder() throws {+ let box = try Sandbox()+ let dir = try fill(box)+ let model = ShellHostModel(config: box.config())+ model.deleteGame(Fixtures.orbit, saves: true)+ #expect(!FileManager.default.fileExists(atPath: dir.path))+ #expect(!listed(model))+ }++ @Test func gameDataSentAgainBringsTheGameBack() throws {+ let box = try Sandbox()+ _ = try fill(box)+ ShellHostModel(config: box.config()).deleteGame(Fixtures.orbit, saves: false)+ try box.giveAppData()+ let model = ShellHostModel(config: box.config())+ #expect(listed(model))+ #expect(try #require(model.details.first { $0.id == Fixtures.orbit }).game.state == .playable)+ #expect(box.defaults(Fixtures.orbit).string(forKey: GameDeletion.deletedKey) == nil, "the mark is dropped once the game is back")+ }++ @Test func aNewBuildOfTheGameBringsItBack() throws {+ let box = try Sandbox()+ _ = try fill(box)+ ShellHostModel(config: box.config()).deleteGame(Fixtures.orbit, saves: false)+ #expect(!listed(ShellHostModel(config: box.config())), "the same build stays deleted")+ let manifest = box.games.appendingPathComponent(Fixtures.orbit).appendingPathComponent("game.manifest.json")+ let text = try String(contentsOf: manifest, encoding: .utf8)+ try Data(text.replacingOccurrences(of: "\"schema\": 1,", with: "\"schema\": 1,\n \"built_at\": \"2026-11-03T10:00:00Z\",").utf8).write(to: manifest)+ let model = ShellHostModel(config: box.config())+ #expect(listed(model))+ #expect(try #require(model.details.first { $0.id == Fixtures.orbit }).game.state == .needsGameData)+ }++ @Test func aFolderThePlayerPickedIsNotTouched() async throws {+ let box = try Sandbox()+ let picked = box.root.appendingPathComponent("Picked/Orbit", isDirectory: true)+ try box.write("", to: picked.appendingPathComponent("romfs/fixture.marker"))+ let model = ShellHostModel(config: box.config(), picker: FakePicker(url: picked))+ await model.pickGameDataNow(Fixtures.orbit)+ #expect(try #require(model.details.first { $0.id == Fixtures.orbit }).game.state == .playable)+ model.deleteGame(Fixtures.orbit, saves: true)+ #expect(FileManager.default.fileExists(atPath: picked.appendingPathComponent("romfs/fixture.marker").path))+ #expect(box.defaults(Fixtures.orbit).data(forKey: BookmarkStore.gameDataKey) == nil, "the pick is forgotten")+ #expect(!listed(model))+ }++ @Test func theRemovalsListNamesEverythingButTheSaves() throws {+ let box = try Sandbox()+ let dir = try fill(box)+ #expect(GameDeletion.removals(in: dir, saves: false).map(\.lastPathComponent) == ["aoc", "log.txt", "romfs", "temp"])+ #expect(GameDeletion.removals(in: dir, saves: true).count == 7)+ #expect(GameDeletion.removals(in: dir.appendingPathComponent("missing"), saves: true).isEmpty)+ }+}diff --git a/frontend-ios/Tests/ShellUITests/DeleteCaptureTests.swift b/frontend-ios/Tests/ShellUITests/DeleteCaptureTests.swiftnew file mode 100644index 00000000..29350e7d--- /dev/null+++ b/frontend-ios/Tests/ShellUITests/DeleteCaptureTests.swift@@ -0,0 +1,55 @@+#if os(macOS)+import AppKit+import SwiftUI+import XCTest+@testable import ShellUI++/// Visual QA of Delete game in the shell (#559), rendered on the Mac: the end of a game's settings with the Delete button, and+/// the question with the saves kept and with the saves chosen. Set NX_SHELL_CAPTURE_DIR to write the PNGs.+@MainActor+final class DeleteCaptureTests: XCTestCase {+ private func capture<V: View>(_ name: String, width: CGFloat, _ view: V) throws {+ guard let dir = ProcessInfo.processInfo.environment["NX_SHELL_CAPTURE_DIR"] else { throw XCTSkip("Set NX_SHELL_CAPTURE_DIR to capture the shell") }+ // NX_SHELL_CAPTURE_LANG=en (or de, zh, ...): the shell's language, whatever the Mac's is. Not saved anywhere.+ if let lang = ProcessInfo.processInfo.environment["NX_SHELL_CAPTURE_LANG"],+ let path = Bundle.module.path(forResource: lang == "zh" ? "zh-Hans" : lang, ofType: "lproj") {+ ShellStrings.captureBundle = Bundle(path: path)+ }+ defer { ShellStrings.captureBundle = nil }+ NSApplication.shared.setActivationPolicy(.accessory)+ let host = NSHostingView(rootView: view.frame(width: width).background(ShellPalette.background).environment(\.colorScheme, .dark))+ host.frame = NSRect(origin: .zero, size: host.fittingSize)+ let window = NSWindow(contentRect: NSRect(origin: NSPoint(x: -100_000, y: -100_000), size: host.frame.size),+ styleMask: [.borderless], backing: .buffered, defer: false)+ window.isReleasedWhenClosed = false+ window.contentView = host+ window.orderFront(nil)+ defer { window.orderOut(nil); window.contentView = nil }+ RunLoop.main.run(until: Date().addingTimeInterval(0.4))+ 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: URL(fileURLWithPath: dir).appendingPathComponent(name + ".png"))+ }++ private let game = GameTile(id: "0100535012974000", title: "Hades II")++ func testCaptureTheSettingsEnd() throws {+ let detail = GameDetail(game: game, dataSource: "This app's folder")+ try capture("shell-settings-delete", width: 402,+ GameDetailView(detail: detail, showsPrimaryAction: false, showsHeader: false)+ .environment(\.shellAskDelete, { _ in })+ .padding(24))+ }++ func testCaptureTheQuestion() throws {+ for saves in [false, true] {+ let card = DeleteGameView(game: game, saves: .constant(saves), delete: {}, cancel: {})+ .background(Color(red: 0.075, green: 0.075, blue: 0.082), in: RoundedRectangle(cornerRadius: 26))+ .overlay(RoundedRectangle(cornerRadius: 26).strokeBorder(.white.opacity(0.10)))+ .padding(16)+ try capture(saves ? "shell-delete-saves" : "shell-delete", width: 402, card.background(Color.black.opacity(0.55)))+ }+ }+}+#endifdiff --git a/frontend/Sources/NX2Apple/DeleteGameSheet.swift b/frontend/Sources/NX2Apple/DeleteGameSheet.swiftnew file mode 100644index 00000000..43f67033--- /dev/null+++ b/frontend/Sources/NX2Apple/DeleteGameSheet.swift@@ -0,0 +1,195 @@+import AppKit+import SwiftUI+import NXCore+import NXModel+import NXLauncher++/// The question before a game is deleted (#559): the same words as the iPhone and iPad app, the list of what goes to the Trash+/// with its size, the saves as a separate switch that starts off, and Cancel as the default button.+struct DeleteGameSheet: View {+ let game: LibraryGame+ let shellRoot: String+ /// The library entry goes once the files are gone. Called with the paths that could not be moved.+ let finished: ([String]) -> Void+ @EnvironmentObject var loc: Localizer+ @EnvironmentObject private var focus: PadFocus+ @Environment(\.dismiss) private var dismiss+ @State private var plan: GameDeletion?+ @State private var saves = false+ @State private var working = false++ init(game: LibraryGame, shellRoot: String, plan: GameDeletion? = nil, saves: Bool = false, finished: @escaping ([String]) -> Void = { _ in }) {+ self.game = game+ self.shellRoot = shellRoot+ self.finished = finished+ _plan = State(initialValue: plan) // visual QA: a measured plan without files on disk+ _saves = State(initialValue: saves)+ }++ var body: some View {+ VStack(alignment: .leading, spacing: 0) {+ HStack(alignment: .top, spacing: 14) {+ Image(systemName: "trash").font(.system(size: 20, weight: .medium)).foregroundStyle(Self.red)+ .frame(width: 40, height: 40).background(Self.red.opacity(0.14), in: Circle())+ VStack(alignment: .leading, spacing: 6) {+ Text(String(format: loc.t("delete.question"), game.name)).font(.manrope(22, .heavy)).tracking(-0.4)+ .fixedSize(horizontal: false, vertical: true)+ if plan.map({ !$0.items.isEmpty || $0.saves != nil }) ?? true { // nothing goes to the Trash for a game with no files here+ Text(loc.t("delete.note")).font(.manrope(13)).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)+ }+ }+ }+ .padding(.horizontal, 28).padding(.top, 26).padding(.bottom, 16)+ VStack(alignment: .leading, spacing: 12) {+ if let plan {+ card {+ if plan.items.isEmpty {+ Text(loc.t("delete.nothing")).font(.manrope(13)).foregroundStyle(.secondary)+ .padding(.horizontal, 18).padding(.vertical, 13)+ }+ ForEach(Array(plan.items.enumerated()), id: \.element.id) { index, item in+ if index > 0 { Divider().opacity(0.25).padding(.leading, 18) }+ row(item)+ }+ }+ savesCard(plan.saves)+ } else {+ HStack(spacing: 10) { ProgressView().controlSize(.small); Text(loc.t("free.measuring")).foregroundStyle(.secondary) }+ .padding(.vertical, 20)+ }+ Text(loc.t("delete.sources")).font(.manrope(12)).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)+ .padding(.horizontal, 2)+ }+ .padding(.horizontal, 28).padding(.bottom, 20)+ Divider().opacity(0.3)+ HStack(spacing: 12) {+ Spacer(minLength: 8)+ Button(loc.t("saves.cancel")) { dismiss() }+ .buttonStyle(LauncherSecondaryButtonStyle())+ .keyboardShortcut(.cancelAction)+ .padTarget("delete.cancel", scope: "delete") { dismiss() }+ Button(action: delete) {+ Text(loc.t(saves && plan?.saves != nil ? "delete.confirmSaves" : "delete.confirm")).font(.manrope(13.5, .bold)).foregroundStyle(.white)+ .padding(.horizontal, 20).padding(.vertical, 9)+ .background(Self.fill, in: Capsule())+ .opacity(plan == nil || working ? 0.5 : 1)+ }+ .buttonStyle(.plain)+ .disabled(plan == nil || working)+ .padTarget("delete.confirm", scope: "delete", radius: 20) { delete() }+ }+ .padding(.horizontal, 28).padding(.vertical, 16)+ }+ .padScope("delete", focus)+ .frame(width: 520)+ .fixedSize(horizontal: false, vertical: true)+ .background(LauncherPalette.background)+ .font(.manrope(13))+ .preferredColorScheme(.dark)+ .tint(LauncherPalette.cream)+ .onAppear { if plan == nil { measure() } }+ }++ static let red = Color(red: 1, green: 0.42, blue: 0.40)+ static let fill = Color(red: 0.86, green: 0.25, blue: 0.24)++ private func title(_ kind: GameDeletion.Item.Kind) -> String {+ switch kind {+ case .macApp: loc.t("delete.part.macApp")+ case .ipa: loc.t("delete.part.ipa")+ case .iosApp: loc.t("delete.part.iosApp")+ case .archive: loc.t("delete.part.archive")+ case .shellFramework: loc.t("delete.part.shellFramework")+ case .buildFolder: loc.t("delete.part.buildFolder")+ case .log: loc.t("delete.part.log")+ case .saves: loc.t("delete.saves")+ }+ }++ /// The line under a part's name: where it is, or for the shared app what happens.+ private func detail(_ item: GameDeletion.Item) -> String {+ if item.kind == .shellFramework { return loc.t("delete.part.shellFrameworkNote") }+ guard let first = item.paths.first else { return "" }+ let shown = item.kind == .buildFolder ? (first as NSString).deletingLastPathComponent : first+ return (shown as NSString).abbreviatingWithTildeInPath+ }++ private func row(_ item: GameDeletion.Item) -> some View {+ HStack(alignment: .firstTextBaseline, spacing: 16) {+ VStack(alignment: .leading, spacing: 3) {+ Text(title(item.kind)).font(.manrope(14, .medium))+ Text(detail(item)).font(.manrope(11.5)).foregroundStyle(.secondary).lineLimit(2).truncationMode(.middle)+ }+ Spacer(minLength: 12)+ if item.bytes > 0 { sizeText(item.bytes) }+ }+ .padding(.horizontal, 18).padding(.vertical, 11)+ }++ @ViewBuilder private func savesCard(_ item: GameDeletion.Item?) -> some View {+ card {+ HStack(alignment: .top, spacing: 16) {+ VStack(alignment: .leading, spacing: 3) {+ Text(loc.t("delete.saves")).font(.manrope(14, .medium))+ Text(item == nil ? loc.t("delete.noSaves") : loc.t(saves ? "delete.savesOn" : "delete.savesOff"))+ .font(.manrope(12)).foregroundStyle(saves && item != nil ? Self.red : .secondary)+ .fixedSize(horizontal: false, vertical: true)+ }+ Spacer(minLength: 12)+ if let item, item.bytes > 0 { sizeText(item.bytes) }+ Toggle("", isOn: $saves).labelsHidden().toggleStyle(LauncherSwitchStyle()).disabled(item == nil || working)+ }+ .padding(.horizontal, 18).padding(.vertical, 13)+ .padTarget("delete.saves", scope: "delete", radius: 10, activate: { if item != nil { saves.toggle() } },+ adjust: { _ in if item != nil { saves.toggle() } })+ }+ }++ private func sizeText(_ bytes: Int64) -> some View {+ Text(FreeSpaceView.bytes(bytes)).font(.manrope(13, .semibold)).monospacedDigit().frame(minWidth: 70, alignment: .trailing)+ }++ private func card<Content: View>(@ViewBuilder _ content: () -> Content) -> some View {+ VStack(alignment: .leading, spacing: 0, content: content)+ .frame(maxWidth: .infinity, alignment: .leading)+ .background(LauncherPalette.surface.opacity(0.75), in: RoundedRectangle(cornerRadius: 14))+ .overlay(RoundedRectangle(cornerRadius: 14).strokeBorder(Color.white.opacity(0.06)))+ }++ private func measure() {+ let game = game, root = shellRoot+ DispatchQueue.global(qos: .userInitiated).async {+ let result = GameDeletion.plan(for: game, shellRoot: root)+ DispatchQueue.main.async { plan = result }+ }+ }++ private func delete() {+ guard let plan, !working else { return }+ working = true+ let withSaves = saves+ DispatchQueue.global(qos: .userInitiated).async {+ let failed = plan.run(saves: withSaves)+ DispatchQueue.main.async {+ working = false+ dismiss()+ finished(failed)+ }+ }+ }+}++extension View {+ /// The Delete sheet of `game`, and the controller's scope while it is open. Its own modifier keeps LauncherView's chain short.+ func deleteGameSheet(_ game: Binding<LibraryGame?>, shellRoot: String, library: GameLibrary, loc: Localizer, pad: PadFocus,+ scope: @escaping () -> String) -> some View {+ sheet(item: game) { game in+ DeleteGameSheet(game: game, shellRoot: shellRoot) { failed in+ library.remove(game.id)+ if !failed.isEmpty { library.error = String(format: loc.t("delete.failed"), failed.joined(separator: "\n")) }+ }+ .environmentObject(pad)+ }+ .onChange(of: game.wrappedValue?.id) { id in pad.scope = id != nil ? "delete" : scope() }+ }+}diff --git a/frontend/Sources/NX2Apple/GameDeletion.swift b/frontend/Sources/NX2Apple/GameDeletion.swiftnew file mode 100644index 00000000..45823b2b--- /dev/null+++ b/frontend/Sources/NX2Apple/GameDeletion.swift@@ -0,0 +1,97 @@+import Foundation+import NXCore++/// Deleting a game from the library (#559): what goes, what stays, and doing it. Everything goes to the Trash, so a wrong+/// click can be undone in the Finder. The game's own files (the NSP, XCI and update packages it was built from) are never+/// touched. Its saves go only when the player chooses so.+struct GameDeletion: Equatable {+ /// One thing that is deleted, with the paths it is made of and their size on disk.+ struct Item: Identifiable, Equatable {+ enum Kind: String, CaseIterable { case macApp, ipa, iosApp, archive, shellFramework, buildFolder, log, saves }+ var kind: Kind+ var paths: [String]+ var bytes: Int64 = 0+ var id: String { kind.rawValue }+ }++ var titleID: String+ /// What is deleted with the game, in the order the question lists it. The saves are apart.+ var items: [Item]+ /// The saves, nil when the game has none on this Mac.+ var saves: Item?+ /// The shared app's folder when the game is in it: the game leaves its list (shell.json), so the next install of the+ /// shared app leaves it out.+ var shellRoot: String?++ /// The plan for one game. Reads only, measures the sizes when `measure` (off the main thread: a build folder can hold+ /// tens of GB).+ static func plan(for game: LibraryGame, shellRoot: String, home: String = NSHomeDirectory(),+ support: URL = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)[0],+ measure: Bool = true) -> GameDeletion {+ let fm = FileManager.default+ func exists(_ path: String) -> Bool { !path.isEmpty && fm.fileExists(atPath: path) }+ var items: [Item] = []+ if exists(game.appPath) { items.append(Item(kind: .macApp, paths: [game.appPath])) }+ if game.hasIPA { items.append(Item(kind: .ipa, paths: [game.ipaPath])) }+ // An app of its own (an older iPhone build). The shared app holds other games too and is never deleted here.+ if game.hasIOSApp && ShellInstall.paths(ofApp: game.iosAppPath) == nil { items.append(Item(kind: .iosApp, paths: [game.iosAppPath])) }+ // The game data the shared app's install sends: <output folder>/games/<title ID>, nothing above it.+ if exists(game.archivePath) && (game.archivePath as NSString).lastPathComponent == game.titleID {+ items.append(Item(kind: .archive, paths: [game.archivePath]))+ }+ var root: String?+ if !shellRoot.isEmpty, ShellLibrary.load(root: shellRoot).games.contains(where: { $0.titleID == game.titleID }) {+ root = shellRoot+ let mirror = ShellInstall.mirroredFramework(root: shellRoot, titleID: game.titleID)+ items.append(Item(kind: .shellFramework, paths: exists(mirror) ? [mirror] : []))+ }+ let build = BuildFolder.location(for: game)+ let sources = Set(game.inputs.values.flatMap { $0 }.map(BuildFolder.resolved))+ if let build {+ // Everything in it but the Mac development build's save (run/), which goes with the saves.+ let names = ((try? fm.contentsOfDirectory(atPath: build)) ?? []).filter { $0 != "run" }.sorted()+ let paths = names.map { build + "/" + $0 }.filter { path in !sources.contains { $0 == path || $0.hasPrefix(path + "/") } }+ items.append(Item(kind: .buildFolder, paths: paths))+ }+ let logs = GameLog.folders(appPath: game.appPath, home: home).flatMap { folder in+ [game.titleID + ".log", game.titleID + ".prev.log"].map { folder.appendingPathComponent($0).path }+ }.filter(exists)+ if !logs.isEmpty { items.append(Item(kind: .log, paths: logs)) }++ let mac = SaveTransfer.macSave(titleID: game.titleID, appPath: game.appPath, support: support)+ var saves = [mac.save, mac.legacy ?? SaveTransfer.legacyMacSave(titleID: game.titleID, support: support)].flatMap { save in+ [save.path, save.path + "_device", save.path + "-backups"]+ }+ if let build { saves.append(build + "/run") }+ saves = Array(Set(saves)).sorted().filter(exists)+ var plan = GameDeletion(titleID: game.titleID, items: items, saves: saves.isEmpty ? nil : Item(kind: .saves, paths: saves), shellRoot: root)+ if measure {+ for i in plan.items.indices { plan.items[i].bytes = plan.items[i].paths.reduce(0) { $0 + BuildFolder.size($1) } }+ plan.saves?.bytes = saves.reduce(0) { $0 + BuildFolder.size($1) }+ }+ return plan+ }++ /// Moves every path of the plan to the Trash, the saves only when `saves`, and takes the game out of the shared app's+ /// list. The library entry is the caller's. Returns the paths that could not be moved. `trash` is the Finder's Trash;+ /// tests delete instead.+ @discardableResult+ func run(saves: Bool, trash: (URL) throws -> Void = { try FileManager.default.trashItem(at: $0, resultingItemURL: nil) }) -> [String] {+ var failed: [String] = []+ let all = items + (saves ? [self.saves].compactMap { $0 } : [])+ for path in all.flatMap(\.paths) where FileManager.default.fileExists(atPath: path) {+ do { try trash(URL(fileURLWithPath: path)) } catch { failed.append(path) }+ }+ // The build folder itself, once nothing is left in it (its run/ stays with the saves).+ if let folder = items.first(where: { $0.kind == .buildFolder })?.paths.first.map({ ($0 as NSString).deletingLastPathComponent }),+ (try? FileManager.default.contentsOfDirectory(atPath: folder))?.isEmpty == true {+ try? FileManager.default.removeItem(atPath: folder)+ }+ if let shellRoot {+ var library = ShellLibrary.load(root: shellRoot)+ library.games.removeAll { $0.titleID == titleID }+ do { try library.save(root: shellRoot) } catch { failed.append(ShellLibrary.stateFile(root: shellRoot)) }+ }+ return failed+ }+}diff --git a/frontend/Sources/NX2Apple/LauncherView.swift b/frontend/Sources/NX2Apple/LauncherView.swiftindex 8c6b54db..fb1db289 100644--- a/frontend/Sources/NX2Apple/LauncherView.swift+++ b/frontend/Sources/NX2Apple/LauncherView.swift@@ -27,6 +27,7 @@ struct LauncherView: View {@State var launching = false@State private var launchError: String?@State private var removing: LibraryGame?+ @State private var deleting: LibraryGame? // the game whose Delete sheet is open (DeleteGameSheet.swift)@State var optionsFor: UUID?@State private var freeSpaceFor: UUID? // the game whose Free space sheet is open@State private var controlsOpen = false@@ -251,6 +252,7 @@ struct LauncherView: View {if let game = library.games.first(where: { $0.id == freeSpaceFor }) { FreeSpaceView(m: m, game: game).environmentObject(padFocus) }}.onChange(of: freeSpaceFor) { id in padFocus.scope = id != nil ? "free" : currentPadScope }+ .deleteGameSheet($deleting, shellRoot: m.shellCachePath, library: library, loc: loc, pad: padFocus, scope: { currentPadScope }).sheet(isPresented: $updates.showUpdateSheet) { UpdateSheet(updates: updates) }.confirmationDialog(loc.t("uninstall.title"), isPresented: Binding(get: { updates.uninstallPlan != nil }, set: { if !$0 { updates.uninstallPlan = nil } }@@ -509,7 +511,7 @@ struct LauncherView: View {}return}- let sheetOpen = controllerSheet || optionsFor != nil || controlsOpen || savesFor != nil || cheatsFor != nil || freeSpaceFor != nil+ let sheetOpen = controllerSheet || optionsFor != nil || controlsOpen || savesFor != nil || cheatsFor != nil || freeSpaceFor != nil || deleting != nilswitch ManagePad.route(action, menuOpen: manageOpenFor != nil, sheetOpen: sheetOpen, hasGame: library.selected != nil && page == .library) {case .close: manageOpenFor = nil; returncase .swallow: return@@ -525,6 +527,7 @@ struct LauncherView: View {if action == .b, cheatsFor != nil { cheatsFor = nil; return }// The Free space sheet: B closes it, the D-pad and A work in it, X, L and R do nothing behind itif freeSpaceFor != nil && [.b, .x, .l, .r].contains(action) { if action == .b { freeSpaceFor = nil }; return }+ if deleting != nil && [.b, .x, .l, .r].contains(action) { if action == .b { deleting = nil }; return }if action == .b {if optionsFor != nil { optionsFor = nil } else if controlsOpen { controlsOpen = false }else if searching { searching = false; search = "" } else if page != .library { page = .library }@@ -565,14 +568,14 @@ struct LauncherView: View {changeArtwork: { chooseArtwork(game) }, resetArtwork: { library.setArtwork("", for: game.id) },reveal: { if let path = game.revealTarget { NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: path)]) } },showLog: { if let log = GameLog.latest(titleID: game.titleID, appPath: game.appPath) { GameLog.show(log) } },- freeSpace: { freeSpaceFor = game.id }, remove: { removing = game }))+ freeSpace: { freeSpaceFor = game.id }, remove: { removing = game }, delete: { deleting = game }))}private func manageItems(for game: LibraryGame?) -> [ManageItem] { game.map(manageItems) ?? [] }/// The scope a controller acts in when no menu is open: the innermost sheet, else the window.private var currentPadScope: String {- controllerSheet ? "console.controllers" : savesFor != nil ? "saves" : cheatsFor != nil ? "cheats" : freeSpaceFor != nil ? "free" : optionsFor != nil ? "launch" : controlsOpen ? "controls" : "main"+ controllerSheet ? "console.controllers" : savesFor != nil ? "saves" : cheatsFor != nil ? "cheats" : freeSpaceFor != nil ? "free" : deleting != nil ? "delete" : optionsFor != nil ? "launch" : controlsOpen ? "controls" : "main"}/// The space the collection row keeps around its cards for the focus ring (PadFocus draws it 4 pt outside a target).diff --git a/frontend/Sources/NX2Apple/ManageMenu.swift b/frontend/Sources/NX2Apple/ManageMenu.swiftindex 31ee262f..c8d6f8ea 100644--- a/frontend/Sources/NX2Apple/ManageMenu.swift+++ b/frontend/Sources/NX2Apple/ManageMenu.swift@@ -15,6 +15,7 @@ struct ManageActions {var showLog: () -> Void = {}var freeSpace: () -> Void = {}var remove: () -> Void = {}+ var delete: () -> Void = {}}/// One row of the Manage menu.@@ -45,8 +46,12 @@ struct ManageItem: Identifiable {hint: hasLog ? nil : t("library.showLog.none"), run: a.showLog))}if hasBuildFolder { items.append(.init(id: "freeSpace", symbol: "externaldrive", title: t("free.menu"), run: a.freeSpace)) }- items.append(.init(id: "remove", symbol: "trash", title: t("library.remove"), enabled: game.id != activeBuildID,+ items.append(.init(id: "remove", symbol: "rectangle.stack.badge.minus", title: t("library.remove"), enabled: game.id != activeBuildID,destructive: true, separatorBefore: true, run: a.remove))+ // Delete moves the game's files to the Trash (GameDeletion). Off while any build runs: it may write into the build folder+ // or the shared app's folder.+ items.append(.init(id: "delete", symbol: "trash", title: t("delete.menu"), enabled: !running, destructive: true,+ hint: running ? t("delete.busy") : nil, run: a.delete))return items}@@ -119,8 +124,8 @@ struct ManageButtonLabel: View {}}-/// The dropdown: the app's dark surface with its border and radius, a symbol and a label per row, Remove in red under a-/// divider. Arrow keys move, Return activates, Esc closes (a local key monitor while it is open: the hero's Play button+/// The dropdown: the app's dark surface with its border and radius, a symbol and a label per row, Remove and Delete in red+/// under a divider. Arrow keys move, Return activates, Esc closes (a local key monitor while it is open: the hero's Play button/// owns Return otherwise); a controller moves by PadFocus in the "manage" scope.struct ManageMenuPanel: View {static let width: CGFloat = 250diff --git a/frontend/Tests/NX2AppleTests/FrenchLocalizationTests.swift b/frontend/Tests/NX2AppleTests/FrenchLocalizationTests.swiftindex d0c3074c..5b1d1ee6 100644--- a/frontend/Tests/NX2AppleTests/FrenchLocalizationTests.swift+++ b/frontend/Tests/NX2AppleTests/FrenchLocalizationTests.swift@@ -12,7 +12,7 @@ final class FrenchLocalizationTests: XCTestCase {"onboarding.background.dotnet", "onboarding.games.version", "onboarding.demo.mario","console.platform.mac", "console.platform.iphone", "console.version","saves.toDevice", "saves.toMac", "section.app", "app.version", "library.ok",- "build.ios", "data.keys", "dep.tool.xcodegen",+ "build.ios", "data.keys", "delete.part.ipa", "dep.tool.xcodegen","dep.tool.zstd", "dep.tool.spirv-cross", "dep.tool.glslangValidator", "diag.title", "dep.brew","dep.spirv.win", "dep.zstd.win", "dep.python.hint", "controls.mode.auto", "controls.fn.A","controls.fn.B", "controls.fn.X", "controls.fn.Y", "controls.fn.L", "controls.fn.R",diff --git a/frontend/Tests/NX2AppleTests/GameDeletionTests.swift b/frontend/Tests/NX2AppleTests/GameDeletionTests.swiftnew file mode 100644index 00000000..a42b7b5a--- /dev/null+++ b/frontend/Tests/NX2AppleTests/GameDeletionTests.swift@@ -0,0 +1,156 @@+import AppKit+import SwiftUI+import XCTest+@testable import NX2Apple+@testable import NXCore+@testable import NXLauncher+@testable import NXModel++/// #559: Delete game on the Mac. What goes (the Mac app, the IPA, the game data for the shared app, the game's place in the+/// shared app, the build folder, the log) and what stays (the files it was built from, other games, and the saves unless the+/// player chose them too).+final class GameDeletionTests: XCTestCase {+ private var root: URL!+ private let titleID = "0100535012974000", other = "0100000000010000"+ private var path: String { root.path }++ override func setUpWithError() throws {+ root = FileManager.default.temporaryDirectory.appendingPathComponent("nxnative-delete-" + UUID().uuidString)+ try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)+ }++ override func tearDownWithError() throws { try FileManager.default.removeItem(at: root) }++ private func file(_ relative: String) throws {+ let url = root.appendingPathComponent(relative)+ try FileManager.default.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)+ try Data("x".utf8).write(to: url)+ }+ private func exists(_ relative: String) -> Bool { FileManager.default.fileExists(atPath: root.appendingPathComponent(relative).path) }++ /// A game built into a library folder (`out`, with the marker) for the Mac and for the shared app, with saves in both places+ /// the Mac app reads them from, a save backup, a Mac development build's save, logs and its place in the shared app.+ private func makeGame() throws -> LibraryGame {+ for f in ["src/Hades [\(titleID)].nsp", "out/.nx2apple-library", "out/Hades.app/Contents/Info.plist", "out/\(titleID).ipa",+ "out/games/\(titleID)/romfs.img", "out/\(titleID)_build/extract/main", "out/\(titleID)_build/shader/lib",+ "out/\(titleID)_build/run/save/0", "out/save/\(titleID)/0/file", "out/save/\(titleID)_device/0/file",+ "out/save/\(titleID)-backups/2026-11-01 mac/file", "out/log/\(titleID).log", "home/Library/Logs/nxnative/\(titleID).prev.log",+ "support/nxnative/\(titleID)/save/0/file", "support/nxnative/\(titleID)/cheats/x.txt",+ "shell/frameworks/DmGame\(titleID).framework/DmGame", "shell/frameworks/DmGame\(other).framework/DmGame",+ "shell/derived-data/Build/Products/Release-iphoneos/DmShell.app/Info.plist"] {+ try file(f)+ }+ var library = ShellLibrary(games: [.init(titleID: titleID, name: "Hades", framework: path + "/shell/frameworks/DmGame\(titleID).framework"),+ .init(titleID: other, name: "Other", framework: path + "/shell/frameworks/DmGame\(other).framework")])+ library.bundleID = "org.nxnative.shell"+ try library.save(root: path + "/shell")+ var game = LibraryGame(titleID: titleID, name: "Hades", appPath: path + "/out/Hades.app", ipaPath: path + "/out/\(titleID).ipa",+ archivePath: path + "/out/games/\(titleID)")+ game.iosAppPath = path + "/shell/derived-data/Build/Products/Release-iphoneos/DmShell.app"+ game.outputDirectory = path + "/out"+ game.inputs = ["base": [path + "/src/Hades [\(titleID)].nsp"]]+ return game+ }++ private func plan(_ game: LibraryGame) -> GameDeletion {+ GameDeletion.plan(for: game, shellRoot: path + "/shell", home: path + "/home", support: root.appendingPathComponent("support"))+ }++ func testThePlanListsWhatGoesAndKeepsTheSavesApart() throws {+ let plan = plan(try makeGame())+ XCTAssertEqual(plan.items.map(\.kind), [.macApp, .ipa, .archive, .shellFramework, .buildFolder, .log],+ "the shared app holds other games and is not listed")+ XCTAssertEqual(plan.items.first { $0.kind == .buildFolder }?.paths.map { ($0 as NSString).lastPathComponent }, ["extract", "shader"],+ "run/ is the Mac development build's save")+ XCTAssertEqual(plan.items.first { $0.kind == .log }?.paths.count, 2)+ XCTAssertEqual(plan.saves?.paths.map { $0.replacingOccurrences(of: path + "/", with: "") }.sorted(),+ ["out/\(titleID)_build/run", "out/save/\(titleID)", "out/save/\(titleID)-backups", "out/save/\(titleID)_device",+ "support/nxnative/\(titleID)/save"])+ XCTAssertGreaterThan(plan.items.first { $0.kind == .macApp }?.bytes ?? 0, 0)+ XCTAssertEqual(plan.shellRoot, path + "/shell")+ }++ func testDeletingKeepsTheSavesTheSourcesAndTheOtherGames() throws {+ let game = try makeGame()+ let failed = plan(game).run(saves: false, trash: { try FileManager.default.removeItem(at: $0) })+ XCTAssertEqual(failed, [])+ for gone in ["out/Hades.app", "out/\(titleID).ipa", "out/games/\(titleID)", "out/\(titleID)_build/extract", "out/\(titleID)_build/shader",+ "out/log/\(titleID).log", "home/Library/Logs/nxnative/\(titleID).prev.log", "shell/frameworks/DmGame\(titleID).framework"] {+ XCTAssertFalse(exists(gone), gone)+ }+ for kept in ["src/Hades [\(titleID)].nsp", "out/\(titleID)_build/run/save/0", "out/save/\(titleID)/0/file", "out/save/\(titleID)_device/0/file",+ "out/save/\(titleID)-backups/2026-11-01 mac/file", "support/nxnative/\(titleID)/save/0/file", "support/nxnative/\(titleID)/cheats/x.txt",+ "shell/frameworks/DmGame\(other).framework/DmGame", "shell/derived-data/Build/Products/Release-iphoneos/DmShell.app/Info.plist"] {+ XCTAssertTrue(exists(kept), kept)+ }+ XCTAssertEqual(ShellLibrary.load(root: path + "/shell").games.map(\.titleID), [other], "the next shared app leaves the game out")+ XCTAssertEqual(ShellLibrary.load(root: path + "/shell").bundleID, "org.nxnative.shell")+ }++ func testDeletingWithSavesRemovesThemAndTheBuildFolder() throws {+ let game = try makeGame()+ XCTAssertEqual(plan(game).run(saves: true, trash: { try FileManager.default.removeItem(at: $0) }), [])+ for gone in ["out/save/\(titleID)", "out/save/\(titleID)_device", "out/save/\(titleID)-backups", "support/nxnative/\(titleID)/save",+ "out/\(titleID)_build"] {+ XCTAssertFalse(exists(gone), gone)+ }+ XCTAssertTrue(exists("src/Hades [\(titleID)].nsp"))+ XCTAssertTrue(exists("support/nxnative/\(titleID)/cheats/x.txt"), "only the saves of the support folder go")+ }++ func testWhatCannotBeMovedIsReported() throws {+ let game = try makeGame()+ let failed = plan(game).run(saves: false, trash: { url in if url.pathExtension == "ipa" { throw CocoaError(.fileWriteNoPermission) } })+ XCTAssertEqual(failed, [path + "/out/\(titleID).ipa"])+ }++ func testAGameWithNothingOnThisMacHasAnEmptyPlan() {+ let plan = plan(LibraryGame(titleID: titleID, name: "Hades"))+ XCTAssertEqual(plan.items, [])+ XCTAssertNil(plan.saves)+ XCTAssertNil(plan.shellRoot)+ }++ func testTheTextsHaveNoSemicolons() {+ let keys = ["delete.menu", "delete.busy", "delete.question", "delete.note", "delete.nothing", "delete.sources", "delete.saves",+ "delete.savesOff", "delete.savesOn", "delete.noSaves", "delete.confirm", "delete.confirmSaves", "delete.failed",+ "delete.part.shellFrameworkNote"]+ for lang in Lang.all { for key in keys { XCTAssertFalse(L10n.string(key, lang).contains(";") || L10n.string(key, lang).contains("\u{FF1B}"), key) } }+ }++ /// The Delete sheet for visual QA (`NX_LAUNCHER_CAPTURE_DIR`, `NX_CAPTURE_LANG`): a game with everything on this Mac and its+ /// saves kept, the same with the saves chosen too, and a game with nothing on this Mac. Example sizes, no files.+ @MainActor func testRenderDeleteSheetForVisualQA() 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)+ NSApplication.shared.setActivationPolicy(.accessory)+ let localizer = LauncherStores().localizer+ localizer.lang = CaptureLanguage.current(.en)+ let game = LibraryGame(titleID: titleID, name: "Hades")+ let out = "/Volumes/Games/Hades"+ let full = GameDeletion(titleID: titleID, items: [+ .init(kind: .macApp, paths: [out + "/Hades.app"], bytes: 14_600_000_000),+ .init(kind: .ipa, paths: [out + "/\(titleID).ipa"], bytes: 380_000_000),+ .init(kind: .archive, paths: [out + "/games/\(titleID)"], bytes: 11_200_000_000),+ .init(kind: .shellFramework, paths: [], bytes: 0),+ .init(kind: .buildFolder, paths: [out + "/\(titleID)_build/extract"], bytes: 18_900_000_000),+ .init(kind: .log, paths: [out + "/log/\(titleID).log"], bytes: 2_400_000)],+ saves: .init(kind: .saves, paths: [out + "/save/\(titleID)"], bytes: 1_200_000), shellRoot: "/Volumes/Games/NX2Apple-shell")+ let empty = GameDeletion(titleID: titleID, items: [], saves: nil, shellRoot: nil)+ for (name, plan, saves) in [("delete-sheet", full, false), ("delete-sheet-saves", full, true), ("delete-sheet-nothing", empty, false)] {+ let host = NSHostingView(rootView: DeleteGameSheet(game: game, shellRoot: "", plan: plan, saves: saves)+ .environmentObject(PadFocus()).environmentObject(localizer))+ host.frame = NSRect(origin: .zero, size: host.fittingSize)+ let window = OffscreenWindow(size: host.frame.size)+ window.contentView = host+ window.orderFront(nil)+ RunLoop.main.run(until: Date().addingTimeInterval(0.4))+ 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)-\(localizer.lang.code).png"))+ window.orderOut(nil)+ }+ }+}diff --git a/frontend/Tests/NX2AppleTests/GermanLocalizationTests.swift b/frontend/Tests/NX2AppleTests/GermanLocalizationTests.swiftindex 0d16c0c6..0e5460dd 100644--- a/frontend/Tests/NX2AppleTests/GermanLocalizationTests.swift+++ b/frontend/Tests/NX2AppleTests/GermanLocalizationTests.swift@@ -12,7 +12,7 @@ final class GermanLocalizationTests: XCTestCase {"onboarding.background.python", "onboarding.background.dotnet", "onboarding.games.version","onboarding.demo.mario", "msg.ipaAt", "console.kind.gamepad", "console.platform.mac","console.platform.iphone", "console.version", "console.fps30", "console.fps60", "saves.toDevice",- "saves.toMac", "cheats.title", "section.app", "app.version", "nav.builds", "library.ok", "build.ios", "data.update", "data.keys",+ "saves.toMac", "cheats.title", "section.app", "app.version", "nav.builds", "library.ok", "build.ios", "data.update", "data.keys", "delete.part.ipa","dep.iossdk", "dep.tool.xcodegen", "dep.tool.zstd", "dep.tool.spirv-cross", "dep.tool.glslangValidator","dep.glslang", "dep.xcode", "dep.metal", "dep.brew", "dep.xcodegen", "dep.zstd", "dep.spirv.win","dep.zstd.win", "dep.spirv", "dep.dotnet", "dep.phase.download", "dep.python.hint",diff --git a/frontend/Tests/NX2AppleTests/ManageMenuTests.swift b/frontend/Tests/NX2AppleTests/ManageMenuTests.swiftindex c8217382..7c5cc4dc 100644--- a/frontend/Tests/NX2AppleTests/ManageMenuTests.swift+++ b/frontend/Tests/NX2AppleTests/ManageMenuTests.swift@@ -37,24 +37,24 @@ final class ManageMenuTests: XCTestCase {hasBuildFolder: folder, hasLog: log, actions: actions)}- func testAReadyGameHasEveryRowInTheOldOrderAndRemoveLastInRed() throws {+ func testAReadyGameHasEveryRowInTheOldOrderAndRemoveAndDeleteLastInRed() throws {var game = try readyGame()game.artworkPath = "/art.png"let list = items(game, folder: true, log: true)- XCTAssertEqual(list.map(\.id), ["rebuild", "options", "saves", "cheats", "artwork", "resetArtwork", "reveal", "log", "freeSpace", "remove"])- XCTAssertEqual(list.map(\.title), ["library.buildAgain", "launch.title", "saves.menu", "cheats.menu", "library.changeArtwork", "library.resetArtwork", "install.reveal", "library.showLog", "free.menu", "library.remove"]+ XCTAssertEqual(list.map(\.id), ["rebuild", "options", "saves", "cheats", "artwork", "resetArtwork", "reveal", "log", "freeSpace", "remove", "delete"])+ XCTAssertEqual(list.map(\.title), ["library.buildAgain", "launch.title", "saves.menu", "cheats.menu", "library.changeArtwork", "library.resetArtwork", "install.reveal", "library.showLog", "free.menu", "library.remove", "delete.menu"].map { L10n.string($0, .en) })XCTAssertTrue(list.allSatisfy(\.enabled))XCTAssertEqual(list.last?.destructive, true)- XCTAssertEqual(list.last?.separatorBefore, true)- XCTAssertEqual(list.filter(\.destructive).count, 1)+ XCTAssertEqual(list.first { $0.id == "remove" }?.separatorBefore, true, "Remove and Delete sit under one divider")+ XCTAssertEqual(list.filter(\.destructive).map(\.id), ["remove", "delete"])XCTAssertEqual(list.filter(\.separatorBefore).count, 1)}func testANotBuiltGameLeavesOutTheRowsThatNeedABuild() {var game = LibraryGame(titleID: titleID, name: "Hades")var list = items(game)- XCTAssertEqual(list.map(\.id), ["rebuild", "saves", "cheats", "artwork", "remove"], "no launch options, Finder or Free space without a build")+ XCTAssertEqual(list.map(\.id), ["rebuild", "saves", "cheats", "artwork", "remove", "delete"], "no launch options, Finder or Free space without a build")XCTAssertFalse(list[0].enabled, "no recorded inputs: nothing to build again")game.inputs = ["base": ["/preview/Hades.nsp"]]list = items(game)@@ -67,6 +67,8 @@ final class ManageMenuTests: XCTestCase {XCTAssertFalse(list.first { $0.id == "rebuild" }!.enabled)XCTAssertFalse(list.first { $0.id == "remove" }!.enabled)XCTAssertTrue(list.first { $0.id == "saves" }!.enabled)+ XCTAssertFalse(list.first { $0.id == "delete" }!.enabled, "a build may write into the build folder or the shared app's folder")+ XCTAssertEqual(list.first { $0.id == "delete" }!.hint, L10n.string("delete.busy", .en))list = items(game, running: true, active: UUID())XCTAssertFalse(list.first { $0.id == "rebuild" }!.enabled, "any running build blocks a new one")XCTAssertTrue(list.first { $0.id == "remove" }!.enabled, "another game's build does not block removing this one")@@ -97,9 +99,9 @@ final class ManageMenuTests: XCTestCase {var log: [String] = []let actions = ManageActions(rebuild: { log.append("rebuild") }, options: { log.append("options") }, saves: { log.append("saves") },cheats: { log.append("cheats") }, changeArtwork: { log.append("artwork") }, resetArtwork: { log.append("reset") }, reveal: { log.append("reveal") }, showLog: { log.append("log") },- freeSpace: { log.append("free") }, remove: { log.append("remove") })+ freeSpace: { log.append("free") }, remove: { log.append("remove") }, delete: { log.append("delete") })for item in items(game, folder: true, log: true, actions: actions) { item.run() }- XCTAssertEqual(log, ["rebuild", "options", "saves", "cheats", "artwork", "reveal", "log", "free", "remove"])+ XCTAssertEqual(log, ["rebuild", "options", "saves", "cheats", "artwork", "reveal", "log", "free", "remove", "delete"])}func testTheControllerLandsOnTheFirstUsableRow() throws {diff --git a/frontend/l10n/de.json b/frontend/l10n/de.jsonindex 557c3f3f..85f0fde9 100644--- a/frontend/l10n/de.json+++ b/frontend/l10n/de.json@@ -265,6 +265,27 @@"data.update": "Update","data.updateNewest": "v%d, das neueste von %d Updates. Ein Update enthält alle früheren.","data.updatePanelMessage": "Wähle das neueste Update. Ein Update enthält die früheren.",+ "delete.busy": "Nicht während eines Builds",+ "delete.confirm": "Spiel löschen",+ "delete.confirmSaves": "Spiel und Spielstände löschen",+ "delete.failed": "Das konnte nicht in den Papierkorb gelegt werden:\n%@",+ "delete.menu": "Spiel löschen …",+ "delete.noSaves": "Dieses Spiel hat keine Spielstände auf diesem Mac.",+ "delete.note": "Das kommt in den Papierkorb. Von dort kannst du es zurücklegen.",+ "delete.nothing": "Von diesem Spiel liegt nichts auf diesem Mac. Nur sein Eintrag in der Sammlung geht.",+ "delete.part.archive": "Spieldaten für iPhone und iPad",+ "delete.part.buildFolder": "Build-Ordner",+ "delete.part.iosApp": "App für iPhone und iPad",+ "delete.part.ipa": "IPA",+ "delete.part.log": "Spielprotokoll",+ "delete.part.macApp": "Mac-App",+ "delete.part.shellFramework": "In der gemeinsamen App für iPhone und iPad",+ "delete.part.shellFrameworkNote": "Verlässt die gemeinsame App bei ihrer nächsten Installation. Bis dahin bleibt es auf dem Gerät.",+ "delete.question": "„%@“ löschen?",+ "delete.saves": "Auch Spielstände löschen",+ "delete.savesOff": "Spielstände bleiben, außer du löschst sie ausdrücklich mit.",+ "delete.savesOn": "Die Spielstände kommen auch in den Papierkorb.",+ "delete.sources": "Die Dateien, aus denen du es gebaut hast (NSP, XCI), bleiben, wo sie sind.","dep.allReady": "Alles bereit","dep.brew": "Homebrew","dep.brew.hint": "brew.sh (wird von den Paketen unten gebraucht)",@@ -544,7 +565,18 @@"free.selected": "%@ ausgewählt","free.title": "Speicherplatz freigeben","install.reveal": "Im Finder zeigen",+ "ios.host.deleteFailed": "Einige Dateien von %@ konnten nicht gelöscht werden.","ios.setting.DM_PSO_MTL4.note": "Behält ein Pipeline-Archiv und braucht mehr Speicher.",+ "ios.ui.cancel": "Abbrechen",+ "ios.ui.deleteGame": "Spiel löschen",+ "ios.ui.deleteGameAndSaves": "Spiel und Spielstände löschen",+ "ios.ui.deleteGameEllipsis": "Spiel löschen …",+ "ios.ui.deleteGameHint": "Löscht die Spieldaten auf diesem Gerät. Du entscheidest, ob die Spielstände mitgehen.",+ "ios.ui.deleteNote": "Die Spieldaten auf diesem Gerät werden gelöscht und das Spiel verschwindet aus der Liste. Ein Ordner, den du selbst gewählt hast, bleibt unberührt. Sende die Spieldaten erneut von deinem Mac, um es zurückzuholen.",+ "ios.ui.deleteQuestion": "„%@“ löschen?",+ "ios.ui.deleteSaves": "Auch Spielstände löschen",+ "ios.ui.deleteSavesOff": "Spielstände bleiben, außer du löschst sie ausdrücklich mit.",+ "ios.ui.deleteSavesOn": "Die Spielstände werden auch gelöscht und lassen sich nicht wiederherstellen.","key.clear": "Löschen","key.code": "Taste %ld","key.delete": "Rückschritt",diff --git a/frontend/l10n/en.json b/frontend/l10n/en.jsonindex 1b55f69a..c90f93be 100644--- a/frontend/l10n/en.json+++ b/frontend/l10n/en.json@@ -263,6 +263,27 @@"data.update": "Update","data.updateNewest": "v%d, the newest of %d. An update contains the earlier ones.","data.updatePanelMessage": "Select the newest update. An update contains the earlier ones.",+ "delete.busy": "Not while a build runs",+ "delete.confirm": "Delete game",+ "delete.confirmSaves": "Delete game and saves",+ "delete.failed": "These could not be moved to the Trash:\n%@",+ "delete.menu": "Delete game…",+ "delete.noSaves": "This game has no saves on this Mac.",+ "delete.note": "These go to the Trash, so you can put them back from there.",+ "delete.nothing": "Nothing of this game is on this Mac. Only its entry in the collection goes.",+ "delete.part.archive": "Game data for iPhone and iPad",+ "delete.part.buildFolder": "Build folder",+ "delete.part.iosApp": "iPhone and iPad app",+ "delete.part.ipa": "IPA",+ "delete.part.log": "Game log",+ "delete.part.macApp": "Mac app",+ "delete.part.shellFramework": "In the shared app for iPhone and iPad",+ "delete.part.shellFrameworkNote": "Leaves the shared app at its next install. Until then it stays on the device.",+ "delete.question": "Delete “%@”?",+ "delete.saves": "Also delete saves",+ "delete.savesOff": "Saves stay unless you choose to delete them too.",+ "delete.savesOn": "Saves go to the Trash too.",+ "delete.sources": "The files you built it from (NSP, XCI) stay where they are.","dep.allReady": "All ready","dep.brew": "Homebrew","dep.brew.hint": "brew.sh (needed by the packages below)",@@ -556,6 +577,7 @@"ios.host.chooseRomfs": "Choose a RomFS folder or romfs.img on this device, an external drive, or iCloud Drive.","ios.host.codeMissing": "Game code missing","ios.host.codeMissingNote": "The game's code is missing from this app. Rebuild and reinstall it.",+ "ios.host.deleteFailed": "Some files of %@ could not be deleted.","ios.host.differentVersionNote": "This game was built for a different version of this app. Update the app or rebuild the game in the launcher on your Mac.","ios.host.done": "Done","ios.host.filesDamaged": "Game files damaged",@@ -604,6 +626,7 @@"ios.setting.DM_PSO_MTL4.note": "Keeps a pipeline archive; uses more memory.","ios.ui.appUpdateNeeded": "App update needed","ios.ui.back": "Back",+ "ios.ui.cancel": "Cancel","ios.ui.charging": "Charging","ios.ui.choose": "Choose","ios.ui.chooseEllipsis": "Choose…",@@ -617,6 +640,15 @@"ios.ui.connectController": "Connect a controller in Bluetooth settings. Touch controls are always available in the library.","ios.ui.controllers": "Controllers","ios.ui.decrease": "Decrease",+ "ios.ui.deleteGame": "Delete game",+ "ios.ui.deleteGameAndSaves": "Delete game and saves",+ "ios.ui.deleteGameEllipsis": "Delete game…",+ "ios.ui.deleteGameHint": "Deletes the game’s data on this device. You choose whether its saves go too.",+ "ios.ui.deleteNote": "The game’s data on this device is deleted and the game leaves the list. A folder you chose yourself is not touched. Send the game data from your Mac again to bring it back.",+ "ios.ui.deleteQuestion": "Delete “%@”?",+ "ios.ui.deleteSaves": "Also delete saves",+ "ios.ui.deleteSavesOff": "Saves stay unless you choose to delete them too.",+ "ios.ui.deleteSavesOn": "Saves are deleted too and cannot be brought back.","ios.ui.details": "Details","ios.ui.done": "Done","ios.ui.doubleTapToSelect": "Double-tap to select",diff --git a/frontend/l10n/fr.json b/frontend/l10n/fr.jsonindex ede484df..111d6e82 100644--- a/frontend/l10n/fr.json+++ b/frontend/l10n/fr.json@@ -264,6 +264,27 @@"data.update": "Mise à jour","data.updateNewest": "v%d, la plus récente sur %d. Une mise à jour contient les précédentes.","data.updatePanelMessage": "Sélectionnez la mise à jour la plus récente. Une mise à jour contient les précédentes.",+ "delete.busy": "Pas pendant une compilation",+ "delete.confirm": "Supprimer le jeu",+ "delete.confirmSaves": "Supprimer le jeu et les sauvegardes",+ "delete.failed": "Ces éléments n’ont pas pu être placés dans la Corbeille :\n%@",+ "delete.menu": "Supprimer le jeu…",+ "delete.noSaves": "Ce jeu n’a pas de sauvegarde sur ce Mac.",+ "delete.note": "Ces éléments vont dans la Corbeille, d’où vous pouvez les remettre.",+ "delete.nothing": "Rien de ce jeu n’est sur ce Mac. Seule son entrée dans la collection est retirée.",+ "delete.part.archive": "Données de jeu pour iPhone et iPad",+ "delete.part.buildFolder": "Dossier de compilation",+ "delete.part.iosApp": "App iPhone et iPad",+ "delete.part.ipa": "IPA",+ "delete.part.log": "Journal du jeu",+ "delete.part.macApp": "App Mac",+ "delete.part.shellFramework": "Dans l’app partagée pour iPhone et iPad",+ "delete.part.shellFrameworkNote": "Quitte l’app partagée à sa prochaine installation. D’ici là, il reste sur l’appareil.",+ "delete.question": "Supprimer « %@ » ?",+ "delete.saves": "Supprimer aussi les sauvegardes",+ "delete.savesOff": "Les sauvegardes restent, sauf si vous choisissez de les supprimer aussi.",+ "delete.savesOn": "Les sauvegardes vont aussi dans la Corbeille.",+ "delete.sources": "Les fichiers à partir desquels vous l’avez compilé (NSP, XCI) restent où ils sont.","dep.allReady": "Tout est prêt","dep.brew": "Homebrew","dep.brew.hint": "brew.sh (requis par les paquets ci-dessous)",@@ -543,7 +564,18 @@"free.selected": "%@ sélectionnés","free.title": "Libérer de l’espace","install.reveal": "Afficher dans le Finder",+ "ios.host.deleteFailed": "Certains fichiers de %@ n’ont pas pu être supprimés.","ios.setting.DM_PSO_MTL4.note": "Conserve une archive de pipelines et utilise plus de mémoire.",+ "ios.ui.cancel": "Annuler",+ "ios.ui.deleteGame": "Supprimer le jeu",+ "ios.ui.deleteGameAndSaves": "Supprimer le jeu et les sauvegardes",+ "ios.ui.deleteGameEllipsis": "Supprimer le jeu…",+ "ios.ui.deleteGameHint": "Supprime les données du jeu sur cet appareil. Vous choisissez si ses sauvegardes partent aussi.",+ "ios.ui.deleteNote": "Les données du jeu sur cet appareil sont supprimées et le jeu quitte la liste. Un dossier que vous avez choisi vous-même n’est pas touché. Envoyez à nouveau les données du jeu depuis votre Mac pour le retrouver.",+ "ios.ui.deleteQuestion": "Supprimer « %@ » ?",+ "ios.ui.deleteSaves": "Supprimer aussi les sauvegardes",+ "ios.ui.deleteSavesOff": "Les sauvegardes restent, sauf si vous choisissez de les supprimer aussi.",+ "ios.ui.deleteSavesOn": "Les sauvegardes sont aussi supprimées et ne peuvent pas être récupérées.","key.clear": "Effacer","key.code": "Touche %ld","key.delete": "Supprimer",diff --git a/frontend/l10n/it.json b/frontend/l10n/it.jsonindex d78d33fc..58b510be 100644--- a/frontend/l10n/it.json+++ b/frontend/l10n/it.json@@ -264,6 +264,27 @@"data.update": "Aggiornamento","data.updateNewest": "v%d, la più recente di %d. Un aggiornamento contiene i precedenti.","data.updatePanelMessage": "Seleziona l’aggiornamento più recente. Un aggiornamento contiene i precedenti.",+ "delete.busy": "Non durante una build",+ "delete.confirm": "Elimina gioco",+ "delete.confirmSaves": "Elimina gioco e salvataggi",+ "delete.failed": "Questi elementi non sono stati spostati nel Cestino:\n%@",+ "delete.menu": "Elimina gioco…",+ "delete.noSaves": "Questo gioco non ha salvataggi su questo Mac.",+ "delete.note": "Questi elementi vanno nel Cestino, da cui puoi ripristinarli.",+ "delete.nothing": "Di questo gioco non c’è nulla su questo Mac. Viene rimossa solo la sua voce nella collezione.",+ "delete.part.archive": "Dati di gioco per iPhone e iPad",+ "delete.part.buildFolder": "Cartella di build",+ "delete.part.iosApp": "App per iPhone e iPad",+ "delete.part.ipa": "IPA",+ "delete.part.log": "Log del gioco",+ "delete.part.macApp": "App per Mac",+ "delete.part.shellFramework": "Nell’app condivisa per iPhone e iPad",+ "delete.part.shellFrameworkNote": "Esce dall’app condivisa alla sua prossima installazione. Fino ad allora resta sul dispositivo.",+ "delete.question": "Eliminare “%@”?",+ "delete.saves": "Elimina anche i salvataggi",+ "delete.savesOff": "I salvataggi restano, a meno che tu non scelga di eliminarli.",+ "delete.savesOn": "Anche i salvataggi vanno nel Cestino.",+ "delete.sources": "I file da cui l’hai creato (NSP, XCI) restano dove sono.","dep.allReady": "Tutto pronto","dep.brew": "Homebrew","dep.brew.hint": "brew.sh (necessario per i pacchetti qui sotto)",@@ -543,7 +564,18 @@"free.selected": "%@ selezionati","free.title": "Libera spazio","install.reveal": "Mostra nel Finder",+ "ios.host.deleteFailed": "Alcuni file di %@ non sono stati eliminati.","ios.setting.DM_PSO_MTL4.note": "Conserva un archivio delle pipeline e usa più memoria.",+ "ios.ui.cancel": "Annulla",+ "ios.ui.deleteGame": "Elimina gioco",+ "ios.ui.deleteGameAndSaves": "Elimina gioco e salvataggi",+ "ios.ui.deleteGameEllipsis": "Elimina gioco…",+ "ios.ui.deleteGameHint": "Elimina i dati del gioco su questo dispositivo. Scegli tu se eliminare anche i salvataggi.",+ "ios.ui.deleteNote": "I dati del gioco su questo dispositivo vengono eliminati e il gioco esce dall’elenco. Una cartella scelta da te non viene toccata. Invia di nuovo i dati del gioco dal Mac per riaverlo.",+ "ios.ui.deleteQuestion": "Eliminare “%@”?",+ "ios.ui.deleteSaves": "Elimina anche i salvataggi",+ "ios.ui.deleteSavesOff": "I salvataggi restano, a meno che tu non scelga di eliminarli.",+ "ios.ui.deleteSavesOn": "Anche i salvataggi vengono eliminati e non si possono recuperare.","key.clear": "Cancella","key.code": "Tasto %ld","key.delete": "Elimina",diff --git a/frontend/l10n/sv.json b/frontend/l10n/sv.jsonindex b8e8795d..04ecc273 100644--- a/frontend/l10n/sv.json+++ b/frontend/l10n/sv.json@@ -169,6 +169,27 @@"data.update": "Uppdatering","data.updateNewest": "v%d, den senaste av %d. En uppdatering innehåller de tidigare.","data.updatePanelMessage": "Välj den senaste uppdateringen. En uppdatering innehåller de tidigare.",+ "delete.busy": "Inte medan ett bygge pågår",+ "delete.confirm": "Radera spelet",+ "delete.confirmSaves": "Radera spelet och sparfilerna",+ "delete.failed": "Det här kunde inte flyttas till papperskorgen:\n%@",+ "delete.menu": "Radera spelet …",+ "delete.noSaves": "Det här spelet har inga sparfiler på den här Macen.",+ "delete.note": "Det här flyttas till papperskorgen, så du kan lägga tillbaka det därifrån.",+ "delete.nothing": "Inget av det här spelet finns på den här Macen. Bara posten i samlingen tas bort.",+ "delete.part.archive": "Speldata för iPhone och iPad",+ "delete.part.buildFolder": "Byggmapp",+ "delete.part.iosApp": "App för iPhone och iPad",+ "delete.part.ipa": "IPA",+ "delete.part.log": "Spellogg",+ "delete.part.macApp": "Mac-app",+ "delete.part.shellFramework": "I den delade appen för iPhone och iPad",+ "delete.part.shellFrameworkNote": "Lämnar den delade appen vid nästa installation. Fram till dess finns det kvar på enheten.",+ "delete.question": "Radera ”%@”?",+ "delete.saves": "Radera även sparfiler",+ "delete.savesOff": "Sparfilerna ligger kvar om du inte väljer att radera dem också.",+ "delete.savesOn": "Sparfilerna flyttas också till papperskorgen.",+ "delete.sources": "Filerna du byggde det från (NSP, XCI) ligger kvar där de är.","dep.allReady": "Allt är klart","dep.brew": "Homebrew","dep.brew.hint": "brew.sh (krävs av paketen nedan)",@@ -385,7 +406,18 @@"free.selected": "%@ valt","free.title": "Frigör utrymme","install.reveal": "Visa i Finder",+ "ios.host.deleteFailed": "Några filer för %@ kunde inte raderas.","ios.setting.DM_PSO_MTL4.note": "Behåller ett pipelinearkiv och använder mer minne.",+ "ios.ui.cancel": "Avbryt",+ "ios.ui.deleteGame": "Radera spelet",+ "ios.ui.deleteGameAndSaves": "Radera spelet och sparfilerna",+ "ios.ui.deleteGameEllipsis": "Radera spelet …",+ "ios.ui.deleteGameHint": "Raderar speldatan på den här enheten. Du väljer om sparfilerna också ska bort.",+ "ios.ui.deleteNote": "Speldatan på den här enheten raderas och spelet försvinner från listan. En mapp du själv har valt rörs inte. Skicka speldatan från din Mac igen för att få tillbaka det.",+ "ios.ui.deleteQuestion": "Radera ”%@”?",+ "ios.ui.deleteSaves": "Radera även sparfiler",+ "ios.ui.deleteSavesOff": "Sparfilerna ligger kvar om du inte väljer att radera dem också.",+ "ios.ui.deleteSavesOn": "Sparfilerna raderas också och kan inte återställas.","key.clear": "Rensa","key.code": "Tangent %ld","key.delete": "Radera",diff --git a/frontend/l10n/zh.json b/frontend/l10n/zh.jsonindex 42b30e10..cf2ba75b 100644--- a/frontend/l10n/zh.json+++ b/frontend/l10n/zh.json@@ -264,6 +264,27 @@"data.update": "更新包","data.updateNewest": "v%d,共 %d 个更新中最新的一个。更新包含之前所有更新的内容。","data.updatePanelMessage": "选择最新的更新。更新包含之前所有更新的内容。",+ "delete.busy": "构建进行中时不可用",+ "delete.confirm": "删除游戏",+ "delete.confirmSaves": "删除游戏和存档",+ "delete.failed": "以下内容无法移到废纸篓:\n%@",+ "delete.menu": "删除游戏…",+ "delete.noSaves": "这个游戏在这台 Mac 上没有存档。",+ "delete.note": "这些文件会移到废纸篓,你可以从那里放回。",+ "delete.nothing": "这台 Mac 上没有这个游戏的文件,只会从游戏库移除它的条目。",+ "delete.part.archive": "iPhone 和 iPad 的游戏数据",+ "delete.part.buildFolder": "构建文件夹",+ "delete.part.iosApp": "iPhone 和 iPad 应用",+ "delete.part.ipa": "IPA",+ "delete.part.log": "游戏日志",+ "delete.part.macApp": "Mac 应用",+ "delete.part.shellFramework": "iPhone 和 iPad 共享应用中的游戏",+ "delete.part.shellFrameworkNote": "下次安装共享应用时移除。在那之前它仍在设备上。",+ "delete.question": "删除“%@”?",+ "delete.saves": "同时删除存档",+ "delete.savesOff": "除非你选择一并删除,否则存档会保留。",+ "delete.savesOn": "存档也会移到废纸篓。",+ "delete.sources": "构建所用的游戏文件(NSP、XCI)保留在原处。","dep.allReady": "全部就绪","dep.brew": "Homebrew","dep.brew.hint": "brew.sh(后续包的前置)",@@ -557,6 +578,7 @@"ios.host.chooseRomfs": "在此设备、外置硬盘或 Mac 上选择 RomFS 文件夹或 romfs.img。iOS 启动器会记住该位置。","ios.host.codeMissing": "游戏代码缺失","ios.host.codeMissingNote": "此 App 中缺少游戏代码。请重新构建并安装。",+ "ios.host.deleteFailed": "%@ 的部分文件无法删除。","ios.host.differentVersionNote": "此游戏是为本 App 的其它版本构建的。请更新 App 或在 Mac 启动器中重新构建。","ios.host.done": "完成","ios.host.filesDamaged": "游戏文件已损坏",@@ -605,6 +627,7 @@"ios.setting.DM_PSO_MTL4.note": "保留管线存档,占用更多内存。","ios.ui.appUpdateNeeded": "需要更新 App","ios.ui.back": "返回",+ "ios.ui.cancel": "取消","ios.ui.charging": "充电中","ios.ui.choose": "选择","ios.ui.chooseEllipsis": "选择…",@@ -618,6 +641,15 @@"ios.ui.connectController": "在蓝牙设置中连接手柄。触屏控制始终可用。","ios.ui.controllers": "手柄","ios.ui.decrease": "减小",+ "ios.ui.deleteGame": "删除游戏",+ "ios.ui.deleteGameAndSaves": "删除游戏和存档",+ "ios.ui.deleteGameEllipsis": "删除游戏…",+ "ios.ui.deleteGameHint": "删除这台设备上的游戏数据。是否一并删除存档由你决定。",+ "ios.ui.deleteNote": "这台设备上的游戏数据会被删除,游戏也会从列表中移除。你自己选择的文件夹不受影响。从 Mac 再次发送游戏数据即可恢复。",+ "ios.ui.deleteQuestion": "删除“%@”?",+ "ios.ui.deleteSaves": "同时删除存档",+ "ios.ui.deleteSavesOff": "除非你选择一并删除,否则存档会保留。",+ "ios.ui.deleteSavesOn": "存档也会被删除,且无法恢复。","ios.ui.details": "详情","ios.ui.done": "完成","ios.ui.doubleTapToSelect": "轻点两下以选择",