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
iOS shell host: keep the title ID out of the main UI
v0lumehid510cef1d982
diff --git a/frontend-ios/Sources/ShellHost/GameCatalogue.swift b/frontend-ios/Sources/ShellHost/GameCatalogue.swiftindex 0b79a316..3db0d5cf 100644--- a/frontend-ios/Sources/ShellHost/GameCatalogue.swift+++ b/frontend-ios/Sources/ShellHost/GameCatalogue.swift@@ -33,7 +33,7 @@ public struct CatalogueEntry: Equatable, Sendable, Identifiable {/// The name from a manifest that could not be fully read, when it still has one.public var readableName: String?- /// Never the bare title ID: an unreadable bundle is "Unknown game" and its ID is the subtitle.+ /// Never the bare title ID: an unreadable bundle is "Unknown game". The ID is shown only in the How to fix sheet.public var title: String { manifest?.name ?? readableName ?? hostText("Unknown game") }public var frameworkURL: URL? { manifest.map { directory.appendingPathComponent($0.framework, isDirectory: true) } }}diff --git a/frontend-ios/Sources/ShellHost/ShellHostModel.swift b/frontend-ios/Sources/ShellHost/ShellHostModel.swiftindex 16100b66..f24bc582 100644--- a/frontend-ios/Sources/ShellHost/ShellHostModel.swift+++ b/frontend-ios/Sources/ShellHost/ShellHostModel.swift@@ -129,7 +129,7 @@ public struct ShellHostConfig: Sendable {let data = data(for: entry)let state = GameStateResolver.state(for: entry, data: data, environment: config.environment)let played = lastPlayed(entry.id)- let tile = GameTile(id: entry.id, title: entry.title, subtitle: entry.manifest.map { ShellFormat.version($0.displayVersion) } ?? entry.id,+ let tile = GameTile(id: entry.id, title: entry.title, subtitle: entry.manifest.map { ShellFormat.version($0.displayVersion) } ?? "",banner: image(entry.bannerURL), icon: image(entry.iconURL), state: state,recentlyPlayed: played.map { ShellFormat.played($0, now: config.now()) })guard let profile = entry.profile, entry.problem == nil else {diff --git a/frontend-ios/Sources/ShellUI/GameStateView.swift b/frontend-ios/Sources/ShellUI/GameStateView.swiftindex 52d6818b..e2480059 100644--- a/frontend-ios/Sources/ShellUI/GameStateView.swift+++ b/frontend-ios/Sources/ShellUI/GameStateView.swift@@ -67,6 +67,8 @@ public struct StateHelpView: View {if case .broken(_, _, let technical) = game.state, !technical.isEmpty {VStack(alignment: .leading, spacing: 4) {Text(ShellStrings.text("Details")).shellText(11.5, .semibold).foregroundStyle(.white.opacity(0.5))+ Text(verbatim: ShellStrings.text("Title ID \(game.id)")).font(.system(size: 12, design: .monospaced)).foregroundStyle(.white.opacity(0.5))+ .textSelection(.enabled).accessibilityIdentifier("help.titleid")Text(verbatim: technical).font(.system(size: 12, design: .monospaced)).foregroundStyle(.white.opacity(0.5)).textSelection(.enabled).fixedSize(horizontal: false, vertical: true).accessibilityIdentifier("help.details")diff --git a/frontend-ios/Sources/ShellUI/Resources/Localizable.xcstrings b/frontend-ios/Sources/ShellUI/Resources/Localizable.xcstringsindex e132daaa..168d5061 100644--- a/frontend-ios/Sources/ShellUI/Resources/Localizable.xcstrings+++ b/frontend-ios/Sources/ShellUI/Resources/Localizable.xcstrings@@ -191,6 +191,16 @@}}},+ "Title ID %@": {+ "localizations": {+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Title ID %@"+ }+ }+ }+ },"Done": {"localizations": {"en": {diff --git a/frontend-ios/Tests/ShellHostTests/ShellHostModelTests.swift b/frontend-ios/Tests/ShellHostTests/ShellHostModelTests.swiftindex 04db476e..8b06a88d 100644--- a/frontend-ios/Tests/ShellHostTests/ShellHostModelTests.swift+++ b/frontend-ios/Tests/ShellHostTests/ShellHostModelTests.swift@@ -336,14 +336,14 @@ final class Clock: @unchecked Sendable { var date: Date; init(_ d: Date) { date@Test func anUnreadableManifestNeverShowsTheBareTitleID() throws {let box = try Sandbox()let model = ShellHostModel(config: box.config())- // Truncated JSON: no name anywhere, so "Unknown game" with the ID as the small line.+ // Truncated JSON: no name anywhere, so "Unknown game" and no subtitle.let unknown = try detail(model, Fixtures.badManifest).game- #expect(unknown.title == "Unknown game" && unknown.subtitle == Fixtures.badManifest)+ #expect(unknown.title == "Unknown game" && unknown.subtitle.isEmpty)#expect(unknown.state == .broken(reason: "Can't read this game", detail: ProblemCause.manifestDamaged.message,technical: try #require({ () -> String? in if case .broken(_, _, let t) = unknown.state { t } else { nil } }())))// Valid JSON that fails validation keeps its own name.let partial = try detail(model, Fixtures.missingKey).game- #expect(partial.title == "Missing Key Fixture" && partial.subtitle == Fixtures.missingKey)+ #expect(partial.title == "Missing Key Fixture" && partial.subtitle.isEmpty)// Nothing the player reads as a title is a 16 digit ID.for d in model.details { #expect(d.game.title.count != 16 || !d.game.title.allSatisfy(\.isNumber)) }}diff --git a/frontend-ios/UITests/ShellHostUITests.swift b/frontend-ios/UITests/ShellHostUITests.swiftindex a4a124b9..54c7f925 100644--- a/frontend-ios/UITests/ShellHostUITests.swift+++ b/frontend-ios/UITests/ShellHostUITests.swift@@ -43,12 +43,16 @@ import XCTestXCTAssertTrue(app.staticTexts["Details"].exists)}- func testUnreadableManifestIsUnknownGameWithItsIDAsSmallText() {+ func testUnreadableManifestIsUnknownGameWithoutTheTitleIDInTheMainUI() {launch(select: "0100000000050000")XCTAssertEqual(app.staticTexts["hero.title"].label, "Unknown game")- XCTAssertTrue(app.staticTexts["0100000000050000"].exists)+ XCTAssertFalse(app.staticTexts.matching(NSPredicate(format: "label CONTAINS '0100000000050000'")).firstMatch.exists)XCTAssertTrue(app.staticTexts.matching(NSPredicate(format: "label CONTAINS[c] \"Can't read this game\"")).firstMatch.exists)XCTAssertTrue(app.staticTexts["This game's manifest is damaged. Rebuild the game in the launcher on your Mac."].exists)+ let fix = app.buttons.matching(identifier: "state.action").allElementsBoundByIndex.first { $0.isHittable }+ fix?.tap()+ XCTAssertTrue(app.staticTexts["help.title"].waitForExistence(timeout: 5))+ XCTAssertEqual(app.staticTexts["help.titleid"].label, "Title ID 0100000000050000")}func testLibraryStartsOnAPlayableGameWithTheVersionLine() {