diff --git a/src/spice2x/hooks/graphics/graphics.h b/src/spice2x/hooks/graphics/graphics.h index 8302458..9916c4f 100644 --- a/src/spice2x/hooks/graphics/graphics.h +++ b/src/spice2x/hooks/graphics/graphics.h @@ -102,4 +102,5 @@ void graphics_update_window_style(HWND hWnd); void graphics_update_z_order(HWND hWnd, bool always_on_top); void graphics_move_resize_window(HWND hWnd); bool graphics_window_change_crashes_game(); +bool graphics_window_resize_breaks_game(); void graphics_load_windowed_subscreen_parameters(); diff --git a/src/spice2x/hooks/graphics/graphics_windowed.cpp b/src/spice2x/hooks/graphics/graphics_windowed.cpp index 8541e34..0d99475 100644 --- a/src/spice2x/hooks/graphics/graphics_windowed.cpp +++ b/src/spice2x/hooks/graphics/graphics_windowed.cpp @@ -1,6 +1,7 @@ #include "graphics.h" #include "avs/game.h" +#include "games/gitadora/gitadora.h" #include "cfg/screen_resize.h" #include "overlay/overlay.h" #include "util/logging.h" @@ -85,6 +86,12 @@ void graphics_capture_initial_window(HWND hWnd) { // ensure frame size is captured graphics_wm_style_changed(hWnd, false); + // if the game is not compatible, ignore user-supplied values and keep the current size + if (graphics_window_resize_breaks_game()) { + cfg::SCREENRESIZE->client_width = client_w; + cfg::SCREENRESIZE->client_height = client_h; + } + // if there was no user-supplied dimension, seed it with the current size // so that the next resize operation will work if (cfg::SCREENRESIZE->client_width == 0) { @@ -392,6 +399,9 @@ void graphics_update_window_style(HWND hWnd) { break; case cfg::WindowDecorationMode::ResizableFrame: style |= WS_OVERLAPPEDWINDOW; + if (graphics_window_resize_breaks_game()) { + style &= ~WS_SIZEBOX; + } break; case cfg::WindowDecorationMode::Default: default: @@ -493,3 +503,24 @@ bool graphics_window_change_crashes_game() { }); return result; } + +bool graphics_window_resize_breaks_game() { + bool is_gitadora = avs::game::is_model({ "J32", "J33", "K32", "K33", "L32", "L33", "M32" }); + bool is_arena = games::gitadora::is_arena_model(); + // for whatever reason, gitadora games on dx/sd/sd2 cabs behave poorly when window is resized + // (eihter at launch or while it's running) + // usually results in: soft lock during scene transtions or really long transitions, + // backgrounds of menus not rendering, etc. + bool result = is_gitadora && !is_arena; + + static std::once_flag flag; + std::call_once(flag, [&result]() { + if (result) { + log_warning( + "graphics-windowed", + "ignoring changes to window size due to incompatibility with this game"); + } + }); + + return result; +} diff --git a/src/spice2x/overlay/windows/screen_resize.cpp b/src/spice2x/overlay/windows/screen_resize.cpp index ed5e52f..e08bad8 100644 --- a/src/spice2x/overlay/windows/screen_resize.cpp +++ b/src/spice2x/overlay/windows/screen_resize.cpp @@ -233,6 +233,14 @@ namespace overlay::windows { bool changed = false; const uint32_t step = 1; const uint32_t step_fast = 10; + + if (graphics_window_resize_breaks_game()) { + ImGui::TextColored(ImVec4(1, 0.5f, 0.5f, 1.f), + "GITADORA tends to hang or have graphical\n" + "glitches when window is resized; resize\n" + "controls are disabled."); + } + ImGui::BeginDisabled(graphics_window_resize_breaks_game()); ImGui::BeginDisabled(cfg::SCREENRESIZE->client_keep_aspect_ratio); ImGui::InputScalar( "Width", @@ -248,6 +256,7 @@ namespace overlay::windows { &cfg::SCREENRESIZE->client_height, &step, &step_fast, nullptr); changed |= ImGui::IsItemDeactivatedAfterEdit(); + ImGui::EndDisabled(); ImGui::InputScalar( "X Offset",