this post was submitted on 11 Aug 2023
1 points (100.0% liked)

Steam Deck

1 readers
0 users here now

Clearly, the best ally money can buy.

founded 1 year ago
MODERATORS
 
This is an automated archive.

The original was posted on /r/steamdeck by /u/dsp_pepsi on 2023-08-10 17:25:14+00:00.


Some games don't offer 16:10 resolutions by default, resulting in black bars when streaming. The common workaround is to manually switch the resolution to 1280x800 or 1920x1200 in nVidia control panel before starting a Moonlight stream. This is tedious.

I've developed a method that will automate changing the screen resolution to a 16:10 ratio when you start streaming via Moonlight, and switch it back to normal when you end the stream.

Part 1:

We need to create a PowerShell function called 'Set-ScreenResolution' that will accept arguments for the vertical resolution, horizontal resolution, and refresh rate.

1 - Open Powershell and type '$Profile' without the quotes. This will give you the location of your PowerShell profile.

Example: C:\Users\dsp_pepsi\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

2 - Open the .ps1 file you found above in Notepad, and paste the code from this script. Save and close:

Credit: Sachin on StackOverflow -

Part 2:

We need to create some batch files that will invoke this function. A separate batch file is needed for each resolution. I suggest creating 3 of them:

1200.bat - This will set the resolution to 1920x1200 at 60HZ, which is a higher resolution but the same aspect ratio (16:10) of the Steam Deck. This oversamples the image, which helps eliminate aliasing (jaggies) at the cost of some performance. Be aware that some games might not scale up UI elements, making them hard to read at this resolution on a small screen.

800.bat - This will set the resolution to 1280x800 at 60HZ, which is the native resolution of the Steam Deck. Use this for games that don't UI scale, or if your computer struggles to maintain 60FPS at higher resolutions.

native.bat - This will return the resolution to your monitor's native resolution and refresh rate. It will be triggered when the Moonlight stream is terminated.

1 - Create a new folder somewhere to store your batch files.

2 - Create a file called 1200.bat. Edit it with Notepad. Enter the following text. Save and close:

powershell -command "set-screenresolution -width 1920 -height 1200" -freq 60

3 - Create a text file called 800.bat. Edit it with Notepad. Enter the following text. Save and close:

powershell -command "set-screenresolution -width 1280 -height 800" -freq 60

4 - Create a text file called native.bat. Edit it with Notepad. Enter the following text, substituting the resolution and refresh rate for your own monitor. Save and close:

powershell -command "set-screenresolution -width 2560 -height 1440" -freq 170

Part 3:

We need to configure Sunshine to invoke these scripts when starting and ending a game.

1 - In the Sunshine web interface, go to the 'Applications' tab and click 'Edit' next to your game.

2 - In the Command Preparations section, add your 1200.bat or 800.bat location to the 'Do Command', and your native.bat to the 'Undo Command'.

Example: Do Command: D:\Games\Scripts\1200.bat Undo Command: D:\Games\Scripts\native.bat

  1. Check the box 'Elevated' to give it admin privileges, otherwise it won't work.

If all works correctly, your resolution will change when you start the stream, and change back when you end it.

Note: you have to actually end the stream in Moonlight. Turning off the Steam Deck or quitting the app is not sufficient to trigger the exit script.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here