darklinkpower / PlayniteExtensionsCollection

Collection of extensions made for Playnite.
MIT License
332 stars 30 forks source link

[PlayState] Processes suspend functionality not working when game installation drive has changed #590

Open LiminalLight opened 5 days ago

LiminalLight commented 5 days ago

Extension name

PlayState

Bug Description

I'm playing Heaven Burns Red, and while the game gets added to the PlayState Manager, it's not getting suspended automatically when I alt-tab to another window. I have to manually suspend it for it to actually work. I confirmed it's not getting suspended since within the PlayState Manager, it says it's not suspended. It's been like this even though it's been minimized for hours at a time.

It has worked normally for me with other games in the past. A normal game would only require a minute at most to suspend automatically.

To Reproduce

No response

Logs

playnite.log extensions.log

Screenshots

No response

LiminalLight commented 5 days ago

I believe I may have found and solved the issue. I was trying to understand the logs, and in playnite.log, noticed:

20-11 22:32:41.458|WARN |GenericPlayController:Replaced missing WorkingDir with new one:
D:\Games\Heaven Burns Red\YostarGames\HeavenBurnsRed
C:\Games\Heaven Burns Red\YostarGames\HeavenBurnsRed

I believe this was because I moved the game folder from my D: drive to C: drive. Playnite seems to have automatically detected and accounted for this change, so it still let me play the game without me manually changing HBR's path inside Playnite. It even opened the C drive's folder when I pressed "Open Installation Location" in Playnite, so I never noticed until I had to right click the game>Edit>Installation>Installation Folder to see the true D: drive path.

On the other hand, I believe PlayState didn't automatically detect this change like Playnite natively did, so it was searching for the game in my D drive which didn't exist. It would explain why I can still play the game through Playnite despite the game not automatically suspend. Not quite sure why I could still manually suspend it with the short-cut though.

Once I updated the path, it seems to work normally.

Would it be possible to make PlayState detect folder changes like Playnite? I've renamed and moved game folders to different locations quite often, so it would explain why the game wouldn't suspend despite me being able to play it. If it's not planned, feel free to this issue!

darklinkpower commented 5 days ago

Would it be possible to make PlayState detect folder changes like Playnite?

Being honest I'm not inclined about it. In my opinion it would be better for this to be resolved on Playnite's side because adding a a workaround or "band-aid fix" for this scenario would add unnecessary complexity to the plugin, and even then, an incorrect game state means that this will likely break other plugins in the future, or Playnite itself.

From the top of my head, I can think of at least 5 plugins I develop that will break due to this same issue.

I've shared my thoughts about it and potential solutions in a newly created issue in Playnite's repository: https://github.com/JosefNemec/Playnite/issues/3872