Skip to content

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

Merge branch 's3-build-store' into s3-launcher-cards

v0lumehia78602d2f56f
diff --cc frontend/Tests/NX2AppleTests/BuildNotificationsTests.swift
index 5484b8e5,2100aa61..5c6afc5e
--- a/frontend/Tests/NX2AppleTests/BuildNotificationsTests.swift
+++ b/frontend/Tests/NX2AppleTests/BuildNotificationsTests.swift
@@@ -63,8 -63,8 +63,8 @@@ import NXMode
MainActor.assumeIsolated { modelStores.dependencies.checked = true }
MainActor.assumeIsolated { modelStores.dependencies.deps = [Dep(id: "test", name: "Xcode", hint: "", present: true, installCmd: [])] }
let library = GameLibrary(file: temporary.appendingPathComponent("preview.json"))
- let host = NSHostingView(rootView: ContentView(stores: modelStores, library: library, initialPage: .settings, performStartupChecks: false))
+ let host = NSHostingView(rootView: LauncherView(stores: modelStores, library: library, initialPage: .settings, performStartupChecks: false))
- let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 1440, height: 1500), styleMask: [.titled, .closable, .resizable], backing: .buffered, defer: false)
+ let window = OffscreenWindow(size: NSSize(width: 1440, height: 1500), styleMask: [.titled, .closable, .resizable])
window.contentView = host
window.orderFront(nil)
RunLoop.main.run(until: Date().addingTimeInterval(0.5))
diff --cc frontend/Tests/NX2AppleTests/ConsoleTests.swift
index d2804d8f,13381b4b..75bbf94d
--- a/frontend/Tests/NX2AppleTests/ConsoleTests.swift
+++ b/frontend/Tests/NX2AppleTests/ConsoleTests.swift
@@@ -212,10 -212,9 +212,9 @@@ import NXMode
let library = GameLibrary(file: output.appendingPathComponent("unused-library.json"))
let driver = MockConsoleDriver(scenario: .controllersMixed, lang: lang, animated: false)
driver.back()
- let view = ContentView(stores: modelStores, library: library, performStartupChecks: false, controllerDriver: AnyConsoleDriver(driver))
+ let view = LauncherView(stores: modelStores, library: library, performStartupChecks: false, controllerDriver: AnyConsoleDriver(driver))
let host = NSHostingView(rootView: view)
- let window = NSWindow(contentRect: NSRect(x: -10000, y: 0, width: width, height: 800), styleMask: [.borderless], backing: .buffered, defer: false)
- window.isReleasedWhenClosed = false
+ let window = OffscreenWindow(size: NSSize(width: width, height: 800), styleMask: [.borderless])
window.contentView = host
window.orderBack(nil)
RunLoop.main.run(until: Date().addingTimeInterval(0.2))
diff --cc frontend/Tests/NX2AppleTests/KeyCheckTests.swift
index 3d196a21,243d9e28..2eacc231
--- a/frontend/Tests/NX2AppleTests/KeyCheckTests.swift
+++ b/frontend/Tests/NX2AppleTests/KeyCheckTests.swift
@@@ -183,8 -183,8 +183,8 @@@ import NXMode
model.slots[0].paths = [base]
model.slots[1].paths = withUpdate ? [update] : []
model.slots[3].paths = [try keysFile(keys)]
- let host = NSHostingView(rootView: ContentView(stores: modelStores, library: library, initialPage: .builds, performStartupChecks: false))
+ let host = NSHostingView(rootView: LauncherView(stores: modelStores, library: library, initialPage: .builds, performStartupChecks: false))
- let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 1440, height: 1024), styleMask: [.titled, .closable, .resizable], backing: .buffered, defer: false)
+ let window = OffscreenWindow(size: NSSize(width: 1440, height: 1024), styleMask: [.titled, .closable, .resizable])
window.contentView = host
window.orderFront(nil)
RunLoop.main.run(until: Date().addingTimeInterval(0.8))
diff --cc frontend/Tests/NX2AppleTests/LauncherPerformanceTests.swift
index 2d9608d4,3c7a053f..4ef7f835
--- a/frontend/Tests/NX2AppleTests/LauncherPerformanceTests.swift
+++ b/frontend/Tests/NX2AppleTests/LauncherPerformanceTests.swift
@@@ -140,10 -140,8 +140,8 @@@ import NXMode
let library = GameLibrary(file: world.libraryFile)
library.selectedID = world.selected
let pad = LauncherGamepad()
- let host = NSHostingView(rootView: ContentView(stores: modelStores, library: library, performStartupChecks: false, gamepad: pad))
+ let host = NSHostingView(rootView: LauncherView(stores: modelStores, library: library, performStartupChecks: false, gamepad: pad))
- let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 1280, height: 900), styleMask: [.titled, .closable, .resizable],
- backing: .buffered, defer: false)
- window.isReleasedWhenClosed = false
+ let window = OffscreenWindow(size: NSSize(width: 1280, height: 900), styleMask: [.titled, .closable, .resizable])
window.contentView = host
window.orderFront(nil)
defer { window.orderOut(nil) }
diff --cc frontend/Tests/NX2AppleTests/LibraryTests.swift
index 182a8599,f4d15263..f925397e
--- a/frontend/Tests/NX2AppleTests/LibraryTests.swift
+++ b/frontend/Tests/NX2AppleTests/LibraryTests.swift
@@@ -612,8 -612,8 +612,8 @@@ import NXMode
model.slots[0].paths = [base.path]
model.slots[3].paths = [keys.path]
let library = GameLibrary(file: temporary.appendingPathComponent("library.json"))
- let host = NSHostingView(rootView: ContentView(stores: modelStores, library: library, initialPage: .builds, performStartupChecks: false))
+ let host = NSHostingView(rootView: LauncherView(stores: modelStores, library: library, initialPage: .builds, performStartupChecks: false))
- let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 1100, height: 800), styleMask: [.titled], backing: .buffered, defer: false)
+ let window = OffscreenWindow(size: NSSize(width: 1100, height: 800))
window.contentView = host
window.orderFront(nil)
defer { window.orderOut(nil) }
@@@ -788,11 -788,10 +788,10 @@@
func capture(_ name: String, width: CGFloat = 1440, height: CGFloat = 1024, page: LauncherPage = .library, activeID: UUID? = nil, empty: Bool = false,
search: String? = nil, older: Set<UUID> = [], manageOpen: Bool = false, padRing: Bool = false, only: GameLibrary? = nil) throws {
let store = only ?? (empty ? GameLibrary(file: temporary.appendingPathComponent("empty.json")) : library)
- let view = ContentView(stores: modelStores, library: store, initialPage: page, activeBuildID: activeID, performStartupChecks: false, search: search,
+ let view = LauncherView(stores: modelStores, library: store, initialPage: page, activeBuildID: activeID, performStartupChecks: false, search: search,
olderTools: older, manageOpen: manageOpen, padRing: padRing)
let host = NSHostingView(rootView: view)
- let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: width, height: height),
- styleMask: [.titled, .closable, .resizable], backing: .buffered, defer: false)
+ let window = OffscreenWindow(size: NSSize(width: width, height: height), styleMask: [.titled, .closable, .resizable])
window.contentView = host
window.orderFront(nil)
RunLoop.main.run(until: Date().addingTimeInterval(0.5))
@@@ -955,9 -954,9 +954,9 @@@
_ = crowded.rememberInputs(model)
}
model.slots[0].paths = []
- let view = ContentView(stores: modelStores, library: crowded, performStartupChecks: false)
+ let view = LauncherView(stores: modelStores, library: crowded, performStartupChecks: false)
let crowdedHost = NSHostingView(rootView: view)
- let crowdedWindow = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 1280, height: 900), styleMask: [.titled], backing: .buffered, defer: false)
+ let crowdedWindow = OffscreenWindow(size: NSSize(width: 1280, height: 900))
crowdedWindow.contentView = crowdedHost
crowdedWindow.orderFront(nil)
RunLoop.main.run(until: Date().addingTimeInterval(0.5))