This project is archived and no longer maintained. From now, I will use, support and recommend Nonarys ResolutionAutomation script as it is maintained more actively. I will keep this repository for historical purposes.
This script is designed to automate the process of changing display resolution when starting and ending game streaming sessions using Sunshine. It allows you to switch to a specific resolution and scaling mode when starting the streaming session and restore the original resolution when ending the session.
This script was inspired by the code found in the following GitHub repository: ResolutionAutomation.
Before using this script, make sure you have the following:
- Sunshine installed on your system.
- The
setdpi.exe
tool if you plan to change the dpi (scale) when streaming. You can download it from here. - A display that can display the resolution of your client (you can add custom resolutions in both AMD and Nvidia settings app)
- Enable debug log level on Sunshine configuration dashboard (Configuration -> Log Level -> Debug)
The installation process for this script will be simplified once I do the installer like OG script.
The script accepts the following parameters:
restore
(mandatory): Set this to$true
if you want to restore the original resolution when ending the streaming session.changeScaling
(optional): Set this to$true
if you want to change the display scaling mode. Default is$true
.displayToScale
(optional): Specify the display index to change the scaling mode. This is the number that windows assignes a display to in display settings. Default is1
.
Add these lines (with modified displayToScale) to your Command Preparations in General section of Sunshine:
powershell.exe -executionpolicy bypass -file "<PathToTheScirptFolder>\main.ps1" -restore:$false -changeScaling:$true -displayToScale:1
powershell.exe -executionpolicy bypass -file "<PathToTheScirptFolder>\main.ps1" -restore:$false -changeScaling:$true -displayToScale:1
The script assumes that the Sunshine log file is located at C:/Windows/Temp/sunshine.log
. If your log file is in a different location, modify the $sunshineLogFilePath
variable in the script accordingly.
The script can also use an overrides.txt
file in the script folder for defining custom resolution and scaling settings. Each line in the file should follow the format original_widthxoriginal_heightxoriginal_refresh_rate=new_widthxnew_heightxnew_refresh_rate[=scaling]
. scaling
parameter is optional. An example line in the overrides.txt
file would be 1920x1080x60=1280x720x60=125
.
If you need to modify the script or extend its functionality, you can do so by editing the PowerShell script directly. The script uses PowerShell classes and functions to handle resolution-related operations.
This script comes with no warranties or guarantees. Use it at your own risk. The script author and contributors are not responsible for any damages or issues caused by the usage of this script.
This script is licensed under the MIT License.
- Nonary - For the inspiration from the ResolutionAutomation code.
- LizardByte - For developing Sunshine.
- imniko - For creating the
setdpi.exe
tool.