hansschmucker / NVStreamer1080

Utility to automatically detect NVidia GameStream activity and set a fitting resolution or switch to a second screen.
Apache License 2.0
112 stars 8 forks source link

Auto kill game/background processes after stream ends #6

Closed SuperLeiyan closed 1 year ago

SuperLeiyan commented 2 years ago

Basically a configurable kill list is what I am proposing in order to auto terminate the game or other background processes when nvstream exits, this is so that when you are streaming over the internet, if nvstream crashes or the host PC is in a bad state(could be network or whatever) and you can no longer reconnect to it for some reason, your game wouldn't just stay running on your PC the whole time.

SuperLeiyan commented 2 years ago

This could also use a timer/grace period, cause maybe nvstream crashed but you are able to quickly reconnect, in which case we probably don't want to kill the game.

hansschmucker commented 2 years ago

image That's the form so far (no functionality yet, just drafting the dialog)...

Each action is defined as image

Where Launch lets you select an application via image

And Close a process via image

Seems fitting?

Still thinking about "killing the game"... not sure if I can detect which is the "game" process... I'll start with fixed processes, but killing the game process is also desired, understood.

hansschmucker commented 2 years ago

Should probably add a distinction between "Not connected" and "Closed"

Can't really find a standard hook for it, but it's possible to identify it by watching nvstreamer.exe's connections.

SuperLeiyan commented 2 years ago

Looking really good! Yeah like if it's difficult to detect the game process, there is always the option to add it to the kill list manually, just gotta remember to do it for every game that is lol.

hansschmucker commented 2 years ago

Dang... can't detect the port activity using user ... that would definitely need admin access. So the other route would be getting the state straight from NVStream itself à la Moonlight... Seems to be some kind of client cert authentication. Probably the right thing to do. For now I'll skip "Not connected" detection and focus on the actions. Still hope to revisit this at a later time, but for now I'll leave this issue as "perform actions after session end"... even if that limits its use.

I'll track "Disconnect detection" in a separate issue.

hansschmucker commented 2 years ago

Dang, can't test sleep right now because my PC is busy with operations that may not be interrupted. Still, if you want, here's the current build... I've tested it launching Notepad, at least that seems to work ^^

Release.zip

--hans

SuperLeiyan commented 2 years ago

Quickly tested hibernate and the mouse acceleration restore this morning before left for work, and they both worked great! I'll try out the kill list when I get home tonight, but thanks so much for implementing these(and so quickly), let me know if you got a PayPal link I'd love to buy you a coffee!

SuperLeiyan commented 2 years ago

Btw this utility should be advertised more for sure, make a reddit post about it in the relevant subredits I think, I'm sure tons of people will find this useful!

hansschmucker commented 2 years ago

You're welcome and thanks for the coffee offer, but not required... this is just for fun ^^. BTW Mouse acceleration shoudn't be working yet, because it's not implemented yet... I just forgot to disable it in this WIP build. Shouldn't be long though. It's pretty simple and as you noticed the UI is already there.

Thanks for testing though... and if you feel like this needs a Reddit post feel free to create one :)

Anyway, I'll leave this open until it's wrapped in a propper release... I still want to add the precision restore an update indicator before I bump that version number.

--hans

hansschmucker commented 2 years ago

The kill on end is implemented, but since this also tracks disconnect detection, I'll leave this open until I've found a way to detect that.

hansschmucker commented 1 year ago

I'm going to close this since there's a separate issue tracking disconnect detection