
# proton

**Steam began providing direct linux support for gaming!**

In the process they forked Wine and began adding, and back-porting, significant improvements.

Most importantly, the project is open source!


## [Glorious Eggroll](https://github.com/GloriousEggroll/proton-ge-custom)

This person has created an excellent fork of proton, allowing custom modifications and patches specific to popular, yet unsupported, games.

**You should almost always favor GE builds.**


## [protondb](protondb.com)

A third party website for people to add, review, and provide supplemental instructions for games they've played or that have not worked.

Basically the answer to [winehq](https://www.winehq.org/).


## launch options

Under `Set Launch Options` you can add various environment variables and common flags to improve performance.

A good standard string is:

	DXVK_HUD=fps PROTON_USE_VKD3D=1 %command% -USEALLAVAILABLECORES -high -vulkan

The `DXVK_HUD` option lets you add an entire graph or just the FPS to any game that uses DXVK.

The `PROTON_USE_VKD3D` enables DX12 in games that support it.

The `%command%` is required if you add anything, and is the command that will run the executable.

The flags `-USEALLAVAILABLECORES`, `-high`, and `-vulkan`, are randomly supported by various games, and thus your mileage may vary.

_Another option is to use `PROTON_USE_WINED3D=1`, which suggests using OpenGL instead of DXVK for DX10/DX11 games, which may provide better performance in select cases._


## non-steam games

While it is possible to run a non-steam game using proton, adding a game to the Steam UI is absurdly complex.

_To add a non-steam game to steam you need to know the post-installation path for the executable, including any options, and possibly if/when you substitute windows path separators.  After, you need to create a placeholder windows binary, which will create the proton prefix computed off the target and some other properties, find that, manually run from command line the installation to create the expected files and replace the temporary executable._

There is a javascript file showing [how to compute a non-steam application id](https://blog.yo1.dog/calculate-id-for-non-steam-games-js/), but the main take-aways are that the label and target provided are what determines the computed identifier.

Fortunately it is still possible to use proton without needing to mess around with the Steam UI, and you can subsequently launch games using bash scripts.


### execution

Steam Proton has some customizations that extend outside of wine configuration.

- `STEAM_COMPAT_DATA_PATH` is a path to a "bottled" environment (eg. `$HOME/.local/share/Steam/steamapps/compatdata/<id>`), and uses the steam game identifier for naming by default.
- `WINEPREFIX` lives inside `${STEAM_COMPAT_DATA_PATH}/pfx`
- `WINEPATH` must be set when running `winetricks` or `winecfg` to the proton path (eg. `$HOME/.local/share/Steam/compatibilitytools.d/Proton-5.21-GE-1/dist/bin`).

**_Executing a windows binary must be done from the same path as that binary and giving the full path to that binary, although both linux and windows paths are acceptable._**  While some executables may appear to work without being in the same path, you may experience strange and unexpected behavior as a result.


### complex UI instructions

**While these instructions are "accurate", I have only gotten them working once and failed a dozen times after.**

You can add and run non-steam games using steam and set them up to run with proton!

It can be a bit convoluted for a few reasons, here are two:

1. The execution of proton from command line may be necessary to install the game
2. Preemptive knowledge of install paths may also be required to properly setup the target

This identifier will then be used for creating a `STEAM_COMPAT_DATA_PATH`, which is basically an isolated wine environment (colloquially referred to as a "wine bottle"), and is where consistent modifications such as those performed by winetricks as well as the windows registry often modified during installations exist.

_The aforementioned problem of not knowing the path prior to installation, and needing to use the same prefix after installation due to registry dependencies creates a chicken vs egg situation._

If you do not know the final target path then here is the recommended solution:

1. Create a temporary folder to export `STEAM_COMPAT_DATA_PATH` to while installing with proton.
2. With the terminal in the installer executable path, and the `STEAM_COMPAT_DATA_PATH` exported as an environment variable, enter the full path to the proton command (eg. `~/.local/share/Steam/compatibilitytools.d/Proton-5.21-GE-1/proton run /full/path/to/installer.exe`), and install to the standard `Program Files` path within `STEAM_COMPAT_DATA_PATH`.
3. Convert the relative path to the final executable from `Program Files` to get your target path, which can then be used to create a `~/.local/share/Steam/steamapps/common` compatible path to setup and install your game to.

If you do know the final target path, or once you learned it from the above steps:

1. Create a directory inside `~/.local/share/Steam/steamapps/common` for your game to be installed in.
2. Copy any placeholder executable (eg. the installer or even a shell script) to the final path within the `common/` directory.
3. From steam add a non-steam game and set the placeholder executable as the target, and edit the properties in order to set the label and enable a specific steam proton version (so that it runs using proton).
4. Launch the application from steam once in order for it to create the new `~/.local/share/Steam/steamapps/compatdata/<id>` path, then close it.
5. From a terminal run the installer but this time setting the `STEAM_COMPAT_DATA_PATH` to the newly created `compatdata/` folder based on the application identifier, and install to the `~/.local/share/Steam/steamapps/common` path you chose for your application.  _For this you may need to delete the temporary folder and/or placeholder executable._
6. Bonus points if you have and want to set an icon to the application.

