diff --git a/src/guard.rs b/src/guard.rs index 1e6cc18..922a0cd 100644 --- a/src/guard.rs +++ b/src/guard.rs @@ -15,6 +15,12 @@ use std::path::{Path, PathBuf}; /// Return `true` if Subnautica 2 appears to be running. #[cfg(target_os = "windows")] pub fn game_running() -> bool { + // Process detection disabled — avoid AV false-positives. + // Close Subnautica 2 manually before using NotAlterra. + false +} +#[allow(dead_code)] +fn _game_running_windows() -> bool { let out = std::process::Command::new("tasklist") .args(["/FI", "IMAGENAME eq Subnautica2.exe", "/NH"]) .output(); @@ -26,6 +32,10 @@ pub fn game_running() -> bool { #[cfg(not(target_os = "windows"))] pub fn game_running() -> bool { + false +} +#[allow(dead_code)] +fn _game_running_linux() -> bool { let patterns = &["Subnautica2", "Subnautica2-Win64-Shipping"]; for pat in patterns { if let Ok(out) = std::process::Command::new("pgrep") diff --git a/src/main.rs b/src/main.rs index d47da80..6ab59d0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -141,19 +141,14 @@ fn refresh_stats(tui_state: &mut tui::AppState, save_folder: Option<&Path>) { fn run_app(terminal: &mut Terminal) -> Result<()> { let mut app = App::new()?; - // Guard: warn if game is running, then exit - if guard::game_running() { - ok_dialog(terminal, &app, "Game Running", - "NotAlterra has detected that Subnautica 2 is currently running.\n\ - \n\ - The game holds file locks on your save files while active.\n\ - Backing up or restoring saves while the game is running can\n\ - result in incomplete, corrupt, or overwritten save files.\n\ - \n\ - Close Subnautica 2, then relaunch NotAlterra.", - )?; - return Ok(()); - } + // Reminder — the user should close the game before using the tool + ok_dialog(terminal, &app, "Before You Begin", + "Please close Subnautica 2 before using NotAlterra.\n\ + \n\ + The game holds file locks on your save files while active.\n\ + Backing up or restoring saves with the game running can\n\ + result in incomplete, corrupt, or overwritten save files.", + )?; // Disclaimer flow if !app.config.disclaimer_accepted { @@ -395,14 +390,6 @@ fn action_locate_saves(terminal: &mut Terminal, app: &mut App) -> fn action_recover_bak(terminal: &mut Terminal, app: &mut App) -> Result<()> { let save_folder = ensure_save_folder(terminal, app)?; - // Warn if game is running - if guard::game_running() { - app.set_status( - "Subnautica 2 is running — save files may be locked!", - tui::StatusStyle::Warning, - ); - } - // Show spinner while parsing metadata app.set_status("Reading save metadata…", tui::StatusStyle::Info); app.set_spinner(true); @@ -598,10 +585,6 @@ fn action_recover_bak(terminal: &mut Terminal, app: &mut App) -> fn action_create_backup(terminal: &mut Terminal, app: &mut App) -> Result<()> { let save_folder = ensure_save_folder(terminal, app)?; - if guard::game_running() { - app.set_status("Subnautica 2 is running — files may be locked.", tui::StatusStyle::Warning); - } - app.set_status("Creating backup…", tui::StatusStyle::Info); app.set_spinner(true); terminal.draw(|f| { @@ -771,10 +754,6 @@ fn ini_backup_action( config_path: &Path, backup_root: &Path, ) -> Result<()> { - if guard::game_running() { - app.set_status("Subnautica 2 is running — files may be locked.", tui::StatusStyle::Warning); - } - match ops::backup_ini_files(config_path, backup_root) { Ok(result) => { let verified = if result.verified { "verified" } else { "unverified" }; @@ -1057,22 +1036,6 @@ fn get_config_path(_terminal: &mut Terminal, app: &mut App) -> Re anyhow::bail!("Cannot determine Config/Windows path. Run 'Locate Subnautica save files' first.") } -/// Derive the target .sav name from a .bak filename. -/// Read the next keyboard event, silently skipping KeyRelease events. -/// Key-repeat and initial press are both accepted. -fn read_key_event() -> Result { - loop { - if event::poll(std::time::Duration::from_millis(100))? { - if let Event::Key(key) = event::read()? { - if key.kind != KeyEventKind::Release { - return Ok(key); - } - } - } - // Other events (terminal changes etc) trigger a loop → redraw - } -} - /// Determine if a save folder is cloud-backed (Xbox/Game Pass wgs path). fn is_cloud_path(path: &Path) -> bool { let s = path.to_string_lossy().to_lowercase();