feat: audio mode

This commit is contained in:
2025-03-29 00:55:31 +00:00
parent ad5a800d1b
commit 17411e8f0d
9 changed files with 203 additions and 8 deletions

View File

@ -2,6 +2,7 @@ pub mod package;
pub mod segatools;
pub mod network;
pub mod bepinex;
pub mod mu3ini;
#[cfg(target_os = "windows")]
pub mod display_windows;

View File

@ -0,0 +1,30 @@
use std::path::Path;
use anyhow::Result;
use ini::Ini;
use crate::model::profile::{Mu3Audio, Mu3Ini};
impl Mu3Ini {
pub fn line_up(&self, game_path: impl AsRef<Path>) -> Result<()> {
let file = game_path.as_ref().join("mu3.ini");
if !file.exists() {
std::fs::write(&file, "")?;
}
let mut ini = Ini::load_from_file(&file)?;
if let Some(audio) = self.audio {
let value = match audio {
Mu3Audio::Shared => "0",
Mu3Audio::Excl6Ch => "1",
Mu3Audio::Excl2Ch => "2",
};
ini.with_section(Some("Sound")).set("WasapiExclusive", value);
}
ini.write_to_file(file)?;
Ok(())
}
}