[launcher event] Add identifier to distinguish manual termination in onTerminated event

  • Feature Description:

Add a way to determine if the user manually closed the launcher.

For example, in the overwolf.games.launchers.onTerminated event add a “source” property that can “manual” or “auto”.

  • impact for my app: mid

  • What is your current pain point?

The goal of the feature request is to determine when the user decides to stop playing League (i.e., they close the launcher manually) and restore the desktop app for the user to review their game play.

I can achieve this with other games by listening to when the game client is closed, but League closes the game client after every match.

Instead, I want to listen to when the League Launcher terminates to restore the desktop window for the user. But currently, when playing LoL the onTerminated event is fired every time when you start a match unless the user changed the default options in the League client to never close during game.

  • What do you have in mind to solve it?

Instead of restoring the desktop window after every game client close, we can flash the desktop window if the game that was closed is League.

It doesn’t match the behaviour as other games, but it’s better than having users complain about the window restore after every game.

Hi!
So, if I understood this correctly, the issue is that, if users choose the following setting, and set it to “always”, the launcher fires a “terminated” event during game?
image

If so, while not optimal, this can be handled with a few small changes.
With this setting enabled, the league client will close after being in the game for a bit. In that case, you can simply check, whenever a terminated event is fired, if the game itself is active. Then, if that is the case, you avoid showing the desktop window.

As an extra, for the odd cases where the launcher will not open after the game (maybe it was manually closed while the game was running?), you can then wait for the game itself to close, and wait say… 10, 15 seconds, to see if it relaunches? or even just flat out check the league settings file (assuming it contains this setting). And then you can try and differentiate that way between the client actually closing down, or just closing itself due to this setting.

Hope that helps!

Hi,

Yes, the launcher will close if the “Close client during game” setting is either “always” or “As Needed”.

I tried checking if the game is running when the onTerminated event is fired, but the launcher always closed before my game is running. It may be linked to how fast the computer loads the game, so it’s not a solution for every computer.

I welcome any other solutions that can help.

I’m not sure I follow - does the launcher close before the game can be detected as running (when using getRunningGameInfo())?

Either way, there are a few possible detection methods like this, but I do agree that if this last one isn’t consistent, these other methods will probably leave some holes as well. I’ll also check this with the team.

Good news: this has been made easier due to a bugfix, currently in the internal dev version, will update here when it releases.

You will now receive through overwolf.games.launchers.onUpdated, that the window’s position changed to -3200 -3200 (or was it -32000?) when the window is closed as well (before it was only when it was minimized) (this also applies to this current case, of the launcher “closing” before a game).
Then, you just need to check after a few seconds (i recommend testing it a bit and then increasing by ~25% roughly from the delay on your end) whether or not league was launched in the time between. If it was, the launcher was closed due to the “close launcher when entering game” setting. If not, you can assume that the launcher was closed for good

For extra safety, you can also try to read the relevant league settings file, to check that setting.

And lastly, make sure that you check if the game was launched/was already running, so you don’t end up accidentally detecting someone manually closing the launcher when the game is on as them quitting completely.

Hope that helps!

Thanks. I will try this solution after the change is released onto the development branch.

This change should now be released in the developer’s channel.
The basic idea is that now, whenever the launcher is minimized, it will update its position to -32k on both coordinates.

With that, you can essentially detect that if the launcher was minimized, and no change occurred to it until it was terminated (since the window is hidden and immediately terminated, termination just takes a while to terminate the entire launcher), it is almost necessarily a termination due to a game (you can add an extra check about whether or not the user is in a game just to be sure).
With that, unless the client crashes/the user closes it directly through task manager, any sequence of events where it is minimized AND ONLY THEN terminated will necessarily be a termination due to the game launching.

Hope that helps!