Choose save data location
This commit is contained in:
+33
-2
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user