mirror of
https://github.com/izzy2lost/xenia-edge.git
synced 2026-07-06 00:20:26 -07:00
[App] Persist fullscreen status
This commit is contained in:
@@ -514,6 +514,11 @@ void EmulatorWindow::EmulatorWindowListener::OnResize(ui::UISetupEvent& e) {
|
||||
}
|
||||
|
||||
void EmulatorWindow::SaveWindowSizeConfig() {
|
||||
// Don't save window dimensions when in fullscreen mode
|
||||
if (window_ && window_->IsFullscreen()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_game_process_) {
|
||||
// Game process - save to game-specific config
|
||||
if (!emulator_ || !emulator_->is_title_open()) {
|
||||
@@ -560,6 +565,36 @@ void EmulatorWindow::SaveWindowSizeConfig() {
|
||||
}
|
||||
}
|
||||
|
||||
void EmulatorWindow::SaveFullscreenConfig(bool fullscreen) {
|
||||
if (!is_game_process_) {
|
||||
return; // Only save for game process
|
||||
}
|
||||
|
||||
if (!emulator_ || !emulator_->is_title_open()) {
|
||||
return; // No title loaded yet
|
||||
}
|
||||
|
||||
uint32_t title_id = emulator_->title_id();
|
||||
if (title_id == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load existing config, update fullscreen value, save
|
||||
toml::table config_table = config::LoadGameConfig(title_id);
|
||||
|
||||
// Ensure Display category exists
|
||||
if (!config_table.contains("Display")) {
|
||||
config_table.insert("Display", toml::table{});
|
||||
}
|
||||
|
||||
auto* display_table = config_table["Display"].as_table();
|
||||
if (display_table) {
|
||||
display_table->insert_or_assign("fullscreen", fullscreen);
|
||||
}
|
||||
|
||||
config::SaveGameConfig(title_id, config_table);
|
||||
}
|
||||
|
||||
void EmulatorWindow::EmulatorWindowListener::OnKeyDown(ui::KeyEvent& e) {
|
||||
emulator_window_.OnKeyDown(e);
|
||||
}
|
||||
@@ -1665,6 +1700,7 @@ void EmulatorWindow::SetFullscreen(bool fullscreen) {
|
||||
return;
|
||||
}
|
||||
window_->SetFullscreen(fullscreen);
|
||||
SaveFullscreenConfig(fullscreen);
|
||||
}
|
||||
|
||||
void EmulatorWindow::ToggleFullscreen() {
|
||||
|
||||
@@ -262,6 +262,9 @@ class EmulatorWindow {
|
||||
// Timer callback for saving window size after resize is complete
|
||||
void SaveWindowSizeConfig();
|
||||
|
||||
// Save fullscreen state to per-game config
|
||||
void SaveFullscreenConfig(bool fullscreen);
|
||||
|
||||
Emulator* emulator_;
|
||||
ui::WindowedAppContext& app_context_;
|
||||
bool is_game_process_;
|
||||
|
||||
Reference in New Issue
Block a user