From 7ae9c59fccf50e11e554af6eefd20dc41f9b0e5c Mon Sep 17 00:00:00 2001 From: Marcus Gursch Date: Mon, 28 Mar 2022 21:10:14 +0200 Subject: [PATCH 01/27] update animation fix with proper pattern scanning --- er-patcher | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/er-patcher b/er-patcher index 58cfb08..fdd5350 100755 --- a/er-patcher +++ b/er-patcher @@ -65,11 +65,12 @@ if __name__ == "__main__": exe_hex = exe_hex[:ca_addr] + "660fefc9" + exe_hex[ca_addr + 8:] # PXOR XMM1,XMM1 if patch.increase_animation_distance or patch.all: - # DIVSS XMM1,dword ptr [R12 + 0x54] -> XORPS XMM1,XMM1; PXOR XMM1,XMM1 - exe_hex = exe_hex.replace( - "e82b309c010f28f80f28c6e820359c01f30f5ef80f28cff3410f5e4c2454", - "e82b309c010f28f80f28c6e820359c01f30f5ef80f28cf0f57c9660fefc9" - ) + iad_pattern = "e8 .. .. .. .. 0f 28 .. 0f 28 .. e8 .. .. .. .. f3 0f .. .. 0f 28 .. f3 41 0f 5e".replace(" ", "") + iad_addr = re.search(iad_pattern, exe_hex).span()[0] + iad_offset = 46 + iad_patch = "0f 57 c9 66 0f ef c9".replace(" ", "") # DIVSS XMM1,dword ptr [R12 + 0x54] -> XORPS XMM1,XMM1; PXOR XMM1,XMM1 + if exe_hex[iad_addr + iad_offset:iad_addr + iad_offset + len(iad_patch)] == "f3 41 0f 5e 4c 24 54".replace(" ", ""): + exe_hex = exe_hex[:iad_addr] + iad_patch + exe_hex[iad_addr + len(iad_patch):] if patch.skip_intro or patch.all: exe_hex = exe_hex.replace( @@ -115,4 +116,4 @@ if __name__ == "__main__": subprocess.run(steam_cmd, cwd=steam_cmd[-1].parent.absolute()) # cleanup - rmtree(game_dir_patched) \ No newline at end of file + rmtree(game_dir_patched) From f49096c2c638cf002e89e7453fc6dad92d0170d7 Mon Sep 17 00:00:00 2001 From: Marcus Gursch Date: Mon, 28 Mar 2022 21:26:32 +0200 Subject: [PATCH 02/27] feature: gracefully fail pattern scanning and print helpful error messages refactor: use regex pattern scanning everywhere --- README.md | 2 +- er-patcher | 92 +++++++++++++++++++++++++++++++++--------------------- 2 files changed, 58 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 8d659ba..4fd26a5 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A tool aimed at enhancing the experience when playing the game on linux through ## Dependencies -- Python >= 3.8.xx (lowest tested) +- Python >= 3.8 ## Usage diff --git a/er-patcher b/er-patcher index fdd5350..69ce45a 100755 --- a/er-patcher +++ b/er-patcher @@ -32,58 +32,80 @@ if __name__ == "__main__": exe_hex = f.read().hex() if patch.rate != 60 and patch.rate > 0: - exe_hex = exe_hex.replace( - "c743208988883ceb43897318ebca897318", - "c743208988883ceb43897318ebca897318".replace( - "8988883c", struct.pack(' XORPS XMM1,XMM1; PXOR XMM1,XMM1 - if exe_hex[iad_addr + iad_offset:iad_addr + iad_offset + len(iad_patch)] == "f3 41 0f 5e 4c 24 54".replace(" ", ""): + iad_pattern = "e8 .. .. .. .. 0f 28 .. 0f 28 .. e8 .. .. .. .. f3 0f .. .. 0f 28 .. f3 41 0f 5e 4c 24 54".replace(" ", "") + if (res := re.search(iad_pattern, exe_hex)) is not None: + iad_addr = res.span()[0] + 46 + iad_patch = "0f 57 c9 66 0f ef c9".replace(" ", "") # DIVSS XMM1,dword ptr [R12 + 0x54] -> XORPS XMM1,XMM1; PXOR XMM1,XMM1 exe_hex = exe_hex[:iad_addr] + iad_patch + exe_hex[iad_addr + len(iad_patch):] + else: + print("er-patcher: increase_animation_distance pattern scan failed") if patch.skip_intro or patch.all: - exe_hex = exe_hex.replace( - "80 bf b8 00 00 00 00 74 53 48".replace(" ", ""), - "80 bf b8 00 00 00 00 90 90 48".replace(" ", "") - ) + si_pattern = "80 bf b8 00 00 00 00 74 53 48".replace(" ", "") + if (res := re.search(si_pattern, exe_hex)) is not None: + si_addr = res.span()[0] + 14 + si_patch = "90 90".replace(" ", "") + exe_hex = exe_hex[:si_addr] + si_patch + exe_hex[si_addr + len(si_patch):] + else: + print("er-patcher: skip_intro pattern scan failed") if patch.remove_60hz_fullscreen or patch.all: - exe_hex = exe_hex.replace( - "c745ef3c000000", - "c745ef00000000" - ) - + fs_pattern = "c7 45 ef 3c 00 00 00".replace(" ", "") + if (res := re.search(fs_pattern, exe_hex)) is not None: + fs_addr = res.span()[0] + 6 + fs_patch = "00" + exe_hex = exe_hex[:fs_addr] + fs_patch + exe_hex[fs_addr + len(fs_patch):] + else: + print("er-patcher: remove_60hz_fullscreen pattern scan failed") + game_dir_patched = Path("er-patcher-tmp") if not game_dir_patched.is_dir(): game_dir_patched.mkdir() From 100c4561b7e28b887fa4fd54ffd3229fbd857277 Mon Sep 17 00:00:00 2001 From: Marcus Gursch Date: Tue, 29 Mar 2022 10:26:33 +0200 Subject: [PATCH 03/27] fix whitespace --- er-patcher | 1 - 1 file changed, 1 deletion(-) diff --git a/er-patcher b/er-patcher index 69ce45a..8e500c6 100755 --- a/er-patcher +++ b/er-patcher @@ -58,7 +58,6 @@ if __name__ == "__main__": else: print("er-patcher: ultrawide pattern scan failed") - if patch.disable_vigniette or patch.all: v_pattern = 'f3 0f 10 .. .. f3 0f 59 .. .. .. .. .. e8 .. .. .. .. f3 41 0f .. .. f3 45 0f .. .. 4c 8d .. .. .. .. .. .. 48'.replace(" ", "") if (res := re.search(v_pattern, exe_hex)) is not None: From 0ec730fe899f4cc11ff4fb904c2ab2e16d3fca6e Mon Sep 17 00:00:00 2001 From: Marcus Gursch Date: Tue, 29 Mar 2022 21:17:43 +0200 Subject: [PATCH 04/27] readme: update recommended launch option line to prevent file permission errors --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4fd26a5..9769b7a 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,13 @@ A tool aimed at enhancing the experience when playing the game on linux through ## Usage 1. Copy the file `er-patcher` to the game directory. -2. In steam, set the game launch options to `./er-patcher ARGS -- %command%` See [Features](#features) for available options. - - Example: `./er-patcher --all --rate 30 --fix-camera -- %command%` - - Example using [MangoHud](https://github.com/flightlessmango/MangoHud) and wine fullscreen FSR: `./er-patcher --rate 144 -uvca -- env WINE_FULLSCREEN_FSR=1 MANGOHUD=1 MANGOHUD_CONFIG=histogram %command%` +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 --fix-camera -- %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. +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. + ## Features | Argument | Description | @@ -36,7 +38,7 @@ A tool aimed at enhancing the experience when playing the game on linux through ## Windows Support -The patcher works just as well on windows. The only difference is that you need to explicitly call python to run the script `er-patcher`. The following launch option line works in case you installed Python from Microsoft Store: +The patcher works just as well on windows. The following launch option line works in case you e.g. installed Python from Microsoft Store: > `python er-patcher --rate 165 --all -- %command%` From 771663eabff2f52614fcd8fe4457aad56db26714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Rodrigues=20Prates=20Braz?= Date: Thu, 21 Apr 2022 00:54:22 -0300 Subject: [PATCH 05/27] Feat: Added option to run game with EAC enabled --- er-patcher | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/er-patcher b/er-patcher index 8e500c6..edfa74e 100755 --- a/er-patcher +++ b/er-patcher @@ -17,6 +17,7 @@ if __name__ == "__main__": parser = argparse.ArgumentParser(description="Patch Elden Ring executable and launch it without EAC.") parser.add_argument("-r", "--rate", type=int, default=60, help="Modify the frame rate limit (e.g. 30, 120, 165 or whatever).") + parser.add_argument("--with-eac", action='store_true', help="Run game with EAC (Use at own your risk)") parser.add_argument("--fix-camera", action='store_true', help="Disable camera auto-rotation.") parser.add_argument("--all", action='store_true', help="Enable all options except rate adjustment and gamplay changes like `--fix-camera`.") parser.add_argument("-u", "--ultrawide", action='store_true', help="Removes black bars when using a resolution with an aspect ratio other than 16:9.") @@ -133,7 +134,7 @@ if __name__ == "__main__": # start patched exe directly to avoid EAC steam_cmd = sys.argv[1 + sys.argv.index("--"):] - steam_cmd[-1] = Path(steam_cmd[-1]).parent.absolute() / game_dir_patched / "eldenring.exe" + steam_cmd[-1] = Path(steam_cmd[-1]).parent.absolute() / game_dir_patched / ("start_protected_game.exe" if patch.with_eac else "eldenring.exe") subprocess.run(steam_cmd, cwd=steam_cmd[-1].parent.absolute()) # cleanup From e2f0ab53cfe6e564880bc9252c9815d5e434d204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Rodrigues=20Prates=20Braz?= Date: Thu, 21 Apr 2022 00:56:17 -0300 Subject: [PATCH 06/27] Feat: Updated Ultrawide fix to version 1.04 --- er-patcher | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/er-patcher b/er-patcher index 8e500c6..e0b8042 100755 --- a/er-patcher +++ b/er-patcher @@ -50,9 +50,9 @@ if __name__ == "__main__": print("er-patcher: fix_camera pattern scan failed") if patch.ultrawide or patch.all: - uw_pattern = "8b 01 85 c0 74 42 44 8b 59 04".replace(" ", "") + uw_pattern = "74 50 .. 8b .. .. dc 03 00 00 .. 85 .. 74 .. .. 8b .. .. 0f af".replace(" ", "") if (res := re.search(uw_pattern, exe_hex)) is not None: - uw_addr = res.span()[0] + 8 + uw_addr = res.span()[0] uw_patch = "eb" exe_hex = exe_hex[:uw_addr] + uw_patch + exe_hex[uw_addr + len(uw_patch):] else: From 0afbe0c4f1083f5b1510be6c3779f445da0a6d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Rodrigues=20Prates=20Braz?= Date: Thu, 21 Apr 2022 01:02:55 -0300 Subject: [PATCH 07/27] Feat: Include 'start_protected_game.exe' in the tmp folder --- er-patcher | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/er-patcher b/er-patcher index edfa74e..9f1c7b4 100755 --- a/er-patcher +++ b/er-patcher @@ -127,7 +127,7 @@ if __name__ == "__main__": # to handle but by default windows 10 doesn't allow them game_files = [f for f in game_dir.rglob("*") if f.is_file()] for f in game_files: - if f.name in ["eldenring.exe", "start_protected_game.exe", "er-patcher"]: + if f.name in ["eldenring.exe", "er-patcher"]: continue if not (game_dir_patched / f).is_file(): f.link_to(game_dir_patched / f) From 33b88872f88292c5c78fdbd7a90873538feb7b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Rodrigues=20Prates=20Braz?= Date: Thu, 21 Apr 2022 17:21:54 -0300 Subject: [PATCH 08/27] Feat: Updated the README to include the 'with-eac' arg --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9769b7a..f56663b 100644 --- a/README.md +++ b/README.md @@ -23,16 +23,17 @@ Note: There might be some distros (e.g. older Ubuntu releases) that launch pytho ## Features -| Argument | Description | -| --------------------------------------- | ---------------------------------------------------------------------------- | -| `-r RATE` or `--rate RATE` | Set a custom framerate limit (default: 60). | -| `--fix-camera` | Disable camera auto-rotation. | +| Argument | Description | +| --------------------------------------- | ------------------------------------------------------------------------------- | +| `-r RATE` or `--rate RATE` | Set a custom framerate limit (default: 60). | +| `--with-eac` | Run game with EAC (Use at own your risk) | +| `--fix-camera` | Disable camera auto-rotation. | | `--all` | Enable all options except `--rate` and
gameplay changes like `--fix-camera`. | -| `-u` or `--ultrawide` | Remove black bars. | -| `-v` or `--disable-vigniette` | Remove the vigniette overlay . | -| `-c` or `--disable-ca` | Disable chromatic abberation. | +| `-u` or `--ultrawide` | Remove black bars. | +| `-v` or `--disable-vigniette` | Remove the vigniette overlay . | +| `-c` or `--disable-ca` | Disable chromatic abberation. | | `-a` or `--increase-animation-distance` | Fix low frame rate animations at screen
edges or for distant entities. | -| `-s` or `--skip-intro` | Skip intro logos at game start. | +| `-s` or `--skip-intro` | Skip intro logos at game start. | | `-f` or `--remove-60hz-fullscreen` | Remove the 60Hz limit in fullscreen
mode (not needed with proton). | From ebcf78c9bb558063b52bd32b3faca7bc0be6e523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Rodrigues=20Prates=20Braz?= Date: Thu, 21 Apr 2022 18:34:05 -0300 Subject: [PATCH 09/27] Fix: Major bug where the flag 'with-eac' defaults to true --- er-patcher | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/er-patcher b/er-patcher index 9f1c7b4..7011ed4 100755 --- a/er-patcher +++ b/er-patcher @@ -17,7 +17,7 @@ if __name__ == "__main__": parser = argparse.ArgumentParser(description="Patch Elden Ring executable and launch it without EAC.") parser.add_argument("-r", "--rate", type=int, default=60, help="Modify the frame rate limit (e.g. 30, 120, 165 or whatever).") - parser.add_argument("--with-eac", action='store_true', help="Run game with EAC (Use at own your risk)") + parser.add_argument("--with-eac", action='store_false', help="Run game with EAC (Use at own your risk)") parser.add_argument("--fix-camera", action='store_true', help="Disable camera auto-rotation.") parser.add_argument("--all", action='store_true', help="Enable all options except rate adjustment and gamplay changes like `--fix-camera`.") parser.add_argument("-u", "--ultrawide", action='store_true', help="Removes black bars when using a resolution with an aspect ratio other than 16:9.") From b1b2af55afe4e41c7adcaa6ef44aabb16a5de51f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Rodrigues=20Prates=20Braz?= Date: Thu, 21 Apr 2022 18:34:44 -0300 Subject: [PATCH 10/27] Feat: Improved README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f56663b..207df06 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A tool aimed at enhancing the experience when playing the game on linux through ## Warning -**This tool is based on patching the game executable through hex-edits. However it is done in a safe and non-destructive way, that ensures the patched executable is never run with EAC enabled. Use at your own risk!** +**This tool is based on patching the game executable through hex-edits. However it is done in a safe and non-destructive way, that ensures the patched executable is never run with EAC enabled (unless explicity told to do so). Use at your own risk!** ## Dependencies @@ -47,7 +47,7 @@ Note: This spawns a python console which will close by itself after the game has ## 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. The tool then modifies the steam launch command to launch the patched executable instead of `start_protected_game.exe`. This ensures that the patched exe is never run with EAC enabled. After the game is closed, the patched executable is removed. +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. ## Credits From 6c4be1ae92de5497240042a94c8c54cb706b8c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Rodrigues=20Prates=20Braz?= Date: Thu, 21 Apr 2022 18:38:38 -0300 Subject: [PATCH 11/27] Revert "Fix: Major bug where the flag 'with-eac' defaults to true" This reverts commit ebcf78c9bb558063b52bd32b3faca7bc0be6e523. --- er-patcher | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/er-patcher b/er-patcher index 7011ed4..9f1c7b4 100755 --- a/er-patcher +++ b/er-patcher @@ -17,7 +17,7 @@ if __name__ == "__main__": parser = argparse.ArgumentParser(description="Patch Elden Ring executable and launch it without EAC.") parser.add_argument("-r", "--rate", type=int, default=60, help="Modify the frame rate limit (e.g. 30, 120, 165 or whatever).") - parser.add_argument("--with-eac", action='store_false', help="Run game with EAC (Use at own your risk)") + parser.add_argument("--with-eac", action='store_true', help="Run game with EAC (Use at own your risk)") parser.add_argument("--fix-camera", action='store_true', help="Disable camera auto-rotation.") parser.add_argument("--all", action='store_true', help="Enable all options except rate adjustment and gamplay changes like `--fix-camera`.") parser.add_argument("-u", "--ultrawide", action='store_true', help="Removes black bars when using a resolution with an aspect ratio other than 16:9.") From f6cebbf832f212023c32eb40cf10e3b2ccfbe96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Braz?= <37230465+joao-pedro-braz@users.noreply.github.com> Date: Fri, 22 Apr 2022 11:49:28 -0300 Subject: [PATCH 12/27] Fix: Grammar in the README Fixed "Use at own your risk" to "Use it at your own risk" --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 207df06..4baabd0 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Note: There might be some distros (e.g. older Ubuntu releases) that launch pytho | Argument | Description | | --------------------------------------- | ------------------------------------------------------------------------------- | | `-r RATE` or `--rate RATE` | Set a custom framerate limit (default: 60). | -| `--with-eac` | Run game with EAC (Use at own your risk) | +| `--with-eac` | Run game with EAC (Use it at your own risk) | | `--fix-camera` | Disable camera auto-rotation. | | `--all` | Enable all options except `--rate` and
gameplay changes like `--fix-camera`. | | `-u` or `--ultrawide` | Remove black bars. | From c3ee974b54f28e4044926cf1b551d103099df905 Mon Sep 17 00:00:00 2001 From: James McKenzie Date: Wed, 15 Jun 2022 12:15:15 -0700 Subject: [PATCH 13/27] Fixes ultrawide for 1.05 with new pattern. --- er-patcher | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/er-patcher b/er-patcher index a74707c..b00ab59 100755 --- a/er-patcher +++ b/er-patcher @@ -51,7 +51,7 @@ if __name__ == "__main__": print("er-patcher: fix_camera pattern scan failed") if patch.ultrawide or patch.all: - uw_pattern = "74 50 .. 8b .. .. dc 03 00 00 .. 85 .. 74 .. .. 8b .. .. 0f af".replace(" ", "") + uw_pattern = "74 4f 45 8b 94 cc".replace(" ", "") if (res := re.search(uw_pattern, exe_hex)) is not None: uw_addr = res.span()[0] uw_patch = "eb" From 0f39247ab7bf0da6b77cac34aed6db969076b8d5 Mon Sep 17 00:00:00 2001 From: Ivar Scholten Date: Sat, 3 Sep 2022 18:05:28 +0200 Subject: [PATCH 14/27] feature: disable rune loss upon death --- README.md | 29 ++++++++++++++++------------- er-patcher | 12 +++++++++++- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 4baabd0..4a212f2 100644 --- a/README.md +++ b/README.md @@ -23,18 +23,19 @@ Note: There might be some distros (e.g. older Ubuntu releases) that launch pytho ## Features -| Argument | Description | -| --------------------------------------- | ------------------------------------------------------------------------------- | -| `-r RATE` or `--rate RATE` | Set a custom framerate limit (default: 60). | -| `--with-eac` | Run game with EAC (Use it at your own risk) | -| `--fix-camera` | Disable camera auto-rotation. | -| `--all` | Enable all options except `--rate` and
gameplay changes like `--fix-camera`. | -| `-u` or `--ultrawide` | Remove black bars. | -| `-v` or `--disable-vigniette` | Remove the vigniette overlay . | -| `-c` or `--disable-ca` | Disable chromatic abberation. | -| `-a` or `--increase-animation-distance` | Fix low frame rate animations at screen
edges or for distant entities. | -| `-s` or `--skip-intro` | Skip intro logos at game start. | -| `-f` or `--remove-60hz-fullscreen` | Remove the 60Hz limit in fullscreen
mode (not needed with proton). | +| Argument | Description | +| --------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| `-r RATE` or `--rate RATE` | Set a custom framerate limit (default: 60). | +| `--with-eac` | Run game with EAC (Use it at your own risk) | +| `--fix-camera` | Disable camera auto-rotation. | +| `--disable-rune-loss` | Disable losing runes upon death. | +| `--all` | Enable all options except `--rate` and
gameplay changes like `--fix-camera` and `--disable-rune-loss`. | +| `-u` or `--ultrawide` | Remove black bars. | +| `-v` or `--disable-vigniette` | Remove the vigniette overlay . | +| `-c` or `--disable-ca` | Disable chromatic abberation. | +| `-a` or `--increase-animation-distance` | Fix low frame rate animations at screen
edges or for distant entities. | +| `-s` or `--skip-intro` | Skip intro logos at game start. | +| `-f` or `--remove-60hz-fullscreen` | Remove the 60Hz limit in fullscreen
mode (not needed with proton). | ## Windows Support @@ -58,4 +59,6 @@ When the game is launched through steam, the tool creates a patched version of ` - vigniette and ca removal - animation distance increase - [DarkSouls3RemoveIntroScreens](https://github.com/bladecoding/DarkSouls3RemoveIntroScreens): intro logo skip -- [EldenRingMods](https://github.com/techiew/EldenRingMods) + [EldenRingFpsUnlockAndMore](https://github.com/uberhalit/EldenRingFpsUnlockAndMore): camera fix +- [EldenRingMods](https://github.com/techiew/EldenRingMods) + [EldenRingFpsUnlockAndMore](https://github.com/uberhalit/EldenRingFpsUnlockAndMore) + - camera fix + - disable rune loss diff --git a/er-patcher b/er-patcher index b00ab59..4da3d79 100755 --- a/er-patcher +++ b/er-patcher @@ -18,8 +18,9 @@ if __name__ == "__main__": parser.add_argument("-r", "--rate", type=int, default=60, help="Modify the frame rate limit (e.g. 30, 120, 165 or whatever).") parser.add_argument("--with-eac", action='store_true', help="Run game with EAC (Use at own your risk)") + parser.add_argument("--disable-rune-loss", action='store_true', help="Disable losing runes upon death.") parser.add_argument("--fix-camera", action='store_true', help="Disable camera auto-rotation.") - parser.add_argument("--all", action='store_true', help="Enable all options except rate adjustment and gamplay changes like `--fix-camera`.") + parser.add_argument("--all", action='store_true', help="Enable all options except rate adjustment and gamplay changes like `--fix-camera` and `--disable-rune-loss`.") parser.add_argument("-u", "--ultrawide", action='store_true', help="Removes black bars when using a resolution with an aspect ratio other than 16:9.") parser.add_argument("-v", "--disable-vigniette", action='store_true', help="Disables the vigniette overlay.") parser.add_argument("-c", "--disable-ca", action='store_true', help="Disables chromatic abberation.") @@ -50,6 +51,15 @@ if __name__ == "__main__": else: print("er-patcher: fix_camera pattern scan failed") + if patch.disable_rune_loss: + rl_pattern = "b0 01 .. 8b .. e8 .. .. .. .. .. 8b .. .. .. 32 c0 .. 83 .. 28 c3".replace(" ", "") + if (res := re.search(rl_pattern, exe_hex)) is not None: + rl_addr = res.span()[0] + 6 + 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: + print("er-patcher: disable rune loss pattern scan failed") + if patch.ultrawide or patch.all: uw_pattern = "74 4f 45 8b 94 cc".replace(" ", "") if (res := re.search(uw_pattern, exe_hex)) is not None: From 1d9d2deafccc760ddf3ac05d8dad5fb6d1c26116 Mon Sep 17 00:00:00 2001 From: Marcus Gursch Date: Sun, 11 Sep 2022 14:45:38 +0200 Subject: [PATCH 15/27] remove `--fix-camera` option It is not longer needed since the game now provides a setting for this. --- er-patcher | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/er-patcher b/er-patcher index 4da3d79..053b3cd 100755 --- a/er-patcher +++ b/er-patcher @@ -19,8 +19,7 @@ if __name__ == "__main__": parser.add_argument("-r", "--rate", type=int, default=60, help="Modify the frame rate limit (e.g. 30, 120, 165 or whatever).") parser.add_argument("--with-eac", action='store_true', help="Run game with EAC (Use at own your risk)") parser.add_argument("--disable-rune-loss", action='store_true', help="Disable losing runes upon death.") - parser.add_argument("--fix-camera", action='store_true', help="Disable camera auto-rotation.") - parser.add_argument("--all", action='store_true', help="Enable all options except rate adjustment and gamplay changes like `--fix-camera` and `--disable-rune-loss`.") + parser.add_argument("--all", action='store_true', help="Enable all options except rate adjustment and gamplay changes like `--disable-rune-loss`.") parser.add_argument("-u", "--ultrawide", action='store_true', help="Removes black bars when using a resolution with an aspect ratio other than 16:9.") parser.add_argument("-v", "--disable-vigniette", action='store_true', help="Disables the vigniette overlay.") parser.add_argument("-c", "--disable-ca", action='store_true', help="Disables chromatic abberation.") @@ -42,15 +41,6 @@ if __name__ == "__main__": else: print("er-patcher: rate pattern scan failed") - if patch.fix_camera: - cf_pattern = '0f 29 a6 .. .. .. .. 41 0f 28 cf'.replace(" ", "") - if (res := re.search(cf_pattern, exe_hex)) is not None: - cf_addr = res.span()[0] - cf_patch = "90 90 90 90 90 90 90".replace(" ", "") - exe_hex = exe_hex[:cf_addr] + cf_patch + exe_hex[cf_addr + len(cf_patch):] - else: - print("er-patcher: fix_camera pattern scan failed") - if patch.disable_rune_loss: rl_pattern = "b0 01 .. 8b .. e8 .. .. .. .. .. 8b .. .. .. 32 c0 .. 83 .. 28 c3".replace(" ", "") if (res := re.search(rl_pattern, exe_hex)) is not None: From 56558f8481ac8912e69751fc410706024e8c6ffe Mon Sep 17 00:00:00 2001 From: Marcus Gursch Date: Sun, 11 Sep 2022 14:49:16 +0200 Subject: [PATCH 16/27] remove `--fix-camera` option --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4a212f2..bdb5689 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,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 --fix-camera -- %command%` + - Example: `python er-patcher --all --rate 30 --disable-rune-loss -- %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. @@ -27,9 +27,8 @@ Note: There might be some distros (e.g. older Ubuntu releases) that launch pytho | --------------------------------------- | --------------------------------------------------------------------------------------------------------- | | `-r RATE` or `--rate RATE` | Set a custom framerate limit (default: 60). | | `--with-eac` | Run game with EAC (Use it at your own risk) | -| `--fix-camera` | Disable camera auto-rotation. | | `--disable-rune-loss` | Disable losing runes upon death. | -| `--all` | Enable all options except `--rate` and
gameplay changes like `--fix-camera` and `--disable-rune-loss`. | +| `--all` | Enable all options except `--rate` and
gameplay changes like `--disable-rune-loss`. | | `-u` or `--ultrawide` | Remove black bars. | | `-v` or `--disable-vigniette` | Remove the vigniette overlay . | | `-c` or `--disable-ca` | Disable chromatic abberation. | @@ -60,5 +59,4 @@ When the game is launched through steam, the tool creates a patched version of ` - animation distance increase - [DarkSouls3RemoveIntroScreens](https://github.com/bladecoding/DarkSouls3RemoveIntroScreens): intro logo skip - [EldenRingMods](https://github.com/techiew/EldenRingMods) + [EldenRingFpsUnlockAndMore](https://github.com/uberhalit/EldenRingFpsUnlockAndMore) - - camera fix - disable rune loss From 124fe3c08229950575ab8a9918e6b2996363ec0b Mon Sep 17 00:00:00 2001 From: Ivar Scholten Date: Fri, 30 Sep 2022 16:32:50 +0200 Subject: [PATCH 17/27] feature: add --executable flag Some mods are launched through a executable different from `eldenring.exe` or `launch_game_protected.exe`. Because of that its useful to be able to explicitly specify the path. Also fixes some linter warnings. --- README.md | 8 +++++--- er-patcher | 22 +++++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index bdb5689..0d25c9c 100644 --- a/README.md +++ b/README.md @@ -16,6 +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 [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. @@ -26,11 +27,12 @@ Note: There might be some distros (e.g. older Ubuntu releases) that launch pytho | Argument | Description | | --------------------------------------- | --------------------------------------------------------------------------------------------------------- | | `-r RATE` or `--rate RATE` | Set a custom framerate limit (default: 60). | -| `--with-eac` | Run game with EAC (Use it at your own risk) | +| `-x EXE` or `--executable EXE` | The executable to launch, relative to the games folder.
Mutually exclusive with `--with-eac`. | +| `--with-eac` | Run game with EAC (Use it at your own risk).
Mutually exclusive with `--executable`. | | `--disable-rune-loss` | Disable losing runes upon death. | -| `--all` | Enable all options except `--rate` and
gameplay changes like `--disable-rune-loss`. | +| `--all` | Enable all options except `--rate`, `--executable`, and
gameplay changes like `--disable-rune-loss`. | | `-u` or `--ultrawide` | Remove black bars. | -| `-v` or `--disable-vigniette` | Remove the vigniette overlay . | +| `-v` or `--disable-vigniette` | Remove the vigniette overlay. | | `-c` or `--disable-ca` | Disable chromatic abberation. | | `-a` or `--increase-animation-distance` | Fix low frame rate animations at screen
edges or for distant entities. | | `-s` or `--skip-intro` | Skip intro logos at game start. | diff --git a/er-patcher b/er-patcher index 053b3cd..ed73579 100755 --- a/er-patcher +++ b/er-patcher @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -import os import sys import subprocess import argparse @@ -13,10 +12,11 @@ from shutil import rmtree if __name__ == "__main__": patcher_args = sys.argv[1:sys.argv.index("--")] - + parser = argparse.ArgumentParser(description="Patch Elden Ring executable and launch it without EAC.") - + parser.add_argument("-r", "--rate", type=int, default=60, help="Modify the frame rate limit (e.g. 30, 120, 165 or whatever).") + parser.add_argument("-x", "--executable", action='store', type=str, default="eldenring.exe", help="The executable to launch, relative to the games folder.") parser.add_argument("--with-eac", action='store_true', help="Run game with EAC (Use at own your risk)") parser.add_argument("--disable-rune-loss", action='store_true', help="Disable losing runes upon death.") parser.add_argument("--all", action='store_true', help="Enable all options except rate adjustment and gamplay changes like `--disable-rune-loss`.") @@ -28,6 +28,10 @@ if __name__ == "__main__": parser.add_argument("-f", "--remove-60hz-fullscreen", action='store_true', help="Remove 60hz lock in fullscreen.") patch = parser.parse_args(patcher_args) + if patch.with_eac and patch.executable != "eldenring.exe": + print("er-patcher: --with-eac is mutually exclusive with --executable") + sys.exit(1) + game_dir = Path(".") with open(game_dir / "eldenring.exe", "rb") as f: exe_hex = f.read().hex() @@ -45,7 +49,7 @@ if __name__ == "__main__": rl_pattern = "b0 01 .. 8b .. e8 .. .. .. .. .. 8b .. .. .. 32 c0 .. 83 .. 28 c3".replace(" ", "") if (res := re.search(rl_pattern, exe_hex)) is not None: rl_addr = res.span()[0] + 6 - rl_patch = "90 90 90 90 90".replace(" ", "") # NOP + 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: print("er-patcher: disable rune loss pattern scan failed") @@ -96,7 +100,7 @@ if __name__ == "__main__": exe_hex = exe_hex[:si_addr] + si_patch + exe_hex[si_addr + len(si_patch):] else: 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(" ", "") if (res := re.search(fs_pattern, exe_hex)) is not None: @@ -121,20 +125,20 @@ if __name__ == "__main__": if d == game_dir_patched: continue if not (game_dir_patched / d).is_dir(): - (game_dir_patched / d).mkdir(parents=True) + (game_dir_patched / d).mkdir(parents=True) # hard link game files to game_dir_patched; symbolic links would be easier # to handle but by default windows 10 doesn't allow them game_files = [f for f in game_dir.rglob("*") if f.is_file()] for f in game_files: if f.name in ["eldenring.exe", "er-patcher"]: - continue + continue if not (game_dir_patched / f).is_file(): - f.link_to(game_dir_patched / f) + f.link_to(game_dir_patched / f) # start patched exe directly to avoid EAC steam_cmd = sys.argv[1 + sys.argv.index("--"):] - steam_cmd[-1] = Path(steam_cmd[-1]).parent.absolute() / game_dir_patched / ("start_protected_game.exe" if patch.with_eac else "eldenring.exe") + 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 From 7faf4c4f25e7786c5d8386b78a62827477c2a23d Mon Sep 17 00:00:00 2001 From: Armin Veres Date: Tue, 27 Dec 2022 12:30:36 +0100 Subject: [PATCH 18/27] Fixed vignette spelling --- README.md | 4 ++-- er-patcher | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0d25c9c..78392d7 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Note: There might be some distros (e.g. older Ubuntu releases) that launch pytho | `--disable-rune-loss` | Disable losing runes upon death. | | `--all` | Enable all options except `--rate`, `--executable`, and
gameplay changes like `--disable-rune-loss`. | | `-u` or `--ultrawide` | Remove black bars. | -| `-v` or `--disable-vigniette` | Remove the vigniette overlay. | +| `-v` or `--disable-vignette` | Remove the vignette overlay. | | `-c` or `--disable-ca` | Disable chromatic abberation. | | `-a` or `--increase-animation-distance` | Fix low frame rate animations at screen
edges or for distant entities. | | `-s` or `--skip-intro` | Skip intro logos at game start. | @@ -57,7 +57,7 @@ When the game is launched through steam, the tool creates a patched version of ` - frame time limit adjustment - black bar removal - [Flawless Widescreen](https://www.flawlesswidescreen.org) - - vigniette and ca removal + - vignette and ca removal - animation distance increase - [DarkSouls3RemoveIntroScreens](https://github.com/bladecoding/DarkSouls3RemoveIntroScreens): intro logo skip - [EldenRingMods](https://github.com/techiew/EldenRingMods) + [EldenRingFpsUnlockAndMore](https://github.com/uberhalit/EldenRingFpsUnlockAndMore) diff --git a/er-patcher b/er-patcher index ed73579..7292dbe 100755 --- a/er-patcher +++ b/er-patcher @@ -21,7 +21,7 @@ if __name__ == "__main__": parser.add_argument("--disable-rune-loss", action='store_true', help="Disable losing runes upon death.") parser.add_argument("--all", action='store_true', help="Enable all options except rate adjustment and gamplay changes like `--disable-rune-loss`.") parser.add_argument("-u", "--ultrawide", action='store_true', help="Removes black bars when using a resolution with an aspect ratio other than 16:9.") - parser.add_argument("-v", "--disable-vigniette", action='store_true', help="Disables the vigniette overlay.") + parser.add_argument("-v", "--disable-vignette", action='store_true', help="Disables the vignette overlay.") parser.add_argument("-c", "--disable-ca", action='store_true', help="Disables chromatic abberation.") parser.add_argument("-a", "--increase-animation-distance", action='store_true', help="Increase animation distance.") parser.add_argument("-s", "--skip-intro", action='store_true', help="Skip intro logos.") @@ -63,14 +63,14 @@ if __name__ == "__main__": else: print("er-patcher: ultrawide pattern scan failed") - if patch.disable_vigniette or patch.all: + if patch.disable_vignette or patch.all: v_pattern = 'f3 0f 10 .. .. f3 0f 59 .. .. .. .. .. e8 .. .. .. .. f3 41 0f .. .. f3 45 0f .. .. 4c 8d .. .. .. .. .. .. 48'.replace(" ", "") if (res := re.search(v_pattern, exe_hex)) is not None: v_addr = res.span()[0] + 46 v_patch = "f3 0f 5c c0 90".replace(" ", "") # SUBSS XMM0,XMM0; NOP; all NOP does work too exe_hex = exe_hex[:v_addr] + v_patch + exe_hex[v_addr + len(v_patch):] else: - print("er-patcher: disable_vigniette pattern scan failed") + print("er-patcher: disable_vignette pattern scan failed") if patch.disable_ca or patch.all: ca_pattern = "0f 11 43 60 48 8d 8b 80 00 00 00 0f 10 87 a0 00 00 00 0f 11 41 f0 48 8d 87 b0 00 00 00 0f 10 08 0f 11 09".replace(" ", "") From 569917cb4b99f34d8998f7e93521eac6bb98ea33 Mon Sep 17 00:00:00 2001 From: Marcus Gursch Date: Mon, 20 Nov 2023 11:37:46 +0100 Subject: [PATCH 19/27] adapt to python 3.12 changes Co-authored-by: mtnorthcott --- er-patcher | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/er-patcher b/er-patcher index 7292dbe..72a75a6 100755 --- a/er-patcher +++ b/er-patcher @@ -134,7 +134,7 @@ if __name__ == "__main__": if f.name in ["eldenring.exe", "er-patcher"]: continue if not (game_dir_patched / f).is_file(): - f.link_to(game_dir_patched / f) + (game_dir_patched / f).hardlink_to(f) # start patched exe directly to avoid EAC steam_cmd = sys.argv[1 + sys.argv.index("--"):] From 98cf4aeaa8a06fa974700280bbcab2b1c915fbb2 Mon Sep 17 00:00:00 2001 From: Marcus Gursch Date: Fri, 12 Jan 2024 02:40:36 +0100 Subject: [PATCH 20/27] use old `link_to` api when running on python 3.9 or older --- er-patcher | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/er-patcher b/er-patcher index 72a75a6..f328e0d 100755 --- a/er-patcher +++ b/er-patcher @@ -134,7 +134,10 @@ if __name__ == "__main__": if f.name in ["eldenring.exe", "er-patcher"]: continue if not (game_dir_patched / f).is_file(): - (game_dir_patched / f).hardlink_to(f) + if sys.version_info.minor >= 10: + (game_dir_patched / f).hardlink_to(f) + else: + f.link_to(game_dir_patched / f) # start patched exe directly to avoid EAC steam_cmd = sys.argv[1 + sys.argv.index("--"):] From a388b09bee51f547a51fdb2640a1fa25ee1061b1 Mon Sep 17 00:00:00 2001 From: polsrepo <110729177+polsrepo@users.noreply.github.com> Date: Thu, 20 Jun 2024 13:25:04 +0200 Subject: [PATCH 21/27] Update er-patcher for v1.12 Updated hex pattern for patch.rate, fixed the offset value for patch.remove_60hz_fullscreen --- er-patcher | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/er-patcher b/er-patcher index f328e0d..fe4fb3c 100755 --- a/er-patcher +++ b/er-patcher @@ -37,7 +37,7 @@ if __name__ == "__main__": exe_hex = f.read().hex() if patch.rate != 60 and patch.rate > 0: - r_pattern = "c7 43 20 89 88 88 3c eb 43 89 73 18 eb ca 89 73 18".replace(" ", "") + r_pattern = "c7 43 1c 89 88 88 3c eb 6d 89 73 18 eb c7 89 73 18".replace(" ", "") if (res := re.search(r_pattern, exe_hex)) is not None: r_addr = res.span()[0] + 6 r_patch = struct.pack(' Date: Thu, 20 Jun 2024 14:01:48 +0200 Subject: [PATCH 22/27] 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 23/27] 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 24/27] 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 25/27] 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 26/27] 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 27/27] 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.