feat: hardware aime
This commit is contained in:
125
rust/Cargo.lock
generated
125
rust/Cargo.lock
generated
@ -803,7 +803,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
|
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1454,6 +1454,16 @@ dependencies = [
|
|||||||
"simd-adler32",
|
"simd-adler32",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fern"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4316185f709b23713e41e3195f90edef7fb00c3ed4adc79769cf09cc762a3b29"
|
||||||
|
dependencies = [
|
||||||
|
"colored",
|
||||||
|
"log",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "field-offset"
|
name = "field-offset"
|
||||||
version = "0.3.6"
|
version = "0.3.6"
|
||||||
@ -2143,6 +2153,12 @@ version = "1.10.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
|
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "humantime"
|
||||||
|
version = "2.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b112acc8b3adf4b107a8ec20977da0273a8c386765a3ec0229bd500a1443f9f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper"
|
name = "hyper"
|
||||||
version = "1.6.0"
|
version = "1.6.0"
|
||||||
@ -2442,6 +2458,16 @@ dependencies = [
|
|||||||
"generic-array",
|
"generic-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "io-kit-sys"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "617ee6cf8e3f66f3b4ea67a4058564628cde41901316e19f559e14c7c72c5e7b"
|
||||||
|
dependencies = [
|
||||||
|
"core-foundation-sys",
|
||||||
|
"mach2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ipnet"
|
name = "ipnet"
|
||||||
version = "2.11.0"
|
version = "2.11.0"
|
||||||
@ -2696,6 +2722,26 @@ dependencies = [
|
|||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libudev"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "78b324152da65df7bb95acfcaab55e3097ceaab02fb19b228a9eb74d55f135e0"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"libudev-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libudev-sys"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"pkg-config",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linux-raw-sys"
|
name = "linux-raw-sys"
|
||||||
version = "0.4.15"
|
version = "0.4.15"
|
||||||
@ -2766,6 +2812,15 @@ version = "0.1.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
|
checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mach2"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "markup5ever"
|
name = "markup5ever"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
@ -2917,6 +2972,17 @@ version = "1.0.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
|
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nix"
|
||||||
|
version = "0.26.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nix"
|
name = "nix"
|
||||||
version = "0.29.0"
|
version = "0.29.0"
|
||||||
@ -2972,15 +3038,6 @@ dependencies = [
|
|||||||
"syn 2.0.100",
|
"syn 2.0.100",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num_threads"
|
|
||||||
version = "0.1.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc-sys"
|
name = "objc-sys"
|
||||||
version = "0.3.5"
|
version = "0.3.5"
|
||||||
@ -4459,6 +4516,25 @@ dependencies = [
|
|||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serialport"
|
||||||
|
version = "4.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2daa7abb9b965493e3c8f4184c6f46435484ff2538a332b886788cf6768b927b"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.9.0",
|
||||||
|
"cfg-if",
|
||||||
|
"core-foundation 0.10.0",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"io-kit-sys",
|
||||||
|
"libudev",
|
||||||
|
"mach2",
|
||||||
|
"nix 0.26.4",
|
||||||
|
"scopeguard",
|
||||||
|
"unescaper",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo_arc"
|
name = "servo_arc"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
@ -4544,18 +4620,6 @@ version = "0.3.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
|
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "simple_logger"
|
|
||||||
version = "5.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e8c5dfa5e08767553704aa0ffd9d9794d527103c736aba9854773851fd7497eb"
|
|
||||||
dependencies = [
|
|
||||||
"colored",
|
|
||||||
"log",
|
|
||||||
"time",
|
|
||||||
"windows-sys 0.48.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "siphasher"
|
name = "siphasher"
|
||||||
version = "0.3.11"
|
version = "0.3.11"
|
||||||
@ -4660,8 +4724,10 @@ dependencies = [
|
|||||||
"directories",
|
"directories",
|
||||||
"displayz",
|
"displayz",
|
||||||
"enumflags2",
|
"enumflags2",
|
||||||
|
"fern",
|
||||||
"flate2",
|
"flate2",
|
||||||
"futures",
|
"futures",
|
||||||
|
"humantime",
|
||||||
"junction",
|
"junction",
|
||||||
"log",
|
"log",
|
||||||
"regex",
|
"regex",
|
||||||
@ -4671,8 +4737,8 @@ dependencies = [
|
|||||||
"serde_derive",
|
"serde_derive",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_json5",
|
"serde_json5",
|
||||||
|
"serialport",
|
||||||
"sha256",
|
"sha256",
|
||||||
"simple_logger",
|
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-build",
|
"tauri-build",
|
||||||
"tauri-plugin-cli",
|
"tauri-plugin-cli",
|
||||||
@ -5406,9 +5472,7 @@ checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"deranged",
|
"deranged",
|
||||||
"itoa 1.0.15",
|
"itoa 1.0.15",
|
||||||
"libc",
|
|
||||||
"num-conv",
|
"num-conv",
|
||||||
"num_threads",
|
|
||||||
"powerfmt",
|
"powerfmt",
|
||||||
"serde",
|
"serde",
|
||||||
"time-core",
|
"time-core",
|
||||||
@ -5727,6 +5791,15 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unescaper"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c878a167baa8afd137494101a688ef8c67125089ff2249284bd2b5f9bfedb815"
|
||||||
|
dependencies = [
|
||||||
|
"thiserror 1.0.69",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unic-char-property"
|
name = "unic-char-property"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
@ -6845,7 +6918,7 @@ dependencies = [
|
|||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-lite",
|
"futures-lite",
|
||||||
"hex",
|
"hex",
|
||||||
"nix",
|
"nix 0.29.0",
|
||||||
"ordered-stream",
|
"ordered-stream",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_repr",
|
"serde_repr",
|
||||||
|
@ -28,7 +28,6 @@ futures = "0.3.31"
|
|||||||
tauri-plugin-shell = "2"
|
tauri-plugin-shell = "2"
|
||||||
directories = "6.0.0"
|
directories = "6.0.0"
|
||||||
rust-ini = "0.21.1"
|
rust-ini = "0.21.1"
|
||||||
simple_logger = "5.0.0"
|
|
||||||
log = "0.4.25"
|
log = "0.4.25"
|
||||||
regex = "1.11.1"
|
regex = "1.11.1"
|
||||||
zip = "2.2.2"
|
zip = "2.2.2"
|
||||||
@ -43,6 +42,9 @@ tauri-plugin-fs = "2"
|
|||||||
yaml-rust2 = "0.10.0"
|
yaml-rust2 = "0.10.0"
|
||||||
enumflags2 = { version = "0.7.11", features = ["serde"] }
|
enumflags2 = { version = "0.7.11", features = ["serde"] }
|
||||||
sha256 = "1.6.0"
|
sha256 = "1.6.0"
|
||||||
|
serialport = "4.7.1"
|
||||||
|
fern = { version ="0.7.1", features = ["colored"] }
|
||||||
|
humantime = "2.2.0"
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||||
tauri-plugin-cli = "2"
|
tauri-plugin-cli = "2"
|
||||||
|
@ -43,7 +43,7 @@ impl AppData {
|
|||||||
.map_err(|e| log::error!("unable to load patch set: {e}"))
|
.map_err(|e| log::error!("unable to load patch set: {e}"))
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
log::debug!("Recent profile: {:?}", profile);
|
log::info!("recent profile: {:?}", profile);
|
||||||
|
|
||||||
AppData {
|
AppData {
|
||||||
profile: profile,
|
profile: profile,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use ini::Ini;
|
use ini::Ini;
|
||||||
use log;
|
use log;
|
||||||
use std::collections::HashMap;
|
use std::collections::{BTreeMap, HashMap};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
@ -445,6 +445,21 @@ pub async fn file_exists(path: String) -> Result<bool, ()> {
|
|||||||
Ok(std::fs::exists(path).unwrap_or(false))
|
Ok(std::fs::exists(path).unwrap_or(false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn list_com_ports() -> Result<BTreeMap<String, i32>, String> {
|
||||||
|
let ports = serialport::available_ports().unwrap_or(Vec::new());
|
||||||
|
let mut res = BTreeMap::new();
|
||||||
|
for p in ports {
|
||||||
|
log::debug!("port {}", p.port_name);
|
||||||
|
if p.port_name.starts_with("COM") {
|
||||||
|
if let Ok(parsed) = (p.port_name[3..]).parse() {
|
||||||
|
res.insert(p.port_name, parsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(res)
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn list_patches(state: State<'_, Mutex<AppData>>, target: String) -> Result<Vec<Patch>, String> {
|
pub async fn list_patches(state: State<'_, Mutex<AppData>>, target: String) -> Result<Vec<Patch>, String> {
|
||||||
log::debug!("invoke: list_patches({})", target);
|
log::debug!("invoke: list_patches({})", target);
|
||||||
|
@ -43,7 +43,7 @@ impl DownloadHandler {
|
|||||||
let mut cache_file_w = File::create(&zip_path_part).await?;
|
let mut cache_file_w = File::create(&zip_path_part).await?;
|
||||||
let mut byte_stream = reqwest::get(&rmt.download_url).await?.bytes_stream();
|
let mut byte_stream = reqwest::get(&rmt.download_url).await?.bytes_stream();
|
||||||
|
|
||||||
log::info!("Downloading: {}", rmt.download_url);
|
log::info!("downloading: {}", rmt.download_url);
|
||||||
while let Some(item) = byte_stream.next().await {
|
while let Some(item) = byte_stream.next().await {
|
||||||
let i = item?;
|
let i = item?;
|
||||||
cache_file_w.write_all(&mut i.as_ref()).await?;
|
cache_file_w.write_all(&mut i.as_ref()).await?;
|
||||||
@ -51,7 +51,7 @@ impl DownloadHandler {
|
|||||||
cache_file_w.sync_all().await?;
|
cache_file_w.sync_all().await?;
|
||||||
tokio::fs::rename(&zip_path_part, &zip_path).await?;
|
tokio::fs::rename(&zip_path_part, &zip_path).await?;
|
||||||
|
|
||||||
log::debug!("Downloaded to {:?}", zip_path);
|
log::debug!("downloaded to {:?}", zip_path);
|
||||||
|
|
||||||
app.emit("download-end", pkg_key)?;
|
app.emit("download-end", pkg_key)?;
|
||||||
|
|
||||||
|
@ -9,10 +9,11 @@ mod modules;
|
|||||||
mod profiles;
|
mod profiles;
|
||||||
mod patcher;
|
mod patcher;
|
||||||
|
|
||||||
use std::sync::OnceLock;
|
use std::{sync::OnceLock, time::SystemTime};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use closure::closure;
|
use closure::closure;
|
||||||
use appdata::{AppData, ToggleAction};
|
use appdata::{AppData, ToggleAction};
|
||||||
|
use fern::colors::{Color, ColoredLevelConfig};
|
||||||
use model::misc::Game;
|
use model::misc::Game;
|
||||||
use pkg::PkgKey;
|
use pkg::PkgKey;
|
||||||
use pkg_store::Payload;
|
use pkg_store::Payload;
|
||||||
@ -26,16 +27,6 @@ static EXIT_REQUESTED: OnceLock<()> = OnceLock::new();
|
|||||||
|
|
||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
pub async fn run(_args: Vec<String>) {
|
pub async fn run(_args: Vec<String>) {
|
||||||
simple_logger::init_with_env().expect("Unable to initialize the logger");
|
|
||||||
|
|
||||||
log::info!(
|
|
||||||
"Running from {}",
|
|
||||||
std::env::current_dir()
|
|
||||||
.unwrap_or_default()
|
|
||||||
.to_str()
|
|
||||||
.unwrap_or_default()
|
|
||||||
);
|
|
||||||
|
|
||||||
let tauri = tauri::Builder::default()
|
let tauri = tauri::Builder::default()
|
||||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||||
.plugin(tauri_plugin_single_instance::init(|app, args, _cwd| {
|
.plugin(tauri_plugin_single_instance::init(|app, args, _cwd| {
|
||||||
@ -58,6 +49,51 @@ pub async fn run(_args: Vec<String>) {
|
|||||||
|
|
||||||
util::init_dirs(&apph);
|
util::init_dirs(&apph);
|
||||||
|
|
||||||
|
let mut fern_builder;
|
||||||
|
{
|
||||||
|
let colors = ColoredLevelConfig::new()
|
||||||
|
.debug(Color::Green)
|
||||||
|
.info(Color::Blue)
|
||||||
|
.warn(Color::Yellow)
|
||||||
|
.error(Color::Red);
|
||||||
|
|
||||||
|
fern_builder = fern::Dispatch::new()
|
||||||
|
.format(move |out, message, record| {
|
||||||
|
out.finish(format_args!(
|
||||||
|
"[{} {} {}] {}",
|
||||||
|
humantime::format_rfc3339_seconds(SystemTime::now()),
|
||||||
|
colors.color(record.level()),
|
||||||
|
record.target(),
|
||||||
|
message
|
||||||
|
))
|
||||||
|
})
|
||||||
|
.chain(std::io::stdout())
|
||||||
|
.chain(fern::log_file(util::data_dir().join("log.txt")).expect("unable to initialize the logger"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
{
|
||||||
|
fern_builder = fern_builder.level(log::LevelFilter::Debug);
|
||||||
|
}
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
{
|
||||||
|
if std::env::var("DEBUG_LOG") {
|
||||||
|
fern_builder = fern_builder.level(log::LevelFilter::Debug);
|
||||||
|
} else {
|
||||||
|
fern_builder = fern_builder.level(log::LevelFilter::Info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fern_builder.apply()?;
|
||||||
|
|
||||||
|
log::info!(
|
||||||
|
"running from {}",
|
||||||
|
std::env::current_dir()
|
||||||
|
.unwrap_or_default()
|
||||||
|
.to_str()
|
||||||
|
.unwrap_or_default()
|
||||||
|
);
|
||||||
|
|
||||||
let mut app_data = AppData::new(app.handle().clone());
|
let mut app_data = AppData::new(app.handle().clone());
|
||||||
let start_immediately;
|
let start_immediately;
|
||||||
|
|
||||||
@ -210,6 +246,8 @@ pub async fn run(_args: Vec<String>) {
|
|||||||
cmd::list_directories,
|
cmd::list_directories,
|
||||||
cmd::file_exists,
|
cmd::file_exists,
|
||||||
|
|
||||||
|
cmd::list_com_ports,
|
||||||
|
|
||||||
cmd::list_patches
|
cmd::list_patches
|
||||||
])
|
])
|
||||||
.build(tauri::generate_context!())
|
.build(tauri::generate_context!())
|
||||||
@ -245,7 +283,7 @@ fn deep_link(app: AppHandle, args: Vec<String>) {
|
|||||||
let url = &args[1];
|
let url = &args[1];
|
||||||
let proto = "rainycolor://";
|
let proto = "rainycolor://";
|
||||||
if &url[..proto.len()] == proto {
|
if &url[..proto.len()] == proto {
|
||||||
log::info!("Deep link: {}", url);
|
log::info!("deep link: {}", url);
|
||||||
|
|
||||||
let regex = regex::Regex::new(
|
let regex = regex::Regex::new(
|
||||||
r"rainycolor://v1/install/rainy\.patafour\.zip/([^/]+)/([^/]+)/[0-9]+\.[0-9]+\.[0-9]+/"
|
r"rainycolor://v1/install/rainy\.patafour\.zip/([^/]+)/([^/]+)/[0-9]+\.[0-9]+\.[0-9]+/"
|
||||||
|
@ -59,7 +59,7 @@ impl Game {
|
|||||||
pub fn amd_args(&self) -> Vec<&'static str> {
|
pub fn amd_args(&self) -> Vec<&'static str> {
|
||||||
match self {
|
match self {
|
||||||
Game::Ongeki => vec!["-f", "-c", "config_common.json", "config_server.json", "config_client.json"],
|
Game::Ongeki => vec!["-f", "-c", "config_common.json", "config_server.json", "config_client.json"],
|
||||||
Game::Chunithm => vec!["-c", "config_common.json", "config_server.json", "config_client.json", "config_cvt.json", "config_sp.json", "config_hook.json"]
|
Game::Chunithm => vec!["-c", "config_common.json", "config_server.json", "config_client.json", "config_cvt.json", "config_sp.json"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,4 +86,28 @@ pub enum StartCheckError {
|
|||||||
MissingLocalPackage(PkgKey),
|
MissingLocalPackage(PkgKey),
|
||||||
MissingDependency(PkgKey, PkgKey),
|
MissingDependency(PkgKey, PkgKey),
|
||||||
MissingTool(PkgKey),
|
MissingTool(PkgKey),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct ConfigHook {
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub allnet_auth: Option<ConfigHookAuth>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub aime: Option<ConfigHookAime>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct ConfigHookAuth {
|
||||||
|
pub r#type: String
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct ConfigHookAime {
|
||||||
|
pub unit: Vec<ConfigHookAimeUnit>
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct ConfigHookAimeUnit {
|
||||||
|
pub port: i32,
|
||||||
|
pub id: i32
|
||||||
}
|
}
|
@ -39,6 +39,7 @@ pub struct Segatools {
|
|||||||
pub intel: bool,
|
pub intel: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub amnet: AMNet,
|
pub amnet: AMNet,
|
||||||
|
pub aime_port: Option<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Segatools {
|
impl Segatools {
|
||||||
@ -56,6 +57,7 @@ impl Segatools {
|
|||||||
aime: Aime::default(),
|
aime: Aime::default(),
|
||||||
intel: false,
|
intel: false,
|
||||||
amnet: AMNet::default(),
|
amnet: AMNet::default(),
|
||||||
|
aime_port: None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::path::{PathBuf, Path};
|
use std::path::{PathBuf, Path};
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use ini::Ini;
|
use ini::Ini;
|
||||||
use crate::{model::{misc::Game, profile::{Aime, Segatools}}, profiles::ProfilePaths, util::{self, PathStr}};
|
use crate::{model::{misc::{ConfigHook, ConfigHookAime, ConfigHookAimeUnit, ConfigHookAuth, Game}, profile::{Aime, Segatools}}, profiles::ProfilePaths, util::{self, PathStr}};
|
||||||
use crate::pkg_store::PackageStore;
|
use crate::pkg_store::PackageStore;
|
||||||
|
|
||||||
impl Segatools {
|
impl Segatools {
|
||||||
@ -171,6 +171,31 @@ impl Segatools {
|
|||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut cfg_hook = ConfigHook::default();
|
||||||
|
|
||||||
|
if game == Game::Chunithm {
|
||||||
|
cfg_hook.allnet_auth = Some({
|
||||||
|
ConfigHookAuth {
|
||||||
|
r#type: "1.0".to_owned()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if let Some(port) = self.aime_port {
|
||||||
|
if self.aime == Aime::Disabled {
|
||||||
|
cfg_hook.aime = Some({
|
||||||
|
ConfigHookAime {
|
||||||
|
unit: vec![
|
||||||
|
ConfigHookAimeUnit {
|
||||||
|
port,
|
||||||
|
id: 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::fs::write(pfx_dir.join("config_hook.json"), serde_json::to_string(&cfg_hook)?)?;
|
||||||
|
|
||||||
log::debug!("end line-up: segatools");
|
log::debug!("end line-up: segatools");
|
||||||
|
|
||||||
Ok(ini_out)
|
Ok(ini_out)
|
||||||
|
@ -142,7 +142,7 @@ impl Profile {
|
|||||||
}
|
}
|
||||||
std::fs::write(&path, s)
|
std::fs::write(&path, s)
|
||||||
.map_err(|e| anyhow!("error when writing to {:?}: {}", path, e))?;
|
.map_err(|e| anyhow!("error when writing to {:?}: {}", path, e))?;
|
||||||
log::info!("Written to {:?}", path);
|
log::info!("profile written to {:?}", path);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -293,6 +293,9 @@ impl Profile {
|
|||||||
.arg(sgt_dir.join(self.meta.game.hook_amd()))
|
.arg(sgt_dir.join(self.meta.game.hook_amd()))
|
||||||
.arg("amdaemon.exe")
|
.arg("amdaemon.exe")
|
||||||
.args(self.meta.game.amd_args());
|
.args(self.meta.game.amd_args());
|
||||||
|
|
||||||
|
amd_builder.arg(self.data_dir().join("config_hook.json"));
|
||||||
|
|
||||||
game_builder
|
game_builder
|
||||||
.env(
|
.env(
|
||||||
"SEGATOOLS_CONFIG_PATH",
|
"SEGATOOLS_CONFIG_PATH",
|
||||||
@ -351,8 +354,8 @@ impl Profile {
|
|||||||
|
|
||||||
util::pkill("amdaemon.exe").await;
|
util::pkill("amdaemon.exe").await;
|
||||||
|
|
||||||
log::info!("Launching amdaemon: {:?}", amd_builder);
|
log::info!("launching amdaemon: {:?}", amd_builder);
|
||||||
log::info!("Launching {}: {:?}", self.meta.game, game_builder);
|
log::info!("launching {}: {:?}", self.meta.game, game_builder);
|
||||||
|
|
||||||
let mut amd = amd_builder.spawn()?;
|
let mut amd = amd_builder.spawn()?;
|
||||||
let mut game = game_builder.spawn()?;
|
let mut game = game_builder.spawn()?;
|
||||||
|
@ -148,29 +148,21 @@ listen<{ message: string; header: string }>('invoke-error', (event) => {
|
|||||||
>
|
>
|
||||||
<div class="fixed w-full flex z-100">
|
<div class="fixed w-full flex z-100">
|
||||||
<TabList class="grow" :show-navigators="false">
|
<TabList class="grow" :show-navigators="false">
|
||||||
<Tab :value="3"
|
<Tab :value="3"><div class="pi pi-users"></div></Tab>
|
||||||
><div class="pi pi-users" v-tooltip="'Profiles'"></div
|
|
||||||
></Tab>
|
|
||||||
<Tab :disabled="isProfileDisabled" :value="0"
|
<Tab :disabled="isProfileDisabled" :value="0"
|
||||||
><div
|
><div class="pi pi-box"></div
|
||||||
class="pi pi-box"
|
|
||||||
v-tooltip="'Installed packages'"
|
|
||||||
></div
|
|
||||||
></Tab>
|
></Tab>
|
||||||
<Tab v-if="prf.current?.meta.game === 'chunithm'" :value="4"
|
<Tab v-if="prf.current?.meta.game === 'chunithm'" :value="4"
|
||||||
><div class="pi pi-ticket" v-tooltip="'Patches'"></div
|
><div class="pi pi-ticket"></div
|
||||||
></Tab>
|
></Tab>
|
||||||
<Tab
|
<Tab
|
||||||
v-if="pkg.networkStatus === 'online'"
|
v-if="pkg.networkStatus === 'online'"
|
||||||
:disabled="isProfileDisabled"
|
:disabled="isProfileDisabled"
|
||||||
:value="1"
|
:value="1"
|
||||||
><div
|
><div class="pi pi-download"></div
|
||||||
class="pi pi-download"
|
|
||||||
v-tooltip="'Package store'"
|
|
||||||
></div
|
|
||||||
></Tab>
|
></Tab>
|
||||||
<Tab :disabled="isProfileDisabled" :value="2"
|
<Tab :disabled="isProfileDisabled" :value="2"
|
||||||
><div class="pi pi-cog" v-tooltip="'Settings'"></div
|
><div class="pi pi-cog"></div
|
||||||
></Tab>
|
></Tab>
|
||||||
|
|
||||||
<div class="grow"></div>
|
<div class="grow"></div>
|
||||||
@ -316,4 +308,8 @@ body {
|
|||||||
.p-tablist-active-bar {
|
.p-tablist-active-bar {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.p-tooltip {
|
||||||
|
min-width: 300px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue';
|
import { Ref, computed, ref } from 'vue';
|
||||||
import InputText from 'primevue/inputtext';
|
import InputText from 'primevue/inputtext';
|
||||||
import Select from 'primevue/select';
|
import Select from 'primevue/select';
|
||||||
import ToggleSwitch from 'primevue/toggleswitch';
|
import ToggleSwitch from 'primevue/toggleswitch';
|
||||||
@ -8,6 +8,7 @@ import * as path from '@tauri-apps/api/path';
|
|||||||
import { readTextFile, writeTextFile } from '@tauri-apps/plugin-fs';
|
import { readTextFile, writeTextFile } from '@tauri-apps/plugin-fs';
|
||||||
import OptionCategory from '../OptionCategory.vue';
|
import OptionCategory from '../OptionCategory.vue';
|
||||||
import OptionRow from '../OptionRow.vue';
|
import OptionRow from '../OptionRow.vue';
|
||||||
|
import { invoke } from '../../invoke';
|
||||||
import { usePkgStore, usePrfStore } from '../../stores';
|
import { usePkgStore, usePrfStore } from '../../stores';
|
||||||
import { Feature } from '../../types';
|
import { Feature } from '../../types';
|
||||||
import { hasFeature, pkgKey } from '../../util';
|
import { hasFeature, pkgKey } from '../../util';
|
||||||
@ -16,6 +17,7 @@ const pkgs = usePkgStore();
|
|||||||
const prf = usePrfStore();
|
const prf = usePrfStore();
|
||||||
|
|
||||||
const aimeCode = ref('');
|
const aimeCode = ref('');
|
||||||
|
const coms: Ref<{ [key: string]: number }> = ref({});
|
||||||
|
|
||||||
prf.reload();
|
prf.reload();
|
||||||
|
|
||||||
@ -46,6 +48,10 @@ const load = async () => {
|
|||||||
aimeCode.value = await readTextFile(aime_path).catch(() => '');
|
aimeCode.value = await readTextFile(aime_path).catch(() => '');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
invoke('list_com_ports').then((newComs) => {
|
||||||
|
coms.value = newComs as typeof coms.value;
|
||||||
|
});
|
||||||
|
|
||||||
listen('reload-aime-code', load);
|
listen('reload-aime-code', load);
|
||||||
|
|
||||||
load();
|
load();
|
||||||
@ -54,14 +60,14 @@ load();
|
|||||||
<template>
|
<template>
|
||||||
<OptionCategory title="Aime">
|
<OptionCategory title="Aime">
|
||||||
<OptionRow
|
<OptionRow
|
||||||
title="Aime emulation"
|
title="Aime type"
|
||||||
tooltip="Aime plugins can be downloaded from the package store."
|
tooltip="Additional Aime plugins can be downloaded from the package store."
|
||||||
>
|
>
|
||||||
<Select
|
<Select
|
||||||
v-model="prf.current!.data.sgt.aime"
|
v-model="prf.current!.data.sgt.aime"
|
||||||
:options="[
|
:options="[
|
||||||
{ title: 'none', value: 'Disabled' },
|
{ title: 'hardware', value: 'Disabled' },
|
||||||
{ title: 'segatools built-in', value: 'BuiltIn' },
|
{ title: 'segatools built-in emulation', value: 'BuiltIn' },
|
||||||
...pkgs.byFeature(Feature.Aime).map((p) => {
|
...pkgs.byFeature(Feature.Aime).map((p) => {
|
||||||
return {
|
return {
|
||||||
title: pkgKey(p),
|
title: pkgKey(p),
|
||||||
@ -76,11 +82,13 @@ load();
|
|||||||
option-value="value"
|
option-value="value"
|
||||||
></Select>
|
></Select>
|
||||||
</OptionRow>
|
</OptionRow>
|
||||||
<OptionRow title="Aime code">
|
<OptionRow
|
||||||
|
title="Aime code"
|
||||||
|
v-if="prf.current!.data.sgt.aime !== 'Disabled'"
|
||||||
|
>
|
||||||
<InputText
|
<InputText
|
||||||
class="shrink"
|
class="shrink"
|
||||||
size="small"
|
size="small"
|
||||||
:disabled="prf.current!.data.sgt.aime === 'Disabled'"
|
|
||||||
:maxlength="20"
|
:maxlength="20"
|
||||||
placeholder="00000000000000000000"
|
placeholder="00000000000000000000"
|
||||||
v-model="aimeCodeModel"
|
v-model="aimeCodeModel"
|
||||||
@ -113,5 +121,26 @@ load();
|
|||||||
<ToggleSwitch v-model="prf.current!.data.sgt.amnet.physical" />
|
<ToggleSwitch v-model="prf.current!.data.sgt.amnet.physical" />
|
||||||
</OptionRow>
|
</OptionRow>
|
||||||
</div>
|
</div>
|
||||||
|
<OptionRow
|
||||||
|
title="Aime serial port"
|
||||||
|
tooltip="Ports can be checked in Devices and Printers or at googlechromelabs.github.io/serial-terminal
|
||||||
|
For AIC Pico, the AIME port should be selected."
|
||||||
|
v-if="prf.current!.data.sgt.aime === 'Disabled'"
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
v-model="prf.current!.data.sgt.aime_port"
|
||||||
|
:options="[
|
||||||
|
{ title: 'default', value: 'Disabled' },
|
||||||
|
...Object.entries(coms ?? {}).map(([title, value]) => {
|
||||||
|
return {
|
||||||
|
title,
|
||||||
|
value,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
]"
|
||||||
|
option-label="title"
|
||||||
|
option-value="value"
|
||||||
|
></Select>
|
||||||
|
</OptionRow>
|
||||||
</OptionCategory>
|
</OptionCategory>
|
||||||
</template>
|
</template>
|
||||||
|
@ -77,6 +77,7 @@ export interface SegatoolsConfig {
|
|||||||
addr: string;
|
addr: string;
|
||||||
physical: boolean;
|
physical: boolean;
|
||||||
};
|
};
|
||||||
|
aime_port: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DisplayConfig {
|
export interface DisplayConfig {
|
||||||
|
Reference in New Issue
Block a user