mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 23:00:42 -07:00
graphics: option to change primary monitor before launching game (#608)
## Description of change Adds `-mainmonitor` option which changes the monitor layout before launching the game. This is much more reliable than the old `-monitor` option which operated at DX9 level. This works for TDJ/UFC subscreens, for example. Rename `-monitor` option to `-dx9mainadapter` to discourage use. `-monitor` will continue to work, of course. Changing of primary monitor happens first before any orientation changes / refresh rate changes, which means those options will result in the logically correct configuration. Create a new option category for `Monitor` (rotate, refresh rate, etc). Add a monitor selection widget for `-mainmonitor` option in the configurator. Improve how we log names of monitors in the log during boot - should be less of "Generic PnP Monitor" after this.
This commit is contained in:
@@ -351,9 +351,9 @@ int main_implementation(int argc, char *argv[]) {
|
||||
GRAPHICS_FORCE_SINGLE_ADAPTER = true;
|
||||
GRAPHICS_PREVENT_SECONDARY_WINDOW = true;
|
||||
}
|
||||
if (options[launcher::Options::DisplayAdapter].is_active() &&
|
||||
options[launcher::Options::DisplayAdapter].value_uint32() != D3DADAPTER_DEFAULT) {
|
||||
D3D9_ADAPTER = options[launcher::Options::DisplayAdapter].value_uint32();
|
||||
if (options[launcher::Options::DX9DisplayAdapter].is_active() &&
|
||||
options[launcher::Options::DX9DisplayAdapter].value_uint32() != D3DADAPTER_DEFAULT) {
|
||||
D3D9_ADAPTER = options[launcher::Options::DX9DisplayAdapter].value_uint32();
|
||||
|
||||
// when we fix up adapter numbers, we only fix the first adapter, and not any subsequent
|
||||
// adapters, so we can't deal with multi-monitor games
|
||||
@@ -374,12 +374,15 @@ int main_implementation(int argc, char *argv[]) {
|
||||
if (options[launcher::Options::AllowEA3Verbose].value_bool()) {
|
||||
avs::ea3::EA3_DEBUG_VERBOSE = true;
|
||||
}
|
||||
|
||||
std::optional<graphics_orientation> monitor_orientation;
|
||||
if (options[launcher::Options::spice2x_AutoOrientation].is_active()) {
|
||||
GRAPHICS_ADJUST_ORIENTATION =
|
||||
monitor_orientation =
|
||||
(graphics_orientation)options[launcher::Options::spice2x_AutoOrientation].value_uint32();
|
||||
} else if (options[launcher::Options::AdjustOrientation].value_bool()) {
|
||||
GRAPHICS_ADJUST_ORIENTATION = ORIENTATION_CW;
|
||||
monitor_orientation = ORIENTATION_CW;
|
||||
}
|
||||
|
||||
if (options[launcher::Options::spice2x_NoD3D9DeviceHook].value_bool()) {
|
||||
D3D9_DEVICE_HOOK_DISABLE = true;
|
||||
// touch emulation gets disabled, might as well turn these on
|
||||
@@ -2134,7 +2137,10 @@ int main_implementation(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
// fix up monitor
|
||||
update_monitor_on_boot();
|
||||
if (options[launcher::Options::PrimaryMonitor].is_active()) {
|
||||
change_primary_monitor(options[launcher::Options::PrimaryMonitor].value_text());
|
||||
}
|
||||
update_monitor_on_boot(monitor_orientation, GRAPHICS_FORCE_REFRESH);
|
||||
|
||||
// initialize raw input
|
||||
RI_MGR = std::make_unique<rawinput::RawInputManager>();
|
||||
|
||||
@@ -23,6 +23,7 @@ static const std::vector<std::string> CATEGORY_ORDER_BASIC = {
|
||||
"Game Options",
|
||||
"Common",
|
||||
"Network",
|
||||
"Monitor",
|
||||
"Graphics (Common)",
|
||||
"Graphics (Full Screen)",
|
||||
"Graphics (Windowed)",
|
||||
@@ -206,9 +207,24 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
|
||||
.category = "Common",
|
||||
},
|
||||
{
|
||||
.title = "Monitor",
|
||||
// PrimaryMonitor
|
||||
.title = "Change Main Monitor",
|
||||
.name = "mainmonitor",
|
||||
.desc = "Changes the primary monitor before launching the game. It will be restored on exit.\n\n"
|
||||
"This may fail to work properly on hybrid laptops with iGPU + dGPU.",
|
||||
.type = OptionType::Text,
|
||||
.setting_name = "\\\\.\\DISPLAY2",
|
||||
.category = "Monitor",
|
||||
.picker = OptionPickerType::Monitor,
|
||||
},
|
||||
{
|
||||
// DX9DisplayAdapter
|
||||
.title = "DX9 Primary Display Adapter Override",
|
||||
.name = "monitor",
|
||||
.desc = "Sets the display that the game will be opened in, for multiple monitors.\n\n"
|
||||
.display_name = "dx9mainadapter",
|
||||
.aliases = "dx9mainadapter",
|
||||
.desc = "Prefer to use Change Main Monitor option instead of this one.\n\n"
|
||||
"Sets the display that the game will be opened in, for multiple monitors.\n\n"
|
||||
"0 is the primary monitor, 1 is the second monitor, and so on.\n\n"
|
||||
"Not all games will respect this. Not recommended for multi-monitor games like Lightning Model / Valkyrie Model modes. "
|
||||
"Disable Full Screen Optimizations for best results.",
|
||||
@@ -216,19 +232,19 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
|
||||
.category = "Graphics (Full Screen)",
|
||||
},
|
||||
{
|
||||
.title = "Only Use One Monitor",
|
||||
.title = "Only Use Main Monitor For Full Screen",
|
||||
.name = "graphics-force-single-adapter",
|
||||
.desc = "Force the graphics device to be opened utilizing only one adapter in multi-monitor systems.\n\n"
|
||||
"May cause unstable framerate and desyncs, especially if monitors have different refresh rates!",
|
||||
.type = OptionType::Bool,
|
||||
.category = "Graphics (Full Screen)",
|
||||
.category = "Monitor",
|
||||
},
|
||||
{
|
||||
.title = "Monitor Refresh Rate",
|
||||
.name = "graphics-force-refresh",
|
||||
.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)",
|
||||
.category = "Monitor",
|
||||
},
|
||||
{
|
||||
// FullscreenResolution
|
||||
@@ -1851,7 +1867,7 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
|
||||
.aliases= "autoorientation",
|
||||
.desc = "Change the orientation of the primary display before launching the game. It will be restored on exit",
|
||||
.type = OptionType::Enum,
|
||||
.category = "Graphics (Common)",
|
||||
.category = "Monitor",
|
||||
// match graphics_orientation enum
|
||||
.elements = {
|
||||
{"0", "Portrait"},
|
||||
|
||||
@@ -26,7 +26,8 @@ namespace launcher {
|
||||
ExecuteScript,
|
||||
CaptureCursor,
|
||||
ShowCursor,
|
||||
DisplayAdapter,
|
||||
PrimaryMonitor,
|
||||
DX9DisplayAdapter,
|
||||
GraphicsForceSingleAdapter,
|
||||
GraphicsForceRefresh,
|
||||
FullscreenResolution,
|
||||
|
||||
Reference in New Issue
Block a user