Merrit / nyrna

Suspend games and applications.
https://nyrna.merritt.codes
GNU General Public License v3.0
896 stars 16 forks source link

[Feature Request] [Windows] Suspend child processes #206

Closed unphased closed 5 months ago

unphased commented 7 months ago

i tried it last year in windows but it sadly did not work in many games. for example RDR2.

i hope to have better luck with it in Linux, but it would help me to reason about how it may interact with a given application if I had a working understanding of what tools and interfaces with the operating are being used to suspend processes.

Merrit commented 7 months ago

Games with onerous DRM and/or anti-cheat software will often not work, specifically because those things work to block outside software from affecting them. To my knowledge RDR2 is one of those; the solution in these cases is to complain to the company about their use of draconian and anti-consumer software like that. It may work better on Linux since it will be suspending the Linux emulation process rather than the native Windows process.

As to how it works, essentially it boils down to:

unphased commented 7 months ago

Thank you.

You bring up a good point that DRM middlewares routinely do unsavory things that can interfere with normal operation of the computer and this is an example. A developer may easily implement an architecture that foils this scheme, for example a simple watchdog process could shut things down if the main process is found to be unresponsive.

I may suggest a feature, if we could (and it usually is easy to) identify a number of processes associated with some app, being able to suspend them all and then resume them all simultaneously might provide more compatibility.

My hunch from playing around with this and other tools on windows (where we have access to the likes of process monitor/process lasso) is that this might do the trick. On Linux I'd also be able to do quick hacks with shell scripts, but hadn't explored it.

Merrit commented 7 months ago

The Linux implementation already suspends and resumes all associated processes: https://github.com/Merrit/nyrna/blob/53381a6cdb69aee52ae22a07b0418ff477701977/lib/native_platform/src/process/repository/src/linux_process_repository.dart#L138-L155

The Windows implementation does not as yet do so. It may indeed help with such situations, though I could also see it causing instability given how flaky Windows reacts to such things already.

Merrit commented 5 months ago

With the games that have given you problems, and specifically Red Dead 2; have you tried running Nyrna as administrator?

unphased commented 5 months ago

that is something i did not think to try, i am very excited to try that next time!

i dont game very much these days outside of low spec games on my steam deck and valve has completely solved the pausing issue there by making suspend really awesome. although, if you forget the device for two weeks it will certainly die by then, and you still lose progress.

i'll be sure to report back and work with you on issues. my RDR2 install and savegames died with my inland 4TB NVMe drive however. it's not certain i will play that game again. it's spectacular but the pace is slow. my plan is to find a savegame online for near where i was and continue as i really cannot justify starting fresh.

worst case when i get a nvidia 5090 once that comes out ill certainly be hunting for demanding games to run at 4k120 and rdr2 will be back on the radar.

Merrit commented 5 months ago

Sorry to hear about your save being lost! Hardware failures are the worst!

Since this sounds a lot like https://github.com/Merrit/nyrna/issues/197, I will close this for now. If you encounter the issue again while running Nyrna as admin, feel free to reopen or start a new issue. :)

unphased commented 5 months ago

Tell ya what, i have no issues so far running Nyrna as admin. I think you may want to give this at least as a suggestion in the readme. I will test more and try to compare with and without running as admin, but so far the experience is really great. I have 64GB in this machine and it is a game changer. It also seems like the OS can swap idle processes out, so it sure looks like I can run 2, 4, probably even more games at the same time, we'll see if I can get up to 8 or 10, it's going to be fun! Even if task manager is lying to me, since most any modern game requires less than 16GB, having 64GB means I can have at least 4.

Maybe this is going to fuel my ADD further, but it really completely changes the experience and allows gaming sessions to have a huge amount more variety when you can pause and resume a number of (presumably non-multiplayer) games at will. That it applies to any application is great too, since being able to pause operations like renders so you can squeeze in some other work simply lets you get more utility out of the hardware. I especially like how I can start a game (or 4) and rapidily switch between work and play, I do believe this engages my brain better and can make me more productive or at least more efficient on the work slice of that time.

Thank you so much for making this tool, I also really like how it will auto focus the game you unpause to bring you right back into the action.

Being able to run a bunch of games at the same time and switch between them freely is like getting gifted a computer from the future. As a dev I always knew the OS ought to be capable of unlocking better ux like this. But most people don't realize and there's no incentive for vendors to provide the UI.

Update: I ran into a crash trying to resume the latest Ratchet & Clank game. But chrome was already wigging out on OOM issues at this point so I need to test more.

Merrit commented 5 months ago

I am glad to hear it is useful to you! :blue_heart:

A suggestion to run as admin was added with v2.18.0 if suspend/resume fails.

I also added a mention to the README just now with 03f584fd2689171af153b9a299c0384d4da66ea1.