Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill Ubisoft Connect after closing a Ubisoft game #2962

Open
arielj opened this issue Aug 6, 2023 · 8 comments
Open

Kill Ubisoft Connect after closing a Ubisoft game #2962

arielj opened this issue Aug 6, 2023 · 8 comments
Labels
feature-request New feature needs to be implemented.

Comments

@arielj
Copy link
Collaborator

arielj commented Aug 6, 2023

Problem description

Currently, when playing a Ubisoft game (from your Epic library with Heroic), after closing the game the launcher is still open, so the game status never changes back to not playing and we have to force-close the game.

Feature description

I don't know if it's possible, but it would be great if we can detect when the game closes and programatically kill the Ubisoft Connect launcher.

Alternatives

The current alternative is to manually close/kill the Ubisoft Connect launcher.

Additional information

No response

@arielj arielj added the feature-request New feature needs to be implemented. label Aug 6, 2023
@Kobi-Blade
Copy link

Kobi-Blade commented Aug 8, 2023

Aggressively closing other apps without user consent is a big no no in software development.

They simply need to change how they detecting the game is open, I don't know why Ubisoft Connect would have anything to do with it.

Whatever code they using to detect a game is running, is making no sense if they tracking Ubisoft Connect instead of the game itself.

Then again is not our problem, cause official support is for GoG and Epic, not Ubisoft Connect.

@imLinguin
Copy link
Member

imLinguin commented Aug 8, 2023

Then again is not our problem, cause official support is for GoG and Epic, not Ubisoft Connect.

Epic provides integration with Ubisoft Connect, which we try to support the same way too.

But I agree, it's aggressive and nearly impossible to do

@arielj
Copy link
Collaborator Author

arielj commented Aug 9, 2023

To be clear, this is about Ubisoft games that you start from your Epic library, so it's about the Epic integration we support. (I updated the description to clarify this)

The way the ubisoft connect games work when launched from your Epic library is:

  • the game is started by running a uplay.exe file included in the game install folder
  • that file launches UbisoftConnect and then launches the game
  • when you close the game, the Ubisoft launcher is still running in the background and is not closed

So my request is: if the ubisoft connect launcher was started without me opening it explicitly (the game launched it), why do I have to kill it myself after I exit the game?

Also to be clear, this is a request just for Linux, I don't think it's an issue in Windows.

I'm not sure I understand what's the aggressive part: the Ubisoft Connect launcher that the game executed is the one that heroic installs in the game's prefix, so the only reason for that app to even exist is for that specific game to run. After exiting the game, that instance of the Ubisoft launcher is literally useless cause it can only see that one game as installed (and at least in my experience, it's bugged and you can't even re-open it to launch the game, you have to kill the process manually). The launcher is not even logged in when started by the game.

@imLinguin
Copy link
Member

imLinguin commented Aug 9, 2023

Just checked it with our Ubisoft experts, unless we are able to introduce hacky solution of knowing which process is the game, know when it closed and be able to run kill on upc.exe, it's impossible.

@arielj
Copy link
Collaborator Author

arielj commented Aug 9, 2023

I did a quick test with Trackmania, so this is my finding:

  • there's an ini file that shows the uplayid (in this case 5595) (we also have that in the game's metadata as "launch_parameters": "-UplayId=5595")
  • when the game is running, a UbisoftConnectLauncher.exe process with -upc_uplay_id 5595 in the arguments of the process is present
  • when the game is closed, that process is gone

I know it's hacky but I imagine something like:

  • when heroic window gains focus, and an ubisoft game is currently with the running status, we can check if there's still a process with the given uplayid in the arguments
  • if there's a process, all good, game is still running, just people alt-tabbing for example
  • if there's no process, wait a bit and try again, if still no process it's probably that the game was closed, so you can kill the launcher that's left there

That's a rough idea of course, I didn't think about it too much (kinda thinking out loud here) and it can be improved for sure, but I think it is kinda possible with not that much hackery.

maybe it can even be added as an opt-in experimental feature, so by default it doesn't kill the launcher, but you can say I want this to happen to give consent.

I think the main issue is: when is the right time to check if that process exists? I was thinking when heroic gains focus because it's kinda when you care about the status of the game in the UI, but I don't know what to do when the game is launched with no GUI

I know in other languages I can attach a listener to a system process and get notified when the process exits, but I couldn't fine anything like that for node.

@Etaash-mathamsetty
Copy link
Member

I think it's just easier to prevent ubisoft connect from running in the background through modifying its config or a reg key

@arielj
Copy link
Collaborator Author

arielj commented Aug 10, 2023

I think it's just easier to prevent ubisoft connect from running in the background through modifying its config or a reg key

I tried that but I couldn't find any config to auto close the ubisoft launcher after the game starts or exits

@sunbeam906
Copy link

sunbeam906 commented Jun 13, 2024

Late to the party, but I am kind of facing the same issue.. although with another game: Assassin's Creed Syndicate. Generally, it would happen the same with any game from Ubisoft running via launcher. I managed to get rid of the executable memory integrity check and set (hardware) breakpoints on known APIs: TerminateProcess, ExitProcess, DestroyWindow. Yes.. once you use the in-game GUI buttons to terminate the game, ExitProcess (FatalExit on newer Windows OSes) is hit. The moment the process dies, the Ubisoft Connect interface is brought to front and the typical "what's new" widget appears on top of the window.. Yes, super annoying and no way to kill it. So I'll focus on proxyifying the launcher so that I can hook some APIs and gracefully kill that "bring to front" and bla.. Stay tuned.

P.S.: I'm aware it's about another game.. but the issue is identical and what I hope to achieve will benefit ANY game started from the launcher.

EDIT: OK, I stand corrected. If you click on your profile picture > Settings, you will find a setting there called "Enable post-game notifications for upcoming releases, events, promotions and additions to my games". Untick it and you'll be free of the awful bring to front and news pop-up after a game close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature needs to be implemented.
Projects
None yet
Development

No branches or pull requests

5 participants