moonlight-stream / moonlight-embedded

Gamestream client for embedded systems
https://github.com/moonlight-stream/moonlight-embedded/wiki
GNU General Public License v3.0
1.5k stars 325 forks source link

Add option for sending quit app request after quitting streaming session #729

Closed hhromic closed 5 years ago

hhromic commented 5 years ago

Description Currently, when quitting a streaming session via key combo (gamepad or keyboard), Moonlight immediately closes the connection and exits, leaving the remote server in an unstable state because GFE doesn't free/close any audio/video resources on abrupt disconnection. One can return the server to normal by manually sending a quit app request from Moonlight after closing the session.

This has been reported numerous times in the past now: https://github.com/irtimmer/moonlight-embedded/issues/721 https://github.com/irtimmer/moonlight-embedded/issues/576 https://github.com/irtimmer/moonlight-embedded/issues/652 https://retropie.org.uk/forum/post/170489 https://retropie.org.uk/forum/post/176216 https://forum.recalbox.com/topic/7895/moonlight-exit-game

In this PR, I'm adding a new option named quitappafter that allows Moonlight to automatically send a quit app request to the server before terminating the streaming session so GFE cleans gracefully. This is implemented in a very similar way to the same option found in Moonlight-QT: https://github.com/moonlight-stream/moonlight-qt/blob/master/app/streaming/session.cpp#L580

Like in Moonlight-QT, the option is disabled by default (keeping current behaviour) and the user can either enable it via command-line option or in a configuration file.

This PR has been tested and working very well on my end.

Purpose Allow moonlight to automatically send a quit app request to the remote server before terminating the streaming session on quit, so GFE also terminates gracefully and restores audio/video settings on server.

Fixes #721, Fixes #576, Fixes #652