From 61b6f8f297971d92513a83eb054b28007d775201 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Mon, 6 Jan 2020 04:07:02 +0000 Subject: [PATCH] [d3d9] Hook up GetAdapterDisplayMode to resp. adapter func Fixes fullscreen at < native res in Vampire: The Masquerade Bloodlines 1/2 --- src/d3d9/d3d9_interface.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/d3d9/d3d9_interface.cpp b/src/d3d9/d3d9_interface.cpp index c51cf241..fc3da9fe 100644 --- a/src/d3d9/d3d9_interface.cpp +++ b/src/d3d9/d3d9_interface.cpp @@ -75,10 +75,22 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE D3D9InterfaceEx::GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE* pMode) { - constexpr D3DFORMAT format = D3DFMT_X8R8G8B8; - const UINT mode = GetAdapterModeCount(Adapter, format) - 1; + if (auto* adapter = GetAdapter(Adapter)) { + D3DDISPLAYMODEEX modeEx; + HRESULT hr = adapter->GetAdapterDisplayModeEx(&modeEx, nullptr); - return this->EnumAdapterModes(Adapter, format, mode, pMode); + if (FAILED(hr)) + return hr; + + pMode->Width = modeEx.Width; + pMode->Height = modeEx.Height; + pMode->RefreshRate = modeEx.RefreshRate; + pMode->Format = modeEx.Format; + + return D3D_OK; + } + + return D3DERR_INVALIDCALL; }