diff --git a/README.md b/README.md index 869c10a..24a3544 100644 --- a/README.md +++ b/README.md @@ -1 +1,31 @@ -# er-patcher \ No newline at end of file +# Elden Ring Proton Patcher + + +A tool aimed at enhancing the experience when playing the game on linux through proton. + +## Features + +- set custom frame time limits (e.g. 30, 90, 165, ...) +- disable black borders when using resolutions with an aspect ratio other than 16:9 (e.g. ultrawide). +- vigniette removal + +## Usage + +1. Copy the file `er-patcher` to the game directory. +2. In steam, set the game launch options to `./er-patcher ARGS -- %command%` where ARGS is replaced with a combination of + - `-r RATE` or `--rate RATE` for setting a custom framerate cap (default: 60) + - `-u` or `--ultrawide` for removing black bars + - `-v` or `--vigniette` for removing the vigniette overlay + - Example: `./er-patcher --rate 30 -uv -- %command%` + - Example with mangohud and wine fullscreen fsr: `./er-patcher --rate 30 -ucv -- 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 should work on windows, just as well. The only difference is, that you need to run the script via your python 3 installation. Depending on the version of python 3 you have installed you would need a slightly different path than shown in the following example. + +Example: `C:\Program Files\Python36\python.exe er-patcher --rate 165 -uv -- %command%` + +## How it works + +When the game is launched through steam, the tool creates a patched version of `eldenring.exe` called `eldenring.patched.exe` while leaving the original intact. The tool then modifies the steam launch command by replacing the string `start_protected_game.exe` with `eldenring.patched.exe` so that the patched exe is always run without EAC. After the game is closed, `eldenring.patched.exe` is deleted. \ No newline at end of file diff --git a/er-patcher b/er-patcher new file mode 100755 index 0000000..7d2c266 --- /dev/null +++ b/er-patcher @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 + + +import os +import sys +import subprocess +import argparse +from pathlib import Path +import struct +import code + + +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("-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.") + patch = parser.parse_args(patcher_args) + + with open(Path("eldenring.exe"), "rb") as f: + exe = f.read() + exe_hex = exe.hex() + + if patch.rate != 60 and patch.rate > 0: + exe_hex = exe_hex.replace( + "c743208988883ceb43897318ebca897318", + "c743208988883ceb43897318ebca897318".replace( + "8988883c", struct.pack('