mwilsnd / SkyrimSE-SmoothCam

A thirdperson camera mod for Skyrim Special Edition
78 stars 19 forks source link

CTD on loading screen #56

Closed ZephaniahNoah closed 2 years ago

ZephaniahNoah commented 2 years ago

While loading a game save file it crashes. It also crashes immediately when starting a new game. Mods:

SmoothCam SmoothCam SynErgy Preset SkyUI Address Library for SKSE SKSE64

Plugins load order:

0 skyrim.esm
1 update.esm
2 dawnguard.esm
3 hearthfire.esm
4 dragonborn.esm
5 skyui_se.esp
6 smoothcam.esp

It should also be noted that I am running the game through Steam using Proton on Linux. The game runs fine without the mod. I didn't see any errors in the SKSE logs other than ImprovedCamera.dll beta 1.0.0.4 not found, running without compatibility. It looks like SmoothCam loaded just fine. I tried the OldCPU option in the fomod installer. I also tried swapping skyui_se and smoothcam in the load order.

mwilsnd commented 2 years ago

Sounds like it crashes while trying to hook game code for some reason. I don't have a linux setup so I can't test myself. If you can, opening SmoothCam.json in the SKSE/Plugins folder and setting 'enableCrashDumps' to true may let the mod generate a crash dump I can look at. Installing .NET Script Framework may also generate a crash log. I don't officially support linux so without a crash dump/log I can only guess as to the issue.

ZephaniahNoah commented 2 years ago

It wrote the dump and a popup opened. I clicked OK and it created another dump and repeated the process again. It just keeps creating dumps. Here's the first dump: SmoothCam_AppCrash.mdmp.zip

Quick note, I had to use a custom SKSE64 because the official SKSE64 doesn't work properly on Linux. I got it from the description of this video.

mwilsnd commented 2 years ago

Looks like a DirectX issue, it failed to read the swapchain and render device objects but the guard code that tries to prevent d3d object creation in such cases failed to work correctly. Ended up crashing while trying to create d3d objects for the crosshair.

This is either caused by kMessage_PreLoadGame from SKSE not firing correctly before kMessage_PostLoadGame, or a broken SEH implementation which is used to guard failures in the DirectX hook (which will then prevent d3d object creation in such failures, if working correctly).

Do you see "Hooking D3D11" in the SmoothCam log file, with "Creating the camera" following it later on? If so and there are no failure messages related to DXGI, then it sounds like SEH is broken.

I can add an extra sanity check later on during initialization for this issue, but it is strange that with null swapchain and device/context pointers it still tried to create d3d objects, that shouldn't be possible. A further curiosity is why the DirectX hook failed in the first place, probably caused by the wrapper interface around vulkan if I had to guess.

ZephaniahNoah commented 2 years ago

It likely is a DXVK issue. Here's what the console says before the game crashes:

Hooking render shutdown method

Hooking D3D11

Looking for compatible mods

ImprovedCamera.dll beta 1.0.0.4 not found, running without compatibility.
Creating the camera
mwilsnd commented 2 years ago

So then either the hook is failing and SEH is broken preventing the guard code from preventing crashes, or the hook is working and the dump file is just missing information. If the latter, the issue would be related to vertex buffer creation when it makes an input assembler layout. At this point I don't think the hook is failing and seems more likely to be a DXVK issue (I see it creating constant buffer objects before the crash). The crash dump is missing a lot of data I'd usually get but the wine implementation appears to give very basic information so I can't be 100% sure.

I don't have many ideas, other than try different versions of proton/wine/DXVK and see what happens. To really understand the crash I'd have to mirror your system configuration and I don't have the hardware or time to do that currently.

ZephaniahNoah commented 2 years ago

That's alright. I don't expect you to go through the trouble of running it on Linux. I appreciate your help thus far. It does create multiple SmoothCam_AppCrash dumps each time I click OK on the, "SmoothCam: Skyrim has crashed!" window. And it opens a new window when I click OK. Each dump is different. Perhaps that has something to do with the missing data/information.

ZephaniahNoah commented 2 years ago

Do you think I should add a new issue to the DXVK issue tracker?

mwilsnd commented 2 years ago

At this time I don't think so, there isn't enough information for anyone to go off of. All I know is it creates constant buffers without issue, then crashes creating a vertex buffer. Perhaps the shader compiler is giving bad output, or something deeper in DXVK is going wrong - hard to say. The issue would need to be pinpointed to ensure it isn't an error on my part and then reduced to a minimum viable reproduction of the problem so that DXVK devs can easily compile and debug the problem.

As for the message box creating multiple crash dumps - it seems the fatal app exit method I use is implemented differently in wine/proton as well which causes that. Only 1 dump file should be created and then the game should close after the message box is dismissed. The other dumps created are likely irrelevant and can be ignored. The app exit method likely throws an exception to close the program under wine/proton, which my crash handler sees and figures is another crash, getting stuck in a loop.

ppk-gh commented 2 years ago

@ZephaniahNoah You could do this with winetricks or manually but I recommend protontricks. For smoothcam and a few other mods that hook into camera functions (ex.: Alternate Conversation Camera) you need an override for d3dcompiler_47.dll

Once you install protontricks just open a terminal and do protontricks 489830 d3dcompiler_47.dll.

ZephaniahNoah commented 2 years ago

Unknown arg d3dcompiler_47.dll Protontricks 1.6.1 EDIT: wtf, it uninstalled steam

ppk-gh commented 2 years ago

It can't uninstall steam, if you pass it an invalid argument it just won't do anything. My bad though, I added the .dll out of muscle memory, try omitting it.

ZephaniahNoah commented 2 years ago

I have no idea why steam was missing. But the command executed. However, Skyrim still crashes. Uninstalling SmoothCam didn't bring things back to normal. I had to remove the d3dcompiler_47 override to stop Skyrim from crashing. Thanks for trying though. :)

BanchouBoo commented 2 years ago

@ppk-gh installing d3dcompiler_47 fixed it for me, thanks!

I thought I'd already tried this but apparently not.

ZephaniahNoah commented 2 years ago

I set this in my Skyrim launch options and it worked! WINEDLLOVERRIDES="d3dcompiler_47" %command% Combined with the audio fix: WINEDLLOVERRIDES="xaudio2_7=n,b;d3dcompiler_47" PULSE_LATENCY_MSEC=90 %command%

mwilsnd commented 2 years ago

Happy to see this get solved! I'll have to add this information to the FAQ when the Skyrim AE update comes out and I'm able to publish a compatible version. Until then, I'll keep this open for anyone else experiencing this issue.