cursey / reframework-d2d

An REFramework plugin that adds Direct2D scripting APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Linux] Crash on Startup

DeadKper opened this issue · comments

Got reframework working but can't find a way to make reframework d2d work, I'm using Proton Experimental and dinput8 override, manually installed vcrun 2017 and dotnet 4.8 in case any of those made a difference, don't know how to generate log files but I'm glad to help with everything I can, that is if you want to support linux

The log should be called re2_framework_log.txt in the game directory. I wouldn't be surprised if the technology this plugin relies on isn't well supported by proton since it's not regularly used in games. I'll look into it if you post the log however.

re2_framework_log.txt
Sure, sorry for the wait, was a little busy

If you could also upload reframework_crash.dmp that would be helpful.

reframework_crash.zip
Didn't let me upload the file so I zipped it

So that dump isn't as helpful as I was hoping it would be. I can't get WinDbg to find the correct symbols for any of the faulting modules. I have to assume it's because they are provided via proton and not actual official Windows modules. This may be able to be addressed in the future if we change REFramework to do a full dump (but the resulting .dmp file would be gigabytes large), until then I can't really analyze the cause.

I'm leaving this issue open so other people can be made aware it. If someone has the setup to debug the issue on Linux maybe they can take a look at it.

The crash is caused by DXVK not implementing D3D11On12CreateDevice (and by that I mean d3d11.dll doesn't even export this function so any attempt to call it causes it to explode). A patch like this fixes that crash:

diff --git a/src/d3d11/d3d11.def b/src/d3d11/d3d11.def
index 8b65655a..d406ba0b 100644
--- a/src/d3d11/d3d11.def
+++ b/src/d3d11/d3d11.def
@@ -3,3 +3,4 @@ EXPORTS
     D3D11CoreCreateDevice @18
     D3D11CreateDevice @22
     D3D11CreateDeviceAndSwapChain @23
+    D3D11On12CreateDevice @24
diff --git a/src/d3d11/d3d11_main.cpp b/src/d3d11/d3d11_main.cpp
index d3f6e0c8..d80d5dec 100644
--- a/src/d3d11/d3d11_main.cpp
+++ b/src/d3d11/d3d11_main.cpp
@@ -242,4 +242,24 @@ extern "C" {
       ppDevice, pFeatureLevel, ppImmediateContext);
   }
   
+
+  DLLEXPORT HRESULT __stdcall D3D11On12CreateDevice(
+          IUnknown*             pDevice,
+          UINT                  Flags,
+    const D3D_FEATURE_LEVEL*    pFeatureLevels,
+          UINT                  FeatureLevels,
+          IUnknown* const*      ppCommandQueues,
+          UINT                  NumQueues,
+          UINT                  NodeMask,
+          ID3D11Device**        ppDevice,
+          ID3D11DeviceContext** ppImmediateContext,
+          D3D_FEATURE_LEVEL*    pChosenFeatureLevel) {
+    static bool s_errorShown = false;
+
+    if (!std::exchange(s_errorShown, true))
+      Logger::err("D3D11On12CreateDevice: Not implemented");
+
+    return E_NOTIMPL;
+  }
+
 }
\ No newline at end of file

Though even with that patch applied this plugin won't be able to draw anything. I asked Philip on Discord about this and he said that there's no chance for D3D11On12 stuff to ever work properly (unless DXVK undergoes a major redesign, that is).

The crash is caused by DXVK not implementing D3D11On12CreateDevice

I figured that was the case. I didn't think whatever technology proton was using to implement Direct3D would bother implementing this since it's unusual for games to use it. Thanks for the confirmation.

Don't know if it helps but there is a mod that actually works in linux and changes the interface, maybe the code is completly different but just in case, the name is "MHR User Interface Plus Plus" in modnexus

Don't know if it helps but there is a mod that actually works in linux and changes the interface, maybe the code is completly different but just in case, the name is "MHR User Interface Plus Plus" in modnexus

That mod doesn't appear to be using this plugin.

That was the point, maybe the way they draw can help to change how this plugin draws in order for it to work but I don't really think it can help, it was more of a just in case

That was the point, maybe the way they draw can help to change how this plugin draws in order for it to work but I don't really think it can help, it was more of a just in case

I wrote the draw functions built into REFramework that the mod you referenced is using😛This plugin just uses an entirely different technology than what is built into REFramework. It's one of the reasons I made this a plugin instead of building it in.

I may be able to have the plugin fallback to using the builtin REFramework drawing API if there is a problem though, I'll have to give that some thought.

commented

Tested on Proton Experimental - plugin no longer crashes the game, but doesn't really seem to work otherwise - the REFramework D2D script generated UI section has no items,, the monster HP bar plugin I have does not render anything, there was a json file generated but it only contains a null. No errors in the logs as far as I can tell.

Latest git revisions of DXVK and vkd3d-proton now support D3D11On12CreateDevice so it's now possible to use reframework-d2d plugin in Wine. However, Proton 7.0 and current Experimental have a bit outdated version of d2d1 that does not support ID2D1Factory3 yet so for now it's necessary to copy/build d2d1.dll from upstream Wine and replace the one in Proton …/files/lib64/wine/x86_64-windows/d2d1.dll.

Otherwise, this now works if you don't mind rather high CPU overhead from Wine's font rendering spending a lot of time in native libfreetype.so.

commented

I'm using the latest Experimental Proton and D2D seems to run fine now.

Can also confirm, latest experimental allows D2D to work, tried on 8.0.1 and some other versions, seems this is the only working version for proton right now.
But it seems the coavins meter i use displays and the menu option for D2D isn't empty. Likely means other mods dependent on this are probably also functional then.

