diff --git a/Whisky/Localizable.xcstrings b/Whisky/Localizable.xcstrings index 6fee1ed4..f51f9d15 100644 --- a/Whisky/Localizable.xcstrings +++ b/Whisky/Localizable.xcstrings @@ -3130,6 +3130,26 @@ } } }, + "config.avx" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Advertise AVX Support" + } + } + } + }, + "config.avx.warning" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "May negatively impact performance" + } + } + } + }, "config.buildVersion" : { "localizations" : { "ar" : { diff --git a/Whisky/Views/Bottle/ConfigView.swift b/Whisky/Views/Bottle/ConfigView.swift index 9edaa3d9..e08ee3a9 100644 --- a/Whisky/Views/Bottle/ConfigView.swift +++ b/Whisky/Views/Bottle/ConfigView.swift @@ -99,6 +99,23 @@ struct ConfigView: View { ) } } + if #available(macOS 15, *) { + Toggle(isOn: $bottle.settings.avxEnabled) { + VStack(alignment: .leading) { + Text("config.avx") + if bottle.settings.avxEnabled { + HStack(alignment: .firstTextBaseline) { + Image(systemName: "exclamationmark.triangle.fill") + .symbolRenderingMode(.multicolor) + .font(.subheadline) + Text("config.avx.warning") + .fontWeight(.light) + .font(.subheadline) + } + } + } + } + } } Section("config.title.dxvk", isExpanded: $dxvkSectionExpanded) { Toggle(isOn: $bottle.settings.dxvk) { diff --git a/WhiskyKit/Sources/WhiskyKit/Whisky/BottleSettings.swift b/WhiskyKit/Sources/WhiskyKit/Whisky/BottleSettings.swift index cbd9692a..7f8c0e29 100644 --- a/WhiskyKit/Sources/WhiskyKit/Whisky/BottleSettings.swift +++ b/WhiskyKit/Sources/WhiskyKit/Whisky/BottleSettings.swift @@ -86,6 +86,7 @@ public struct BottleWineConfig: Codable, Equatable { var wineVersion: SemanticVersion = Self.defaultWineVersion var windowsVersion: WinVersion = .win10 var enhancedSync: EnhancedSync = .msync + var avxEnabled: Bool = false public init() {} @@ -95,6 +96,7 @@ public struct BottleWineConfig: Codable, Equatable { self.wineVersion = try container.decodeIfPresent(SemanticVersion.self, forKey: .wineVersion) ?? Self.defaultWineVersion self.windowsVersion = try container.decodeIfPresent(WinVersion.self, forKey: .windowsVersion) ?? .win10 self.enhancedSync = try container.decodeIfPresent(EnhancedSync.self, forKey: .enhancedSync) ?? .msync + self.avxEnabled = try container.decodeIfPresent(Bool.self, forKey: .avxEnabled) ?? false } // swiftlint:enable line_length } @@ -218,6 +220,11 @@ public struct BottleSettings: Codable, Equatable { set { dxvkConfig.dxvkHud = newValue } } + public var avxEnabled: Bool { + get { return wineConfig.avxEnabled } + set { wineConfig.avxEnabled = newValue } + } + @discardableResult public static func decode(from metadataURL: URL) throws -> BottleSettings { guard FileManager.default.fileExists(atPath: metadataURL.path(percentEncoded: false)) else { @@ -295,5 +302,9 @@ public struct BottleSettings: Codable, Equatable { if metalTrace { wineEnv.updateValue("1", forKey: "METAL_CAPTURE_ENABLED") } + + if avxEnabled { + wineEnv.updateValue("1", forKey: "ROSETTA_ADVERTISE_AVX") + } } }