From e760080aa2a5c36ac7650d72ac57aacea4852774 Mon Sep 17 00:00:00 2001 From: Andrey Kozlov Date: Wed, 11 Nov 2026 19:55:21 +0000 Subject: [PATCH] fix(pharaoh): bypass unskippable intro video hang and configure D3DMetal (#1) --- Sources/PositronCore/GameProfileStore.swift | 12 +++++++- Sources/PositronCore/RuntimeFixes.swift | 5 ++++ .../PositronCoreTests/PositronCoreTests.swift | 6 ++++ steam-bridge/engine/feats/compat_run.sh | 28 +++++++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/Sources/PositronCore/GameProfileStore.swift b/Sources/PositronCore/GameProfileStore.swift index d315859..c776895 100644 --- a/Sources/PositronCore/GameProfileStore.swift +++ b/Sources/PositronCore/GameProfileStore.swift @@ -338,6 +338,7 @@ public enum GameQuirksDatabase { GamePresetInfo(appID: 292030, title: "The Witcher 3: Wild Hunt — Remastered", subtitle: "REDengine 3 • 64-bit DirectX 12 (Patch 5.0+)", recommendedSummary: "Rosetta 2 + D3DMetal (DX12) + Stream-Output PSO & SDR Fix", notes: "Automatically links bin/x64 -> x64_dx12, stages the stream-output PSO skip proxy (amd_fidelityfx_loader_dx12.dll) and SDR DXGI hook (dinput8.dll), bypasses REDprelauncher.exe, and disables winspool.drv."), GamePresetInfo(appID: 1151340, title: "Fallout 76", subtitle: "Creation Engine • 64-bit DirectX 11 Online", recommendedSummary: "Rosetta 2 + DXMT (DX11) + 60 FPS Metal Pacing & Stutter Fix", notes: "Uses DXMT with 60 FPS Metal CoreAnimation pacing, disables Bethesda's VSync stutter lock (iPresentInterval=0), optimizes shadow distance & volumetric lighting, caps tessellation, and uses native xaudio2_7."), GamePresetInfo(appID: 668580, title: "Atomic Heart", subtitle: "Unreal Engine 4 • 64-bit DirectX 12 / 11", recommendedSummary: "Rosetta 2 + D3DMetal (DX12) + AVX + XAudio2", notes: "Uses Rosetta 2 with AVX and D3DMetal for Unreal Engine 4 DirectX 12 rendering, plus native xaudio2_9 and VC++ runtime overrides."), + GamePresetInfo(appID: 1351080, title: "Pharaoh: A New Era", subtitle: "Unity Engine • 64-bit DirectX 11 + Video Player Fix", recommendedSummary: "Rosetta 2 + D3DMetal + Intro Video Bypass", notes: "Bypasses the unskippable startup intro video that hangs on Wine DXGI shared texture handles (IsIntroAlreadyViewed=1) and configures Rosetta 2 + D3DMetal for stable 60 FPS city-building."), GamePresetInfo(appID: 3105440, title: "Heroes of Might and Magic: Olden Era", subtitle: "Unity 6 Engine • 64-bit DirectX 11 + Media Foundation Video", recommendedSummary: "Rosetta 2 + D3DMetal + Standard DPI + Internal APFS Prefix", notes: "Uses D3DMetal on Rosetta 2 so IDXGIResource::GetSharedHandle and D3D11Fence work for .mp4 intro/campaign videos, while purging exFAT ._* files and keeping Retina scaling off."), GamePresetInfo(appID: 1174180, title: "Red Dead Redemption 2", subtitle: "RAGE Engine • 64-bit DirectX 12 / Vulkan", recommendedSummary: "Rosetta 2 + D3DMetal (DX12) + Anti-Flicker / SDR / TAA Fix", notes: "Disables D3DMetal DLSS-to-MetalFX (nvngx=d, D3DM_ENABLE_METALFX=0) and clamps NaN/Inf shader samples to eliminate 3D world blinking, while configuring system.xml for DX12 SDR Windowed Borderless with TAA High."), GamePresetInfo(appID: 1286830, title: "STAR WARS: The Old Republic", subtitle: "HeroEngine • 32-bit CEF Launcher -> 64-bit Retail Client", recommendedSummary: "Rosetta 2 (WoW64) + WineD3D + CEF Launcher Fix", notes: "Uses Rosetta 2 + WineD3D and appends --disable-gpu --disable-gpu-compositing to launcher.exe (libcef.dll) so the launcher window renders visibly without a cross-process D3D11 swapchain."), @@ -435,6 +436,15 @@ public enum GameQuirksDatabase { dx12RosettaRule(&profile) profile.dllOverrides["xaudio2_9"] = "n,b" }), + 1351080: ("Pharaoh: A New Era", { profile in + profile.translator = .rosetta + profile.graphics = .d3dMetal + profile.advertiseAVX = true + profile.sync = .msync + profile.dllOverrides["vcruntime140"] = "n,b" + profile.dllOverrides["vcruntime140_1"] = "n,b" + profile.dllOverrides["d3dcompiler_47"] = "n,b" + }), 3105440: ("Heroes of Might and Magic: Olden Era", { profile in profile.translator = .rosetta profile.graphics = .d3dMetal @@ -600,7 +610,7 @@ public enum GameQuirksDatabase { public static func builtInDefaultProfile(forAppID appID: UInt32, preferredTranslator: CPUTranslator = .rosetta) -> GameProfile { let forceRosettaIDs: Set = [ - 292030, 1151340, 668580, 3105440, 1091500, 1174180, 1245620, 1286830, 38410, 412020, + 292030, 1151340, 1351080, 668580, 3105440, 1091500, 1174180, 1245620, 1286830, 38410, 412020, 1716740, 1888160, 1363080, 1466860, 2215430, 2322010, 1151640, 2420110, 1817070, 1817190, 1888930, 1771300, 1446780, 2246340, 2344520, 2694490, 2358720, 2054970, 2050650, 1196590, 782330, 379720, 2161700, 2072450, diff --git a/Sources/PositronCore/RuntimeFixes.swift b/Sources/PositronCore/RuntimeFixes.swift index f615009..6d9f682 100644 --- a/Sources/PositronCore/RuntimeFixes.swift +++ b/Sources/PositronCore/RuntimeFixes.swift @@ -31,6 +31,11 @@ public struct RuntimeFix: Sendable, Identifiable, Equatable { detail: "MetalFX/DLSS off, NaN clamp, esync, and SDR + TAA in system.xml.", scope: .game, appIDs: [1174180] ), + RuntimeFix( + id: "pharaoh-intro-bypass", title: "Pharaoh: A New Era intro video hang fix", + detail: "Sets IsIntroAlreadyViewed=1 in the registry to bypass the unskippable startup intro video that hangs on Wine DXGI shared texture handles.", + scope: .game, appIDs: [1351080] + ), RuntimeFix( id: "fo76-perf-tweaks", title: "Fallout 76 smooth 60 FPS pacing & graphics optimization", detail: "Disables Bethesda's VSync stutter lock (iPresentInterval=0), coordinates 60 FPS Metal pacing, optimizes shadow distance & volumetric lighting, and caps tessellation.", diff --git a/Tests/PositronCoreTests/PositronCoreTests.swift b/Tests/PositronCoreTests/PositronCoreTests.swift index ca3efb4..6ed2264 100644 --- a/Tests/PositronCoreTests/PositronCoreTests.swift +++ b/Tests/PositronCoreTests/PositronCoreTests.swift @@ -35,6 +35,12 @@ struct PositronCoreTests { @Test("Curated presets for Witcher 3 Remaster, RDR2, Atomic Heart, Fallout 76, and Heroes of Olden Era configure optimal settings") func curatedGameProfiles() { + // 0. Pharaoh: A New Era - AppID 1351080 (D3DMetal + Rosetta 2 for shared DXGI texture handles) + let pharaoh = GameQuirksDatabase.defaultProfile(forAppID: 1351080, preferredTranslator: .fex) + #expect(pharaoh.translator == .rosetta) + #expect(pharaoh.graphics == .d3dMetal) + #expect(GameQuirksDatabase.presetInfo(forAppID: 1351080)?.title == "Pharaoh: A New Era") + // 1. The Witcher 3: Wild Hunt (Next-Gen Remaster) - AppID 292030 let witcher3 = GameQuirksDatabase.defaultProfile(forAppID: 292030, preferredTranslator: .fex) #expect(witcher3.translator == .rosetta) diff --git a/steam-bridge/engine/feats/compat_run.sh b/steam-bridge/engine/feats/compat_run.sh index 89de76b..8ac75c4 100755 --- a/steam-bridge/engine/feats/compat_run.sh +++ b/steam-bridge/engine/feats/compat_run.sh @@ -1592,6 +1592,34 @@ if [ "$verb" = waitforexitandrun ] && game_fix_on witcher3-dx12-fix && { [ "$app fi fi +# Automatic runtime fix for Pharaoh: A New Era (AppID 1351080): +# Bypasses the unskippable startup intro video that hangs on Wine DXGI shared texture handles +# (Got null handle from IDXGIResource::GetSharedHandle) by ensuring IsIntroAlreadyViewed=1 +# in HKEY_CURRENT_USER\Software\Triskell Interactive\Pharaoh, and forces D3DMetal. +if [ "$verb" = waitforexitandrun ] && game_fix_on pharaoh-intro-bypass && { [ "$app_id" = "1351080" ] || [ -f "$STEAM_COMPAT_INSTALL_PATH/Pharaoh.exe" ]; }; then + export CX_GRAPHICS_BACKEND="d3dmetal" + pharaoh_reg="$WINEPREFIX/user.reg" + if [ -f "$pharaoh_reg" ]; then + python3 -c ' +import sys +p = sys.argv[1] +try: + content = open(p, "r", encoding="utf-8", errors="ignore").read() + target = "[Software\\\\Triskell Interactive\\\\Pharaoh]" + if target in content: + if "IsIntroAlreadyViewed" not in content: + idx = content.find(target) + len(target) + content = content[:idx] + "\n\"IsIntroAlreadyViewed\"=dword:00000001" + content[idx:] + open(p, "w", encoding="utf-8").write(content) + else: + open(p, "a", encoding="utf-8").write("\n\n" + target + "\n\"IsIntroAlreadyViewed\"=dword:00000001\n") +except Exception: + pass +' "$pharaoh_reg" 2>/dev/null || true + echo "=== Pharaoh: A New Era fix: bypassed unskippable intro video (IsIntroAlreadyViewed=1) and configured D3DMetal ===" >> "$log" 2>&1 || true + fi +fi + # Automatic runtime fix for Red Dead Redemption 2 (AppID 1174180): # Eliminates 3D world/lighting blinking under D3DMetal by disabling D3DMetal's broken DLSS-to-MetalFX # bridge (nvngx=d, D3DM_ENABLE_METALFX=0), clamping NaN/Inf shader samples, using WINEESYNC=1,