feat: amnet integration
This commit is contained in:
@ -2,7 +2,7 @@ use std::path::PathBuf;
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use ini::Ini;
|
||||
use crate::{model::{profile::Segatools, segatools_base::segatools_base}, profiles::ProfilePaths, util::{self, PathStr}};
|
||||
use crate::{model::{profile::{Aime, Segatools}, segatools_base::segatools_base}, profiles::ProfilePaths, util::{self, PathStr}};
|
||||
|
||||
impl Segatools {
|
||||
pub async fn line_up(&self, p: &impl ProfilePaths) -> Result<Ini> {
|
||||
@ -50,10 +50,30 @@ impl Segatools {
|
||||
pfx_dir.join("BepInEx").join("core").join("BepInEx.Preloader.dll").stringify()?
|
||||
);
|
||||
|
||||
if self.enable_aime {
|
||||
if let Some(aime) = &self.aime {
|
||||
ini_out.with_section(Some("aime"))
|
||||
.set("enable", "1")
|
||||
.set("aimePath", p.config_dir().join("aime.txt").stringify()?);
|
||||
if let Aime::AMNet(key) = aime {
|
||||
let mut aimeio = ini_out.with_section(Some("aimeio"));
|
||||
aimeio
|
||||
.set("path", util::pkg_dir().join(key.to_string()).join("segatools").join("aimeio.dll").stringify()?)
|
||||
.set("gameId", "SDDT")
|
||||
.set("serverAddress", &self.amnet.addr)
|
||||
.set("useAimeDBForPhysicalCards", if self.amnet.physical { "1" } else { "0" })
|
||||
.set("enableKeyboardMode", "0");
|
||||
|
||||
if let Ok(keyboard_code) = std::fs::read_to_string(p.config_dir().join("aime.txt")) {
|
||||
log::debug!("{} {}", keyboard_code, keyboard_code.len());
|
||||
if keyboard_code.len() == 20 {
|
||||
aimeio.set("enableKeyboardMode", "1");
|
||||
}
|
||||
}
|
||||
|
||||
if self.amnet.name.len() > 0 {
|
||||
aimeio.set("serverName", &self.amnet.name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ini_out.with_section(Some("aime"))
|
||||
.set("enable", "0");
|
||||
|
Reference in New Issue
Block a user