Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.
Swift apple-silicond3dmetaldxmtdxvkfexgame-porting-toolkitgamingmac-gamingmacosmetalmoltenvksteamswiftuivkd3d-protonwhisky-alternativewindows-gameswinewine-wrapper
Whether an Epic Mac install removes the Windows copy is decided in HighballKit, and tested
Gabe31159570babc
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex 0b26dda..d97bc54 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -3483,17 +3483,23 @@ final class AppState {let store = epicStorelet checkThenRemoveWindows: @MainActor () async throws -> Void = { [self] instage = L("Asking Epic about the Mac version")- let hasMac: Bool+ let hasMac: Bool?do {hasMac = try await Task.detached { try store.hasMacBuild(app) }.value} catch {appendLog("\(item.title): legendary info --platform Mac failed: \(error)")- throw HighballError.failed(L("Highball could not ask Epic whether a Mac build of this game is there to download, so nothing was changed. Check your connection, then try again."))+ hasMac = nil}- guard hasMac else {+ switch EpicStore.MacInstallStep.after(hasMacBuild: hasMac, replacingWindows: replacingWindows) {+ case .couldNotAsk:+ throw HighballError.failed(L("Highball could not ask Epic whether a Mac build of this game is there to download, so nothing was changed. Check your connection, then try again."))+ case .noMacBuild:throw HighballError.failed(L("Epic lists a Mac version of this game, but has no Mac build to download for your account, so nothing was changed."))+ case .install:+ return+ case .removeWindowsThenInstall:+ break}- guard replacingWindows else { return }stage = String(format: L("Removing the Windows version of %@"), item.title)let log: @Sendable (String) -> Void = { line in Task { @MainActor in self.appendLog(line) } }let status: Int32 = try await Task.detached { try store.uninstall(app, onLine: log) }.valuediff --git a/Sources/HighballKit/EpicStore.swift b/Sources/HighballKit/EpicStore.swiftindex a439254..5e1f05a 100644--- a/Sources/HighballKit/EpicStore.swift+++ b/Sources/HighballKit/EpicStore.swift@@ -260,6 +260,19 @@ public struct EpicStore: Sendable {return versions[platform] != nil}+ /// What a Mac install does once `hasMacBuild` has answered: nil when it could not ask. Stop+ /// with nothing changed unless Epic named a Mac build, and only then remove the Windows build+ /// first when switching from it, so a missing build never costs the Windows copy.+ public enum MacInstallStep: Equatable, Sendable {+ case couldNotAsk, noMacBuild, install, removeWindowsThenInstall++ public static func after(hasMacBuild: Bool?, replacingWindows: Bool) -> MacInstallStep {+ guard let hasMacBuild else { return .couldNotAsk }+ guard hasMacBuild else { return .noMacBuild }+ return replacingWindows ? .removeWindowsThenInstall : .install+ }+ }+/// Installs a game's Windows build into the bottle at drive_c/Games/<folder>.@discardableResultpublic func install(_ appName: String, into bottle: Bottle, control: LegendaryControl? = nil,diff --git a/Tests/HighballKitTests/StoreMacVersionTests.swift b/Tests/HighballKitTests/StoreMacVersionTests.swiftindex 49d9715..f99dc07 100644--- a/Tests/HighballKitTests/StoreMacVersionTests.swift+++ b/Tests/HighballKitTests/StoreMacVersionTests.swift@@ -250,6 +250,16 @@ final class EpicMacBuildTests: XCTestCase {XCTAssertFalse(EpicStore.listsBuild(Data("No game information available.".utf8), platform: "Mac"))}+ /// The Windows copy goes only once Epic named a Mac build, and only when switching from it.+ func testTheWindowsCopyGoesOnlyOnceEpicNamedAMacBuild() {+ typealias Step = EpicStore.MacInstallStep+ XCTAssertEqual(Step.after(hasMacBuild: nil, replacingWindows: true), .couldNotAsk)+ XCTAssertEqual(Step.after(hasMacBuild: false, replacingWindows: true), .noMacBuild)+ XCTAssertEqual(Step.after(hasMacBuild: false, replacingWindows: false), .noMacBuild)+ XCTAssertEqual(Step.after(hasMacBuild: true, replacingWindows: false), .install)+ XCTAssertEqual(Step.after(hasMacBuild: true, replacingWindows: true), .removeWindowsThenInstall)+ }+func testTheFallBackToWindowsIsSeen() {XCTAssertTrue(EpicStore.fellBackToWindows(#"[cli] WARNING: App has no asset for platform "Mac", falling back to "Windows"."#))XCTAssertFalse(EpicStore.fellBackToWindows(#"[cli] INFO: Preparing download for "Garlic"..."#))