feat: add 'games' to the manifest
This commit is contained in:
@ -5,6 +5,7 @@
|
|||||||
- Chunithm: added Lumi+ patches
|
- Chunithm: added Lumi+ patches
|
||||||
- Added a button linking to the profile config folder
|
- 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
|
- 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
|
## 0.11.1
|
||||||
|
|
||||||
|
@ -14,7 +14,10 @@ pub struct PackageManifest {
|
|||||||
pub dependencies: BTreeSet<PkgKeyVersion>,
|
pub dependencies: BTreeSet<PkgKeyVersion>,
|
||||||
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub installers: Vec<BTreeMap<String, serde_json::Value>>
|
pub installers: Vec<BTreeMap<String, serde_json::Value>>,
|
||||||
|
|
||||||
|
#[serde(default)]
|
||||||
|
pub games: Option<Vec<Game>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type PackageList = BTreeMap<PkgKey, PackageListEntry>;
|
pub type PackageList = BTreeMap<PkgKey, PackageListEntry>;
|
||||||
|
@ -5,30 +5,30 @@ use crate::{model::{misc::{ConfigHook, ConfigHookAime, ConfigHookAimeUnit, Confi
|
|||||||
use crate::pkg_store::PackageStore;
|
use crate::pkg_store::PackageStore;
|
||||||
|
|
||||||
impl Segatools {
|
impl Segatools {
|
||||||
pub fn fix(&mut self, store: &PackageStore) {
|
pub fn fix(&mut self, _store: &PackageStore) {
|
||||||
macro_rules! remove_if_nonpresent {
|
// macro_rules! remove_if_nonpresent {
|
||||||
($item:expr,$key:expr,$emptyval:expr,$store:expr) => {
|
// ($item:expr,$key:expr,$emptyval:expr,$store:expr) => {
|
||||||
if let Ok(pkg) = $store.get($key) {
|
// if let Ok(pkg) = $store.get($key) {
|
||||||
if pkg.loc.is_none() {
|
// if pkg.loc.is_none() {
|
||||||
$item = $emptyval;
|
// $item = $emptyval;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
$item = $emptyval;
|
// $item = $emptyval;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if let Some(key) = &self.hook {
|
// if let Some(key) = &self.hook {
|
||||||
remove_if_nonpresent!(self.hook, key, None, store);
|
// remove_if_nonpresent!(self.hook, key, None, store);
|
||||||
}
|
// }
|
||||||
if let IOSelection::Custom(key) = &self.io2 {
|
// if let IOSelection::Custom(key) = &self.io2 {
|
||||||
remove_if_nonpresent!(self.io2, key, IOSelection::default(), store);
|
// remove_if_nonpresent!(self.io2, key, IOSelection::default(), store);
|
||||||
}
|
// }
|
||||||
match &self.aime {
|
// match &self.aime {
|
||||||
Aime::AMNet(key) => remove_if_nonpresent!(self.aime, key, Aime::BuiltIn, store),
|
// Aime::AMNet(key) => remove_if_nonpresent!(self.aime, key, Aime::BuiltIn, store),
|
||||||
Aime::Other(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<Path>) -> Result<()> {
|
pub fn load_from_ini(&mut self, ini: &Ini, config_dir: impl AsRef<Path>) -> Result<()> {
|
||||||
log::debug!("loading sgt");
|
log::debug!("loading sgt");
|
||||||
|
@ -120,7 +120,7 @@ impl Package {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn from_dir(dir: PathBuf, source: PackageSource) -> Result<Package> {
|
pub async fn from_dir(dir: PathBuf, source: PackageSource) -> Result<(Package, Option<Vec<Game>>)> {
|
||||||
let str = fs::read_to_string(dir.join("manifest.json")).await?;
|
let str = fs::read_to_string(dir.join("manifest.json")).await?;
|
||||||
let mft: local::PackageManifest = serde_json::from_str(&str)?;
|
let mft: local::PackageManifest = serde_json::from_str(&str)?;
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ impl Package {
|
|||||||
let status = Self::parse_status(&mft, &dir);
|
let status = Self::parse_status(&mft, &dir);
|
||||||
let dependencies = Self::sanitize_deps(mft.dependencies);
|
let dependencies = Self::sanitize_deps(mft.dependencies);
|
||||||
|
|
||||||
Ok(Package {
|
Ok((Package {
|
||||||
namespace: Self::dir_to_namespace(&dir)?,
|
namespace: Self::dir_to_namespace(&dir)?,
|
||||||
name: mft.name.clone(),
|
name: mft.name.clone(),
|
||||||
description: mft.description.clone(),
|
description: mft.description.clone(),
|
||||||
@ -146,7 +146,7 @@ impl Package {
|
|||||||
}),
|
}),
|
||||||
rmt: None,
|
rmt: None,
|
||||||
source
|
source
|
||||||
})
|
}, mft.games))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn key(&self) -> PkgKey {
|
pub fn key(&self) -> PkgKey {
|
||||||
|
@ -83,7 +83,7 @@ impl PackageStore {
|
|||||||
|
|
||||||
pub async fn reload_package(&mut self, key: PkgKey) {
|
pub async fn reload_package(&mut self, key: PkgKey) {
|
||||||
let dir = util::pkg_dir().join(&key.0);
|
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);
|
self.update_nonremote(key, pkg);
|
||||||
} else {
|
} else {
|
||||||
log::error!("couldn't reload {}", key);
|
log::error!("couldn't reload {}", key);
|
||||||
@ -102,7 +102,13 @@ impl PackageStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while let Some(res) = futures.join_next().await {
|
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);
|
self.update_nonremote(pkg.key(), pkg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user