Merge pull request #25 from joao-pedro-braz/dev-with-eac

Flag to allow the game to run with EAC
This commit is contained in:
gurrgur 2022-04-22 10:55:03 +02:00 committed by GitHub
commit b87fa70015
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 12 deletions

View file

@ -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
@ -24,8 +24,9 @@ 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 at own your risk) |
| `--fix-camera` | Disable camera auto-rotation. |
| `--all` | Enable all options except `--rate` and<br>gameplay changes like `--fix-camera`. |
| `-u` or `--ultrawide` | Remove black bars. |
@ -46,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

View file

@ -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.")
@ -126,14 +127,14 @@ 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)
# 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