graphics: submonitor refresh rate option (#507)

## Description of change
Add an option that forces requested refresh rate value for the second
monitor; i.e., instead of 60Hz allow the user to override the adapter to
be 70Hz.

Useful for people who have a touch screen that can't do 60Hz.

I don't know if this would cause any timing issues in IIDX or SDVX, but
it seems to boot and monitor check is unaffected.

## Testing
Tested TDJ And UFC mode with a submonitor that can only do 61Hz.
This commit is contained in:
bicarus
2026-01-09 19:50:07 -08:00
committed by GitHub
parent e3d63c65c1
commit 6bf7ae9074
6 changed files with 41 additions and 2 deletions
@@ -812,6 +812,14 @@ HRESULT STDMETHODCALLTYPE WrappedIDirect3D9::CreateDevice(
"either use -graphics-force-refresh option or change the desktop resolution beforehand.");
}
if (!GRAPHICS_WINDOWED && num_adapters >= 2 && GRAPHICS_FORCE_REFRESH_SUB.has_value()) {
log_info("graphics::d3d9", "force sub refresh rate: {} => {} Hz (-graphics-force-refresh-sub option)",
pPresentationParameters[1].FullScreen_RefreshRateInHz,
GRAPHICS_FORCE_REFRESH_SUB.value());
pPresentationParameters[1].FullScreen_RefreshRateInHz = GRAPHICS_FORCE_REFRESH_SUB.value();
}
// force single adapter
if (GRAPHICS_FORCE_SINGLE_ADAPTER) {
log_info("graphics::d3d9", "disabling adapter group device with force single adapter mode");
@@ -1031,6 +1039,17 @@ HRESULT STDMETHODCALLTYPE WrappedIDirect3D9::CreateDeviceEx(
}
}
if (!GRAPHICS_WINDOWED && num_adapters >= 2 && GRAPHICS_FORCE_REFRESH_SUB.has_value()) {
log_info("graphics::d3d9", "force sub refresh rate: {} => {} Hz (-graphics-force-refresh-sub option)",
pPresentationParameters[1].FullScreen_RefreshRateInHz,
GRAPHICS_FORCE_REFRESH_SUB.value());
pPresentationParameters[1].FullScreen_RefreshRateInHz = GRAPHICS_FORCE_REFRESH_SUB.value();
if (pFullscreenDisplayMode) {
pFullscreenDisplayMode[1].RefreshRate = GRAPHICS_FORCE_REFRESH_SUB.value();
}
}
// force single adapter
if (GRAPHICS_FORCE_SINGLE_ADAPTER) {
log_info("graphics::d3d9", "disabling adapter group device with force single adapter mode");
+1
View File
@@ -63,6 +63,7 @@ bool GRAPHICS_WINDOWED = false;
std::vector<HWND> GRAPHICS_WINDOWS;
std::optional<HWND> GRAPHICS_WINDOW_MAIN;
UINT GRAPHICS_FORCE_REFRESH = 0;
std::optional<uint32_t> GRAPHICS_FORCE_REFRESH_SUB;
std::optional<int> GRAPHICS_FORCE_VSYNC_BUFFER;
bool GRAPHICS_FORCE_SINGLE_ADAPTER = false;
bool GRAPHICS_PREVENT_SECONDARY_WINDOW = false;
+1
View File
@@ -33,6 +33,7 @@ extern graphics_orientation GRAPHICS_ADJUST_ORIENTATION;
extern std::vector<HWND> GRAPHICS_WINDOWS;
extern std::optional<HWND> GRAPHICS_WINDOW_MAIN;
extern UINT GRAPHICS_FORCE_REFRESH;
extern std::optional<uint32_t> GRAPHICS_FORCE_REFRESH_SUB;
extern std::optional<int> GRAPHICS_FORCE_VSYNC_BUFFER;
extern bool GRAPHICS_FORCE_SINGLE_ADAPTER;
extern bool GRAPHICS_PREVENT_SECONDARY_WINDOW;
+4
View File
@@ -326,6 +326,10 @@ int main_implementation(int argc, char *argv[]) {
if (options[launcher::Options::GraphicsForceRefresh].is_active()) {
GRAPHICS_FORCE_REFRESH = options[launcher::Options::GraphicsForceRefresh].value_uint32();
}
if (options[launcher::Options::FullscreenSubRefreshRate].is_active()) {
GRAPHICS_FORCE_REFRESH_SUB =
options[launcher::Options::FullscreenSubRefreshRate].value_uint32();
}
if (options[launcher::Options::GraphicsForceSingleAdapter].value_bool()) {
GRAPHICS_FORCE_SINGLE_ADAPTER = true;
}
+15 -2
View File
@@ -221,9 +221,11 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
.category = "Graphics (Full Screen)",
},
{
.title = "Force Refresh Rate",
.title = "Force Monitor Refresh Rate",
.name = "graphics-force-refresh",
.desc = "Force the refresh rate for the primary display adapter; works in both full screen and windowed modes",
.desc =
"Attempt to change the refresh rate for the primary monitor before the game boots; "
"works in both full screen and windowed modes, but known to fail for some games",
.type = OptionType::Integer,
.category = "Graphics (Common)",
},
@@ -254,6 +256,17 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
.hidden = true,
.category = "Graphics (Full Screen)"
},
{
// FullscreenSubRefreshRate
.title = "Force Submonitor Refresh Rate (EXPERIMENTAL)",
.name = "graphics-force-refresh-sub",
.desc =
"Override fullscreen refresh rate requested by the game for second monitor, "
"useful if you have a sub monitor that is not quite exactly 60Hz.\n\n"
"WARNING: experimental as we have not done extensive testing to see if this causes desyncs",
.type = OptionType::Integer,
.category = "Graphics (Full Screen)"
},
{
// Graphics9On12
.title = "DirectX 9 on 12 (DEPRECATED - use -dx9on12 instead)",
+1
View File
@@ -31,6 +31,7 @@ namespace launcher {
GraphicsForceRefresh,
FullscreenResolution,
FullscreenOrientationFlip,
FullscreenSubRefreshRate,
Graphics9On12,
spice2x_Dx9On12,
NoLegacy,