test release
Pre-releasePlayNite Watcher Script
Welcome to the PlayNite Watcher script for Sunshine and Moonlight! This script helps you add multiple games to Sunshine, and automatically closes Moonlight when the games are closed. It also allows you to end the stream and have it close automatically on your computer. This script creates an experience similar to GeForce Experience with its limited 300 supported games. Once the installation is done, you'll see game names, box art, and other details in Moonlight.
If you prefer having a "Big Picture Mode" experience, or want to utilize the FullScreen mode of PlayNite this script also offers that capability as well, with the support of terminating any currently running game when you close the app from Moonlight.
Why a script is needed
A lot of games launch with their own launchers, and do not work without being added as a "detached" command. Unfortunately, when doing this... it prevents Sunshine and Moonlight from being able to tell if the game has closed to end the stream automatically.
In addition, those that prefer to add a single app for a big picture mode experience, can also benefit from this script as it will close out games and end sunshine automatically once finished. This is useful for setting up a "kiosk" PC, or handling out closing out frozen emulators using just Moonlight itself.
Essentially, the purpose of this script is to use PlayNite to allow most games to work in the way you'd expect them to work by converting them into "commands" which can be watched by Sunshine.
Caveats:
- This script only works with Sunshine 0.20.x or above.
- If using Windows 11, you'll need to set the default terminal to Windows Console Host as there is currently a bug in Windows Terminal that prevents hidden consoles from working properly.
- That can be changed at Settings > Privacy & security > Security > For developers > Terminal [Let Windows decide] >> (change to) >> Terminal [Windows Console Host]
- Prepcommands do not work from cold reboots, and will prevent Sunshine from working until you logon locally.
- You should add a new application (with any name you'd like) in the WebUI and leave both the command and detached command empty.
- When adding this new application, make sure global prep command option is disabled.
- That will serve as a fallback option when you have to remote into your computer from a cold start.
- Normal reboots issued from start menu, will still work without the workaround above as long as Settings > Accounts > Sign-in options and "Use my sign-in info to automatically finish setting up after an update" is enabled which is default in Windows 10 & 11.
- The script will stop working if you move the folder, simply reinstall it to resolve that issue.
Prerequisites
Before starting, make sure you meet these requirements:
- Your host computer must be running on Windows.
- Sunshine must be installed as a service (the zip version of Sunshine won't work with this script).
- Set Sunshine's logging level to Debug.
- Users must have read permissions to
%WINDIR%/Temp/Sunshine.log
(do not change other permissions, just ensure Users have at least read permissions). - Sunshine is at least 0.20 or higher.
Setup
Note: The script will add Playnite fullscreen mode to Sunshine automatically, so you don't have to add every game to Sunshine, focus on exporting your most popular ones. The fullscreen mode added is like Steams "Big Picture Mode" and can be used to launch games you have not added directly to Sunshine.
- Open the PlayNite program on your computer.
- Visit the Playnite Add-ons page and download the "Sunshine App Export" extension, when prompted by the browser to open it in PlayNite, click Open.
- After it is installed, you will be prompted to reboot PlayNite, please do so to proceed to the next steps.
- In PlayNite, select the games you want to expoty to Sunshine.
- Click the "Controller" menu button in the top left corner of the PlayNite window, then go to "Extensions" -> "Sunshine App Export" -> "Export selected games".
- If you've changed the install path of Sunshine, click the browse button to select the correct path, otherwise just click "Export Games" to finalize the export. You will be prompted for administrator rights, confirm the prompt and approve the UAC prompt (it will show up as Windows Powershell is requesting changes to your computer.)
- Double-click on the "Installer.bat" file. Click OK on the administrator prompt dialog. A window will open, showing the list of games you selected in step 5.
- If you see an error message about the program being unable to retrieve configuration, follow the instructions in the error message to fix the issue.
- Check the box next to each game you want to install the PlayNite Watcher Script on. Alternatively, click the Check All button to select all PlayNite games added to Sunshine.
- Click the "Install" button when you're ready.
Installing the script will automatically add a Playnite application to Sunshine which will launch the fullscreen of Playnite, which can be used to launch your least popular games if you prefer not to add everything to Sunshine.
Troubleshooting
If you encounter any issues while using the PlayNite Watcher script, try these steps to resolve them:
- Make sure you've followed all the setup steps correctly.
- Verify you have the proper prerequisites installed and configured.
- Ensure you have read permissions for
%WINDIR%/Temp/Sunshine.log
. - Verify Sunshine is at 0.20 or higher.
If you still experience issues after following these troubleshooting steps, please consider posting your issue on either the Sunshine or Moonlight discord. The author of this script is DemonCat.