Add files via upload

This commit is contained in:
helpme970 2025-11-23 06:28:46 +01:00 committed by GitHub
parent 98aa86767c
commit f6661e8861
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,7 +6,7 @@ import argparse
from pathlib import Path
import struct
import re
from shutil import rmtree
from shutil import rmtree, copy
import os
import time
@ -27,7 +27,10 @@ def cleanup(game_dir_patched):
if __name__ == "__main__":
if "--" in sys.argv:
patcher_args = sys.argv[1:sys.argv.index("--")]
else:
patcher_args = sys.argv[1:]
parser = argparse.ArgumentParser(description="Patch Elden Ring executable and launch it without EAC.")
@ -42,6 +45,7 @@ if __name__ == "__main__":
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.")
parser.add_argument("-f", "--remove-60hz-fullscreen", action='store_true', help="Remove 60hz lock in fullscreen.")
parser.add_argument("-p", "--permanent", action='store_true', help="Make the patches permanently.")
patch = parser.parse_args(patcher_args)
if patch.with_eac and patch.executable != "eldenring.exe":
@ -130,6 +134,20 @@ if __name__ == "__main__":
else:
print("er-patcher: remove_60hz_fullscreen pattern scan failed")
if patch.permanent:
# create backup of eldenring.exe
copy("eldenring.exe", "eldenring.exe.bak")
if patch.with_eac:
exe = "eldenring.exe"
else:
exe = "start_protected_game.exe"
# patch elden ring
with open(exe, "wb") as f:
f.write(bytes.fromhex(exe_hex))
else:
game_dir_patched = Path("er-patcher-tmp")
# make sure a fresh directory is used