Heroic-Games-Launcher / HeroicGamesLauncher

A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.
https://heroicgameslauncher.com
GNU General Public License v3.0
7.92k stars 418 forks source link

Kill Ubisoft Connect after closing a Ubisoft game #2962

Open arielj opened 1 year ago

arielj commented 1 year ago

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

Kobi-Blade commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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:

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 commented 1 year ago

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 commented 1 year ago

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

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

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 commented 1 year ago

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

arielj commented 1 year ago

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 commented 3 months ago

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.