forked from akanyan/STARTLINER
feat: audio mode
This commit is contained in:
@ -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;
|
30
rust/src/modules/mu3ini.rs
Normal file
30
rust/src/modules/mu3ini.rs
Normal 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(())
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user