fix: begin fixing linux support

This commit is contained in:
2025-04-23 17:17:59 +02:00
parent f26d83f291
commit bf4c06ee2d
13 changed files with 135 additions and 30 deletions

View File

@ -1,6 +1,6 @@
pub use types::{Profile, ProfileData, ProfileMeta, ProfilePaths, StartPayload};
use std::{collections::{BTreeMap, BTreeSet}, path::{Path, PathBuf}};
use crate::{model::{misc::Game, patch::{PatchList, PatchSelection}, profile::{Aime, ChunithmKeyboard, IOSelection, Keyboard, Mu3Ini, OngekiKeyboard, ProfileModule}}, modules::{display_windows::DisplayInfo, package::prepare_packages}, pkg::PkgKey, pkg_store::PackageStore, util};
use crate::{model::{misc::Game, patch::{PatchList, PatchSelection}, profile::{Aime, ChunithmKeyboard, IOSelection, Keyboard, Mu3Ini, OngekiKeyboard, ProfileModule}}, modules::package::prepare_packages, pkg::PkgKey, pkg_store::PackageStore, util};
use tauri::Emitter;
use std::process::Stdio;
use crate::model::profile::BepInEx;
@ -10,9 +10,23 @@ use std::fs::File;
use tokio::process::Command;
use tokio::task::JoinSet;
#[cfg(target_os = "windows")]
use crate::modules::display_windows::DisplayInfo;
pub mod template;
pub mod types;
#[cfg(target_os = "linux")]
pub trait RawArg {
fn raw_arg<S: AsRef<std::ffi::OsStr>>(&mut self, arg: S) -> &mut Command;
}
#[cfg(target_os = "linux")]
impl RawArg for Command {
fn raw_arg<S: AsRef<std::ffi::OsStr>>(&mut self, arg: S) -> &mut Command {
return self.arg::<S>(arg);
}
}
impl Profile {
pub fn new(mut meta: ProfileMeta) -> Result<Self> {
meta.name = fixed_name(&meta, true);
@ -176,6 +190,7 @@ impl Profile {
self.data.patches = source.patches;
}
}
#[cfg(target_os = "windows")]
pub fn prepare_display(&self) -> Result<Option<DisplayInfo>> {
let info = match &self.data.display {
None => None,
@ -252,8 +267,8 @@ impl Profile {
}
#[cfg(target_os = "linux")]
{
game_builder = Command::new(&self.wine.runtime);
amd_builder = Command::new(&self.wine.runtime);
game_builder = Command::new(&self.data.wine.runtime);
amd_builder = Command::new(&self.data.wine.runtime);
game_builder.arg(sgt_dir.join(self.meta.game.inject_exe()));
amd_builder.arg("cmd.exe");
@ -349,8 +364,8 @@ impl Profile {
#[cfg(target_os = "linux")]
{
amd_builder.env("WINEPREFIX", &self.wine.prefix);
game_builder.env("WINEPREFIX", &self.wine.prefix);
amd_builder.env("WINEPREFIX", &self.data.wine.prefix);
game_builder.env("WINEPREFIX", &self.data.wine.prefix);
}
let amd_log = File::create(self.data_dir().join("amdaemon.exe.log"))?;