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
A game's own DXMT_CONFIG keeps the frame cap. Highball sets DXMT_CONFIG for a frame cap in DXMT and D3DMetal mode, and the environment's variables and a game's recipe variables were merged after it with plain keys, so a DXMT_CONFIG of their own silently removed the cap. GTA V needs one: it falls back to 800x600 and its lowest settings when DXMT presents the Mac's GPU as Apple's, and DXMT can present an AMD card through dxgi.customVendorId and friends (highball-db#72, probe on the M4). DXMT reads ";"-separated settings, so the cap is now appended to a value that doesn't set one itself; a value that sets its own cap wins, and without a frame cap or a game value nothing changes.
Gauthier Piarrette77b6493f7485
diff --git a/Sources/HighballKit/Bottle.swift b/Sources/HighballKit/Bottle.swiftindex d8228c4..dee7303 100644--- a/Sources/HighballKit/Bottle.swift+++ b/Sources/HighballKit/Bottle.swift@@ -776,6 +776,12 @@ public struct Bottle: Sendable {merge(&env, settings.environment)merge(&env, try effective.environment(engine: engine))merge(&env, extra)+ // A game's recipe or the player may set DXMT_CONFIG too, a GPU identity for instance+ // (GTA V falls back to 800x600 on an Apple GPU, highball-db#72), and the merges above+ // replaced the frame cap's. DXMT reads ";"-separated settings, so both apply.+ if settings.fpsCap > 0, r == .dxmt || r == .d3dmetal, let config = env["DXMT_CONFIG"], !config.contains("d3d11.preferredMaxFrameRate=") {+ env["DXMT_CONFIG"] = (config.isEmpty || config.hasSuffix(";") ? config : config + ";") + "d3d11.preferredMaxFrameRate=\(settings.fpsCap);"+ }// CrossOver's DLSS switch enables the renderer's NVIDIA extension bridge. DXMT ships// its DLLs under their normal names; Apple's D3DMetal bridge is named nvngx-on-metalfx// and is exposed as nvngx.dll in this bottle at launch (see prepareDLSSBridge).diff --git a/Tests/HighballKitTests/EnvironmentTests.swift b/Tests/HighballKitTests/EnvironmentTests.swiftindex 816cff3..3d35ecb 100644--- a/Tests/HighballKitTests/EnvironmentTests.swift+++ b/Tests/HighballKitTests/EnvironmentTests.swift@@ -310,4 +310,26 @@ final class EnvironmentTests: XCTestCase {XCTAssertEqual(env["D3DM_MAX_FPS"], "45", "the 64-bit games D3DMetal serves get its own cap")XCTAssertNil(env["DXVK_FRAME_RATE"], "d3dmetal has no dxvk cap channel")}++ // A game's own DXMT_CONFIG (GTA V's AMD identity, highball-db#72) keeps the frame cap, and the+ // cap's absence or an explicit cap in the variable leave it as written.+ func testAGameDXMTConfigKeepsTheFrameCap() throws {+ let engine = try d3dmetalEngine()+ defer { try? FileManager.default.removeItem(at: engine.root) }+ try FileManager.default.createDirectory(at: engine.frameworksDir.appending(path: "renderer/dxmt/wine"), withIntermediateDirectories: true)+ var bottle = Bottle(url: URL(fileURLWithPath: "/tmp/hb-test-bottle"),+ settings: BottleSettings(name: "t", engineID: engine.id))+ let identity = #"dxgi.customVendorId=1002;dxgi.customDeviceId=73bf;dxgi.customDeviceDesc="AMD Radeon RX 6800 XT";"#+ XCTAssertEqual(try bottle.environment(engine: engine, renderer: .dxmt, extra: ["DXMT_CONFIG": identity])["DXMT_CONFIG"], identity,+ "uncapped, the game's value stands as it is")+ bottle.settings.fpsCap = 60+ XCTAssertEqual(try bottle.environment(engine: engine, renderer: .dxmt, extra: ["DXMT_CONFIG": identity])["DXMT_CONFIG"],+ identity + "d3d11.preferredMaxFrameRate=60;")+ XCTAssertEqual(try bottle.environment(engine: engine, renderer: .dxmt, extra: ["DXMT_CONFIG": "dxgi.customVendorId=1002"])["DXMT_CONFIG"],+ "dxgi.customVendorId=1002;d3d11.preferredMaxFrameRate=60;", "a value without its last ; still parses")+ XCTAssertEqual(try bottle.environment(engine: engine, renderer: .dxmt, extra: ["DXMT_CONFIG": "d3d11.preferredMaxFrameRate=30;"])["DXMT_CONFIG"],+ "d3d11.preferredMaxFrameRate=30;", "a cap the game sets itself wins")+ XCTAssertEqual(try bottle.environment(engine: engine, renderer: .dxmt)["DXMT_CONFIG"], "d3d11.preferredMaxFrameRate=60;",+ "without a game value nothing changes")+ }}