feat: start checks

This commit is contained in:
2025-03-16 17:55:38 +00:00
parent 08d6a2a2fe
commit 8d55e92fc9
26 changed files with 456 additions and 211 deletions

View File

@ -1,102 +1,10 @@
use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use crate::pkg::PkgKey;
use super::misc::Game;
#[derive(Deserialize, Serialize, Clone)]
pub struct Segatools {
pub target: PathBuf,
pub hook: Option<PkgKey>,
pub io: Option<PkgKey>,
pub amfs: PathBuf,
pub option: PathBuf,
pub appdata: PathBuf,
pub enable_aime: bool,
pub intel: bool,
}
#[derive(Serialize, Deserialize, Clone, Default)]
pub struct GlobalConfig {
pub recent_profile: Option<(Game, String)>,
impl Default for Segatools {
fn default() -> Self {
Segatools {
target: PathBuf::default(),
hook: Some(PkgKey("segatools-mu3hook".to_owned())),
io: None,
amfs: PathBuf::default(),
option: PathBuf::default(),
appdata: PathBuf::from("appdata"),
enable_aime: false,
intel: false
}
}
}
#[derive(Deserialize, Serialize, Clone, Default, PartialEq)]
pub enum DisplayMode {
Window,
#[default] Borderless,
Fullscreen
}
#[derive(Deserialize, Serialize, Clone)]
pub struct Display {
pub target: String,
pub rez: (i32, i32),
pub mode: DisplayMode,
pub rotation: i32,
pub frequency: i32,
pub borderless_fullscreen: bool,
}
impl Default for Display {
fn default() -> Self {
Display {
target: "default".to_owned(),
rez: (1080, 1920),
mode: DisplayMode::Borderless,
rotation: 0,
frequency: 60,
borderless_fullscreen: true,
}
}
}
#[derive(Deserialize, Serialize, Clone, Default, PartialEq)]
pub enum NetworkType {
#[default] Remote,
Artemis,
}
#[derive(Deserialize, Serialize, Clone, Default)]
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<i32>,
}
#[derive(Deserialize, Serialize, Clone, Default)]
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()
}
}
#[serde(default)]
pub offline_mode: bool,
}

View File

@ -1,4 +1,5 @@
use serde::{Deserialize, Serialize};
use crate::pkg::PkgKey;
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub enum Game {
@ -26,3 +27,11 @@ impl std::fmt::Display for Game {
}
}
}
#[derive(Serialize, Deserialize)]
pub enum StartCheckError {
MissingRemotePackage(PkgKey),
MissingLocalPackage(PkgKey),
MissingDependency(PkgKey, PkgKey),
MissingTool(PkgKey),
}

View File

@ -1,5 +1,6 @@
pub mod local;
pub mod misc;
pub mod rainy;
pub mod profile;
pub mod config;
pub mod segatools_base;

102
rust/src/model/profile.rs Normal file
View File

@ -0,0 +1,102 @@
use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use crate::pkg::PkgKey;
#[derive(Deserialize, Serialize, Clone)]
pub struct Segatools {
pub target: PathBuf,
pub hook: Option<PkgKey>,
pub io: Option<PkgKey>,
pub amfs: PathBuf,
pub option: PathBuf,
pub appdata: PathBuf,
pub enable_aime: bool,
pub intel: bool,
}
impl Default for Segatools {
fn default() -> Self {
Segatools {
target: PathBuf::default(),
hook: Some(PkgKey("segatools-mu3hook".to_owned())),
io: None,
amfs: PathBuf::default(),
option: PathBuf::default(),
appdata: PathBuf::from("appdata"),
enable_aime: false,
intel: false
}
}
}
#[derive(Deserialize, Serialize, Clone, Default, PartialEq)]
pub enum DisplayMode {
Window,
#[default] Borderless,
Fullscreen
}
#[derive(Deserialize, Serialize, Clone)]
pub struct Display {
pub target: String,
pub rez: (i32, i32),
pub mode: DisplayMode,
pub rotation: i32,
pub frequency: i32,
pub borderless_fullscreen: bool,
}
impl Default for Display {
fn default() -> Self {
Display {
target: "default".to_owned(),
rez: (1080, 1920),
mode: DisplayMode::Borderless,
rotation: 0,
frequency: 60,
borderless_fullscreen: true,
}
}
}
#[derive(Deserialize, Serialize, Clone, Default, PartialEq)]
pub enum NetworkType {
#[default] Remote,
Artemis,
}
#[derive(Deserialize, Serialize, Clone, Default)]
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<i32>,
}
#[derive(Deserialize, Serialize, Clone, Default)]
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()
}
}
}