forked from akanyan/STARTLINER
feat: audio mode
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tauri::AppHandle;
|
||||
use std::{collections::BTreeSet, path::{Path, PathBuf}};
|
||||
use crate::{model::{misc::Game, profile::Aime}, modules::package::prepare_packages, pkg::PkgKey, pkg_store::PackageStore, util};
|
||||
use crate::{model::{misc::Game, profile::{Aime, Mu3Ini, ProfileModule}}, modules::package::prepare_packages, pkg::PkgKey, pkg_store::PackageStore, util};
|
||||
use tauri::Emitter;
|
||||
use std::process::Stdio;
|
||||
use crate::model::profile::BepInEx;
|
||||
@ -42,14 +42,19 @@ pub struct Profile {
|
||||
pub struct ProfileData {
|
||||
pub mods: BTreeSet<PkgKey>,
|
||||
pub sgt: Segatools,
|
||||
pub display: Option<Display>,
|
||||
pub network: Network,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub display: Option<Display>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub bepinex: Option<BepInEx>,
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
pub wine: crate::model::profile::Wine,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub mu3_ini: Option<Mu3Ini>
|
||||
}
|
||||
|
||||
impl Profile {
|
||||
@ -68,6 +73,7 @@ impl Profile {
|
||||
bepinex: if meta.game == Game::Ongeki { Some(BepInEx::default()) } else { None },
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
wine: crate::model::profile::Wine::default(),
|
||||
mu3_ini: if meta.game == Game::Ongeki { Some(Mu3Ini { audio: None, blacklist: None }) } else { None },
|
||||
},
|
||||
meta: meta.clone()
|
||||
};
|
||||
@ -138,18 +144,25 @@ impl Profile {
|
||||
self.data.sgt.fix(store);
|
||||
}
|
||||
pub fn sync(&mut self, source: ProfileData) {
|
||||
if self.data.bepinex.is_some() {
|
||||
if self.meta.game.has_module(ProfileModule::BepInEx) && source.bepinex.is_some() {
|
||||
self.data.bepinex = source.bepinex;
|
||||
}
|
||||
if self.data.display.is_some() {
|
||||
|
||||
if self.meta.game.has_module(ProfileModule::Display) && source.display.is_some() {
|
||||
self.data.display = source.display;
|
||||
}
|
||||
// if self.data.network.is_some() {
|
||||
|
||||
if self.meta.game.has_module(ProfileModule::Network) {
|
||||
self.data.network = source.network;
|
||||
// }
|
||||
// if self.data.sgt.is_some() {
|
||||
}
|
||||
|
||||
if self.meta.game.has_module(ProfileModule::Segatools) {
|
||||
self.data.sgt = source.sgt;
|
||||
// }
|
||||
}
|
||||
|
||||
if self.meta.game.has_module(ProfileModule::Mu3Ini) && source.mu3_ini.is_some() {
|
||||
self.data.mu3_ini = source.mu3_ini;
|
||||
}
|
||||
}
|
||||
pub async fn line_up(&self, pkg_hash: String, refresh: bool, _app: AppHandle) -> Result<()> {
|
||||
let info = match &self.data.display {
|
||||
@ -194,6 +207,10 @@ impl Profile {
|
||||
bepinex.line_up(&self.meta)?;
|
||||
}
|
||||
|
||||
if let Some(mu3ini) = &self.data.mu3_ini {
|
||||
mu3ini.line_up(&self.data.sgt.target.parent().unwrap())?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user