gurrgur / er-patcher

Elden Ring enhancement patches (ultrawide support, custom frame rate limits and more) seamlessly integrated with steam.
MIT License
311 stars 25 forks source link

Whitescreen Crash issue when using the er-patcher #3

Closed TheLux83 closed 2 years ago

TheLux83 commented 2 years ago

Hey there,

I have found this github repository on protondb.com and tried it. Unfortunately, I get the whitescreen crash, when I use this patch and I don't know why.

My command looks like this: ./er-patcher -uavc -- %command% I've tried Proton-7.3-GE-1 and GE-Proton 7-9 and 7-8 If I start the game without this patcher, it works in Proton-7.3-GE-1. It still doesn't really work on the other ones but there I don't get the white screen either.

I have a Radeon 6900 XT and a AMD Ryzen 7 3700X 8-Core Processor.

Do you have any idea what the issue might be?

gurrgur commented 2 years ago

Hey, as a first sanity check please run ./er-patcher -- %command% which bypasses EAC but doesnt apply edits to the executable. If this causes the game to launch without issue, one of the patches is causing it. In that case please try applying the patches one at a time so we can see which.

  1. ./er-patcher -u -- %command%
  2. ./er-patcher -a -- %command%
  3. ./er-patcher -v -- %command%
  4. ./er-patcher -c -- %command%
TheLux83 commented 2 years ago

Well, that is something that should have come to my mind, before posting here. Sorry for that ^^

Unfortunately it isn't running either, when I just run './er-patcher -- %command% I've tried on Proton-7.3-GE-1 and GE-Proton 7-9

Maybe it's important to say, that I'm running Manjaro (Linux Trenzalore 5.15.25-1-MANJARO #1 SMP PREEMPT Wed Feb 23 14:44:03 UTC 2022 x86_64 GNU/Linux)

I'm using the video-linux driver image

gurrgur commented 2 years ago

This is a bit odd but it seems like the issue is not with er-patcher or any of its patches. Some more questions:

Other than that unfortunately I can only give some generic tips like

TheLux83 commented 2 years ago

Yes, when I launch the game with ./er-patcher -- %command% it also fails with a white screen. Proton-7.3-GE-1 bypasses EAC with renaming start_protected_game.exe and eldenring.exe. GE-Proton 7-9 doesn't do that if I recognize correctly.

Will do your suggestions. Mayve there is something with my installation, because I only can play on Proton-7.3-GE-1 and on the other versions, it only starts once, if even and than not again. Maybe your suggestions are helping me with that. I will keep you informed. Thanks :)

MekaDragon commented 2 years ago

Hello there, thanks a lot for this project.

It happens the very same to me. I've tried ./er-patcher with and without options, I can even see how it creates the new files and folders before booting and then deleting them when the game crashes.

I've tried to use GE-Proton7-8, GE-Proton7-9, Proton Experimental and Proton Experimental (bleeding edge) to no avail. The very same result happens with every Proton version.

CPU: AMD Ryzen 5 3600X. GPU: AMD RX 5700 XT, with Mesa 21.3.7 drivers. OS: SolusOS 5.14.21-210.

gurrgur commented 2 years ago

You could check if it has to do something with launching the executable from a subfolder.

  1. Open er-patcher in a text editor and change the last two lines to
    # os.remove(patched_exe_dir / exe_name)
    # os.rmdir(patched_exe_dir)
  1. Set the launch options you want to run the game with (assuming eerything works) and start it from steam once (we expect it to crash here)
  2. rename start_protected_game.exe to start_protected_game.exe.bak
  3. rename ./er-patcher-tmp/eldenring.exe to start_protected_game.exe and move it to the main game directory
  4. remove all Elden Ring launch options
  5. Try starting the game from steam with a version of proton that would normally launch the game fine
MekaDragon commented 2 years ago

Thanks! That worked!

gurrgur commented 2 years ago

I think the issue might actually be the performance workarounds in vkd3d since they are only enabled when the game process name is eldenring.exe. When you rename it to start_protected_game.exe, the process name becomes start_protected effectively bypassing aforementioned workarounds.

Could you do one more test using this older release? You can leave the modified start_protected_game.exe as is in case it won't work. Note that chromatic abberation removal and the animation fix are not included in that release.

gurrgur commented 2 years ago

Or even better: Try this launch option line with the most recent release (or main)

./er-patcher ARGS -- env VKD3D_CONFIG=skip_application_workarounds %command%

TheLux83 commented 2 years ago

I will try your suggestions tomorrow. Maybe this will work for me, too. :-)

TheLux83 commented 2 years ago

Sorry for the late reply. I have tested all your suggestions:

  1. manually removing the two lines and copying the file. Worked on my site.
  2. using the older release. Worked on my site
  3. Using ./er-patcher ARGS -- env VKD3D_CONFIG=skip_application_workarounds %command% still got a white screen.

