Skip to content

Commit

Permalink
feat: avx feature switch
Browse files Browse the repository at this point in the history
  • Loading branch information
ohaiibuzzle committed Jun 18, 2024
1 parent 4e4911f commit 270476a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Whisky/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -3130,6 +3130,16 @@
}
}
},
"config.avx" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "AVX Support"
}
}
}
},
"config.buildVersion" : {
"localizations" : {
"ar" : {
Expand Down
3 changes: 3 additions & 0 deletions Whisky/Views/Bottle/ConfigView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ struct ConfigView: View {
)
}
}
Toggle(isOn: $bottle.settings.avxEnabled) {
Text("config.avx")
}
}
Section("config.title.dxvk", isExpanded: $dxvkSectionExpanded) {
Toggle(isOn: $bottle.settings.dxvk) {
Expand Down
11 changes: 11 additions & 0 deletions WhiskyKit/Sources/WhiskyKit/Whisky/BottleSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

Expand All @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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")
}
}
}

0 comments on commit 270476a

Please sign in to comment.