(but as a note the latest experimental doesn't seem to allow the game to exit gracefully and i have to forcekill it in steam after).

Proton 8 seems to work now, but both it and experimental seem to crash from time to time. I don't get the crashes/lockups when i remove the entire reframework, but i don't know if d2d or reframework is at fault here; and its semi-difficult to test as the only mod i use wants me to use d2d.

Edit: This might be a d2d issue still. I'll probably post again if I manage to cause another crash. But currently i can't seem to reproduce the issue if i remove d2d and the d2d script from the coavins meter.

I'm thinking this is a d2d issue, attaching the log file, i haven't been able to get a crash in about 4 different hour+ long sessions. So while it will initially load up, i get the feeling something is still not fully compatible here.
re2_framework_log.txt

line 93041 it starts running some reframework-d2d lua script. Adds hooks, saves the configuration, and then throws an exception and starts crashing. This is apparently still functional on other people's systems running windows, which leads me to believe something going on here with d2d is causing an issue.
Deleting the d2d lua and the dll causes it to run fine (as coavins can run without it)

I got a call stack on this. I don't know the code well enough but going to include it here anyway in case someone has some more knowledge on what causes it. The exception code itself is 0xc05 which is an access violation error.

[2023-08-16 16:34:27.541] [REFramework] [error] Exception occurred: c0000005
[2023-08-16 16:34:27.541] [REFramework] [error] RIP: 144c5b517
[2023-08-16 16:34:27.541] [REFramework] [error] RSP: 7777f2e0
[2023-08-16 16:34:27.541] [REFramework] [error] RCX: 0
[2023-08-16 16:34:27.541] [REFramework] [error] RDX: 0
[2023-08-16 16:34:27.541] [REFramework] [error] R8: 118
[2023-08-16 16:34:27.541] [REFramework] [error] R9: 2c392620
[2023-08-16 16:34:27.541] [REFramework] [error] R10: 1c2e4d01
[2023-08-16 16:34:27.541] [REFramework] [error] R11: 45dcfb10
[2023-08-16 16:34:27.541] [REFramework] [error] R12: 244
[2023-08-16 16:34:27.541] [REFramework] [error] R13: 326c5a20
[2023-08-16 16:34:27.541] [REFramework] [error] R14: 1
[2023-08-16 16:34:27.541] [REFramework] [error] R15: 45dcb770
[2023-08-16 16:34:27.541] [REFramework] [error] RAX: 2c392620
[2023-08-16 16:34:27.541] [REFramework] [error] RBX: 326c5a20
[2023-08-16 16:34:27.541] [REFramework] [error] RBP: d
[2023-08-16 16:34:27.541] [REFramework] [error] RSI: 800
[2023-08-16 16:34:27.541] [REFramework] [error] RDI: a0
[2023-08-16 16:34:27.541] [REFramework] [error] EFLAGS: 10206
[2023-08-16 16:34:27.541] [REFramework] [error] CS: 33
[2023-08-16 16:34:27.541] [REFramework] [error] DS: 2b
[2023-08-16 16:34:27.541] [REFramework] [error] ES: 0
[2023-08-16 16:34:27.541] [REFramework] [error] FS: 0
[2023-08-16 16:34:27.541] [REFramework] [error] GS: 0
[2023-08-16 16:34:27.541] [REFramework] [error] SS: 2b
[2023-08-16 16:34:28.044] [REFramework] [info] Windows message hook is still intact, ignoring...
[2023-08-16 16:34:29.268] [REFramework] [error] Call stack:
[2023-08-16 16:34:29.271] [REFramework] [error] 
 Unknown symbol
  0x83dd7a

 Unknown symbol
  0x83f439

 Unknown symbol
  C:\windows\system32\kernelbase.dll + 0x666a9

 Unknown symbol
  C:\windows\system32\ntdll.dll + 0x42c36

 Unknown symbol
  C:\windows\system32\ntdll.dll + 0x429c8

 Unknown symbol
  C:\windows\system32\ntdll.dll + 0xef74

 Unknown symbol
  C:\windows\system32\ntdll.dll + 0x425bc

 Unknown symbol
  C:\windows\system32\ntdll.dll + 0x44de9

 Unknown symbol
  C:\windows\system32\ntdll.dll + 0xefce

 Unknown symbol
  Z:\home\alexandra\.local\share\Steam\steamapps\common\MonsterHunterRise\MonsterHunterRise.exe + 0x4c5b517

 Unknown symbol
  Z:\home\alexandra\.local\share\Steam\steamapps\common\MonsterHunterRise\MonsterHunterRise.exe + 0x4c5ea43

 Unknown symbol
  Z:\home\alexandra\.local\share\Steam\steamapps\common\MonsterHunterRise\MonsterHunterRise.exe + 0x4b1841d

 Unknown symbol
  Z:\home\alexandra\.local\share\Steam\steamapps\common\MonsterHunterRise\MonsterHunterRise.exe + 0x4b1528a

 Unknown symbol
  Z:\home\alexandra\.local\share\Steam\steamapps\common\MonsterHunterRise\MonsterHunterRise.exe + 0x4222219

 Unknown symbol
  Z:\home\alexandra\.local\share\Steam\steamapps\common\MonsterHunterRise\MonsterHunterRise.exe + 0x42226eb

 Unknown symbol
  Z:\home\alexandra\.local\share\Steam\steamapps\common\MonsterHunterRise\MonsterHunterRise.exe + 0x42eb295

 Unknown symbol
  C:\windows\system32\kernel32.dll + 0x1469d

 Unknown symbol
  C:\windows\system32\ntdll.dll + 0xf1a7

 Unknown symbol
  Z:\home\alexandra\.local\share\Steam\steamapps\common\MonsterHunterRise\MonsterHunterRise.exe + 0xfffffffec0000000