Skip to content

armgit / soju

Public Imported from GitHub
0

Play Windows games on Apple Silicon Macs. Free, open-source app that installs the official Battle.net, Steam, Epic and GOG launchers and lists your games in one library.

Unreal games start without the graphics driver warning window (#190)

Mikek98fe6f59d7a8
diff --git a/scripts/play.sh b/scripts/play.sh
index 129316e28eb..30012a3d3bb 100755
--- a/scripts/play.sh
+++ b/scripts/play.sh
@@ -54,6 +54,9 @@ elif [[ "$MODE" =~ ^(ea|rockstar|ubisoft)(-kill)?$ ]]; then
else
export WINEPREFIX="${WINEPREFIX:-${SOJU_BASE:-$HOME/.battlenet-macos}/bottle}"
fi
+# Unreal Engine games that ran here before start without the "Known issues with graphics driver" window
+# that otherwise holds them at start (scripts/ue_driver_warning.py).
+case "$MODE" in *-kill|kill|controllers) ;; *) python3 "$(dirname "${BASH_SOURCE[0]}")/ue_driver_warning.py" "$WINEPREFIX" >/dev/null 2>&1 || true ;; esac
# The EA app, Rockstar Games Launcher and Ubisoft Connect run on the launcher
# engine: the CX engine plus a Mac driver and DXMT that let their browser UIs
diff --git a/scripts/ue_driver_warning.py b/scripts/ue_driver_warning.py
new file mode 100644
index 00000000000..66060827484
--- /dev/null
+++ b/scripts/ue_driver_warning.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python3
+"""Unreal Engine games stop at start with "WARNING: Known issues with graphics driver" on a Mac.
+
+Apple's toolkit presents the GPU as "AMD Compatibility Mode" with driver 30.0.15.1233, which Unreal's
+driver list calls outdated (it recommends 23.2.1). The game waits behind that window until it is
+closed, and a window that opens behind others looks like a game that never starts (Hogwarts Legacy,
+2026-11-24). Unreal reads r.WarnOfBadDrivers from the game's own Engine.ini; setting it to 0 skips the
+window and changes nothing else. (The driver version Unreal checks is not the one in the registry:
+setting RadeonSoftwareVersion there did not help.)
+
+ ue_driver_warning.py <bottle>
+ For each Unreal game that has run in the bottle (it has
+ users/<name>/AppData/Local/<Game>/Saved/Config/Windows[NoEditor]/), make sure its Engine.ini says
+ r.WarnOfBadDrivers=0 under [SystemSettings]. A game that has never run gets it after its first start.
+"""
+import sys
+from pathlib import Path
+
+SKIP = {"epicgameslauncher", "crashreportclient", "unrealengine", "unrealenginelauncher"}
+LINE = "r.WarnOfBadDrivers=0"
+
+
+def quiet(ini):
+ try:
+ raw = ini.read_bytes() if ini.exists() else b""
+ except OSError:
+ return False
+ text = raw.decode("utf-8-sig", "replace")
+ if "r.warnofbaddrivers" in text.lower():
+ return False
+ nl = "\r\n" if "\r\n" in text or not text else "\n"
+ lines = text.splitlines()
+ for i, line in enumerate(lines):
+ if line.strip().lower() == "[systemsettings]":
+ lines.insert(i + 1, LINE)
+ break
+ else:
+ if lines and lines[-1].strip():
+ lines.append("")
+ lines += ["[SystemSettings]", LINE]
+ try:
+ ini.write_text(nl.join(lines) + nl, encoding="utf-8", newline="")
+ return True
+ except OSError:
+ return False
+
+
+def main(argv):
+ if len(argv) != 1:
+ print("usage: ue_driver_warning.py <bottle>", file=sys.stderr)
+ return 64
+ users = Path(argv[0]) / "drive_c/users"
+ changed = 0
+ for config in users.glob("*/AppData/Local/*/Saved/Config"):
+ if config.parent.parent.name.lower() in SKIP:
+ continue
+ for platform in ("WindowsNoEditor", "Windows"):
+ if (config / platform).is_dir():
+ changed += quiet(config / platform / "Engine.ini")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv[1:]))
diff --git a/scripts/xbox-wine.sh b/scripts/xbox-wine.sh
index ee8e5a60f1b..f174efb5ebb 100755
--- a/scripts/xbox-wine.sh
+++ b/scripts/xbox-wine.sh
@@ -6,6 +6,7 @@
BASE="${SOJU_BASE:-$HOME/.battlenet-macos}"
ENGINE="${ENGINE:-$BASE/cx26-engine}"
export WINEPREFIX="$BASE/xbox-bottle"
+python3 "$(dirname "${BASH_SOURCE[0]}")/ue_driver_warning.py" "$WINEPREFIX" >/dev/null 2>&1 || true # Unreal games: no driver warning window
# xbox-run.py drops WINE* variables from the environment; SOJU_XBOX_WINEDEBUG
# passes a Wine debug channel list through for diagnosis.
export WINEDEBUG="${SOJU_XBOX_WINEDEBUG:-${WINEDEBUG:-fixme-all}}"
diff --git a/tests/test_ue_driver_warning.py b/tests/test_ue_driver_warning.py
new file mode 100644
index 00000000000..d6fcaab9d18
--- /dev/null
+++ b/tests/test_ue_driver_warning.py
@@ -0,0 +1,37 @@
+import subprocess
+import sys
+import tempfile
+import unittest
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parent.parent
+SCRIPT = ROOT / "scripts/ue_driver_warning.py"
+
+
+class UnrealDriverWarningTests(unittest.TestCase):
+ def test_unreal_games_that_ran_get_the_setting_once_and_launchers_are_left_alone(self):
+ with tempfile.TemporaryDirectory() as d:
+ local = Path(d) / "drive_c/users/crossover/AppData/Local"
+ game = local / "HogwartsLegacy/Saved/Config/WindowsNoEditor"
+ game.mkdir(parents=True)
+ (game / "Engine.ini").write_bytes(b"[Core.System]\r\nPaths=../../Content\r\n\r\n[SystemSettings]\r\nr.Foo=1\r\n")
+ other = local / "Seven/Saved/Config/Windows"
+ other.mkdir(parents=True)
+ launcher = local / "EpicGamesLauncher/Saved/Config/Windows"
+ launcher.mkdir(parents=True)
+ for _ in range(2): # twice: the second run changes nothing
+ subprocess.run([sys.executable, str(SCRIPT), d], check=True)
+ text = (game / "Engine.ini").read_bytes()
+ self.assertEqual(text.count(b"r.WarnOfBadDrivers=0"), 1)
+ self.assertIn(b"[SystemSettings]\r\nr.WarnOfBadDrivers=0\r\nr.Foo=1\r\n", text)
+ self.assertIn(b"[Core.System]\r\nPaths=../../Content\r\n", text)
+ self.assertIn("[SystemSettings]\r\nr.WarnOfBadDrivers=0", (other / "Engine.ini").read_text(newline=""))
+ self.assertFalse((launcher / "Engine.ini").exists())
+
+ def test_play_sh_runs_it(self):
+ self.assertIn("ue_driver_warning.py", (ROOT / "scripts/play.sh").read_text())
+ self.assertIn("ue_driver_warning.py", (ROOT / "scripts/xbox-wine.sh").read_text())
+
+
+if __name__ == "__main__":
+ unittest.main()