Fix debug assert that'd occur when closing the debug menu

Closing the settings window will immediately flush a temporary 0, 0 value it writes for the size which gets overwritten by the MainWindow a few seconds later.

In the code, -1 is considered the "off" state, and 0 is considered a "it should be saved, but only whenever the value is available". The save gamepad size/pos option already worked like this new behavior, since you might enable the option but not (previously) have it open yet. When encountering a 0 as the size, it'll just use the default window size of Cemu.
This commit is contained in:
Crementif 2025-07-16 16:14:55 +02:00
parent 2d74bcfbfa
commit 42ff3ad468
2 changed files with 1 additions and 2 deletions

View file

@ -1299,7 +1299,7 @@ void MainWindow::LoadSettings()
if (config.window_position != Vector2i{ -1,-1 }) if (config.window_position != Vector2i{ -1,-1 })
this->SetPosition({ config.window_position.x, config.window_position.y }); this->SetPosition({ config.window_position.x, config.window_position.y });
if (config.window_size != Vector2i{ -1,-1 }) if (config.window_size.x > 0 && config.window_size.y > 0)
{ {
this->SetSize({ config.window_size.x, config.window_size.y }); this->SetSize({ config.window_size.x, config.window_size.y });

View file

@ -136,7 +136,6 @@ void wxCemuConfig::Save(XMLConfigParser& config)
wpos.set<sint32>("y", window_position.y); wpos.set<sint32>("y", window_position.y);
auto wsize = config.set("window_size"); auto wsize = config.set("window_size");
wsize.set<sint32>("x", window_size.x); wsize.set<sint32>("x", window_size.x);
cemu_assert_debug(window_size.x != 0);
wsize.set<sint32>("y", window_size.y); wsize.set<sint32>("y", window_size.y);
config.set<bool>("window_maximized", window_maximized); config.set<bool>("window_maximized", window_maximized);