Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

DLSS through NVIDIA Streamline on D3DMetal: NGX gets a signed core to load. Streamline's NGX loads its core, _nvngx.dll (then nvngx.dll), from the folder HKLM\SOFTWARE\NVIDIA Corporation\Global\NGXCore\FullPath names and refuses a file whose Authenticode signature does not verify. D3DMetal wrote C:\windows\system32 there, where Wine keeps only an unsigned placeholder for a builtin DLL, so NGX failed ("failed to load NGXCore: 126" for _nvngx.dll, 0x800B0109 for nvngx.dll), Streamline unloaded its DLSS plugin and Forza Horizon 6 offered no DLSS even with an NVIDIA identity and the DLSS switch on. Apple signs the MetalFX bridge (nvngx-on-metalfx.dll, DigiCert Trusted G4 code signing), and Wine verifies that signature. With the switch on and D3DMetal in effect, prepareDLSSBridge now links the bridge into the bottle's C:\highball\ngx as nvngx.dll and _nvngx.dll and aliases its unix half as _nvngx.so beside the existing aliases, the environment points D3DM_NVNGX_PATH at C:\highball\ngx (D3DMetal writes it to FullPath; it accepts at most 129 characters and wants nvngx.dll inside, hence a short folder in the bottle rather than the alias folder's Unix path) and keeps the alias folder on the DLL path. Measured 2026-10-20 on an M4 Max, macOS 27.0.1, engine r26 with the r28 shim, Forza Horizon 6 with an RTX 4070 identity: Streamline's log reads "Loaded NGXCore from path (C:\highball\ngx\_nvngx.dll)", DLSS appears in Video settings and runs (DLSSContext 1200x750 to 1800x1125); DLSS Frame Generation stays unavailable (Streamline wants GPU hardware scheduling). With the switch off nothing is linked and the game reaches its title screen without DLSS. EnvironmentTests covers both.

tdrkDev4cb329372d30
diff --git a/Sources/HighballKit/Bottle.swift b/Sources/HighballKit/Bottle.swift
index 72cdbd9..df4af51 100644
--- a/Sources/HighballKit/Bottle.swift
+++ b/Sources/HighballKit/Bottle.swift
@@ -817,10 +817,11 @@ public struct Bottle: Sendable {
merge(&env, ["WINEDLLOVERRIDES+": "nvapi64,nvngx=n,b"])
case .d3dmetal:
env["D3DM_ENABLE_METALFX"] = "1"
- if needsDLSSBridgeAliases(engine: engine) {
- let aliases = url.appending(path: ".highball-dlss/wine").path
- merge(&env, ["WINEDLLPATH_PREPEND+": aliases])
- }
+ // The bridge's unix half has to be found under the core's name too (_nvngx), so the
+ // aliases are on the DLL path whenever the switch is on. D3DMetal writes this folder into
+ // the registry as NGX's core location (see prepareDLSSBridge).
+ merge(&env, ["WINEDLLPATH_PREPEND+": url.appending(path: ".highball-dlss/wine").path])
+ env["D3DM_NVNGX_PATH"] = Self.ngxCoreWindowsDir
merge(&env, ["WINEDLLOVERRIDES+": "nvapi64,nvngx=n,b"])
default:
break
@@ -904,16 +905,12 @@ public struct Bottle: Sendable {
}
}
- private func needsDLSSBridgeAliases(engine: InstalledEngine) -> Bool {
- guard let dir = engine.rendererDir("d3dmetal") else { return false }
- let wine = dir.appending(path: "wine")
- let pe = engine.manifest.pe64LibDir, unix = engine.manifest.unixLibDir
- let needsWindowsAlias = !FileManager.default.fileExists(atPath: wine.appending(path: "\(pe)/nvngx.dll").path)
- && FileManager.default.fileExists(atPath: wine.appending(path: "\(pe)/nvngx-on-metalfx.dll").path)
- let needsUnixAlias = !FileManager.default.fileExists(atPath: wine.appending(path: "\(unix)/nvngx.so").path)
- && FileManager.default.fileExists(atPath: wine.appending(path: "\(unix)/nvngx-on-metalfx.so").path)
- return needsWindowsAlias || needsUnixAlias
- }
+ /// Where NGX finds its core, as Windows sees it and on disk. A real file has to sit there: NGX checks
+ /// the Authenticode signature of the file at the path it loads, and Wine's system32 has only an
+ /// unsigned placeholder for a builtin DLL. D3DMetal reads D3DM_NVNGX_PATH (129 characters at most)
+ /// and writes it to HKLM\SOFTWARE\NVIDIA Corporation\Global\NGXCore\FullPath.
+ public static let ngxCoreWindowsDir = #"C:\highball\ngx"#
+ public var ngxCoreDir: URL { driveC.appending(path: "highball/ngx", directoryHint: .isDirectory) }
/// Windows path of the generated DXVK config inside the prefix.
public static let dxvkConfigWindowsPath = #"C:\highball\dxvk.conf"#
@@ -1035,33 +1032,49 @@ public struct Bottle: Sendable {
/// for the standard nvngx module name, so expose aliases inside this bottle (never the shared
/// engine or Windows system32). The aliases are only put on the DLL search path when the
/// setting is enabled and D3DMetal is the effective renderer.
+ ///
+ /// Games that reach DLSS through NVIDIA Streamline load NGX's core, _nvngx.dll, from the folder
+ /// the registry names, and refuse a file without a valid signature there. Wine's system32 holds
+ /// only an unsigned placeholder for a builtin DLL, so NGX failed ("failed to load NGXCore") and
+ /// Streamline dropped DLSS from the game's menu (Forza Horizon 6, 2026-10-20). The bridge Apple
+ /// signs is linked into ngxCoreDir as nvngx.dll and _nvngx.dll, and its unix half is aliased as
+ /// _nvngx.so, the name Wine looks for when the core loads.
public func prepareDLSSBridge(engine: InstalledEngine, renderer: Renderer) throws {
guard settings.dlssEnabled, renderer == .d3dmetal,
supportsDLSS(engine: engine, renderer: renderer),
let dir = engine.rendererDir("d3dmetal") else { return }
let pe = engine.manifest.pe64LibDir, unix = engine.manifest.unixLibDir
- let sources = [
- (dir.appending(path: "wine/\(pe)/nvngx.dll"), dir.appending(path: "wine/\(pe)/nvngx-on-metalfx.dll"), "\(pe)/nvngx.dll"),
- (dir.appending(path: "wine/\(unix)/nvngx.so"), dir.appending(path: "wine/\(unix)/nvngx-on-metalfx.so"), "\(unix)/nvngx.so"),
- ]
let fm = FileManager.default
+ func bridge(_ libDir: String, _ ext: String) throws -> URL {
+ let direct = dir.appending(path: "wine/\(libDir)/nvngx.\(ext)")
+ if fm.fileExists(atPath: direct.path) { return direct }
+ let renamed = dir.appending(path: "wine/\(libDir)/nvngx-on-metalfx.\(ext)")
+ guard fm.fileExists(atPath: renamed.path) else { throw HighballError.missing("D3DMetal's DLSS-to-MetalFX bridge (nvngx-on-metalfx)") }
+ return renamed
+ }
+ let windows = try bridge(pe, "dll"), unixLib = try bridge(unix, "so")
let wineDir = url.appending(path: ".highball-dlss/wine", directoryHint: .isDirectory)
- for (direct, renamed, relativeTarget) in sources {
- if fm.fileExists(atPath: direct.path) { continue }
- guard fm.fileExists(atPath: renamed.path) else {
- throw HighballError.missing("D3DMetal's DLSS-to-MetalFX bridge (nvngx-on-metalfx)")
- }
- let target = wineDir.appending(path: relativeTarget)
- try fm.createDirectory(at: target.deletingLastPathComponent(), withIntermediateDirectories: true)
- if let existing = try? fm.destinationOfSymbolicLink(atPath: target.path),
- URL(fileURLWithPath: existing, relativeTo: target.deletingLastPathComponent()).standardizedFileURL == renamed.standardizedFileURL {
- continue
- }
- if fm.fileExists(atPath: target.path) || (try? fm.destinationOfSymbolicLink(atPath: target.path)) != nil {
- try fm.removeItem(at: target)
- }
- try fm.createSymbolicLink(at: target, withDestinationURL: renamed)
+ var links: [(URL, URL)] = [
+ (wineDir.appending(path: "\(pe)/_nvngx.dll"), windows), (wineDir.appending(path: "\(unix)/_nvngx.so"), unixLib),
+ (ngxCoreDir.appending(path: "nvngx.dll"), windows), (ngxCoreDir.appending(path: "_nvngx.dll"), windows),
+ ]
+ if windows.lastPathComponent != "nvngx.dll" { links.append((wineDir.appending(path: "\(pe)/nvngx.dll"), windows)) }
+ if unixLib.lastPathComponent != "nvngx.so" { links.append((wineDir.appending(path: "\(unix)/nvngx.so"), unixLib)) }
+ for (link, target) in links { try Self.symlink(link, to: target) }
+ }
+
+ /// Points link at target, replacing whatever is there unless it already points there.
+ static func symlink(_ link: URL, to target: URL) throws {
+ let fm = FileManager.default
+ try fm.createDirectory(at: link.deletingLastPathComponent(), withIntermediateDirectories: true)
+ if let existing = try? fm.destinationOfSymbolicLink(atPath: link.path),
+ URL(fileURLWithPath: existing, relativeTo: link.deletingLastPathComponent()).standardizedFileURL == target.standardizedFileURL {
+ return
+ }
+ if fm.fileExists(atPath: link.path) || (try? fm.destinationOfSymbolicLink(atPath: link.path)) != nil {
+ try fm.removeItem(at: link)
}
+ try fm.createSymbolicLink(at: link, withDestinationURL: target)
}
private func merge(_ env: inout [String: String], _ add: [String: String]) {
diff --git a/Tests/HighballKitTests/EnvironmentTests.swift b/Tests/HighballKitTests/EnvironmentTests.swift
index 9272b65..b525f5a 100644
--- a/Tests/HighballKitTests/EnvironmentTests.swift
+++ b/Tests/HighballKitTests/EnvironmentTests.swift
@@ -313,6 +313,50 @@ final class EnvironmentTests: XCTestCase {
"dxmt comes after d3dmetal, so d3dmetal still serves everything it ships")
}
+ /// Forza Horizon 6 reaches DLSS through Streamline, whose NGX loads its core (_nvngx.dll) from the folder
+ /// the registry names and checks the file's signature. With the switch on and D3DMetal in effect, the
+ /// signed bridge is linked into C:\highball\ngx under both core names, D3DMetal is told that folder, and
+ /// the bridge's unix half answers to _nvngx too. With the switch off nothing of it is set up.
+ func testTheDLSSSwitchGivesNGXASignedCoreFolder() throws {
+ let engine = try d3dmetalEngine()
+ defer { try? FileManager.default.removeItem(at: engine.root) }
+ let wine = try XCTUnwrap(engine.rendererDir("d3dmetal")).appending(path: "wine")
+ let pe = wine.appending(path: "\(engine.manifest.pe64LibDir)/nvngx-on-metalfx.dll"), so = wine.appending(path: "\(engine.manifest.unixLibDir)/nvngx-on-metalfx.so")
+ for f in [pe, so] {
+ try FileManager.default.createDirectory(at: f.deletingLastPathComponent(), withIntermediateDirectories: true)
+ try Data("bridge".utf8).write(to: f)
+ }
+ let root = FileManager.default.temporaryDirectory.appending(path: "hb-test-dlss-\(UUID().uuidString)")
+ defer { try? FileManager.default.removeItem(at: root) }
+ var bottle = Bottle(url: root, settings: BottleSettings(name: "t", engineID: engine.id))
+
+ var env = try bottle.environment(engine: engine, renderer: .d3dmetal)
+ XCTAssertNil(env["D3DM_NVNGX_PATH"], "switch off: D3DMetal keeps its own default")
+ try bottle.prepareDLSSBridge(engine: engine, renderer: .d3dmetal)
+ XCTAssertFalse(FileManager.default.fileExists(atPath: bottle.ngxCoreDir.path), "switch off: nothing is linked")
+
+ bottle.settings.dlssEnabled = true
+ env = try bottle.environment(engine: engine, renderer: .d3dmetal)
+ XCTAssertEqual(env["D3DM_ENABLE_METALFX"], "1")
+ XCTAssertEqual(env["D3DM_NVNGX_PATH"], #"C:\highball\ngx"#)
+ XCTAssertLessThanOrEqual(Bottle.ngxCoreWindowsDir.count, 129, "D3DMetal ignores a longer folder")
+ XCTAssertTrue(env["WINEDLLPATH_PREPEND"]?.hasPrefix(root.appending(path: ".highball-dlss/wine").path) == true, "the aliases come first")
+ XCTAssertTrue(env["WINEDLLOVERRIDES"]?.contains("nvapi64,nvngx=n,b") == true)
+
+ for _ in 0..<2 { // a second launch finds everything in place
+ try bottle.prepareDLSSBridge(engine: engine, renderer: .d3dmetal)
+ func target(_ u: URL) -> String? { (try? FileManager.default.destinationOfSymbolicLink(atPath: u.path)).map { URL(fileURLWithPath: $0).standardizedFileURL.path } }
+ for name in ["nvngx.dll", "_nvngx.dll"] {
+ XCTAssertEqual(target(bottle.ngxCoreDir.appending(path: name)), pe.standardizedFileURL.path, "C:\\highball\\ngx\\\(name) is the signed bridge")
+ }
+ let aliases = root.appending(path: ".highball-dlss/wine")
+ XCTAssertEqual(target(aliases.appending(path: "\(engine.manifest.pe64LibDir)/nvngx.dll")), pe.standardizedFileURL.path)
+ XCTAssertEqual(target(aliases.appending(path: "\(engine.manifest.pe64LibDir)/_nvngx.dll")), pe.standardizedFileURL.path)
+ XCTAssertEqual(target(aliases.appending(path: "\(engine.manifest.unixLibDir)/nvngx.so")), so.standardizedFileURL.path)
+ XCTAssertEqual(target(aliases.appending(path: "\(engine.manifest.unixLibDir)/_nvngx.so")), so.standardizedFileURL.path)
+ }
+ }
+
// the fps cap reaches the 32-bit games dxmt serves on a d3dmetal environment
func testD3DMetalPassesTheFpsCapToDXMT() throws {
let engine = try d3dmetalEngine()