Commit 91574993 authored by Joshua Ashton's avatar Joshua Ashton 🐸

[d3d9] Return current display mode in GetAdapterDisplayModeEx rather than last mode

Fixes fullscreen at < native res in Vampire: The Masquerade Bloodlines 1/2
parent 845ab2b5
......@@ -667,15 +667,34 @@ namespace dxvk {
HRESULT D3D9Adapter::GetAdapterDisplayModeEx(
D3DDISPLAYMODEEX* pMode,
D3DDISPLAYROTATION* pRotation) {
if (pMode == nullptr)
return D3DERR_INVALIDCALL;
if (pRotation != nullptr)
*pRotation = D3DDISPLAYROTATION_IDENTITY;
D3DDISPLAYMODEFILTER filter;
filter.Size = sizeof(filter);
filter.Format = D3DFMT_X8R8G8B8;
filter.ScanLineOrdering = D3DSCANLINEORDERING_PROGRESSIVE;
MONITORINFOEXW monInfo = { };
monInfo.cbSize = sizeof(monInfo);
if (!::GetMonitorInfoW(GetDefaultMonitor(), reinterpret_cast<MONITORINFO*>(&monInfo)))
throw DxvkError("D3D9Adapter::GetAdapterDisplayModeEx: Failed to query monitor info");
DEVMODEW devMode = DEVMODEW();
devMode.dmSize = sizeof(devMode);
return this->EnumAdapterModesEx(&filter, 0, pMode);
if (!::EnumDisplaySettingsW(monInfo.szDevice, ENUM_CURRENT_SETTINGS, &devMode)) {
Logger::err("D3D9Adapter::GetAdapterDisplayModeEx: Failed to enum display settings");
return D3DERR_INVALIDCALL;
}
pMode->Size = sizeof(D3DDISPLAYMODEEX);
pMode->Width = devMode.dmPelsWidth;
pMode->Height = devMode.dmPelsHeight;
pMode->RefreshRate = devMode.dmDisplayFrequency;
pMode->Format = D3DFMT_X8R8G8B8;
pMode->ScanLineOrdering = D3DSCANLINEORDERING_PROGRESSIVE;
return D3D_OK;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment