From 3718d914fd7c092070d7ab3b3eb3957b5f15c761 Mon Sep 17 00:00:00 2001
From: Logan McNaughton <848146+loganmc10@users.noreply.github.com>
Date: Wed, 17 Jun 2026 08:58:44 +0200
Subject: [PATCH] try to restore input data from old config (#1097)
---
src/ui/config.rs | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/ui/config.rs b/src/ui/config.rs
index 0b2e7dab..9c13c454 100644
--- a/src/ui/config.rs
+++ b/src/ui/config.rs
@@ -136,17 +136,27 @@ impl Config {
let dirs = ui::get_dirs();
let file_path = dirs.config_dir.join("config.json");
let config_file = std::fs::read(file_path);
+ let mut input_data: Option = None;
if let Ok(config_file) = config_file {
let result = serde_json::from_slice::(config_file.as_ref());
if let Ok(mut result) = result {
result.write_to_disk = true;
return result;
}
+
+ // try to restore input data from old config file
+ if let Ok(value) = serde_json::from_slice::(&config_file)
+ && let Some(data) = value.get("input")
+ && let Ok(data) = serde_json::from_value::(data.clone())
+ {
+ input_data = Some(data);
+ }
}
+
let mut input_profiles = std::collections::BTreeMap::new();
input_profiles.insert("default".to_string(), ui::input::get_default_profile());
Config {
- input: Input {
+ input: input_data.unwrap_or(Input {
input_profile_binding: [
"default".to_string(),
"default".to_string(),
@@ -160,7 +170,7 @@ impl Config {
gb_rom_path: [String::new(), String::new(), String::new(), String::new()],
gb_ram_path: [String::new(), String::new(), String::new(), String::new()],
emulate_vru: false,
- },
+ }),
video: Video {
upscale: 1,
ssaa: false,