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
+11 -15
View File
@@ -15,7 +15,7 @@ use winit::event_loop::{ControlFlow, EventLoop};
use crate::{
config::{AppConfig, CliArgs, SimConfig},
emulator::SimId,
persistence::Persistence,
filesystem::Persistence,
};
mod app;
@@ -24,12 +24,12 @@ mod config;
mod controller;
mod emulator;
mod filepicker;
mod filesystem;
mod gdbserver;
mod graphics;
mod images;
mod input;
mod memory;
mod persistence;
mod profiler;
mod window;
@@ -60,14 +60,9 @@ fn set_panic_handler() {
eprint!("{message}");
let Some(project_dirs) = directories::ProjectDirs::from("com", "virtual-boy", "Lemur")
else {
let Some(data_dir) = filesystem::init_data_dir() else {
return;
};
let data_dir = project_dirs.data_dir();
if std::fs::create_dir_all(data_dir).is_err() {
return;
}
let timestamp = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap()
@@ -98,7 +93,14 @@ fn main() -> Result<()> {
let persistence = Persistence::new();
let (mut builder, client) = EmulatorBuilder::new();
let mut config = AppConfig::load(&persistence);
if config.update(&args) {
let _ = config.save(&persistence);
}
let p1 = SimConfig::load(&persistence, SimId::Player1);
let p2 = SimConfig::load(&persistence, SimId::Player2);
let (mut builder, client) = EmulatorBuilder::new(config.save_data_location);
if let Some(path) = &args.rom {
builder = builder.with_rom(path);
}
@@ -111,12 +113,6 @@ fn main() -> Result<()> {
if args.profile {
builder = builder.start_paused(true)
}
let mut config = AppConfig::load(&persistence);
if config.update(&args) {
let _ = config.save(&persistence);
}
let p1 = SimConfig::load(&persistence, SimId::Player1);
let p2 = SimConfig::load(&persistence, SimId::Player2);
let watch = args.watch;