From 05a5425654d938cfda4e7a68457ca8549b6d703a Mon Sep 17 00:00:00 2001 From: polsrepo <110729177+polsrepo@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:01:48 +0200 Subject: [PATCH 1/6] Update README.md for Windows users Added Note 2 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 78392d7..b30d7b5 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,8 @@ The patcher works just as well on windows. The following launch option line work Note: This spawns a python console which will close by itself after the game has finished running. If you find this annoying you can try using `pythonw` instead. In any case `python` needs to be in PATH for windows to find it. +Note 2: Ensure Vertical Sync is turned off for Elden Ring in Nvidia Control Panel / AMD Radeon Software / Intel Graphics Command Center, otherwise the custom framerate limit feature won't work. + ## How it works When the game is launched through steam, the tool creates a patched version of `eldenring.exe` in a temporary subdirectory while leaving the original intact. As long the flag `--with-eac` is not set, the tool modifies the steam launch command to launch the patched executable instead of `start_protected_game.exe`, thefore ensuring that the patched exe is never run with EAC enabled. After the game is closed, the patched executable is removed. From 9c22a9cd1ba856fb755b5d2889d3bfd94fe6afa5 Mon Sep 17 00:00:00 2001 From: polsrepo <110729177+polsrepo@users.noreply.github.com> Date: Fri, 21 Jun 2024 12:13:11 +0200 Subject: [PATCH 2/6] Potential fix for crash on death with --disable-rune-loss and 60Hz lock on full screen Updated the hex pattern in patch.disable_rune_loss to potentially fix the crash on death. Updated the patch.remove_60hz_fullscreen function and hex pattern to potentially fix the 60hz lock in full screen --- er-patcher | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/er-patcher b/er-patcher index fe4fb3c..6ac6b33 100755 --- a/er-patcher +++ b/er-patcher @@ -46,9 +46,9 @@ if __name__ == "__main__": print("er-patcher: rate pattern scan failed") if patch.disable_rune_loss: - rl_pattern = "b0 01 .. 8b .. e8 .. .. .. .. .. 8b .. .. .. 32 c0 .. 83 .. 28 c3".replace(" ", "") + rl_pattern = "41 .. 01 48 .. .. e8 .. .. .. .. 48 .. .. .. .. 32 c0".replace(" ", "") if (res := re.search(rl_pattern, exe_hex)) is not None: - rl_addr = res.span()[0] + 6 + rl_addr = res.span()[0] + 12 rl_patch = "90 90 90 90 90".replace(" ", "") # NOP exe_hex = exe_hex[:rl_addr] + rl_patch + exe_hex[rl_addr + len(rl_patch):] else: @@ -102,11 +102,15 @@ if __name__ == "__main__": print("er-patcher: skip_intro pattern scan failed") if patch.remove_60hz_fullscreen or patch.all: - fs_pattern = "c7 45 ef 3c 00 00 00".replace(" ", "") + fs_pattern = "eb .. c7 .. .. 3c 00 00 00 c7 .. .. 01 00 00 00".replace(" ", "") if (res := re.search(fs_pattern, exe_hex)) is not None: - fs_addr = res.span()[0] + 3 + fs_addr = res.span()[0] + 10 fs_patch = "00" exe_hex = exe_hex[:fs_addr] + fs_patch + exe_hex[fs_addr + len(fs_patch):] + + fs_addr_2 = res.span()[0] + 24 + fs_patch_2 = "00" + exe_hex = exe_hex[:fs_addr_2] + fs_patch_2 + exe_hex[fs_addr_2 + len(fs_patch_2):] else: print("er-patcher: remove_60hz_fullscreen pattern scan failed") From ebc316f9e32dd2534d765352934000b847c2b048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Metin=20=C3=87elik?= Date: Sun, 7 Jul 2024 16:56:18 +0200 Subject: [PATCH 3/6] Use new executable name for Seamless Co-op example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b30d7b5..afb11dc 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ A tool aimed at enhancing the experience when playing the game on linux through 1. Copy the file `er-patcher` to the game directory. 2. In steam, set the game launch options to `python er-patcher ARGS -- %command%` See [Features](#features) for available options. - Example: `python er-patcher --all --rate 30 --disable-rune-loss -- %command%` - - Example using the [seamless co-op](https://www.nexusmods.com/eldenring/mods/510) mod: `python er-patcher --all --executable launch_elden_ring_seamlesscoop.exe -- %command%` + - Example using the [Seamless Co-op](https://www.nexusmods.com/eldenring/mods/510) mod: `python er-patcher --all --executable ersc_launcher.exe -- %command%` - Example using [MangoHud](https://github.com/flightlessmango/MangoHud) and wine fullscreen FSR: `python er-patcher --rate 144 -uvca -- env WINE_FULLSCREEN_FSR=1 MANGOHUD=1 MANGOHUD_CONFIG=histogram %command%` 3. Launch the game through steam. `er-patcher` automatically launches a patched version of `eldenring.exe` with EAC disabled. From e9f39e6ae32d67e1b858f9b3a1b90dc79cd82148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Metin=20=C3=87elik?= Date: Mon, 8 Jul 2024 00:46:14 +0200 Subject: [PATCH 4/6] Avoid deleting eldenring.exe while it is locked --- er-patcher | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/er-patcher b/er-patcher index 6ac6b33..d396739 100755 --- a/er-patcher +++ b/er-patcher @@ -7,7 +7,17 @@ from pathlib import Path import struct import re from shutil import rmtree +import os +def cleanup(game_dir_patched): + if game_dir_patched.exists(): + eldenring_path = game_dir_patched / "eldenring.exe" + try: + if eldenring_path.exists(): + os.remove(eldenring_path) + rmtree(game_dir_patched) + except Exception as e: + print(f"er-patcher: could not delete {game_dir_patched}: {e}") if __name__ == "__main__": @@ -115,6 +125,10 @@ if __name__ == "__main__": print("er-patcher: remove_60hz_fullscreen pattern scan failed") game_dir_patched = Path("er-patcher-tmp") + + # make sure a fresh directory is used + cleanup(game_dir_patched) + if not game_dir_patched.is_dir(): game_dir_patched.mkdir() @@ -148,5 +162,5 @@ if __name__ == "__main__": steam_cmd[-1] = Path(steam_cmd[-1]).parent.absolute() / game_dir_patched / ("start_protected_game.exe" if patch.with_eac else patch.executable) subprocess.run(steam_cmd, cwd=steam_cmd[-1].parent.absolute()) - # cleanup - rmtree(game_dir_patched) + # try to remove game_dir_patched + cleanup(game_dir_patched) From adf3fe57aa603ca5deca805cf7569303f95e291c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Metin=20=C3=87elik?= Date: Sun, 14 Jul 2024 11:56:59 +0200 Subject: [PATCH 5/6] Retry deleting eldenring.exe if it is still running --- er-patcher | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/er-patcher b/er-patcher index d396739..2e51c39 100755 --- a/er-patcher +++ b/er-patcher @@ -8,16 +8,22 @@ import struct import re from shutil import rmtree import os +import time def cleanup(game_dir_patched): if game_dir_patched.exists(): eldenring_path = game_dir_patched / "eldenring.exe" - try: - if eldenring_path.exists(): + while eldenring_path.exists(): + try: os.remove(eldenring_path) - rmtree(game_dir_patched) - except Exception as e: - print(f"er-patcher: could not delete {game_dir_patched}: {e}") + break + except PermissionError: + # eldenring.exe is still running, retry in 3 s + time.sleep(3) + except Exception as e: + print(f"er-patcher: could not delete {eldenring_path}: {e}") + break + rmtree(game_dir_patched) if __name__ == "__main__": From 98aa86767c02d46917d576189b0ab4ee5cbec3b8 Mon Sep 17 00:00:00 2001 From: gurrgur <31393177+gurrgur@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:04:36 +0200 Subject: [PATCH 6/6] Add Linux HDR example --- README.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index afb11dc..377e1d7 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,22 @@ A tool aimed at enhancing the experience when playing the game on linux through 1. Copy the file `er-patcher` to the game directory. 2. In steam, set the game launch options to `python er-patcher ARGS -- %command%` See [Features](#features) for available options. - - Example: `python er-patcher --all --rate 30 --disable-rune-loss -- %command%` - - Example using the [Seamless Co-op](https://www.nexusmods.com/eldenring/mods/510) mod: `python er-patcher --all --executable ersc_launcher.exe -- %command%` - - Example using [MangoHud](https://github.com/flightlessmango/MangoHud) and wine fullscreen FSR: `python er-patcher --rate 144 -uvca -- env WINE_FULLSCREEN_FSR=1 MANGOHUD=1 MANGOHUD_CONFIG=histogram %command%` + - Example: + + `python er-patcher --all --rate 30 --disable-rune-loss -- %command%` + + - Example using the [Seamless Co-op](https://www.nexusmods.com/eldenring/mods/510) mod: + + `python er-patcher --all --executable ersc_launcher.exe -- %command%` + + - Example using [MangoHud](https://github.com/flightlessmango/MangoHud) and wine fullscreen FSR: + + `python er-patcher --rate 144 -uvca -- env WINE_FULLSCREEN_FSR=1 MANGOHUD=1 MANGOHUD_CONFIG=histogram %command%` + + - Example for enabling HDR using gamescope on Linux (reported to work on Plasma 6.1): + + `ENABLE_GAMESCOPE_WSI=1 DXVK_HDR=1 gamescope -W 3440 -H 1440 -f -r 165 --hdr-enabled -- python er-patcher --all --rate 165 -- %command%` + 3. Launch the game through steam. `er-patcher` automatically launches a patched version of `eldenring.exe` with EAC disabled. Note: There might be some distros (e.g. older Ubuntu releases) that launch python 2 instead of 3 when running `python`. In that case you'll need to replace `python` with `python3` in the launch option line.