eterniti / xv2patcher

A dll that patches Xenoverse 2 to improve modding functionalities
12 stars 5 forks source link

DLL Does not load on Steam Deck via Proton #1

Open DebugDax opened 2 years ago

DebugDax commented 2 years ago

Hello,

When attempting to use xv2patcher 3.711 with either the xinput1_3.dll or dinput8.dll on a Steam Deck, the game loads as normal without the patcher string at the bottom right of the title screen. The patch never injects even though it's running through the Proton environment as a Windows executable.

I see in main.cpp there's a lot of print statements, so if there's a way to get those logged/shown I can submit a log to help. But I also notice the Epatches have hard coded addresses that may be different now with the executable being ran through Proton?

Is it possible to get this patcher functioning through Proton so that installed x2m mods can be loaded? I can assist with any debugging you may need to proceed with.

Thanks.

eterniti commented 2 years ago

Don't worry about the Epatches. Those relative addresses from the .exe shouldn't be different in Windows or Proton, regardless of wether they use ASLR or not. (Besides that, the patcher actually searches the patches, those addresses are only the starting point of search).

If the DLL run at all, there should be a file called "xv2_log.txt" inside the XV2PATCHER directory, with log information. If there isn't, then the most likely cause is that Proton didn't even load the .dll, e.g, it loaded its own version of xinput.dll (maybe a native version of it) and ignored the one of the patcher. The xv2patcher dll work under the premise that Windows give priority to the dll next to the .exe than the ones in System32, but I don't know if Proton ignores that.

DebugDax commented 2 years ago

If the DLL run at all, there should be a file called "xv2_log.txt" inside the XV2PATCHER directory

I don't think 3.711 has logging enabled? Even on my Windows machine where the patcher does work, there is no log file present in /XV2PATCHER/ yet it loads the game patched.

--

I did have success though! I followed this comment and I can get the patcher to load now: https://www.reddit.com/r/SatisfactoryGame/comments/izomcx/anyone_else_playing_this_on_linux/g6kgahj/ Adding WINEDLLOVERRIDES="xinput1_3.dll=n,b" %command% to the game launch properties.

But the controls do not work in-game when overriding the DLL.

I replaced xinput1_3.dll with dinput8.dll and now it works loading the patches and input!

So to anyone with future issues getting this utility to run on a Steam Deck, you just need to modify your game's launch command and make sure to use dinput8.dll and not xinput.

eterniti commented 2 years ago

Debug is enabled by default. It is controlled by .ini variable General:default_log_level, which should be set to 2 in default .ini file. If there is no log file in XV2PATCHER, maybe there is no writing permissions on that folder.

At first sight of the wine code, it looks like it is missing some functions that are present in the Microsoft dll (I guess the undocumented functions). It is possible that this is making the function "load_dll" exit ahead of time, leaving some functions redirected to the wine xinput dll, and some not. I guess that if I reorder the functions in such a way that I put first all the ones that are common in Windows and Wine, it may work.

Something that may worth at least try is the following: grab a xinput1_3.dll from a real windows (it should be in System32 directory) and put it next to the patcher dll with the name "xinput_other.dll". If that file is present, the patcher would load that instead of the System32 one (this feature was added so that some controller apps could work together with the patcher). Now the question is wether the original Windows dll can work in Wine or not.

eterniti commented 2 years ago

I've commited some code to check if the patcher is running under Wine, and ignore the error of missing functions so that the redirect functions loop can continue. It's untested and unknown if it will solve the problem.

I attach the binary. xinput1_3.zip