diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 3a93bd8..0f5933a 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1051,13 +1051,9 @@ async fn launch_game(app: AppHandle, state: State<'_, GameState>, instance_id: S let mut c = tokio::process::Command::new(proton_exe); let compat_data = instance_dir.join("proton_prefix"); fs::create_dir_all(&compat_data).map_err(|e| e.to_string())?; - if std::env::var("STEAM_COMPAT_CLIENT_INSTALL_PATH").is_err() { - c.env("STEAM_COMPAT_CLIENT_INSTALL_PATH", ""); - } + c.env("STEAM_COMPAT_CLIENT_INSTALL_PATH", ""); c.env("STEAM_COMPAT_DATA_PATH", compat_data.to_str().unwrap()); - if std::env::var("SteamAppId").is_err() { - c.env("SteamAppId", "480"); - } + c.env("SteamAppId", "480"); c.arg("run"); c } else { @@ -1065,10 +1061,7 @@ async fn launch_game(app: AppHandle, state: State<'_, GameState>, instance_id: S }; #[cfg(unix)] - { - cmd.process_group(0); - cmd.env_remove("LD_PRELOAD"); - } + cmd.process_group(0); cmd.arg(&game_exe) .current_dir(&instance_dir); diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index a00ae0a..868cbaa 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -10,15 +10,9 @@ fn main() { use std::thread; let stage = env::var("EMERALD_LAUNCH_STAGE").unwrap_or_else(|_| "0".to_string()); if stage == "0" { - let mut cmd = Command::new(env::current_exe().unwrap()); - cmd.env("EMERALD_LAUNCH_STAGE", "1"); - - let wayland_libs = ["/usr/lib/libwayland-client.so.0", "/usr/lib64/libwayland-client.so.0"]; - if let Some(path) = wayland_libs.iter().find(|p| std::path::Path::new(p).exists()) { - cmd.env("LD_PRELOAD", path); - } - - let mut child = cmd + let mut child = Command::new(env::current_exe().unwrap()) + .env("EMERALD_LAUNCH_STAGE", "1") + .env("LD_PRELOAD", "LD_PRELOAD=/usr/lib64/libwayland-client.so.0") //neo: hacky way to fix appimage on systems like gentoo .stdout(Stdio::piped()) .stderr(Stdio::piped()) .spawn() @@ -75,17 +69,14 @@ fn main() { if found_error { println!("Emerald: Automatic recovery triggered for graphics crash/invisible launch."); } - let mut retry_cmd = Command::new(env::current_exe().unwrap()); - retry_cmd.env("EMERALD_LAUNCH_STAGE", "2") - .env("GDK_BACKEND", "x11") - .env("WEBKIT_DISABLE_DMABUF_RENDERER", "1") - .env("WEBKIT_DISABLE_COMPOSITING_MODE", "1"); - if let Some(path) = wayland_libs.iter().find(|p| std::path::Path::new(p).exists()) { - retry_cmd.env("LD_PRELOAD", path); - } - - let mut retry_child = retry_cmd.spawn().expect("failed to spawn fallback child process"); + let mut retry_child = Command::new(env::current_exe().unwrap()) + .env("EMERALD_LAUNCH_STAGE", "2") + .env("WEBKIT_DISABLE_DMABUF_RENDERER", "1") + .env("WEBKIT_DISABLE_COMPOSITING_MODE", "1") + .env("LD_PRELOAD", "LD_PRELOAD=/usr/lib64/libwayland-client.so.0") //neo: hacky way to fix appimage on systems like gentoo + .spawn() + .expect("failed to spawn fallback child process"); let retry_status = retry_child.wait().expect("failed to wait on fallback child process"); exit(retry_status.code().unwrap_or(1));