From 0ada5acea710868f882acaa6230c5bd60c0031fe Mon Sep 17 00:00:00 2001 From: narzoul Date: Sat, 1 May 2021 14:11:08 +0200 Subject: [PATCH] Fixed crash at startup in Debug build See issue #96. --- DDrawCompat/Direct3d/Hooks.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DDrawCompat/Direct3d/Hooks.cpp b/DDrawCompat/Direct3d/Hooks.cpp index ff497cc..a43380e 100644 --- a/DDrawCompat/Direct3d/Hooks.cpp +++ b/DDrawCompat/Direct3d/Hooks.cpp @@ -28,7 +28,11 @@ namespace CompatPtr d3d; HRESULT result = dd->QueryInterface(&dd, Compat::getIntfId(), reinterpret_cast(&d3d.getRef())); - if (FAILED(result)) + if (SUCCEEDED(result)) + { + CompatVtable>::s_origVtable = *d3d.get()->lpVtbl; + } + else { Compat::Log() << "ERROR: Failed to create a Direct3D object for hooking: " << Compat::hex(result); }