diff --git a/CHANGELOG.md b/CHANGELOG.md index 7002f4e..e6bbfc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Chunithm: added Lumi+ patches - Added a button linking to the profile config folder - Fixed the button linking to the data folder showing up when the folder does not exist +- Uninstalled tool packages are no longer automatically deselected, as that caused issues ## 0.11.1 diff --git a/rust/src/model/local.rs b/rust/src/model/local.rs index dd82c6b..2914779 100644 --- a/rust/src/model/local.rs +++ b/rust/src/model/local.rs @@ -14,7 +14,10 @@ pub struct PackageManifest { pub dependencies: BTreeSet, #[serde(default)] - pub installers: Vec> + pub installers: Vec>, + + #[serde(default)] + pub games: Option>, } pub type PackageList = BTreeMap; diff --git a/rust/src/modules/segatools.rs b/rust/src/modules/segatools.rs index b74b9a4..eee822e 100644 --- a/rust/src/modules/segatools.rs +++ b/rust/src/modules/segatools.rs @@ -5,30 +5,30 @@ use crate::{model::{misc::{ConfigHook, ConfigHookAime, ConfigHookAimeUnit, Confi use crate::pkg_store::PackageStore; impl Segatools { - pub fn fix(&mut self, store: &PackageStore) { - macro_rules! remove_if_nonpresent { - ($item:expr,$key:expr,$emptyval:expr,$store:expr) => { - if let Ok(pkg) = $store.get($key) { - if pkg.loc.is_none() { - $item = $emptyval; - } - } else { - $item = $emptyval; - } - } - } + pub fn fix(&mut self, _store: &PackageStore) { + // macro_rules! remove_if_nonpresent { + // ($item:expr,$key:expr,$emptyval:expr,$store:expr) => { + // if let Ok(pkg) = $store.get($key) { + // if pkg.loc.is_none() { + // $item = $emptyval; + // } + // } else { + // $item = $emptyval; + // } + // } + // } - if let Some(key) = &self.hook { - remove_if_nonpresent!(self.hook, key, None, store); - } - if let IOSelection::Custom(key) = &self.io2 { - remove_if_nonpresent!(self.io2, key, IOSelection::default(), store); - } - match &self.aime { - Aime::AMNet(key) => remove_if_nonpresent!(self.aime, key, Aime::BuiltIn, store), - Aime::Other(key) => remove_if_nonpresent!(self.aime, key, Aime::BuiltIn, store), - _ => {}, - } + // if let Some(key) = &self.hook { + // remove_if_nonpresent!(self.hook, key, None, store); + // } + // if let IOSelection::Custom(key) = &self.io2 { + // remove_if_nonpresent!(self.io2, key, IOSelection::default(), store); + // } + // match &self.aime { + // Aime::AMNet(key) => remove_if_nonpresent!(self.aime, key, Aime::BuiltIn, store), + // Aime::Other(key) => remove_if_nonpresent!(self.aime, key, Aime::BuiltIn, store), + // _ => {}, + // } } pub fn load_from_ini(&mut self, ini: &Ini, config_dir: impl AsRef) -> Result<()> { log::debug!("loading sgt"); diff --git a/rust/src/pkg.rs b/rust/src/pkg.rs index 020023f..a1e83ad 100644 --- a/rust/src/pkg.rs +++ b/rust/src/pkg.rs @@ -120,7 +120,7 @@ impl Package { }) } - pub async fn from_dir(dir: PathBuf, source: PackageSource) -> Result { + pub async fn from_dir(dir: PathBuf, source: PackageSource) -> Result<(Package, Option>)> { let str = fs::read_to_string(dir.join("manifest.json")).await?; let mft: local::PackageManifest = serde_json::from_str(&str)?; @@ -133,7 +133,7 @@ impl Package { let status = Self::parse_status(&mft, &dir); let dependencies = Self::sanitize_deps(mft.dependencies); - Ok(Package { + Ok((Package { namespace: Self::dir_to_namespace(&dir)?, name: mft.name.clone(), description: mft.description.clone(), @@ -146,7 +146,7 @@ impl Package { }), rmt: None, source - }) + }, mft.games)) } pub fn key(&self) -> PkgKey { diff --git a/rust/src/pkg_store.rs b/rust/src/pkg_store.rs index 0fb7e2e..e64ddb5 100644 --- a/rust/src/pkg_store.rs +++ b/rust/src/pkg_store.rs @@ -83,7 +83,7 @@ impl PackageStore { pub async fn reload_package(&mut self, key: PkgKey) { let dir = util::pkg_dir().join(&key.0); - if let Ok(pkg) = Package::from_dir(dir, PackageSource::Rainy).await { + if let Ok((pkg, _)) = Package::from_dir(dir, PackageSource::Rainy).await { self.update_nonremote(key, pkg); } else { log::error!("couldn't reload {}", key); @@ -102,7 +102,13 @@ impl PackageStore { } while let Some(res) = futures.join_next().await { - if let Ok(Ok(pkg)) = res { + if let Ok(Ok((pkg, locally_declared_games))) = res { + if let Some(games) = locally_declared_games { + self.meta_list.insert(pkg.key(), PackageListEntry { + version: pkg.loc.as_ref().unwrap().version.clone(), + games + }); + } self.update_nonremote(pkg.key(), pkg); } }