Choose save data location

This commit is contained in:
2026-09-06 21:30:46 -04:00
parent 7d517e932e
commit e2c25cbae5
9 changed files with 234 additions and 117 deletions
+33 -2
View File
@@ -7,13 +7,13 @@ use std::{
use crate::{
app::UserEvent,
config::{COLOR_PRESETS, SimConfig},
config::{AppConfig, COLOR_PRESETS, SaveDataLocation, SimConfig},
emulator::{EmulatorClient, EmulatorCommand, EmulatorState, SimId, SimState},
filepicker::FilePicker,
filesystem::Persistence,
images::ImageTextureLoader,
input::{Command, MappingProvider, ShortcutProvider},
memory::MemoryClient,
persistence::Persistence,
window::{
AboutWindow, BgMapWindow, CharacterDataWindow, FrameBufferWindow, GdbServerWindow,
HotkeysWindow, InitArgs, InputWindow, ObjectWindow, ProfileWindow, RegisterWindow,
@@ -604,6 +604,37 @@ impl GameWindow {
if ui.button("Hotkeys").clicked() {
self.open(ChildWindow::Hotkeys);
}
ui.menu_button("Save Data Location", |ui| {
let save_data_location = self.client.save_data_location();
let update_save_data_location = |new_location: SaveDataLocation| {
if new_location == save_data_location {
return;
};
let mut app_config = AppConfig::load(&self.persistence);
app_config.save_data_location = new_location;
let _ = app_config.save(&self.persistence);
self.client
.send_command(EmulatorCommand::SetSaveDataLocation(new_location));
};
if ui
.selectable_button(
save_data_location == SaveDataLocation::RomDirectory,
"Same Directory as ROM",
)
.clicked()
{
update_save_data_location(SaveDataLocation::RomDirectory);
}
if ui
.selectable_button(
save_data_location == SaveDataLocation::DataDirectory,
"App Data Directory",
)
.clicked()
{
update_save_data_location(SaveDataLocation::DataDirectory);
}
});
}
fn show_color_picker(&mut self, ui: &mut Ui) {