From ae10673b3e528e35dd9470a53b63397dcfacd77b Mon Sep 17 00:00:00 2001 From: narzoul Date: Sat, 17 Aug 2024 16:16:10 +0200 Subject: [PATCH] Fixed a crash when the driver's WDDM version is higher than the OS supports --- DDrawCompat/D3dDdi/Adapter.cpp | 2 +- DDrawCompat/D3dDdi/Hooks.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DDrawCompat/D3dDdi/Adapter.cpp b/DDrawCompat/D3dDdi/Adapter.cpp index c0fce79..b22c4f8 100644 --- a/DDrawCompat/D3dDdi/Adapter.cpp +++ b/DDrawCompat/D3dDdi/Adapter.cpp @@ -437,7 +437,7 @@ namespace D3dDdi pCreateData->Interface = origInterface; if (SUCCEEDED(result)) { - DeviceFuncs::hookVtable(*pCreateData->pDeviceFuncs, m_driverVersion); + DeviceFuncs::hookVtable(*pCreateData->pDeviceFuncs, std::min(m_runtimeVersion, m_driverVersion)); Device::add(*this, pCreateData->hDevice); } return result; diff --git a/DDrawCompat/D3dDdi/Hooks.cpp b/DDrawCompat/D3dDdi/Hooks.cpp index 5a796f0..80e1127 100644 --- a/DDrawCompat/D3dDdi/Hooks.cpp +++ b/DDrawCompat/D3dDdi/Hooks.cpp @@ -121,7 +121,7 @@ namespace pOpenData->Interface = origInterface; if (SUCCEEDED(result)) { - D3dDdi::AdapterFuncs::hookVtable(*pOpenData->pAdapterFuncs, pOpenData->DriverVersion); + D3dDdi::AdapterFuncs::hookVtable(*pOpenData->pAdapterFuncs, std::min(pOpenData->Version, pOpenData->DriverVersion)); D3dDdi::Adapter::add(*pOpenData); } return result;