lyckantropen / moonlight_hdr_launcher

Launch anything in HDR mode using Moonlight
MIT License
73 stars 5 forks source link
gamestream geforce-experience hdr moonlight shield

Moonlight HDR Launcher

[!WARNING] GameStream has been discontinued and therefore using Moonlight HDR Launcher no longer makes sense. Go check out Sunshine which supports HDR streaming out of the box!

This is a launcher for GameStream that mocks Mass Effect Andromeda to launch any executable from a Shield device or Moonlight with HDR support. For example, it can be used in conjunction with gamestream_launchpad to launch GOG Galaxy 2.0 in HDR mode.

It is loosely based on a solution by tmac666 on NVIDIA forums.

The installer puts the files in C:\Program Files\moonlight_hdr_launcher and modifies the GeForce Experience entry for Mass Effect Andromeda to launch the mock executable.

Installing

Download latest release here.

Unzip and launch the installer. At some point there will be a dialog window asking you to rescan for games in GeForce Experience. Only then the last part of the script can succeed. The installer will try restarting GeForce Experience. Now in Shield or Moonlight you should see the new entry. If you're not seeing it, try rebooting your PC.

Note: I haven't been able to get the cover art to work for me. If you know how to do it, please reach out.

Description

GeForce Experience recognizes Mass Effect Andromeda as a game that supports HDR and will initiate a GameStream session with HDR support if it is launched.

This software provides a mock MassEffectAndromeda.exe and patches the NvBackend cache to launch it instead of the game.

The installation does the following:

The MassEffectAndromeda.exe launcher does the following:

Configuration

The installer will offer a basic choice of launchers and resolutions to use as an initial configuration. Later on you can edit the file moonlight_hdr_launcher.ini file in C:\Program Files\moonlight_hdr_launcher and modify it to your needs. These are the options:

I highly recommend the setup using gamestream_launchpad. Simply put gamestream_gog_galaxy.ini and gamestream_launchpad.exe in C:\Program Files\moonlight_hdr_launcher and uncomment the relevant lines in moonlinght_hdr_launcher.ini. Note: As of 1.1.2 the installer will download gamestream_launchpad automatically.

Additional notes regarding macOS.

Example configurations

HDTV & HDR monitor owners

If you have an HDR monitor connected to your PC or a DisplayPort dongle that supports HDR, you can rely on the toggle_hdr option.

This example will use gamestream_launchpad to launch GOG Galaxy. First step is to put gamestream_gog_galaxy.ini and gamestream_launchpad.exe in C:\Program Files\moonlight_hdr_launcher.

moonlight_hdr_launcher.ini:

[options]
launcher_exe = gamestream_launchpad.exe 2560 1440 gamestream_gog_galaxy.ini
toggle_hdr = 1
wait_on_process = 1

gamestream_gog_galaxy.ini:

[LAUNCHER]
launcher_path = %%programfiles(x86)%%\GOG Galaxy\GalaxyClient.exe
launcher_window_name = GOG Galaxy 2

[BACKGROUND]

[SETTINGS]
debug = 0
sleep_on_exit = 0
close_watch_method = window

Variant with compatibility_window=1:

This configuration allows for avoiding the "Connection terminated" message after quitting gamestream_launchpad. Requires gamestream_launchpad 0.8 for the --no-nv-kill option.

moonlight_hdr_launcher.ini:

[options]
launcher_exe = gamestream_launchpad.exe 2560 1440 gamestream_gog_galaxy.ini --no-nv-kill
toggle_hdr = 1
wait_on_process = 1
compatibility_window = 1

HDTV owners without HDR monitor

Update: For a while GameStream has been adding the entry for Steam Big Picture on its own as a separate cover and it does support HDR. The solution below is redundant. OS-level HDR games still won't work though.

Note: This will not make OS-level HDR games (e.g. Cyberpunk 2077) work. Buy a DisplayPort dongle with HDR support.

The only way (allegedly) to achieve HDR support is to launch Steam Big Picture through the launcher. Bear in mind that this solution creates sessions that need to be force-quit from Moonlight. This example does not use gamestream_launchpad. After starting the launcher, it is imperative that your game is in true fullscreen mode. "Windowed fullscreen" will not work.

Your mileage may vary.

moonlight_hdr_launcher.ini:

[options]
launcher_exe = C:\Program Files (x86)\Steam\steam.exe steam://open/bigpicture
wait_on_process = 0
# no HDR toggle because there are no HDR monitors and wait_on_process=0
toggle_hdr = 0

HDTV owners withouth HDR monitor (gamestream_launchpad version)

This is the same as the previous example, but using gamestream_launchpad.

moonlight_hdr_launcher.ini:

[options]
# launch Steam Big Picture using gamestream_launchpad
# please adjust resolution
launcher_exe = gamestream_launchpad.exe 2560 1440 gamestream_steam_bp.ini
wait_on_process = 1
toggle_hdr = 1

gamestream_steam_bp.ini:

[LAUNCHER]
launcher_path = %%programfiles(x86)%%\Steam\steam.exe steam://open/bigpicture Fullscreen
# set it to something other than Steam because gamestream_launchpad can detect multiple windows and will close prematurely
launcher_window_name = NotSteam

[BACKGROUND]

[SETTINGS]
debug = 0
sleep_on_exit = 0
close_watch_method = window

FAQ & Troubleshooting

Building the launcher executable

If you don't know how to build projects with CMake, better not attempt it.

Building the installer

First, install Python 3. Then:

pip install -r requirements.txt
pyinstaller install.spec

install.exe will be put in dist.

Attribution

This code uses parts of hdr-switch by Brad Gearon under the following license:

MIT License

Copyright (c) 2020 Brad Gearon

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

This code uses the WinReg library by Giovanni Dicanio under the following license:

MIT License

Copyright (c) 2017-2020 by Giovanni Dicanio

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.