rb: prevent window moves and resizes in windowed mode (#532)

## Link to GitHub Issue, if one exists
n/a

## Description of change
Disable all window options that change dimensions or position as they
cause problems with touch overlay in windowed mode. Always On Top is the
only thing that's still possible.

## Testing
This commit is contained in:
bicarus
2026-01-24 18:49:16 -08:00
committed by GitHub
parent 2f538fe2e4
commit 1d1981fcde
3 changed files with 81 additions and 42 deletions
+3 -1
View File
@@ -101,6 +101,8 @@ void graphics_capture_initial_window(HWND hWnd);
void graphics_update_window_style(HWND hWnd); void graphics_update_window_style(HWND hWnd);
void graphics_update_z_order(HWND hWnd, bool always_on_top); void graphics_update_z_order(HWND hWnd, bool always_on_top);
void graphics_move_resize_window(HWND hWnd); void graphics_move_resize_window(HWND hWnd);
bool graphics_window_change_crashes_game(); bool graphics_window_options_breaks_game();
bool graphics_window_decoration_change_crashes_game();
bool graphics_window_resize_breaks_game(); bool graphics_window_resize_breaks_game();
bool graphics_window_move_and_resize_breaks_game();
void graphics_load_windowed_subscreen_parameters(); void graphics_load_windowed_subscreen_parameters();
@@ -96,6 +96,9 @@ void graphics_capture_initial_window(HWND hWnd) {
cfg::SCREENRESIZE->client_width = client_w; cfg::SCREENRESIZE->client_width = client_w;
cfg::SCREENRESIZE->client_height = client_h; cfg::SCREENRESIZE->client_height = client_h;
} }
if (graphics_window_move_and_resize_breaks_game()) {
cfg::SCREENRESIZE->enable_window_resize = false;
}
// if there was no user-supplied dimension, seed it with the current size // if there was no user-supplied dimension, seed it with the current size
// so that the next resize operation will work // so that the next resize operation will work
@@ -386,7 +389,7 @@ void graphics_update_window_style(HWND hWnd) {
if (!GRAPHICS_WINDOWED) { if (!GRAPHICS_WINDOWED) {
return; return;
} }
if (graphics_window_change_crashes_game()) { if (graphics_window_decoration_change_crashes_game()) {
return; return;
} }
@@ -496,12 +499,19 @@ void graphics_move_resize_window(HWND hWnd) {
log_debug("graphics-windowed", "graphics_move_resize_window returned"); log_debug("graphics-windowed", "graphics_move_resize_window returned");
} }
bool graphics_window_change_crashes_game() { bool graphics_window_decoration_change_crashes_game() {
static std::once_flag flag; static std::once_flag flag;
static bool result = false; static bool result = false;
std::call_once(flag, []() { std::call_once(flag, []() {
// ddr crashes when frame style changes // ddr crashes when frame style changes
result = avs::game::is_model("MDX"); result = avs::game::is_model("MDX");
// changing window decoration also changes dimensions and position
// so this must be prevented
if (graphics_window_move_and_resize_breaks_game()) {
result = true;
}
if (result) { if (result) {
log_warning( log_warning(
"graphics-windowed", "graphics-windowed",
@@ -511,14 +521,33 @@ bool graphics_window_change_crashes_game() {
return result; return result;
} }
bool graphics_window_move_and_resize_breaks_game() {
static std::once_flag flag;
static bool result = false;
std::call_once(flag, []() {
// games like reflec beat in use spice touch overlay for windowed mode
// and mouse input breaks if window is moved as the overlay does not
// currently support window moves/resizes
result = avs::game::is_model({"KBR", "LBR", "MBR"});
if (result) {
log_warning(
"graphics-windowed",
"ignoring changes to window properties due to incompatibility with this game");
}
});
return result;
}
bool graphics_window_resize_breaks_game() { 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 // for whatever reason, gitadora games on dx/sd/sd2 cabs behave poorly when window is resized
// (eihter at launch or while it's running) // (eihter at launch or while it's running)
// usually results in: soft lock during scene transtions or really long transitions, // usually results in: soft lock during scene transtions or really long transitions,
// backgrounds of menus not rendering, etc. // backgrounds of menus not rendering, etc.
bool result = is_gitadora && !is_arena; bool is_gitadora = avs::game::is_model({ "J32", "J33", "K32", "K33", "L32", "L33", "M32" });
bool is_arena = games::gitadora::is_arena_model();
bool result = graphics_window_move_and_resize_breaks_game() || (is_gitadora && !is_arena);
static std::once_flag flag; static std::once_flag flag;
std::call_once(flag, [&result]() { std::call_once(flag, [&result]() {
+15 -7
View File
@@ -202,7 +202,7 @@ namespace overlay::windows {
return; return;
} }
ImGui::BeginDisabled(graphics_window_change_crashes_game()); ImGui::BeginDisabled(graphics_window_decoration_change_crashes_game());
if (ImGui::Combo( if (ImGui::Combo(
"Window Style", "Window Style",
&cfg::SCREENRESIZE->window_decoration, &cfg::SCREENRESIZE->window_decoration,
@@ -227,28 +227,31 @@ namespace overlay::windows {
"Reduces pixelated scaling artifacts. Works great on some games, but completely broken on others.\n\n" "Reduces pixelated scaling artifacts. Works great on some games, but completely broken on others.\n\n"
"This can't be changed in-game; instead, set -windowscale option in spicecfg and restart."); "This can't be changed in-game; instead, set -windowscale option in spicecfg and restart.");
ImGui::BeginDisabled(graphics_window_move_and_resize_breaks_game());
{
ImGui::Checkbox("Keep Aspect Ratio", &cfg::SCREENRESIZE->client_keep_aspect_ratio); ImGui::Checkbox("Keep Aspect Ratio", &cfg::SCREENRESIZE->client_keep_aspect_ratio);
ImGui::Checkbox("Manual window move/resize", &cfg::SCREENRESIZE->enable_window_resize); ImGui::Checkbox("Manual window move/resize", &cfg::SCREENRESIZE->enable_window_resize);
}
ImGui::EndDisabled();
ImGui::BeginDisabled(!cfg::SCREENRESIZE->enable_window_resize); ImGui::BeginDisabled(!cfg::SCREENRESIZE->enable_window_resize);
bool changed = false; bool changed = false;
const uint32_t step = 1; const uint32_t step = 1;
const uint32_t step_fast = 10; 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(graphics_window_resize_breaks_game());
{
ImGui::BeginDisabled(cfg::SCREENRESIZE->client_keep_aspect_ratio); ImGui::BeginDisabled(cfg::SCREENRESIZE->client_keep_aspect_ratio);
{
ImGui::InputScalar( ImGui::InputScalar(
"Width", "Width",
ImGuiDataType_U32, ImGuiDataType_U32,
&cfg::SCREENRESIZE->client_width, &cfg::SCREENRESIZE->client_width,
&step, &step_fast, nullptr); &step, &step_fast, nullptr);
changed |= ImGui::IsItemDeactivatedAfterEdit(); changed |= ImGui::IsItemDeactivatedAfterEdit();
}
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::InputScalar( ImGui::InputScalar(
@@ -257,8 +260,11 @@ namespace overlay::windows {
&cfg::SCREENRESIZE->client_height, &cfg::SCREENRESIZE->client_height,
&step, &step_fast, nullptr); &step, &step_fast, nullptr);
changed |= ImGui::IsItemDeactivatedAfterEdit(); changed |= ImGui::IsItemDeactivatedAfterEdit();
}
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::BeginDisabled(graphics_window_move_and_resize_breaks_game());
{
ImGui::InputScalar( ImGui::InputScalar(
"X Offset", "X Offset",
ImGuiDataType_S32, ImGuiDataType_S32,
@@ -272,6 +278,8 @@ namespace overlay::windows {
&cfg::SCREENRESIZE->window_offset_y, &cfg::SCREENRESIZE->window_offset_y,
&step, &step_fast, nullptr); &step, &step_fast, nullptr);
changed |= ImGui::IsItemDeactivatedAfterEdit(); changed |= ImGui::IsItemDeactivatedAfterEdit();
}
ImGui::EndDisabled();
if (changed) { if (changed) {
if (cfg::SCREENRESIZE->client_keep_aspect_ratio) { if (cfg::SCREENRESIZE->client_keep_aspect_ratio) {