Playnite Forums
  • Playnite Web
  • Rules
  • Members
  • Team
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Playnite Forums Extension Database Generic Extensions PlayState | Extension to suspend/resume games at any moment

PlayState | Extension to suspend/resume games at any moment
darklinkpower
Offline

#1
04-05-2020, 09:53 AM (This post was last modified: 10-14-2020, 02:51 PM by darklinkpower.)
PlayState | Extension to suspend/resume games at any moment. Pause whenever you want.

[Image: eU1TyVf.png]


Description
                                                                                                                                                                             
This extension will let you suspend and resume your game at any moment. This gives a the benefit of pausing your game at any time and also to free your CPU and GPU usage when you are not playing, effectively acting as if you closed the game when you activate the script. See the screenshots for comparison.

Github Repository: https://github.com/darklinkpower/Playnit...Extensions

Installation/Requirements
                                                                                                                                                                             
1. First download AutoHotKey here and install it: https://www.autohotkey.com

Attention: You might get a message by google or your browser that AutoHotKey's website is malicious. AutoHotKey has got false positives by antivirus and it's possible this caused Google to say that the site is malicious but this is not true. I suggest you read AutoHotKey's team explanation of the matter here: https://autohotkey.com/download/safe.htm

2. Download the latest "PlayState*.pext" extension file from the Download section and drag and drop it to the Playnite main window to install.

Usage
                                                                                                                                                                             

PlayState:
1. Launch your game.
2. Press either the 'Home' or 'Pause' key to suspend/resume your game. If you are running your game in exclusive fullscreen it is highly recommended to alt+tab first before using the functions to prevent issues.

PlayState blacklist system:
The blacklist system is designed for games you don't want the extension to be executed for.
1. Select the games you want to add or remove from the blacklist in the Playnite UI
2. Select in the extension submenu
  • "PlayState - Add selected games to blacklist" for games you want to add to the blacklist
  • "PlayState - Remove selected games from blacklist" for games you want to remove from the blacklist
Games that are blacklisted will have "PlayState blacklist" in their features, which you can remove via the extension function or editing via Playnite to remove the games from the blacklist.

Screenshots
                                                                                                                                                                             

[Image: 2020-04-18_16-03-56.gif]

Before Suspend (15.1% CPU and 62.7% GPU usage):

[Image: 8tppCJ7.jpg]

After Suspend (0.0% CPU and 0.0% GPU usage):

[Image: lWpVxIW.jpg]

Blacklist system functions:

[Image: BPwTGPx.png]


Troubleshooting (Extension not working with game)
                                                                                                                                                                             
1. Check that you have not added the game to the blacklist in the PlayState by seeing if the game has a Feature with the name "PlayState blacklist".  If that's the case, remove it from the blacklist with the extension menu function or with Playnite.
[Image: Y3mIlRY.png]

2. Make sure you have installed AutoHotKey in any location and that you have the "AutoHotkeyU64.exe" executable inside the installation directory, since it's the executable PlayState uses for the suspend function.

[Image: lULeamT.png]

3. If you see the PlayState script running in your tray and it's not working, click on "Edit This Script"

[Image: epWgBT5.png]

Check if the highlighted parts have the same name as your game executable (You can check which is the game executable by opening the task manager, right clicking on your game process and selecting "Open file location". It should take you to the folder and highlight the game executable that is running). 

[Image: qPHNYjq.png]

PlayState detection couples multiple detection methods to grab the correct executable with an internal database exclusion list. It might be possible that this may cause that the wrong executable is picked in extremely rare cases. If that happens, please send me the PlayState.log (located at {PlayniteDir}\PlayState.log) via discord or copy and send information from that runtime here and tell me what should have been the correct executable. For example, I would need something like this:

[Image: R4hQ1xS.png]

4. If your game is launched with administrator rights, you'll need to configurate the AutoHotkeyU64.exe to launch with administrator rights too by going into it's properties.

