game_window: don't allow resizing until after boot, fix monitor switching

This commit is contained in:
Hyper 2025-02-07 20:28:57 +00:00
parent e1edd5f35d
commit 70ebdaa685
3 changed files with 11 additions and 1 deletions

View file

@ -38,6 +38,7 @@ PPC_FUNC(sub_824EB490)
SWA::SGlobals::Init();
Registry::Save();
GameWindow::SetResizable(true);
__imp__sub_824EB490(ctx, base);
}

View file

@ -382,6 +382,11 @@ void GameWindow::SetFullscreenCursorVisibility(bool isVisible)
}
}
void GameWindow::SetResizable(bool isResizable)
{
SDL_SetWindowResizable(s_pWindow, (SDL_bool)isResizable);
}
bool GameWindow::IsMaximised()
{
return SDL_GetWindowFlags(s_pWindow) & SDL_WINDOW_MAXIMIZED;
@ -442,7 +447,7 @@ void GameWindow::ResetDimensions()
uint32_t GameWindow::GetWindowFlags()
{
uint32_t flags = SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI;
uint32_t flags = SDL_WINDOW_HIDDEN | SDL_WINDOW_ALLOW_HIGHDPI;
if (Config::WindowState == EWindowState::Maximised)
flags |= SDL_WINDOW_MAXIMIZED;
@ -480,6 +485,9 @@ void GameWindow::SetDisplay(int displayIndex)
if (!IsFullscreen())
return;
if (GetDisplay() == displayIndex)
return;
s_isChangingDisplay = true;
SDL_Rect bounds;

View file

@ -34,6 +34,7 @@ public:
static bool IsFullscreen();
static bool SetFullscreen(bool isEnabled);
static void SetFullscreenCursorVisibility(bool isVisible);
static void SetResizable(bool isResizable);
static bool IsMaximised();
static EWindowState SetMaximised(bool isEnabled);
static SDL_Rect GetDimensions();