feature: add chromatic abberation patch

This commit is contained in:
Marcus Gursch 2022-03-07 14:02:11 +01:00
parent fc5e8a75da
commit 9432648fac
2 changed files with 10 additions and 3 deletions

View file

@ -20,15 +20,16 @@ A tool aimed at enhancing the experience when playing the game on linux through
- `-r RATE` or `--rate RATE` for setting a custom framerate cap (default: 60)
- `-u` or `--ultrawide` for removing black bars
- `-v` or `--disable-vigniette` for removing the vigniette overlay
- Example: `./er-patcher --rate 30 -uv -- %command%`
- Example with mangohud and wine fullscreen fsr: `./er-patcher --rate 144 -uv -- env WINE_FULLSCREEN_FSR=1 MANGOHUD=1 MANGOHUD_CONFIG=histogram %command%`
- `-c` or `--disable-ca` for disabling chromatic abberation
- Example: `./er-patcher --rate 30 -uvc -- %command%`
- Example with mangohud and wine fullscreen fsr: `./er-patcher --rate 144 -uvc -- 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.
### Windows
It also work just as well on windows. The only difference is, that you need to run the script via your Python 3 installation. The following launch option line works in case you installed Python from Microsoft Store:
> `python er-patcher --rate 165 -uv -- %command%`
> `python er-patcher --rate 165 -uvc -- %command%`
## How it works

View file

@ -16,6 +16,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("-u", "--ultrawide", action=argparse.BooleanOptionalAction, help="Removes black bars when using a resolution with an aspect ratio other than 16:9.")
parser.add_argument("-v", "--disable-vigniette", action=argparse.BooleanOptionalAction, help="Disables the vigniette overlay.")
parser.add_argument("-c", "--disable-ca", action=argparse.BooleanOptionalAction, help="Disables chromatic abberation.")
patch = parser.parse_args(patcher_args)
exe_name = Path("eldenring.exe")
@ -42,6 +43,11 @@ if __name__ == "__main__":
"f30f590514a76e01f3440f5cc8f3450f5ecb",
"f30f590524b56e01f3440f5cc8f3450f5ecb"
)
if patch.disable_ca:
ca_addr = 94 + exe_hex.index("0f114360488d8b800000000f1087a00000000f1141f0488d87b00000000f10080f1109")
if exe_hex[ca_addr:ca_addr + 8] == "0f114920":
exe_hex = exe_hex[:ca_addr] + "660fefc9" + exe_hex[ca_addr + 8:] # PXOR XMM1,XMM1
patched_exe_dir = Path("./er-patcher-tmp")
if not patched_exe_dir.is_dir():