graphics: rewrite auto-rotate and refresh rate options to be more reliable (#607)

## Description of change

Rotate monitor & change the refresh rate **well before** the game is
launched.

This is much faster and more reliable compared to what we do now, which
is trying to do monitor changes during CreateWindow hooks. For example,
SDVX makes a bunch of OS / NVAPI calls to figure out monitor geometry
while it's booting, and by the time CreateWindow is called, the game
already made up its mind, which leads to weird graphical issues.

This affects both windowed mode and full screen.

In addition, add options for normal orientation (landscape) and upside
down (landscape, flipped) options. This can be used if the monitor is
normally rotated to portrait, but the game needs to be in landscape.
This commit is contained in:
bicarus
2026-04-04 03:23:28 -07:00
committed by GitHub
parent e0f6cb2cbd
commit a4c3eddc2f
5 changed files with 133 additions and 102 deletions
+3
View File
@@ -2133,6 +2133,9 @@ int main_implementation(int argc, char *argv[]) {
sysutils::print_gpus();
}
// fix up monitor
update_monitor_on_boot();
// initialize raw input
RI_MGR = std::make_unique<rawinput::RawInputManager>();
for (const auto &device : sextet_devices) {
+11 -10
View File
@@ -224,11 +224,9 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
.category = "Graphics (Full Screen)",
},
{
.title = "Force Monitor Refresh Rate",
.title = "Monitor Refresh Rate",
.name = "graphics-force-refresh",
.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.",
.desc = "Change the refresh rate for the primary monitor before launching the game. It will be restored on exit.",
.type = OptionType::Integer,
.category = "Graphics (Common)",
},
@@ -1847,17 +1845,20 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
},
{
// spice2x_AutoOrientation
.title = "Auto-rotate Display",
.title = "Rotate Monitor",
.name = "sp2x-autoorientation",
.display_name = "autoorientation",
.aliases= "autoorientation",
.desc = "Automatically adjust the orientation of your display when launched. "
"WARNING: game may launch at incorrect refresh rate! Use in combination with "
"-graphics-force-refresh and potentially either -9on12 or full-screen optimizations (FSO) to fix.",
.desc = "Change the orientation of the primary display before launching the game. It will be restored on exit",
.type = OptionType::Enum,
.category = "Graphics (Common)",
// match graphics_orientation
.elements = {{"0", "90 (CW)"}, {"1", "270 (CCW)"}},
// match graphics_orientation enum
.elements = {
{"0", "Portrait"},
{"1", "Portrait, Flipped"},
{"2", "Landscape"},
{"3", "Landscape, Flipped"}
},
},
{
.title = "AVS Log Level",