FAQ
                                                                                                                                                                             
Q: "Does it stop playtime tracking by Playnite while the game is suspended?"
A: No, Playtime tracking is handled by Playnite and it's library plugins. Since the process isn't closed, it still gets detected as opened and playtime tracking will continue.

Q: "Does it work with Microsoft Store/Xbox/Game Pass games?"
A: Yes, no limitations apply for games from any source.

Q: "Is there any limitation or games that are not compatible?"
A: All games are compatible from all my tests. There shouldn't be incompatible games since version 1.3 but if you find one let me know.

Q: "Will this ban me in online games?"
A: I'm not sure but I don't recommend using it in online games just for safety. Also in an online game the server will timeout and kick you after a few seconds if you suspend your game.

Q: "Why did I get an "App not responding" Windows message?"
A: That must be because you are trying to interact with the game after suspending it but it has not been resumed. Windows says that message because it in fact doesn't respond because the game is still suspended. To prevent this, if you are running your game in exclusive fullscreen mode make sure to first alt+tab before using the suspend function and seen the "Game Suspended" message and then resume the game and make sure the "Game Resumed" message shows before alt+tabbing to the game again.

Changelog
                                                                                                                                                                             
v1.0
  • Initial Release

v1.1
  • Added extension icon
  • Improved detection of specific games (Dark Souls III, Dragon Quest XI, The Witcher2, etc.)
  • Improved detection of Unreal Engine games
  • General game detection improvements
  • Code improvements and cleanup

v1.3
  • Rewrote detection functions from scratch. Detection accuracy should be 99~%
  • Fixed incompatibility with 64 bits games in previous versions
  • Added logging to extension. Log is generated at {PlayniteDir}\PlayState.log
  • Added automatic AutoHotKey installation directory detection via registry key. It's no longer neccesary to install at default location
  • Added PlayState internal exclusion list for executables to be ignored during initial executable game detection (For launchers, configuration executables, etc)
  • Code optimization and cleanup

v1.4
  • Changed activation key. Suspend and resume functions now activate with either the 'Home' or 'Pause' key.
  • Added 10 seconds delay to detect functions to prevent bootstrap or launcher executables not filtered from getting picked.
  • Added game name to suspend/resume message window.
  • Added extra logging.
  • Fix: Removed "DarkSoulsIII.exe" from exclusion list that was added for testing.

v1.5
  • Made changes to how the extension works to prevent Playnite from locking when the extension is still working
  • Increased delay to detect functions from 10 to 40 seconds to further prevent bootstrap or launcher executables not filtered from getting picked.
  • Increased detect executable runtimes to 60 seconds.
  • Fixed logs not including seconds.
  • Removed old unused detection methods that are no longer needed.

v1.5.1
  • Correctly close Autohotkey executable on game exit in cases where it has been set to run as administrator.
  • Prevent executable search functions from running if game platform is not PC.

v1.6
  • Implemented blacklist system for games you don't want the extension to be executed for.

v1.6.1
  • Use game features field for PlayState blacklist system.

v1.7
  • Refactor and cleanup
  • Support for emulated games
  • Fix in cases where previous AutoHotKey executable was not closed correctly

v1.7.1
  • Reorganized extension functions in submenu.
  • Added Id property and Github link to extension manifest.
  • Fix log not being deleted when size exceeds set size
  • Add "Texmod.exe" to exclusion list

Download:
                                                                                                                                                                             

.pext   PlayState_1_7_1.pext (Size: 15.78 KB / Downloads: 182)



.pext   PlayState_1_1.pext (Size: 12.93 KB / Downloads: 71)
.pext   PlayState_1_3.pext (Size: 14.68 KB / Downloads: 69)
.pext   PlayState_1_4.pext (Size: 14.76 KB / Downloads: 83)
.pext   PlayState_1_5.pext (Size: 14.85 KB / Downloads: 85)
.pext   PlayState_1_5_1.pext (Size: 14.96 KB / Downloads: 119)
.pext   PlayState_1_6_1.pext (Size: 15.82 KB / Downloads: 131)
.pext   PlayState_1_7.pext (Size: 15.6 KB / Downloads: 114)
xyifer12
Offline

