mirror of
https://github.com/gurrgur/er-patcher.git
synced 2026-06-13 09:47:54 +00:00
Merge pull request #78 from metinc/main
Avoid deleting eldenring.exe while it is running
This commit is contained in:
commit
3ca1d96c9b
2 changed files with 23 additions and 3 deletions
|
|
@ -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.
|
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.
|
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: `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%`
|
- 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.
|
3. Launch the game through steam. `er-patcher` automatically launches a patched version of `eldenring.exe` with EAC disabled.
|
||||||
|
|
||||||
|
|
|
||||||
24
er-patcher
24
er-patcher
|
|
@ -7,7 +7,23 @@ from pathlib import Path
|
||||||
import struct
|
import struct
|
||||||
import re
|
import re
|
||||||
from shutil import rmtree
|
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"
|
||||||
|
while eldenring_path.exists():
|
||||||
|
try:
|
||||||
|
os.remove(eldenring_path)
|
||||||
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
|
@ -115,6 +131,10 @@ if __name__ == "__main__":
|
||||||
print("er-patcher: remove_60hz_fullscreen pattern scan failed")
|
print("er-patcher: remove_60hz_fullscreen pattern scan failed")
|
||||||
|
|
||||||
game_dir_patched = Path("er-patcher-tmp")
|
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():
|
if not game_dir_patched.is_dir():
|
||||||
game_dir_patched.mkdir()
|
game_dir_patched.mkdir()
|
||||||
|
|
||||||
|
|
@ -148,5 +168,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)
|
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())
|
subprocess.run(steam_cmd, cwd=steam_cmd[-1].parent.absolute())
|
||||||
|
|
||||||
# cleanup
|
# try to remove game_dir_patched
|
||||||
rmtree(game_dir_patched)
|
cleanup(game_dir_patched)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue