LemmusLemmus / GlosSI-Integration-Playnite

A Playnite extension that automates creating, launching and closing of GlosSI Steam shortcuts for your games.
GNU General Public License v3.0
27 stars 0 forks source link

Unrecoverable error on exiting games #16

Closed King-0f-Hero closed 1 year ago

King-0f-Hero commented 1 year ago

There is seemingly no option for me to exit games without some sort of error. When exiting games through regular in-game options the following error statement appears and I have to restart Playnite every time.

Screenshot 2022-11-07 153731

And whether or not I have the option "Close GlosSi when launched app quits and vice versa [...]" enabled in Advanced Settings in GlosSi - Config, in both cases when I try to exit the game with Steam Overlay's "Exit Shortcut" the overlay closes, but the game keeps running and I now have no controls over the game anymore and am forced to ALT+TAB out of the game and closing the program manually.

When I a) add a Non-Steam game directly through Steam and start it there, everything including exiting works fine (except of course GlosSi, because I did't add it through that), but that's to be expected, because it is a Steam built-in feature to be able to use Steam Input when you add a Non-Steam game to it and launch it through Steam. And b) when I add the game through GlosSi - Config manually everything - now including GlosSi features - works fine as well. So when both of the other options work perfectly fine for their use cases, but launching a game that has been added with the Playnite plugin doesn't work as intended the problem has to have something to do with the plugin.

[Sidenote to clarify: starting a game that has been added to Steam with the plugin within Steam launches the GlosSi-Target, but doesn't launch the game at all and launching the game through Playnite works fine, but then exiting it (with all mentioned options) brings up the mentioned issues and error.]

I really like the concept and idea of your plugin, which reduces so much manual labour of adding every game in Playnite individually to GlosSi and Steam and launching games works perfectly fine like I mentioned, but having to restart and wait for Playnite every time I exit a game gets very cumbersome and annoying so I would be more than happy if you helped me with this issue. :)

The log files are attached below. Let me know when you need anything else like other files or explanations. GlosSI-Playnite-log.zip

LemmusLemmus commented 1 year ago

Thanks for opening an issue!

When exiting games through regular in-game options the following error statement appears and I have to restart Playnite every time.

Looking at the logs, the reason the extension crashes is due to the integration getting "Access is denied" when attempting to check if the game is still running or not. This should definitely not cause the entire extension to crash, a mere logging of the error would suffice! One reason this could occur is if the game is run with elevated privileges.

And whether or not I have the option "Close GlosSi when launched app quits and vice versa [...]" enabled in Advanced Settings in GlosSi - Config, in both cases when I try to exit the game with Steam Overlay's "Exit Shortcut" the overlay closes, but the game keeps running and I now have no controls over the game anymore and am forced to ALT+TAB out of the game and closing the program manually.

This is the intended behavior, sort of. The extension doesn't actually care about whether the option is enabled or disabled, it does the closing of games on its own (it only looks at the option "When the game overlay is closed, also close the game").

[Sidenote to clarify: starting a game that has been added to Steam with the plugin within Steam launches the GlosSi-Target, but doesn't launch the game at all and launching the game through Playnite works fine, but then exiting it (with all mentioned options) brings up the mentioned issues and error.]

When adding a shortcut via the extension, it unfortunately doesn't actually add a shortcut that references the game. All it does is add a shortcut to GlosSITarget with no associated game. This means that it will not work as expected if you launch the shortcut from Steam, since it only launches the overlay itself and not the game. There are two main reasons I went with this approach:

  1. There is no way in Playnite to replace the launched program without creating a new Play action, which is not always desirable.
  2. It is difficult, and sometimes impossible, to figure out a single path to each game in Playnite.

Side note: In the logs I see that issue #15 occurred. Did you update GlosSI before using this extension by any chance? I can also see in the logs several attempts at updating the Steam shortcuts that failed.

RamazanKara commented 1 year ago

Same issue for me. Tested with default configuration. Latest update. Elevated admin rights also for me, as with Steam Deck you kinda need them to not be annoyed by UAC.

LemmusLemmus commented 1 year ago

@RamazanKara Just to make sure I understood you correctly: are you running the game with admin rights, and nothing else?


Apparently it is a bug, or rather an oversight, in Process.hasExited() that makes it unable to check if a process has exited if the process it has to check is running with elevated privileges. This particular problem should luckily be fairly easy to fix: I could either write my own hasExited() method, or I could just attempt to kill the game without checking if it is actually still running or not.


I just realized that my statement:

It is difficult, and sometimes impossible, to figure out a single path to each game in Playnite.

is actually false! Although yes, it may not always be possible to retrieve a Playnite game's "true" path, one could just launch it via Playnite, like so: playnite://playnite/start/<game>. This means that I could add support for running the shortcuts created by this extension via Steam as well (albeit still indirectly via Playnite)! Let me know if anyone would like such a feature to be added.

M0rr1s0n commented 1 year ago

I get the same error whenever closing a game, checked the logs and it does report a "Access is denied" before crashing. I only checked the plugin with Gamepass games, maybe it has to do with Windows weird way of handling it's own games and launcher regarding elevated rights? Gonna put the crashreport here, too.

Anyway, wonderful plugin, I always wished the old Glosc and old Playnite integration wouldve worked so seamless as this combination does! Thank you for this! crash.zip

LemmusLemmus commented 1 year ago

Here is a version of the extension that implements the changes described above (and a as of yet unreleased makeshift fix for game overlays being run before the Playnite overlay finishes starting): GlosSIIntegration_1_1_0_experimental3.zip. Does this version solve the problem?

M0rr1s0n commented 1 year ago

Here is a version of the extension that implements the changes described above (and a as of yet unreleased makeshift fix for game overlays being run before the Playnite overlay finishes starting): GlosSIIntegration_1_1_0_experimental3.zip. Does this version solve the problem?

Was able to test it just yet, and tested it with MS store version of Guardians of the Galaxy, which made Playnite crash yesterday, and with your experimental version everything is closing fine! Seems to work!

LemmusLemmus commented 1 year ago

The changes have been released in v1.1.1!

LemmusLemmus commented 1 year ago

I will close this issue if everyone is happy with the fix. Feel free to open a separate issue for the other problems @King-0f-Hero mentioned, if you would like to see them fixed.

King-0f-Hero commented 1 year ago

Thank you so much! Exiting a game through in-game menus closes GlosSI-Target as well and opens up Playnite again without issues - so the problem is solved.