#2
04-05-2020, 12:15 PM
How does this work? how does it free resources?

If this is more effective than simply pausing and minimizing, this will be super useful.
darklinkpower
Offline

#3
04-05-2020, 04:40 PM
(04-05-2020, 12:15 PM)xyifer12 Wrote: How does this work? how does it free resources?

If this is more effective than simply pausing and minimizing, this will be super useful.

Hello. What the script does is suspend the game process altogether. You can suspend the game and it will stop consuming CPU and GPU resources until you resume it. I added some comparison screenshots to the OP to show what is it's effect on a game while it's already paused inside game.
Pyvi
Offline

#4
04-05-2020, 04:51 PM
Will this also pause Playnite's Game Time aswell?
Crow
Offline

Administrator
#5
04-05-2020, 05:44 PM (This post was last modified: 04-05-2020, 05:45 PM by Crow.)
(04-05-2020, 04:51 PM)Pyvi Wrote: Will this also pause Playnite's Game Time aswell?

No it won't, Playnite (or specific library plugin) tracks if game process exists and that doesn't change with this system.
xyifer12
Offline

#6
04-05-2020, 08:17 PM
I installed AHK to the default location, installed your plugin, restarted Playnite, and launched games from Playnite. CTRL+B does not pause any games for me.
darklinkpower
Offline

#7
04-06-2020, 09:39 AM (This post was last modified: 04-06-2020, 09:40 AM by darklinkpower.)
(04-05-2020, 08:17 PM)xyifer12 Wrote: I installed AHK to the default location, installed your plugin, restarted Playnite, and launched games from Playnite. CTRL+B does not pause any games for me.
I uploaded a new version of the extension, can you check with that one? It has better detection and if it still doesn't work, check the Troubleshooting section.
dennisjjunk
Offline

#8
04-06-2020, 03:42 PM
Will this work with Windows 10 (Microsoft Store) games?
darklinkpower
Offline

#9
04-06-2020, 05:11 PM
(04-06-2020, 03:42 PM)dennisjjunk Wrote: Will this work with Windows 10 (Microsoft Store) games?

Yes, it will work with Microsoft Store games too.
BuzStringer
Offline

#10
04-18-2020, 03:56 PM
This looks awesome I wanted to write myself but i couldn't grab the right application most of the time.

Does this use the windows built in suspend / resume?
darklinkpower
Offline

#11
04-18-2020, 09:29 PM
(04-18-2020, 03:56 PM)BuzStringer Wrote: This looks awesome I wanted to write myself but i couldn't grab the right application most of the time.

Does this use the windows built in suspend / resume?

It uses the NtSuspendProcess function in the ntdll.dll API.
ritchay
Offline

#12
06-08-2020, 10:18 PM
(04-18-2020, 09:29 PM)darklinkpower Wrote:
(04-18-2020, 03:56 PM)BuzStringer Wrote: This looks awesome I wanted to write myself but i couldn't grab the right application most of the time.

Does this use the windows built in suspend / resume?

It uses the NtSuspendProcess function in the ntdll.dll API.
Hey, first off thank you so much for an awesome extension!
Secondly, is there any way to easily prevent the windows "this app is not responding, wait or close" window that pops up after a minute or so suspended?

Thanks again!
darklinkpower
Offline

#13
06-09-2020, 02:23 AM
(06-08-2020, 10:18 PM)ritchay Wrote:
(04-18-2020, 09:29 PM)darklinkpower Wrote:
(04-18-2020, 03:56 PM)BuzStringer Wrote: This looks awesome I wanted to write myself but i couldn't grab the right application most of the time.

Does this use the windows built in suspend / resume?

