feat: basic card setup

This commit is contained in:
2025-02-25 19:27:37 +00:00
parent 43fd622322
commit 1586f81152
12 changed files with 140 additions and 69 deletions

View File

@ -13,7 +13,7 @@ async fn symlink(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> std::io::Resul
#[cfg(target_os = "windows")]
async fn symlink(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> std::io::Result<()> {
//std::os::windows::fs::junction_point(src, dst)
//std::os::windows::fs::junction_point(src, dst) // is unstable
junction::create(src, dst)
}
@ -77,6 +77,13 @@ pub async fn line_up(p: &Profile) -> Result<()> {
"targetAssembly",
util::path_to_str(dir_out.join("BepInEx").join("core").join("BepInEx.Preloader.dll"))?
);
if prepare_aime(p).await.unwrap_or(false) {
ini_out.with_section(Some("aime"))
.set("enable", "1")
.set("aimePath", util::path_to_str(dir_out.join("aime.txt"))?);
}
ini_out.write_to_file(dir_out.join("segatools.ini"))?;
log::debug!("Option dir: {} -> {}", opt_dir_in.to_string_lossy(), opt_dir_out.to_string_lossy());
@ -87,3 +94,15 @@ pub async fn line_up(p: &Profile) -> Result<()> {
Ok(())
}
// Todo multiple codes
async fn prepare_aime(p: &Profile) -> Result<bool> {
if p.get_bool("aime", true) {
if let Some(code) = p.cfg.get("aime-code") {
let code = code.as_str().expect("Invalid config");
fs::write(util::profile_dir(&p).join("aime.txt"), code).await?;
return Ok(true);
}
}
Ok(false)
}