So at the moment, I am happy that I can use the older release. But I'm also here, if you need further testing :)

kzdixon commented 2 years ago

I was having this issue until today apparently. Retried the latest version with Proton Experimental (bleeding-edge) and all seems well!

Framerate is capped to the lower refresh rate of my two monitors sadly (120hz versus 165hz), primary in nvidia is of course set to the higher one and this is a common issue for games anyway on linux.

Launch args used: ./er-patcher -r 165 -uavc -- env MANGOHUD=1 gamemoderun %command%

Riyyi commented 2 years ago

Just tested the patcher on the game's latest patch (1.03) together with GE-Proton-7-9 and it works! Used the following launch options: ./er-patcher -uvac -- %command%. Previously it failed unless I launched it manually with the modified .exe.

TheLux83 commented 2 years ago

I've tested it, too. But it's not working for me :-( But I'm also not able to start the game with gamemoderun %command% so I think there is an issue on my site

This is the log I get from Steam:

System information:
    Wine build: wine-7.0 (Staging)
    Platform: x86_64
    Version: Windows 10
    Host system: Linux
    Host version: 5.15.25-1-MANJARO
ThreadGetProcessExitCode: no such process 98346
ThreadGetProcessExitCode: no such process 98230
ThreadGetProcessExitCode: no such process 98250
ThreadGetProcessExitCode: no such process 98224
ThreadGetProcessExitCode: no such process 98216
ThreadGetProcessExitCode: no such process 98194
ThreadGetProcessExitCode: no such process 98191
ThreadGetProcessExitCode: no such process 98185
ThreadGetProcessExitCode: no such process 98183
pid 98187 != 98186, skipping destruction (fork without exec?)
Game process removed: AppID 1245620 "./er-patcher -- /home/sascham/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=1245620 -- '/home/sascham/.local/share/Steam/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/sascham/.local/share/Steam/compatibilitytools.d/GE-Proton7-9'/proton waitforexitandrun  '/home/sascham/.local/share/Steam/steamapps/common/ELDEN RING/Game/start_protected_game.exe'", ProcID 98268 
ThreadGetProcessExitCode: no such process 98268
ThreadGetProcessExitCode: no such process 98203
ThreadGetProcessExitCode: no such process 98005
ThreadGetProcessExitCode: no such process 98004
Game 1245620 created interface STEAMAPPS_INTERFACE_VERSION008 / 
Game 1245620 created interface SteamController008 / 
Game 1245620 created interface SteamInput002 / 
Game 1245620 created interface SteamUser021 / User
Game 1245620 created interface SteamUtils010 / 
Game 1245620 method call count for IClientAppManager::GetCurrentLanguage : 1
Game 1245620 method call count for IClientAppManager::BIsDlcEnabled : 1
Game 1245620 method call count for IClientUtils::RecordSteamInterfaceCreation : 6
Game 1245620 method call count for IClientUtils::GetAppID : 8
Game 1245620 method call count for IClientUser::BIsSubscribedApp : 1
Game 1245620 method call count for IClientUser::GetSteamID : 1
Uploaded AppInterfaceStats to Steam
insunaa commented 2 years ago

I'm 90% sure this issue comes from running the binary outside of the usual working directory. The backtrace hints at eldenring.exe trying to access some functions from a dynamic library (which is one folder up) and failing => access violation => crash it probably makes more sense to put the temporary binary in the same directory as the original binary and only delete that one afterwards. I'm not sure if what people here have been saying about the VKD3D improvements only working if the file is named eldenring.exe is true, however. If it is then this is a conundrum.

I got it to work for me by changing the last few lines of the script to:

    if patch.remove_60hz_fullscreen:
        exe_hex = exe_hex.replace(
            "c745ef3c000000",
            "c745ef00000000"
        )

    patched_exe_name = Path("patched." +  exe_name.name)

    with open(patched_exe_name, "wb") as f:
        f.write(bytes.fromhex(exe_hex))

    del exe_hex

    # start patched exe directly to avoid EAC
    steam_cmd = sys.argv[1 + sys.argv.index("--"):]
    steam_cmd[-1] = Path(steam_cmd[-1]).parent.absolute() / patched_exe_name
    subprocess.run(steam_cmd)

    os.remove(patched_exe_name)

(the 60hz part is just before my changes start, I just include it so you can find where I started my changes)

Edit: I tried with replacing and running it as eldenring.exe in the original path and then deleting it post gameplay and I had the exact same result. There was no noticeable performance difference either. => this issue is not caused by the vkd3d workarounds. I confirmed that the game was launched as eldenring.exe through htop

gurrgur commented 2 years ago

Well, putting the patched binary into a subdirectory should not make any difference w.r.t. the working directory. In the first release it was done the way you are suggesting (same folder, modified name). However I changed it because the vkd3d-proton workarounds depend on the game process name being "eldenring.exe". Renaming the executable also changes the process name which bypasses these workarounds. I checked vkd3d-proton info stdout and confirmed this behaviour.

Though, I remember that the process name was cropped to a limited number of letters. It's possible that naming the executable "eldenring.exe.patched.exe" does not change the process name so that vkd3d-proton workarounds kick in as desired.

But I think a cleaner way to temporarily replace the game executable might be to redirect all access to "eldenring.exe" to our patched executable similar to this stackoverflow question. Unfortunately doing it like that would require platform dependent code and most likely additional dependencies, both of which I want to avoid.

bright-side-99 commented 2 years ago

https://github.com/gurrgur/er-patcher/issues/3#issuecomment-1063903203

also works for me. Meaning the game starts with the features I want.

gurrgur commented 2 years ago

Is the whitescreen crash still happening for you guys? I'd appreciate if you could test this modified version of ~er-patcher~ and let me know whether it fixes the issue.

bright-side-99 commented 2 years ago

I'm getting the following error (elementary OS 6.1 (Ubuntu 20.04.3 LTS)):

./er-patcher -vcs -- %command%

Traceback (most recent call last):
  File "./er-patcher", line 110, in <module>
    (game_dir_patched / f).hardlink_to(f)
AttributeError: 'PosixPath' object has no attribute 'hardlink_to'
gurrgur commented 2 years ago

Thanks for the quick response. What file system are you using? Tested it on windows/ntfs and linux/ext4 and it worked fine 🤔

bright-side-99 commented 2 years ago

it's ext4 in my case. I'll update if I find something out... maybe someone else can try?

gurrgur commented 2 years ago

Ah I see, it's a python 3.8 compat issue. This here should work: ~er-patcher.zip~

Edit: Wait, there seems to be another error.

gurrgur commented 2 years ago

This one should actually really finally work: er-patcher.zip

Sorry for the spam 😅

bright-side-99 commented 2 years ago

ah, you are right, also saw it here: https://docs.python.org/3/library/pathlib.html#pathlib.Path

(https://docs.python.org/3/library/pathlib.html#pathlib.Path.hardlink_to)Path.hardlink_to(target)
{...}
New in version 3.10.

edit: lemme try the new version...

bright-side-99 commented 2 years ago

the link seems to work, but running the subprocess fails:

Traceback (most recent call last):

  File "./er-patcher", line 115, in <module>
    subprocess.run(steam_cmd, cwd=steam_cmd[-1].parent.absolute())

  File "/usr/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:

  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,

  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)

PermissionError: [Errno 13] Permission denied: PosixPath('/mnt/nvme/games/SteamLibrary/steamapps/common/ELDEN RING/Game/er-patcher-tmp/eldenring.exe')

if I stop the execution before that line and give er-patcher-tmp and er-patcher-tmp/eldenring.exe 777, I get:

File "/home/andy/Documents/common_nvme/ELDEN RING/Game/er-patcher", line 115, in <module>
    subprocess.run(steam_cmd, cwd=steam_cmd[-1].parent.absolute())
  File "/usr/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: PosixPath('/mnt/nvme/games/SteamLibrary/steamapps/common/ELDEN RING/Game/er-patcher-tmp/eldenring.exe')

Ah, don't waste your time on that, I was debugging the script directly, forgot that I have to run it using steam...

bright-side-99 commented 2 years ago

I'm happy to report that (settings I'm interested in) ./er-patcher -vcs -- %command%

works as expected, so no vignette, no chromatic abberation, no intros, and no whitescreen crash of course ;)

edit: ./er-patcher --all --rate 30 --fix-camera -- %command% also works without issues, locks framerate as expected to 30.

./er-patcher --all --rate 90 --fix-camera -- %command% also works without issues, unlocks framerate as expected to 90.

gurrgur commented 2 years ago

Great! Thats what I wanted to hear :) Also thanks again for testing! Can @TheLux83 try and see if it fixes the issue? If yes I'll merge the changes (MR #16) and we can close this issue.

kaythomas0 commented 2 years ago

This one should actually really finally work: er-patcher.zip

Sorry for the spam sweat_smile

This is the version that finally made it work for me, thanks a lot!

TheLux83 commented 2 years ago

Great! Thats what I wanted to hear :) Also thanks again for testing! Can @TheLux83 try and see if it fixes the issue? If yes I'll merge the changes (MR #16) and we can close this issue.

I'll try to test it this weekend (hopefully today) and will come back to you when I'm done :-) Thanks for the hard work and thanks for the rest for testing :-)

TheLux83 commented 2 years ago

It seems that it's running for me too now :-) Good work!

gurrgur commented 2 years ago

That's great to hear :) I guess we can close this issue then.