mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 06:40: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>();
|
||||
|
||||
Reference in New Issue
Block a user