diff --git a/src/spice2x/games/gitadora/gitadora.cpp b/src/spice2x/games/gitadora/gitadora.cpp index 184740b..516024e 100644 --- a/src/spice2x/games/gitadora/gitadora.cpp +++ b/src/spice2x/games/gitadora/gitadora.cpp @@ -27,6 +27,7 @@ namespace games::gitadora { bool P2_LEFTY = false; std::optional SUBSCREEN_OVERLAY_SIZE; std::optional PICK_ALGO = socd::SocdAlgorithm::PreferRecent; + std::optional ARENA_WINDOW_COUNT = std::nullopt; /* * Prevent GitaDora from creating folders on F drive @@ -223,12 +224,6 @@ namespace games::gitadora { } #endif - // arena model launches a tiny window yet backbuffer at 4k, resulting in unusable overlay - // force scaling to make things usable - if (!overlay::UI_SCALE_PERCENT.has_value() && is_arena_model() && !cfg::CONFIGURATOR_STANDALONE) { - overlay::UI_SCALE_PERCENT = 250; - } - // for guitar wail SOCD cleaning socd::ALGORITHM = socd::SocdAlgorithm::PreferRecent; @@ -241,14 +236,46 @@ namespace games::gitadora { #if SPICE64 && !SPICE_XP - if (is_arena_model() && !GRAPHICS_WINDOWED && !GRAPHICS_FORCE_SINGLE_ADAPTER) { - const auto &monitors = sysutils::enumerate_monitors(); - const size_t active_count = monitors.size(); - log_info("gitadora", "arena model: detected {} active monitor(s)", active_count); - if (active_count < 4) { - log_info("gitadora", "arena model: enable single monitor mode due to insufficient monitors"); - GRAPHICS_FORCE_SINGLE_ADAPTER = true; - GRAPHICS_PREVENT_SECONDARY_WINDOW = true; + if (is_arena_model()) { + // in full screen, if single-adapter option is checked, it's functionally + // the same as forcing a single monitor + if (!GRAPHICS_WINDOWED && GRAPHICS_FORCE_SINGLE_ADAPTER) { + ARENA_WINDOW_COUNT = 1; + } + + // figure out default settings if user didn't provide one + if (!ARENA_WINDOW_COUNT.has_value()) { + if (!GRAPHICS_WINDOWED && sysutils::enumerate_monitors().size() < 4) { + log_info("gitadora", "arena model: <4 monitors, defaulting to single window mode"); + ARENA_WINDOW_COUNT = 1; + } else { + ARENA_WINDOW_COUNT = 4; + } + } + + const int count = ARENA_WINDOW_COUNT.value(); + switch (count) { + case 1: + log_info("gitadora", "arena model: single-window mode"); + GRAPHICS_FORCE_SINGLE_ADAPTER = true; + GRAPHICS_PREVENT_SECONDARY_WINDOWS = true; + break; + case 2: + if (!GRAPHICS_WINDOWED) { + log_fatal( + "gitadora", + "arena model: 2-window mode is not supported in fullscreen, choose 1 or 4"); + } + log_info("gitadora", "arena model: two-window mode"); + GRAPHICS_GITADORA_HIDE_SIDE_WINDOWS = true; + break; + case 4: + log_info("gitadora", "arena model: four-window mode"); + break; + default: + log_fatal( + "gitadora", + "arena model: unsupported window count: {}", count); } } @@ -527,6 +554,13 @@ namespace games::gitadora { void GitaDoraGame::attach() { Game::attach(); + // arena model launches a tiny window yet backbuffer at 4k, resulting in unusable overlay + // force scaling to make things usable + if (!overlay::UI_SCALE_PERCENT.has_value() && is_arena_model()) { + log_info("gitadora", "forcing UI scale to 250% for arena model"); + overlay::UI_SCALE_PERCENT = 250; + } + // modules HMODULE sharepj_module = libutils::try_module("libshare-pj.dll"); HMODULE bmsd2_module = libutils::try_module("libbmsd2.dll"); @@ -582,7 +616,7 @@ namespace games::gitadora { hooks::audio::mme::init(avs::game::DLL_INSTANCE); // monitor/touch hooks (windowed or full screen) - if (GRAPHICS_FORCE_SINGLE_ADAPTER || GRAPHICS_PREVENT_SECONDARY_WINDOW) { + if (GRAPHICS_PREVENT_SECONDARY_WINDOWS) { // enable touch hook for subscreen overlay wintouchemu::FORCE = true; wintouchemu::INJECT_MOUSE_AS_WM_TOUCH = true; diff --git a/src/spice2x/games/gitadora/gitadora.h b/src/spice2x/games/gitadora/gitadora.h index f3662ec..451c370 100644 --- a/src/spice2x/games/gitadora/gitadora.h +++ b/src/spice2x/games/gitadora/gitadora.h @@ -15,6 +15,7 @@ namespace games::gitadora { extern bool P2_LEFTY; extern std::optional SUBSCREEN_OVERLAY_SIZE; extern std::optional PICK_ALGO; + extern std::optional ARENA_WINDOW_COUNT; class GitaDoraGame : public games::Game { public: diff --git a/src/spice2x/hooks/graphics/backends/d3d9/d3d9_backend.cpp b/src/spice2x/hooks/graphics/backends/d3d9/d3d9_backend.cpp index a361024..4037ba2 100644 --- a/src/spice2x/hooks/graphics/backends/d3d9/d3d9_backend.cpp +++ b/src/spice2x/hooks/graphics/backends/d3d9/d3d9_backend.cpp @@ -718,7 +718,7 @@ HRESULT STDMETHODCALLTYPE WrappedIDirect3D9::GetDeviceCaps(UINT Adapter, D3DDEVT } // in windowed mode, LDJ will always launch two windows, no special handling needed here } else if (avs::game::is_model("KFC")) { - if (GRAPHICS_WINDOWED && GRAPHICS_PREVENT_SECONDARY_WINDOW) { + if (GRAPHICS_WINDOWED && GRAPHICS_PREVENT_SECONDARY_WINDOWS) { // user wants windowed mode but does not want subscreen at all pCaps->NumberOfAdaptersInGroup = 1; } else { @@ -1480,9 +1480,7 @@ void graphics_d3d9_on_present( // for IIDX TDJ / SDVX UFC, handle subscreen const bool is_vm = games::sdvx::is_valkyrie_model(); const bool is_tdj = avs::game::is_model("LDJ") && games::iidx::TDJ_MODE; - const bool is_gfdm_arena = games::gitadora::is_arena_model() && - (GRAPHICS_FORCE_SINGLE_ADAPTER || GRAPHICS_PREVENT_SECONDARY_WINDOW); - + const bool is_gfdm_arena = games::gitadora::is_arena_model() && GRAPHICS_PREVENT_SECONDARY_WINDOWS; const bool is_pika = games::popn::is_pikapika_model(); if (is_vm || is_tdj || is_gfdm_arena || is_pika) { graphics_d3d9_ldj_on_present(wrapped_device); diff --git a/src/spice2x/hooks/graphics/backends/d3d9/d3d9_device.cpp b/src/spice2x/hooks/graphics/backends/d3d9/d3d9_device.cpp index d2e4a55..38a2c37 100644 --- a/src/spice2x/hooks/graphics/backends/d3d9/d3d9_device.cpp +++ b/src/spice2x/hooks/graphics/backends/d3d9/d3d9_device.cpp @@ -260,9 +260,8 @@ HRESULT STDMETHODCALLTYPE WrappedIDirect3DDevice9::CreateAdditionalSwapChain( create_swap_chain = true; } else if (games::gitadora::is_arena_model() && - (GRAPHICS_FORCE_SINGLE_ADAPTER || - GRAPHICS_PREVENT_SECONDARY_WINDOW || - GRAPHICS_GITADORA_HIDE_SIDE_WINDOWS)) { + (GRAPHICS_PREVENT_SECONDARY_WINDOWS || GRAPHICS_GITADORA_HIDE_SIDE_WINDOWS)) { + if (pPresentationParameters->BackBufferWidth == 800) { // SMALL (subscreen) create_swap_chain = true; @@ -275,7 +274,7 @@ HRESULT STDMETHODCALLTYPE WrappedIDirect3DDevice9::CreateAdditionalSwapChain( index = 2; } create_fake_swap_chain = GRAPHICS_GITADORA_HIDE_SIDE_WINDOWS && - !GRAPHICS_PREVENT_SECONDARY_WINDOW; + !GRAPHICS_PREVENT_SECONDARY_WINDOWS; } else { log_warning("graphics::d3d9", "unknown swap chain detected in CreateAdditionalSwapChain"); } diff --git a/src/spice2x/hooks/graphics/graphics.cpp b/src/spice2x/hooks/graphics/graphics.cpp index baed618..ca41aa0 100644 --- a/src/spice2x/hooks/graphics/graphics.cpp +++ b/src/spice2x/hooks/graphics/graphics.cpp @@ -78,7 +78,7 @@ UINT GRAPHICS_FORCE_REFRESH = 0; std::optional GRAPHICS_FORCE_REFRESH_SUB; std::optional GRAPHICS_FORCE_VSYNC_BUFFER; bool GRAPHICS_FORCE_SINGLE_ADAPTER = false; -bool GRAPHICS_PREVENT_SECONDARY_WINDOW = false; +bool GRAPHICS_PREVENT_SECONDARY_WINDOWS = false; bool GRAPHICS_GITADORA_HIDE_SIDE_WINDOWS = false; graphics_dx9on12_state GRAPHICS_9_ON_12_STATE = DX9ON12_AUTO; bool GRAPHICS_9_ON_12_REQUESTED_BY_GAME = false; @@ -426,7 +426,7 @@ static HWND WINAPI CreateWindowExA_hook(DWORD dwExStyle, LPCSTR lpClassName, LPC } // only hook touch window if multiple windows are allowed - if (is_gfdm_sub_window && GRAPHICS_WINDOWED && !GRAPHICS_PREVENT_SECONDARY_WINDOW) { + if (is_gfdm_sub_window && GRAPHICS_WINDOWED && !GRAPHICS_PREVENT_SECONDARY_WINDOWS) { GFDM_SUBSCREEN_WINDOW = result; graphics_hook_subscreen_window(GFDM_SUBSCREEN_WINDOW); } @@ -439,7 +439,7 @@ static HWND WINAPI CreateWindowExA_hook(DWORD dwExStyle, LPCSTR lpClassName, LPC if (is_popn_sub_window) { POPN_SUBSCREEN_WINDOW = result; - if (!GRAPHICS_PREVENT_SECONDARY_WINDOW) { + if (!GRAPHICS_PREVENT_SECONDARY_WINDOWS) { graphics_hook_subscreen_window(POPN_SUBSCREEN_WINDOW); } } @@ -713,7 +713,7 @@ static BOOL WINAPI SetWindowPos_hook(HWND hWnd, HWND hWndInsertAfter, static BOOL WINAPI ShowWindow_hook(HWND hWnd, int nCmdShow) { if (games::gitadora::is_arena_model() && - GRAPHICS_PREVENT_SECONDARY_WINDOW && + GRAPHICS_PREVENT_SECONDARY_WINDOWS && hWnd != GRAPHICS_HOOKED_WINDOW) { log_info("graphics", "ShowWindow_hook - hiding sub window {}", fmt::ptr(hWnd)); return true; @@ -727,7 +727,7 @@ static BOOL WINAPI ShowWindow_hook(HWND hWnd, int nCmdShow) { } if (games::popn::is_pikapika_model() && - GRAPHICS_PREVENT_SECONDARY_WINDOW && + GRAPHICS_PREVENT_SECONDARY_WINDOWS && hWnd == POPN_SUBSCREEN_WINDOW) { log_info("graphics", "ShowWindow_hook - hiding sub window {}", fmt::ptr(hWnd)); return true; diff --git a/src/spice2x/hooks/graphics/graphics.h b/src/spice2x/hooks/graphics/graphics.h index bcaf1bb..816cb62 100644 --- a/src/spice2x/hooks/graphics/graphics.h +++ b/src/spice2x/hooks/graphics/graphics.h @@ -38,7 +38,7 @@ extern UINT GRAPHICS_FORCE_REFRESH; extern std::optional GRAPHICS_FORCE_REFRESH_SUB; extern std::optional GRAPHICS_FORCE_VSYNC_BUFFER; extern bool GRAPHICS_FORCE_SINGLE_ADAPTER; -extern bool GRAPHICS_PREVENT_SECONDARY_WINDOW; +extern bool GRAPHICS_PREVENT_SECONDARY_WINDOWS; extern bool GRAPHICS_GITADORA_HIDE_SIDE_WINDOWS; extern std::optional> GRAPHICS_FS_CUSTOM_RESOLUTION; extern std::optional> GRAPHICS_FS_CUSTOM_RESOLUTION_SUB; diff --git a/src/spice2x/launcher/launcher.cpp b/src/spice2x/launcher/launcher.cpp index 9e5137c..feb41de 100644 --- a/src/spice2x/launcher/launcher.cpp +++ b/src/spice2x/launcher/launcher.cpp @@ -375,7 +375,7 @@ int main_implementation(int argc, char *argv[]) { } if (options[launcher::Options::spice2x_SDVXNoSub].value_bool()) { GRAPHICS_FORCE_SINGLE_ADAPTER = true; - GRAPHICS_PREVENT_SECONDARY_WINDOW = true; + GRAPHICS_PREVENT_SECONDARY_WINDOWS = true; } if (options[launcher::Options::DXDisplayAdapter].is_active() && options[launcher::Options::DXDisplayAdapter].value_uint32() != D3DADAPTER_DEFAULT) { @@ -628,7 +628,7 @@ int main_implementation(int argc, char *argv[]) { } if (options[launcher::Options::PopnNoSub].value_bool()) { GRAPHICS_FORCE_SINGLE_ADAPTER = true; - GRAPHICS_PREVENT_SECONDARY_WINDOW = true; + GRAPHICS_PREVENT_SECONDARY_WINDOWS = true; } if (options[launcher::Options::PopnSubMonitorOverride].is_active()) { sysutils::SECOND_MONITOR_OVERRIDE = options[launcher::Options::PopnSubMonitorOverride].value_text(); @@ -645,27 +645,22 @@ int main_implementation(int argc, char *argv[]) { if (options[launcher::Options::GitaDoraCabinetType].is_active()) { games::gitadora::CAB_TYPE = options[launcher::Options::GitaDoraCabinetType].value_uint32(); } - if (options[launcher::Options::GitaDoraArenaWindowLayout].is_active()) { - if (GRAPHICS_WINDOWED) { - const auto window_count = options[launcher::Options::GitaDoraArenaWindowLayout].value_uint32(); - if (window_count == 1) { - GRAPHICS_PREVENT_SECONDARY_WINDOW = true; - } else if (window_count == 2) { - GRAPHICS_GITADORA_HIDE_SIDE_WINDOWS = true; - } - } else { - log_warning("launcher", "-gdawindows only applies with -w; ignoring GitaDora Arena windowed layout"); - } - } + + // gitadora arena layout if (options[launcher::Options::GitaDoraArenaSingleWindow].value_bool()) { - if (GRAPHICS_WINDOWED) { - GRAPHICS_PREVENT_SECONDARY_WINDOW = true; - GRAPHICS_GITADORA_HIDE_SIDE_WINDOWS = false; - } else { - GRAPHICS_FORCE_SINGLE_ADAPTER = true; - GRAPHICS_PREVENT_SECONDARY_WINDOW = true; + games::gitadora::ARENA_WINDOW_COUNT = 1; + } + if (options[launcher::Options::GitaDoraArenaWindowLayout].is_active()) { + const auto window_count = options[launcher::Options::GitaDoraArenaWindowLayout].value_text(); + if (window_count == "1") { + games::gitadora::ARENA_WINDOW_COUNT = 1; + } else if (window_count == "2") { + games::gitadora::ARENA_WINDOW_COUNT = 2; + } else if (window_count == "4") { + games::gitadora::ARENA_WINDOW_COUNT = 4; } } + if (options[launcher::Options::GitaDoraWailHold].is_active()) { socd::TILT_HOLD_MS = options[launcher::Options::GitaDoraWailHold].value_uint32(); } diff --git a/src/spice2x/launcher/options.cpp b/src/spice2x/launcher/options.cpp index f22ab53..3f0bba6 100644 --- a/src/spice2x/launcher/options.cpp +++ b/src/spice2x/launcher/options.cpp @@ -1094,32 +1094,34 @@ static const std::vector OPTION_DEFINITIONS = { }, { // GitaDoraArenaSingleWindow - .title = "GitaDora Arena Disable Subscreens (EXPERIMENTAL)", + .title = "GitaDora Arena Disable Subscreens (DEPRECATED - use -gdawindows)", .name = "gdaonewindow", - .desc = "For Arena Model:\n\n" + .desc = "DEPRECATED - use -gdawindows.\n\n" + "For Arena Model:\n\n" "Windowed mode: instead of 4 windows, create 1 window.\n\n" "Fullscreen mode: instead of requiring 4 monitors, use only the primary monitor. WARNING: requires 4K monitor.\n\n" "To access the subscreen, use the subscreen overlay.", .type = OptionType::Bool, + .hidden = true, .game_name = "GitaDora", .category = "Game Options", }, { // GitaDoraArenaWindowLayout - .title = "GitaDora Arena Windowed Layout (EXPERIMENTAL)", - .name = "gdawindows", - .desc = "For Arena Model windowed mode (-w): select how many windows to create.\n\n" - "4 windows: main + LEFT + RIGHT + SMALL.\n\n" - "2 windows: main + SMALL.\n\n" + .title = "GitaDora Arena Layout (EXPERIMENTAL)", + .name = "gdalayout", + .desc = "For Arena Model: select how many windows to create.\n\n" "1 window: main only; use the subscreen overlay for SMALL.\n\n" - "Ignored in fullscreen mode.", + "2 windows: main + SMALL. Note: currently only works for windowed mode, broken for fullscreen.\n\n" + "4 windows: main + LEFT + RIGHT + SMALL. Fullscreen requires exactly 4 monitors in the " + "right resolution; see wiki for details.", .type = OptionType::Enum, .game_name = "GitaDora", .category = "Game Options", .elements = { - {"4", "4 windows"}, - {"2", "2 windows"}, {"1", "1 window"}, + {"2", "2 windows"}, + {"4", "4 windows"} }, }, { diff --git a/src/spice2x/misc/wintouchemu.cpp b/src/spice2x/misc/wintouchemu.cpp index 0432925..8b1eb42 100644 --- a/src/spice2x/misc/wintouchemu.cpp +++ b/src/spice2x/misc/wintouchemu.cpp @@ -416,7 +416,7 @@ namespace wintouchemu { // same as iidx case above log_info("wintouchemu", "use mouse cursor API for popn overlay subscreen"); USE_MOUSE = true; - } else if (games::gitadora::is_arena_model() && GRAPHICS_PREVENT_SECONDARY_WINDOW) { + } else if (games::gitadora::is_arena_model() && GRAPHICS_PREVENT_SECONDARY_WINDOWS) { log_info("wintouchemu", "use mouse cursor API for gitadora overlay subscreen"); USE_MOUSE = true; } else { diff --git a/src/spice2x/overlay/windows/gfdm_sub.cpp b/src/spice2x/overlay/windows/gfdm_sub.cpp index 201293d..116bc69 100644 --- a/src/spice2x/overlay/windows/gfdm_sub.cpp +++ b/src/spice2x/overlay/windows/gfdm_sub.cpp @@ -11,7 +11,7 @@ namespace overlay::windows { if (!games::gitadora::is_arena_model()) { this->disabled_message = "Requires Arena Model!"; - } else if (!GRAPHICS_PREVENT_SECONDARY_WINDOW) { + } else if (!GRAPHICS_PREVENT_SECONDARY_WINDOWS) { if (GRAPHICS_WINDOWED) { this->disabled_message = "Use the dedicated subscreen window!"; } else { diff --git a/src/spice2x/overlay/windows/popn_sub.cpp b/src/spice2x/overlay/windows/popn_sub.cpp index 8bfaea7..5a88975 100644 --- a/src/spice2x/overlay/windows/popn_sub.cpp +++ b/src/spice2x/overlay/windows/popn_sub.cpp @@ -15,7 +15,7 @@ namespace overlay::windows { this->disabled_message = "Game did not launch as Pikapika Pop-kun (invalid )!"; } else if (games::popn::SHOW_PIKA_MONITOR_WARNING) { this->disabled_message = "Subscreen overlay is not compatible with -dxmainadapter option, use -mainmonitor instead"; - } else if (GRAPHICS_WINDOWED && !GRAPHICS_PREVENT_SECONDARY_WINDOW) { + } else if (GRAPHICS_WINDOWED && !GRAPHICS_PREVENT_SECONDARY_WINDOWS) { this->disabled_message = "Subscren overlay was not enabled in spicecfg. Use the second window (ALT+TAB)."; } diff --git a/src/spice2x/overlay/windows/sdvx_sub.cpp b/src/spice2x/overlay/windows/sdvx_sub.cpp index 5c28f94..a7081e1 100644 --- a/src/spice2x/overlay/windows/sdvx_sub.cpp +++ b/src/spice2x/overlay/windows/sdvx_sub.cpp @@ -15,7 +15,7 @@ namespace overlay::windows { } else if (games::sdvx::SHOW_VM_MONITOR_WARNING) { this->disabled_message = "VM mode subscreen overlay is not compatible with -dxmainadapter option, use -mainmonitor instead"; } else if (GRAPHICS_WINDOWED) { - if (GRAPHICS_PREVENT_SECONDARY_WINDOW) { + if (GRAPHICS_PREVENT_SECONDARY_WINDOWS) { this->disabled_message = "Subscreen has been disabled by the user (-sdvxnosub)."; } else { this->disabled_message = "Overlay unavailable in windowed mode! Use the second window instead. (ALT+TAB)";