1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

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

Fixes fullscreen at < native res in Vampire: The Masquerade Bloodlines 1/2
This commit is contained in:
Joshua Ashton 2020-01-06 04:06:45 +00:00
parent 845ab2b5af
commit 91574993df

View File

@ -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);
return this->EnumAdapterModesEx(&filter, 0, pMode);
if (!::GetMonitorInfoW(GetDefaultMonitor(), reinterpret_cast<MONITORINFO*>(&monInfo)))
throw DxvkError("D3D9Adapter::GetAdapterDisplayModeEx: Failed to query monitor info");
DEVMODEW devMode = DEVMODEW();
devMode.dmSize = sizeof(devMode);
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;
}