It uses the NtSuspendProcess function in the ntdll.dll API.
Hey, first off thank you so much for an awesome extension!
Secondly, is there any way to easily prevent the windows "this app is not responding, wait or close" window that pops up after a minute or so suspended?

Thanks again!

That must be because you are trying to interact with the game after suspending it but it has not been resumed. Windows says that message because it in fact doesn't responds because, well, it's suspended. To prevent this, make sure you have pressed the button to resume it and seen the message. I suggest to alt tab and do the suspending/resuming while not in the game window to prevent issues like this.
Oikos
Offline

#14
06-10-2020, 05:18 PM
Thank you so much for this extension I was getting super tired of suspending games from the resource monitor

Is there a way to disable the script from launching on certain games?

Also for Rainbow Six Siege my game gets the wrong exe -> (RainbowSix_BE.exe) whereas it should be (RainbowSix.exe) editing the script to that and reloading the script makes it work

I included the log and what my file shows



.txt   R6S_script.txt (Size: 1.14 KB / Downloads: 59)
.txt   R6Slog.txt (Size: 3.88 KB / Downloads: 57)
darklinkpower
Offline

#15
06-11-2020, 05:53 AM (This post was last modified: 06-11-2020, 05:56 AM by darklinkpower.)
Playstate v1.6 Released

Changelog:
  • Implemented blacklist system for games you don't want the extension to be executed for.
To use the new system use the PlayState functions in the extensions submenu.

(06-10-2020, 05:18 PM)Oikos Wrote: Thank you so much for this extension I was getting super tired of suspending games from the resource monitor

Is there a way to disable the script from launching on certain games?

Also for Rainbow Six Siege my game gets the wrong exe -> (RainbowSix_BE.exe) whereas it should be (RainbowSix.exe) editing the script to that and reloading the script makes it work

I included the log and what my file shows

I've released version 1.6 which implements a blacklist system. I have not had time to look deeply in what's the problem with your game but I'll do it when I have time.
N0t_Just1n
Offline

#16
06-19-2020, 02:47 AM
Is there a way to get this to function with multiple game instances, like to switch between 2 or more games?
robinsiebler
Offline

#17
06-20-2020, 04:46 PM
If I exit a game and then launch it again at another point (or launch a different game), I get this dialog:

   
darklinkpower
Offline

#18
06-21-2020, 06:29 PM (This post was last modified: 06-21-2020, 06:30 PM by darklinkpower.)
(06-19-2020, 02:47 AM)N0t_Just1n Wrote: Is there a way to get this to function with multiple game instances, like to switch between 2 or more games?
Currently I don't have a computer to work but I'll implement something when I (hopefully) repair my PC.

(06-20-2020, 04:46 PM)robinsiebler Wrote: If I exit a game and then launch it again at another point (or launch a different game), I get this dialog:
Does it happen with every game and always? Can you upload the log somewhere and send me the link or just paste the last runtime from the log here please?
TheCatWheel
Offline

#19
08-14-2020, 04:21 AM (This post was last modified: 08-14-2020, 04:23 AM by TheCatWheel.)
I have autohotkey installed along with the extension, but when I open a game and try to use home or pause/break to freeze a game nothing happens. It doesn't work with any game I've tested, and I can't see if the script is running. What should I do?
darklinkpower
Offline

#20
08-14-2020, 07:14 AM
(08-14-2020, 04:21 AM)TheCatWheel Wrote: I have autohotkey installed along with the extension, but when I open a game and try to use home or pause/break to freeze a game nothing happens. It doesn't work with any game I've tested, and I can't see if the script is running. What should I do?

Hello, check the Troubleshooting (Extension not working with game) section in the OP and see if the info there helps. If not, please upload somewhere or paste here the info from the PlayState log located in the Playnite install directory.
« Next Oldest | Next Newest »
Pages (2): 1 2 Next »



  • View a Printable Version
  • Subscribe to this thread

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode