Skip to content

Commit

Permalink
Add "ForceDefaultRefreshRate" global config option
Browse files Browse the repository at this point in the history
  • Loading branch information
crosire committed Dec 18, 2022
1 parent f37cf90 commit a7ec39c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions source/d3d9/d3d9.cpp
Expand Up @@ -161,6 +161,14 @@ void dump_and_modify_present_parameters(D3DPRESENT_PARAMETERS &pp, IDirect3D9 *d
pp.FullScreen_RefreshRateInHz = current_mode.RefreshRate;
}
}
if (config.get("APP", "ForceDefaultRefreshRate") && !pp.Windowed)
{
D3DDISPLAYMODE current_mode;
if (SUCCEEDED(d3d->GetAdapterDisplayMode(adapter_index, &current_mode)))
{
pp.FullScreen_RefreshRateInHz = current_mode.RefreshRate;
}
}

if (unsigned int force_resolution[2] = {};
config.get("APP", "ForceResolution", force_resolution) && force_resolution[0] != 0 && force_resolution[1] != 0)
Expand Down
10 changes: 10 additions & 0 deletions source/dxgi/dxgi.cpp
Expand Up @@ -136,6 +136,12 @@ bool modify_swapchain_desc(DXGI_SWAP_CHAIN_DESC &internal_desc)

modified = true;
}
if (config.get("APP", "ForceDefaultRefreshRate"))
{
internal_desc.BufferDesc.RefreshRate = { 0, 1 };

modified = true;
}

if (unsigned int force_resolution[2] = {};
config.get("APP", "ForceResolution", force_resolution) &&
Expand Down Expand Up @@ -298,6 +304,10 @@ static void dump_and_modify_swapchain_desc(DXGI_SWAP_CHAIN_DESC1 &desc, DXGI_SWA
{
fullscreen_desc.Windowed = FALSE;
}
if (config.get("APP", "ForceDefaultRefreshRate"))
{
fullscreen_desc.RefreshRate = { 0, 1 };
}
}

UINT query_device(IUnknown *&device, com_ptr<IUnknown> &device_proxy)
Expand Down

0 comments on commit a7ec39c

Please sign in to comment.