From 6cd212aac29683bf9d68d7894127d116dbb4aa3b Mon Sep 17 00:00:00 2001 From: bicarus-dev <202771338+bicarus-dev@users.noreply.github.com> Date: Wed, 24 Dec 2025 17:35:15 -0800 Subject: [PATCH] iidx,sdvx: disable subscreen overlay if -monitor is in use (#471) ## Link to GitHub Issue, if one exists #345 ## Description of change If TDJ / VM mode is active AND user is enabled `-monitor` option (and the value isn't 0, the primary monitor) then disable the subscreen overlay, show an error message instead. We're doing this because both games cannot accept emulated touch input if `-monitor` option is in use. There is not much point in displaying the second screen's image, other than to REALLY confuse people when nothing happens when they click on it. ## Testing Tested both games with `-monitor`. --- src/spice2x/games/iidx/iidx.cpp | 6 +++--- src/spice2x/games/iidx/iidx.h | 1 + src/spice2x/games/sdvx/sdvx.cpp | 15 ++++++--------- src/spice2x/games/sdvx/sdvx.h | 9 +++++++++ src/spice2x/launcher/launcher.cpp | 7 ++++++- src/spice2x/launcher/options.cpp | 2 +- src/spice2x/overlay/windows/iidx_sub.cpp | 2 ++ src/spice2x/overlay/windows/sdvx_sub.cpp | 2 ++ 8 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/spice2x/games/iidx/iidx.cpp b/src/spice2x/games/iidx/iidx.cpp index 51d5db4..2376485 100644 --- a/src/spice2x/games/iidx/iidx.cpp +++ b/src/spice2x/games/iidx/iidx.cpp @@ -79,6 +79,7 @@ namespace games::iidx { char IIDXIO_LED_TICKER[10] = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\x00'}; bool IIDXIO_LED_TICKER_READONLY = false; std::mutex IIDX_LED_TICKER_LOCK; + bool IIDX_TDJ_MONITOR_WARNING = false; // io static bool HAS_LIBAIO; // this is how we detect iidx27+ @@ -475,9 +476,8 @@ namespace games::iidx { } // check -monitor + TDJ mode - if (!GRAPHICS_WINDOWED && - options->at(launcher::Options::DisplayAdapter).is_active() && - TDJ_MODE) { + if (!GRAPHICS_WINDOWED && D3D9_ADAPTER.has_value() && TDJ_MODE) { + IIDX_TDJ_MONITOR_WARNING = true; log_warning( "iidx", "\n\n!!! using -monitor option with TDJ is NOT recommended due to known !!!\n" diff --git a/src/spice2x/games/iidx/iidx.h b/src/spice2x/games/iidx/iidx.h index 0ec9662..997d1a7 100644 --- a/src/spice2x/games/iidx/iidx.h +++ b/src/spice2x/games/iidx/iidx.h @@ -33,6 +33,7 @@ namespace games::iidx { extern char IIDXIO_LED_TICKER[10]; extern bool IIDXIO_LED_TICKER_READONLY; extern std::mutex IIDX_LED_TICKER_LOCK; + extern bool IIDX_TDJ_MONITOR_WARNING; constexpr int IIDX_TAPELED_TOTAL = 17; // data mapping diff --git a/src/spice2x/games/sdvx/sdvx.cpp b/src/spice2x/games/sdvx/sdvx.cpp index e25eae7..0e15b3c 100644 --- a/src/spice2x/games/sdvx/sdvx.cpp +++ b/src/spice2x/games/sdvx/sdvx.cpp @@ -52,6 +52,7 @@ namespace games::sdvx { std::optional ASIO_DRIVER = std::nullopt; // states + bool SHOW_VM_MONITOR_WARNING = false; static HKEY real_asio_reg_handle = nullptr; static HKEY real_asio_device_reg_handle = nullptr; @@ -295,12 +296,10 @@ namespace games::sdvx { } #ifdef SPICE64 // SDVX5+ specific code - bool isValkyrieCabinetMode = avs::game::SPEC[0] == 'G' || avs::game::SPEC[0] == 'H'; - auto options = games::get_options(eamuse_get_game()); + this->VALKYRIE_MODEL = avs::game::SPEC[0] == 'G' || avs::game::SPEC[0] == 'H'; // check -monitor + UFC mode - if (!GRAPHICS_WINDOWED && - options->at(launcher::Options::DisplayAdapter).is_active() && - isValkyrieCabinetMode) { + if (!GRAPHICS_WINDOWED && D3D9_ADAPTER.has_value() && this->VALKYRIE_MODEL) { + SHOW_VM_MONITOR_WARNING = true; log_warning( "sdvx", "\n\n!!! using -monitor option with VM mode is NOT recommended due to !!!\n" @@ -330,10 +329,9 @@ namespace games::sdvx { Game::attach(); #ifdef SPICE64 // SDVX5+ specific code - bool isValkyrieCabinetMode = avs::game::SPEC[0] == 'G' || avs::game::SPEC[0] == 'H'; // LCD handle - if (!isValkyrieCabinetMode) { + if (!this->VALKYRIE_MODEL) { devicehook_init(); devicehook_add(new games::shared::LCDHandle()); } @@ -372,8 +370,7 @@ namespace games::sdvx { nvapi_hook::initialize(avs::game::DLL_INSTANCE); } - // check for Valkyrie cabinet mode - if (isValkyrieCabinetMode) { + if (this->VALKYRIE_MODEL) { // hook touch window // in windowed mode, game can accept mouse input on the second screen if (!NATIVETOUCH && !GRAPHICS_WINDOWED) { diff --git a/src/spice2x/games/sdvx/sdvx.h b/src/spice2x/games/sdvx/sdvx.h index 32f5655..98b7440 100644 --- a/src/spice2x/games/sdvx/sdvx.h +++ b/src/spice2x/games/sdvx/sdvx.h @@ -23,6 +23,9 @@ namespace games::sdvx { extern bool BI2X_INITIALIZED; extern SdvxOverlayPosition OVERLAY_POS; + // states + extern bool SHOW_VM_MONITOR_WARNING; + class SDVXGame : public games::Game { public: SDVXGame(); @@ -30,5 +33,11 @@ namespace games::sdvx { virtual void attach() override; virtual void post_attach() override; virtual void detach() override; + private: + // don't be tempted to make this into a public or a global variable + // various modules need to check if VM mode is active and they should + // not depend on the fact that SDVX module is active (since it can be + // inactive on cabs or partial I/O setup) + bool VALKYRIE_MODEL = false; }; } diff --git a/src/spice2x/launcher/launcher.cpp b/src/spice2x/launcher/launcher.cpp index 521decb..18d831e 100644 --- a/src/spice2x/launcher/launcher.cpp +++ b/src/spice2x/launcher/launcher.cpp @@ -344,8 +344,13 @@ int main_implementation(int argc, char *argv[]) { GRAPHICS_FORCE_SINGLE_ADAPTER = true; GRAPHICS_PREVENT_SECONDARY_WINDOW = true; } - if (options[launcher::Options::DisplayAdapter].is_active()) { + if (options[launcher::Options::DisplayAdapter].is_active() && + options[launcher::Options::DisplayAdapter].value_uint32() != D3DADAPTER_DEFAULT) { D3D9_ADAPTER = options[launcher::Options::DisplayAdapter].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 + GRAPHICS_FORCE_SINGLE_ADAPTER = true; } if (options[launcher::Options::CaptureCursor].value_bool()) { GRAPHICS_CAPTURE_CURSOR = true; diff --git a/src/spice2x/launcher/options.cpp b/src/spice2x/launcher/options.cpp index 8a7f814..f3e22e8 100644 --- a/src/spice2x/launcher/options.cpp +++ b/src/spice2x/launcher/options.cpp @@ -207,7 +207,7 @@ static const std::vector OPTION_DEFINITIONS = { .name = "monitor", .desc = "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. Does not work at all with multi-monitor games like TDJ/UFC. " + "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", .type = OptionType::Integer, .category = "Graphics (Full Screen)", diff --git a/src/spice2x/overlay/windows/iidx_sub.cpp b/src/spice2x/overlay/windows/iidx_sub.cpp index 2394941..1f3c1b3 100644 --- a/src/spice2x/overlay/windows/iidx_sub.cpp +++ b/src/spice2x/overlay/windows/iidx_sub.cpp @@ -15,6 +15,8 @@ namespace overlay::windows { this->disabled_message = "Close this overlay and use the second window.\n" "If you don't see the window, double check your DLL type and apply TDJ I/O patches as needed."; + } else if (games::iidx::IIDX_TDJ_MONITOR_WARNING) { + this->disabled_message = "TDJ mode subscreen overlay is not compatible with -monitor option"; } float size = 0.5f; diff --git a/src/spice2x/overlay/windows/sdvx_sub.cpp b/src/spice2x/overlay/windows/sdvx_sub.cpp index 909a0c8..b730f32 100644 --- a/src/spice2x/overlay/windows/sdvx_sub.cpp +++ b/src/spice2x/overlay/windows/sdvx_sub.cpp @@ -13,6 +13,8 @@ namespace overlay::windows { bool isValkyrieCabinetMode = avs::game::SPEC[0] == 'G' || avs::game::SPEC[0] == 'H'; if (!isValkyrieCabinetMode) { this->disabled_message = "Valkyrie Model mode is not enabled!"; + } else if (games::sdvx::SHOW_VM_MONITOR_WARNING) { + this->disabled_message = "VM mode subscreen overlay is not compatible with -monitor option"; } else if (GRAPHICS_WINDOWED) { if (GRAPHICS_PREVENT_SECONDARY_WINDOW) { this->disabled_message = "Subscreen has been disabled by the user (-sdvxnosub).";