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.

DXMT: make the pure virtual call handler non-fatal (Skyrim SE aborts at startup) (#92)

Duncan Woodfbaf89f671c6
diff --git a/docs/STEAM-PREBUILTS.md b/docs/STEAM-PREBUILTS.md
index 74c2a0b369f..854e0b24254 100644
--- a/docs/STEAM-PREBUILTS.md
+++ b/docs/STEAM-PREBUILTS.md
@@ -5,6 +5,8 @@ The package contains only these open-source components:
- DXMT: notpop/dxmt commit `924a607e3eee06fad5be6f176d8510bb08bc418d`,
plus `patches/steam-dxmt-build.patch` and `patches/dxmt-max-tess-factor.patch`
(a backport of upstream DXMT ef116534, the `d3d11.maxTessFactor` option)
+ and `patches/dxmt-nonfatal-pure-virtual.patch` (a backport of upstream DXMT 66277b82e: a call on a
+ destroyed object, which Skyrim Special Edition makes at startup, is logged instead of aborting the game)
(MIT; bundled DirectX headers retain their own notices).
- Wine 11.0 winemac: `db11d0fe6a169c457e23d007e20404643d067aa8`,
plus `patches/steam-winemac.patch`, built with public driver symbols
diff --git a/patches/dxmt-nonfatal-pure-virtual.patch b/patches/dxmt-nonfatal-pure-virtual.patch
new file mode 100644
index 00000000000..22d7858147e
--- /dev/null
+++ b/patches/dxmt-nonfatal-pure-virtual.patch
@@ -0,0 +1,23 @@
+Backport of upstream DXMT 66277b82e "fix(d3d11): make pure virtual call non-fatal"
+(Feifan He, MIT, 2026-09-16) to the pinned DXMT revision.
+
+Skyrim Special Edition releases a destroyed texture a second time, and the call lands on a pure
+virtual slot of a destroyed D3D11 object. The pinned revision answers that with __builtin_trap(), so
+the game dies about 12 seconds after launch with "err: Pure virtual function called". Windows and
+DXVK let the same stray call return harmlessly. This logs the message as before and then returns,
+except in debug builds (the release build defines NDEBUG: meson `b_ndebug=if-release`).
+Upstream issue: https://github.com/3Shain/dxmt/issues/231
+
+diff --git a/src/d3d11/d3d11.cpp b/src/d3d11/d3d11.cpp
+index 0550862..790b2d1 100644
+--- a/src/d3d11/d3d11.cpp
++++ b/src/d3d11/d3d11.cpp
+@@ -212,5 +212,7 @@ extern "C" void _massert(const char *_Message, const char *_File,
+
+ extern "C" void __cxa_pure_virtual() {
+ dxmt::Logger::err(dxmt::str::format("Pure virtual function called"));
++#ifndef NDEBUG
+ __builtin_trap();
++#endif
+ }
+\ No newline at end of file
diff --git a/scripts/build-steam-support.sh b/scripts/build-steam-support.sh
index 38867213294..5ce537b9250 100755
--- a/scripts/build-steam-support.sh
+++ b/scripts/build-steam-support.sh
@@ -38,6 +38,7 @@ apply_once(){
apply_once wine "$ROOT/patches/steam-winemac.patch"
apply_once dxmt "$ROOT/patches/steam-dxmt-build.patch"
apply_once dxmt "$ROOT/patches/dxmt-max-tess-factor.patch"
+apply_once dxmt "$ROOT/patches/dxmt-nonfatal-pure-virtual.patch"
export MACOSX_DEPLOYMENT_TARGET=26.0
[ -x venv/bin/meson ] || { python3 -m venv venv; venv/bin/pip install 'meson==1.10.2'; }
mkdir -p dxmt/toolchains/wine
diff --git a/tests/test_installation.py b/tests/test_installation.py
index 9245144a64f..8feea76af8d 100644
--- a/tests/test_installation.py
+++ b/tests/test_installation.py
@@ -251,10 +251,13 @@ class SupportManifestTests(unittest.TestCase):
def test_every_dxmt_patch_is_applied_by_the_build(self):
script = (ROOT/"scripts/build-steam-support.sh").read_text()
- for patch in ("steam-dxmt-build.patch", "dxmt-max-tess-factor.patch"):
+ for patch in ("steam-dxmt-build.patch", "dxmt-max-tess-factor.patch", "dxmt-nonfatal-pure-virtual.patch"):
self.assertTrue((ROOT/"patches"/patch).is_file())
self.assertIn('apply_once dxmt "$ROOT/patches/' + patch + '"', script)
self.assertIn("d3d11.maxTessFactor", (ROOT/"patches/dxmt-max-tess-factor.patch").read_text())
+ # Skyrim SE releases a destroyed texture twice; the handler must log and return, not trap.
+ pure_virtual = (ROOT/"patches/dxmt-nonfatal-pure-virtual.patch").read_text()
+ self.assertIn("+#ifndef NDEBUG\n __builtin_trap();\n+#endif", pure_virtual)
class EnginePatchTests(unittest.TestCase):
def test_stored_acls_patch_is_applied_once_by_the_engine_build(self):