use std::path::PathBuf; use serde::{Deserialize, Serialize}; use crate::pkg::PkgKey; use enumflags2::bitflags; use super::misc::Game; #[derive(Deserialize, Serialize, Clone, Default, PartialEq, Debug)] pub enum Aime { Disabled, #[default] BuiltIn, AMNet(PkgKey), Other(PkgKey), } #[derive(Deserialize, Serialize, Clone, Debug)] pub struct AMNet { pub name: String, pub addr: String, pub physical: bool, } impl Default for AMNet { fn default() -> Self { Self { name: Default::default(), addr: "http://+:6070".to_string(), physical: false } } } #[derive(Deserialize, Serialize, Clone, Debug)] pub struct Segatools { pub target: PathBuf, pub hook: Option, pub io: Option, #[serde(default)] pub aime: Aime, pub amfs: PathBuf, pub option: PathBuf, pub appdata: PathBuf, pub intel: bool, #[serde(default)] pub amnet: AMNet, } impl Segatools { pub fn default_for(game: Game) -> Self { Segatools { target: PathBuf::default(), hook: match game { Game::Ongeki => Some(PkgKey("segatools-mu3hook".to_owned())), Game::Chunithm => Some(PkgKey("segatools-chusanhook".to_owned())) }, io: None, amfs: PathBuf::default(), option: PathBuf::default(), appdata: PathBuf::from("appdata"), aime: Aime::default(), intel: false, amnet: AMNet::default(), } } } #[derive(Deserialize, Serialize, Clone, Default, PartialEq, Debug)] pub enum DisplayMode { Window, #[default] Borderless, Fullscreen } #[derive(Deserialize, Serialize, Clone, Debug)] pub struct Display { pub target: String, pub rez: (i32, i32), pub mode: DisplayMode, pub rotation: i32, pub frequency: i32, pub borderless_fullscreen: bool, } impl Display { pub fn default_for(game: Game) -> Self { Display { target: "default".to_owned(), rez: match game { Game::Chunithm => (1920, 1080), Game::Ongeki => (1080, 1920), }, mode: DisplayMode::Borderless, rotation: 0, frequency: match game { Game::Chunithm => 120, Game::Ongeki => 60, }, borderless_fullscreen: true, } } } #[derive(Deserialize, Serialize, Clone, Default, PartialEq, Debug)] pub enum NetworkType { #[default] Remote, Artemis, } #[derive(Deserialize, Serialize, Clone, Default, Debug)] pub struct Network { pub network_type: NetworkType, pub local_path: PathBuf, pub local_console: bool, pub remote_address: String, pub keychip: String, pub subnet: String, pub suffix: Option, } #[derive(Deserialize, Serialize, Clone, Default, Debug)] pub struct BepInEx { pub console: bool, } #[derive(Deserialize, Serialize, Clone)] pub struct Wine { pub runtime: PathBuf, pub prefix: PathBuf, } impl Default for Wine { fn default() -> Self { Wine { runtime: PathBuf::from("/usr/bin/wine"), prefix: std::env::var("HOME") .and_then(|home| Ok(PathBuf::from(home).join(".wine"))) .unwrap_or_default() } } } #[derive(Deserialize, Serialize, Clone, PartialEq, Debug, Copy)] pub enum Mu3Audio { Shared, Excl6Ch, Excl2Ch, } #[derive(Deserialize, Serialize, Clone, Debug)] pub struct Mu3Ini { #[serde(skip_serializing_if = "Option::is_none")] pub audio: Option, #[serde(skip_serializing_if = "Option::is_none")] pub blacklist: Option<(i32, i32)>, } #[bitflags] #[repr(u8)] #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum ProfileModule { Segatools, Network, Display, BepInEx, Mu3Ini }