From 04d2d66d185b86e97531f1d3f72b30435da01bf7 Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Sun, 8 Sep 2024 03:03:36 +0200 Subject: [PATCH 1/9] Added README.md with documentation --- README.md | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..844d9cc5 --- /dev/null +++ b/README.md @@ -0,0 +1,136 @@ +# UMU-Protonfixes + +This project acts as a stopgap for fixing games that don't work out of the box on Proton. It implements game-specific patches, such as installing Winetricks verbs. + +It is the heart of `UMU-Proton` and `GE-Proton`. + +## Start parameter fixes + +The [default fix file for Steam](gamefixes-steam/default.py) implements a feature to install Winetricks / Protontricks verbs via startup parameters. Just add `-pf_tricks=` to it. You can install multiple verbs by adding the parameter more than once. + +```bash +-pf_tricks=xliveless -pf_tricks=d3dcompiler_47 +``` + +You can also set [dxvk options](https://github.com/doitsujin/dxvk/wiki/Configuration). + +```bash +-pf_dxvk_set=dxgi.maxFrameRate=40 -pf_dxvk_set=d3d9.maxFrameRate=40 +``` + +The order is not important and the arguments are not passed on to the game. + +## Local fixes + +The easiest way to implement a new fix or modify an existing one, is to use local fixes. + +First of all, you should find the Steam-ID of the game (right click in your Steam library -> ) and use it as the filename, with a `.py` extension. + +Example `Day of Defeat: Source`: + +> ~/.config/protonfixes/localfixes/300.py + +Another type of fix is one that runs before each game. This allows you to set defaults for all games. + +> ~/.config/protonfixes/localfixes/default.py + +Note that local fixes override the included "global" fixes. So using an existing fix might be a good starting point for modifications, as they will not be executed. + +For example, overriding the default fix will disable [the parameter parsing for Steam games](#start-parameter-fixes). This can be restored by copying [the global default file](gamefixes-steam/default.py) and applying your changes accordingly. + +## Non-Steam games + +As we support platforms other than Steam, these fixes can also be used by other launchers, such as Lutris, Heroic, Legendary or Bottles. + +The current implementation requires entries in a special database that looks up the `UMU-ID`, which consists of the prefix `umu-` and in most cases the SteamID (if the game exists on that platform). + +https://github.com/Open-Wine-Components/umu-database + +## Config file + +There is a config file located at: + +> ~/.config/protonfixes/config.ini + +It's not widely used at the moment, but you can configure some aspects. + +### Defaults + +```toml +[main] +enable_checks = true +enable_global_fixes = true + +[path] +cache_dir = ~/.cache/protonfixes +``` + +### Variables + +`enable_checks`: De-/activate checks that are run on every startup. Currently only a check if esync might cause problems. + +`enable_global_fixes`: De-/activate global fixes, which are the built-in files in the `gamefix-*` folders. Only [local fixes](#local-fixes) will be executed. + +`cache_dir`: Used when something needs to be unpacked or similar. + +### Values + +Valid "enable" values are: `yes`, `y`, `true`, `1` + +Any other value is interpreted as disabled. + +## Building binaries + +UMU-Protonfixes ships some binaries - used by some fixes - that need to be built. + +**You probably do not need to build them to contribute.** + +These binaries are not included in this repository, but are built from git-submodules in the [subprojects folder](subprojects/). To get the submodules, run the following command: + +```bash +git submodule update --init --recursive +``` + +To actually build the binaries, simply run: + +```bash +make +``` + +## Contributing + +We do enforce some linting and testing that can and should be done locally - before you open a pull request. + +### Linting + +To install the necessary tools, just run: + +```bash +python3 -m pip install --upgrade pip +pip install ruff +``` + +On Arch / Manjaro, you should run this instead: + +```bash +sudo pacman -Sy ruff +``` + +To run a check, just execute: + +```bash +ruff check . +``` + +You are good to go when you see the message `All checks passed!`. + +### Testing + +The filenames of the fixes are checked against the Steam and GOG APIs. All symbolic links are also checked. This is not mandatory to run locally, as you should have a working game fix to begin with, and it will be done automatically by Github's CI. + +You can still run it though: + +```bash +cd .github/scripts +python check_gamefixes.py +``` From 5741ad3e3e9652dc78da3c7b46a1760533c3e6d4 Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Sun, 8 Sep 2024 03:03:58 +0200 Subject: [PATCH 2/9] Removed unused config parameter --- config.py | 1 - 1 file changed, 1 deletion(-) diff --git a/config.py b/config.py index 0743be36..735d93ca 100644 --- a/config.py +++ b/config.py @@ -13,7 +13,6 @@ DEFAULT_CONF = """ [main] enable_checks = true -enable_splash = false enable_global_fixes = true From 0c919bab66bdb9c2b1764e05a0909272e79bd668 Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Sun, 8 Sep 2024 03:05:11 +0200 Subject: [PATCH 3/9] Added directories created by `make` to .gitignore --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index e5bd5844..ed0072e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ +# Builing umu-protonfixes binaries +builddir/ +dist/ +subprojects/ + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] From 19d6625406a68facced8823f329c75b4a5badb2d Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Sun, 8 Sep 2024 03:52:47 +0200 Subject: [PATCH 4/9] Fixed missing text in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 844d9cc5..422d43e7 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,9 @@ The order is not important and the arguments are not passed on to the game. The easiest way to implement a new fix or modify an existing one, is to use local fixes. -First of all, you should find the Steam-ID of the game (right click in your Steam library -> ) and use it as the filename, with a `.py` extension. +First of all, you should find the Steam-ID of the game (right click the game in your Steam library -> 'Properties...' -> 'Updates' -> 'App ID:') and use it as the filename, with a `.py` extension. -Example `Day of Defeat: Source`: +Example `Day of Defeat: Source` (AppID 300): > ~/.config/protonfixes/localfixes/300.py From 65af67ad893d2221f86025a48789d2bc42978026 Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Sun, 8 Sep 2024 04:02:14 +0200 Subject: [PATCH 5/9] Added prerequisites for testing --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 422d43e7..49576516 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ We do enforce some linting and testing that can and should be done locally - bef To install the necessary tools, just run: ```bash -python3 -m pip install --upgrade pip +python -m pip install --upgrade pip pip install ruff ``` @@ -134,3 +134,16 @@ You can still run it though: cd .github/scripts python check_gamefixes.py ``` + +You need the following prerequisites: + +```bash +python -m pip install --upgrade pip +pip install ijson +``` + +On Arch / Manjaro: + +```bash +sudo pacman -Sy python-ijson +``` From dbea02bffa757170b979a17f1795493244ba3e11 Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Mon, 9 Sep 2024 13:17:47 +0200 Subject: [PATCH 6/9] README: Added instruction for auto formatting --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 49576516..f5f76f21 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,12 @@ ruff check . You are good to go when you see the message `All checks passed!`. +If not, try letting `ruff` (the linter we use) fix it automatically: + +```bash +ruff format . +``` + ### Testing The filenames of the fixes are checked against the Steam and GOG APIs. All symbolic links are also checked. This is not mandatory to run locally, as you should have a working game fix to begin with, and it will be done automatically by Github's CI. From 9eb1082f1790864cffe103e75fa7aa56d3997769 Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Tue, 10 Sep 2024 02:43:07 +0200 Subject: [PATCH 7/9] Added paragraph about local verbs --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index f5f76f21..a6aeaa3e 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ The order is not important and the arguments are not passed on to the game. The easiest way to implement a new fix or modify an existing one, is to use local fixes. +### Game fixes + First of all, you should find the Steam-ID of the game (right click the game in your Steam library -> 'Properties...' -> 'Updates' -> 'App ID:') and use it as the filename, with a `.py` extension. Example `Day of Defeat: Source` (AppID 300): @@ -38,6 +40,20 @@ Note that local fixes override the included "global" fixes. So using an existing For example, overriding the default fix will disable [the parameter parsing for Steam games](#start-parameter-fixes). This can be restored by copying [the global default file](gamefixes-steam/default.py) and applying your changes accordingly. +### Verbs + +You can also add local Winetricks verbs, just like the ones implemented [here](verbs). + +This also allows you to override existing Protontricks and Winetricks verbs, for example if a URL or file hash has changed. + +> ~/.config/protonfixes/localfixes/.verb + +To call them, just use the default function: + +```python +util.protontricks('') +``` + ## Non-Steam games As we support platforms other than Steam, these fixes can also be used by other launchers, such as Lutris, Heroic, Legendary or Bottles. From b5cc22353c93b63e65a5461abe91f8a64f801a7b Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Thu, 24 Oct 2024 16:24:03 +0200 Subject: [PATCH 8/9] Added -pf_replace_cmd documentation --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index a6aeaa3e..4148701a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,12 @@ The [default fix file for Steam](gamefixes-steam/default.py) implements a featur ```bash -pf_tricks=xliveless -pf_tricks=d3dcompiler_47 ``` +Additionally, you have the option to replace parts of the executable's path, such as the name of the .exe file. +Please note that all occurrences of the first part (before the '=') will be replaced. Be careful. + +```bash +-pf_replace_cmd=/launcher.exe=/game.exe -pf_replace_cmd=/demo/=/full_version/ +``` You can also set [dxvk options](https://github.com/doitsujin/dxvk/wiki/Configuration). From ace5b8fc0b81c298c1c842634aca2bb52e1db6a0 Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Thu, 24 Oct 2024 16:25:07 +0200 Subject: [PATCH 9/9] Added full example for start parameters --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 4148701a..5e4305fd 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,14 @@ You can also set [dxvk options](https://github.com/doitsujin/dxvk/wiki/Configura The order is not important and the arguments are not passed on to the game. +If you don't use `%command%` in your launch options, you can just add the parameters. + +If you do, please add it after the `%command%` part, as in this example: + +```bash +mangohud %command% -window -pf_replace_cmd=/launcher.exe=/game.exe -pf_tricks=xliveless +``` + ## Local fixes The easiest way to implement a new fix or modify an existing one, is to use local fixes.