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 01/16] 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 02/16] 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 03/16] 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 04/16] 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 05/16] 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 06/16] 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 07/16] 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 08/16] 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 09/16] 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 10/16] 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 11/16] 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 12/16] 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 13/16] 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 14/16] 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 15/16] 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 16/16] 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.