ishitatsuyuki / LatencyFleX

Vendor agnostic latency reduction middleware. An alternative to NVIDIA Reflex.
Apache License 2.0
797 stars 20 forks source link

Unity Mod/Hook fail with "System.EntryPointNotFoundException: winelfx_WaitAndBeginFrame" when launching the game from Steam #36

Closed Fijxu closed 1 year ago

Fijxu commented 1 year ago

When i setup LatencyFlex for Unity games and start them from Steam this error appears in the Bepinex output (from the LogOutput.log file in the Bepinex folder):

...
[Info   :   BepInEx] 1 plugin to load
[Info   :   BepInEx] Loading [LatencyFleX 1.0.0]
[Info   :LatencyFleX] Direct DLL load failed: trying wine bridge
[Error  :   BepInEx] Error loading [LatencyFleX 1.0.0]: System.EntryPointNotFoundException: winelfx_WaitAndBeginFrame
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal.Prelink(System.Reflection.MethodInfo)
  at LatencyFleX.Plugin.Run () [0x00043] in <b63a64aa56334f3d866cedb38365850d>:0 
  at LatencyFleX.Il2CppPlugin.Load () [0x0000b] in <b63a64aa56334f3d866cedb38365850d>:0 
  at BepInEx.IL2CPP.IL2CPPChainloader.LoadPlugin (BepInEx.PluginInfo pluginInfo, System.Reflection.Assembly pluginAssembly) [0x00011] in <e9997477cd8143c9a348224def0a337e>:0 
  at BepInEx.Bootstrap.BaseChainloader`1[TPlugin].LoadPlugins (System.Collections.Generic.IList`1[T] plugins) [0x0025c] in <16694cdb03bf4887828a298c286d045b>:0 
[Message:   BepInEx] Chainloader startup complete

Games tested:

The error is always almost the same, with System.EntryPointNotFoundException: winelfx_WaitAndBeginFrame on it

As i said, this only happens when launching the game from Steam. But if i launch the game maually (using the command WINEDLLOVERRIDES="winhttp=n,b" LFX=1 proton <gameexecutable.exe> in a command line prompt) it loads without any problems and the output is:

...
[Info   :   BepInEx] 1 plugin to load
[Info   :   BepInEx] Loading [LatencyFleX 1.0.0]
[Info   :Unhollower] Registered mono type LatencyFleX.Plugin+LfxBeforeLoopInit in il2cpp domain
[Info   :LatencyFleX] Plugin LatencyFleX is loaded!
[Message:   BepInEx] Chainloader startup complete

Thing that i checked:

ishitatsuyuki commented 1 year ago

Please do not inject code into anti-cheat enabled games (NVAPI is an exception as it's not injection). This will get you banned.

Could you try direct copy instead of symlinks? Symlinks can have issues when the Steam Container Runtime is used.

Fijxu commented 1 year ago

Could you try direct copy instead of symlinks? Symlinks can have issues when the Steam Container Runtime is used.

Oh yeah i have to note that i copied the files and i didn't symlink them because the DLL doesn't load as you said, sorry about that.

Fijxu commented 1 year ago

I disabled Steam Container Runtime using SteamTinkerLaunch, now it loads the LatencyFlex plugin without any problems.

But this is still an issue. If it can't be solved and the only workaround is disabling the Steam Container Runtime then feel free to close it.

ishitatsuyuki commented 1 year ago

Yeah I think the hiccups with container runtime is pretty much a limitation of this bridge approach. For the in-development LFX2 I've opted for PE binaries only which should suffer less from all this dynamic library ABI and containerization problem.