aboutsummaryrefslogtreecommitdiff
path: root/libs/nak/src/steam/mod.rs
diff options
context:
space:
mode:
authorSulfurNitride <SulfurNitride@users.noreply.github.com>2026-04-08 03:30:04 -0500
committerSulfurNitride <SulfurNitride@users.noreply.github.com>2026-04-08 03:30:04 -0500
commit3de4056df4ea5d0afbcea388ad8d681daea1aac3 (patch)
treefc5978451f9f51b84268f45bd2fa6f5d4a17baaf /libs/nak/src/steam/mod.rs
parent5ba23a6d7a40052d9e1d4bd0cf018cfe7814d03a (diff)
Remove NaK/Rust dependency, port remaining functionality to native C++
Replace NaK Rust crate and nak_ffi with native C++ implementations: - Game detection (Steam, Heroic, Bottles), VDF parser, icon extraction - Prefix symlinks, SLR manager, Steam path detection - Known games database Add FUSE VFS optimizations: zero-copy reads via fuse_reply_data, default_permissions mount option, FUSE_CAP_ASYNC_DIO, FUSE_CAP_EXPIRE_ONLY, lookup cache parent index, cached mode bits, increased I/O buffer sizes. Update build system, prefix setup, and various fixes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'libs/nak/src/steam/mod.rs')
-rw-r--r--libs/nak/src/steam/mod.rs135
1 files changed, 0 insertions, 135 deletions
diff --git a/libs/nak/src/steam/mod.rs b/libs/nak/src/steam/mod.rs
deleted file mode 100644
index c5964aa..0000000
--- a/libs/nak/src/steam/mod.rs
+++ /dev/null
@@ -1,135 +0,0 @@
-//! Steam integration module
-//!
-//! Handles Proton detection, Steam path detection, and mount point discovery.
-//! Shortcuts and config.vdf manipulation removed (handled by C++ side).
-
-mod paths;
-mod proton;
-
-// Re-export path detection utilities
-pub use paths::{
- detect_steam_path_checked, find_steam_path, find_userdata_path,
- get_steam_accounts,
-};
-
-// Re-export Proton detection
-pub use proton::{find_steam_protons, SteamProton};
-
-use std::fs;
-
-/// Kill Steam process gracefully, then force if needed
-pub fn kill_steam() -> Result<(), Box<dyn std::error::Error>> {
- use std::process::Command;
-
- // Try steam -shutdown first (graceful)
- let _ = Command::new("steam")
- .arg("-shutdown")
- .status();
-
- std::thread::sleep(std::time::Duration::from_secs(2));
-
- // Then force kill if still running
- let _ = Command::new("pkill")
- .arg("-9")
- .arg("steam")
- .status();
-
- // Brief wait for Steam to fully exit
- std::thread::sleep(std::time::Duration::from_secs(2));
-
- Ok(())
-}
-
-/// Start Steam in background
-pub fn start_steam() -> Result<(), Box<dyn std::error::Error>> {
- use std::process::{Command, Stdio};
-
- Command::new("setsid")
- .arg("steam")
- .arg("-silent")
- .stdout(Stdio::null())
- .stderr(Stdio::null())
- .spawn()?;
-
- Ok(())
-}
-
-/// Restart Steam (kill then start)
-pub fn restart_steam() -> Result<(), Box<dyn std::error::Error>> {
- kill_steam()?;
- start_steam()?;
- Ok(())
-}
-
-// ============================================================================
-// STEAM_COMPAT_MOUNTS Detection
-// ============================================================================
-
-/// Directories that pressure-vessel already exposes by default
-const ALREADY_EXPOSED: &[&str] = &[
- "bin", "etc", "home", "lib", "lib32", "lib64",
- "overrides", "run", "sbin", "tmp", "usr", "var",
-];
-
-/// System directories that shouldn't be mounted
-const SYSTEM_DIRS: &[&str] = &[
- "proc", "sys", "dev", "boot", "root", "lost+found", "snap",
-];
-
-/// Detect directories at root that need to be added to STEAM_COMPAT_MOUNTS
-pub fn detect_extra_mounts() -> Vec<String> {
- let mut mounts = Vec::new();
-
- let Ok(entries) = fs::read_dir("/") else {
- return mounts;
- };
-
- for entry in entries.flatten() {
- let name = entry.file_name().to_string_lossy().to_string();
-
- if ALREADY_EXPOSED.contains(&name.as_str()) {
- continue;
- }
-
- if SYSTEM_DIRS.contains(&name.as_str()) {
- continue;
- }
-
- if name.starts_with('.') {
- continue;
- }
-
- if entry.path().is_dir() {
- mounts.push(format!("/{}", name));
- }
- }
-
- mounts.sort();
- mounts
-}
-
-/// Generate launch options string with DXVK config file and STEAM_COMPAT_MOUNTS
-pub fn generate_launch_options(dxvk_conf_path: Option<&std::path::Path>, is_electron_app: bool) -> String {
- let mounts = detect_extra_mounts();
-
- let dxvk_part = match dxvk_conf_path {
- Some(path) => format!(
- "DXVK_CONFIG_FILE=\"{}\"",
- crate::config::normalize_path_for_steam(&path.to_string_lossy())
- ),
- None => String::new(),
- };
-
- let electron_flags = if is_electron_app {
- " --disable-gpu --no-sandbox"
- } else {
- ""
- };
-
- match (dxvk_part.is_empty(), mounts.is_empty()) {
- (true, true) => format!("%command%{}", electron_flags),
- (true, false) => format!("STEAM_COMPAT_MOUNTS={} %command%{}", mounts.join(":"), electron_flags),
- (false, true) => format!("{} %command%{}", dxvk_part, electron_flags),
- (false, false) => format!("{} STEAM_COMPAT_MOUNTS={} %command%{}", dxvk_part, mounts.join(":"), electron_flags),
- }
-}