0neGal / viper

Launcher+Updater for TF|2 Northstar
https://0negal.github.io/viper
GNU General Public License v3.0
151 stars 21 forks source link

bug: Viper doesn't check whether Northstar/Titanfall2 is running before installing Northstar #177

Closed GeckoEidechse closed 1 year ago

GeckoEidechse commented 1 year ago

Describe the bug This bug was discovered in a ticket on the Northstar Discord server.

The TL;DR is that a user had a broken install due to mod conflicts, was adviced to delete R2Northstar then reinstall via their preferred method.

They used Viper but it failed to install. Testing with FlightCore as well it revealed that Northstar appeared to still be running.

Screenshots sent by the user in question

discord screenshot

discord screenshot

discord screenshot

Testing with FlightCore

discord screenshot

Ultimately they managed to resolve the issue by restarting their computer which obviously killed any lingering Northstar process that would still have a lock on the directory.

To Reproduce Not sure if can be easily reproduced but if, it would probably be

Steps to reproduce the behavior:

  1. Launch Northstar
  2. Delete R2Northstar
  3. Open Viper
  4. Have it fail to install?

Expected behavior Viper should perform a check if Northstar is running before attempting an install/update.

Screenshots See above

Version: Presumably newest as of time of writing.

0neGal commented 1 year ago

Huh, weird, I actually thought this was already being checked for... I'll have a look at this...

GeckoEidechse commented 1 year ago

Maybe Viper and FlightCore check for it differently? All FlightCore does is check if NorthstarLauncher.exe exists

/// Checks if Northstar process is running
pub fn check_northstar_running() -> bool {
    let s = sysinfo::System::new_all();
    for _process in s.processes_by_name("NorthstarLauncher.exe") {
        // check here if this is your process
        // dbg!(process);
        return true;
    }
    false
}

https://github.com/R2NorthstarTools/FlightCore/blob/v1.8.2/src-tauri/src/lib.rs#L334-L343

0neGal commented 1 year ago

We do that as well (in src/utils.js)

Albeit just for whether the game or Northstar is running, and not NS specifically, however it needs refactoring, like many other things in utils.js :p

I've now however come to the discovery that this function is not used on manual updates, and only on the automated ones... As the handleNorthstarUpdates() function is a wrapper around updateNorthstar(), the wrapper making these checks, and the latter simply does it irregardless of anything, which by itself is fine, we just shouldn't be calling it outside of the wrapper, but here we should've put handleNorthstarUpdates() instead...

I'll be refactoring a lot of the updating process away from the unreadable and unmaintainable mess that it is right now, and then I'll implement a fix for this, and subsequently a release.

0neGal commented 1 year ago

This is now fixed in the latest release (v1.7.1), an alert is now shown if you attempt to update the game whilst it or Northstar is running, which then prevents you from updating.