ositools icon indicating copy to clipboard operation
ositools copied to clipboard

[Linux] DLL does not seem to be loaded with Proton

Open keraldi opened this issue 4 years ago • 31 comments

It seems that when playing D:OS2 on Linux via Proton on Steam, the DLL is not being loaded.

Using Proton, the game is launched via EoCApp.exe after applying the following workaround:

mv ./bin ./bin.bak && ln -s DefEd/bin bin && cd bin && mv ./SupportTool.exe ./SupportTool.bak && ln -s EoCApp.exe SupportTool.exe

(create a backup of folder 'bin', make a symlink 'bin' that points to 'DefEd/bin', change directory to 'bin', create backup of file 'SupportTool.exe', make a symlink 'SupportTool.exe' that points to 'EoCApp.exe')

Essentially launching 'EoCApp.exe' directly via Steam. Mods subscribed to in the Steam workshop show up normally in the game. Mods that require ositools cause an error that the story could not be created. Mods that do not require ositools work fine.

Linux version: openSUSE Tumbleweed x86_64 running Kernel 5.5.7-1-vanilla. Proton version: Proton 5.0-4 Game version: v3.6.58.1306

If any further information or help is required, I'll try to assist to the best of my abilities.

keraldi avatar Mar 20 '20 21:03 keraldi

The DLL looks for the main exe using GetModuleHandleW(L"EoCApp.exe") and GetModuleHandleW(L"DivinityEngine2.exe"), to ensure that it doesn't get loaded for other apps that run from the bin directory (like ReCon, SFG compiler, launcher, etc.).

Since your EoCApp.exe is not EoCApp.exe anymore, the DLL may load but it won't do anything.

Norbyte avatar Mar 21 '20 14:03 Norbyte

I tried starting EoCApp.exe directly by setting the game's launch options to "/home/tobias/.local/share/Steam/steamapps/common/Divinity Original Sin 2/DefEd/EoCApp.exe"; %command% > /dev/null

(launches original EoCApp.exe, sends Steam's original launch command to /dev/null, once the game exits)

I did it like that since creating a custom launcher for D:OS2 doesn't work. The game launches normally, the DLL seems to not work still.

I would be grateful if you could send me a resource to try to compile it myself, that's what I would look into next. I'll also search for wine/proton specific information about loading DLLs like that.

If possible, I'd like to try the DLL without the GetModuleHandleW(L"*") restriction if you could provide it for me to test.

keraldi avatar Mar 21 '20 16:03 keraldi

DXGI-Spec.zip

I've built a launcher version that always loads independently of filename (see above).

Norbyte avatar Mar 26 '20 18:03 Norbyte

Doesn't seem to work still, neither with the workaround, nor with launching EoCApp.exe directly. Here's the proton log of launching it with the workaround, it has a couple occurrences of DXGI but I don't know whether they're important.

steam-435150.log

keraldi avatar Mar 26 '20 18:03 keraldi

DXGI-Spec2.zip

This one has a debug console, can you check its output?

Norbyte avatar Mar 26 '20 19:03 Norbyte

If the console is supposed to appear in game, it didn't. Are there any other logs I should look out for? Here's the proton log with DXGI-Spec, DXGI-Spec2 and a diff view of the logs.

steam-435150.log steam-435150.debug_console.log steam-435150.diff.log

keraldi avatar Mar 26 '20 22:03 keraldi

I'm also having the same issues I'll post a log based off Spec2 and there was nothing that appeared in game and I also created a .json like an older issue you had but I don't see the console anywhere. I tried checking for any new type of files it might've created as well but didn't find any in /steam or /DSO2 and below

steam-435150.log

Zerraphous avatar Apr 01 '20 19:04 Zerraphous

Launching via the bink2w64.dll wrapper included in "Achievements -Definitive Edition" loads the DLL and launches with the Debug console on the desktop. The debug console logs a (probably unrelated) message "Unable to read VR Path Registry from ... Local Settings\Application Data\orpenvr\openvrpaths.vrpath", but seemingly continues to load, then tries to update OsirisExtender.

Updating OsirisExtender fails after successfully downloading the Update.zip file with a popup dialog "Unable to extract Script Extender update package. IShellDispatch::NameSpace() call failed on zip file ...\Update.zip"

Enabling trace on shell and seh results in the following log (exception occurs around line 15,000)

steam-435150.fail.log

chicken42 avatar Apr 20 '20 22:04 chicken42

Interesting ... looks like shell32 in Proton doesn't support reading Zip files as COM Folders, so it is unable to extract the zip. You can bypass the update step by extracting Update.zip directly to the folder it is located in (i.e. Local Settings\Application Data\OsirisExtender\).

Norbyte avatar Apr 21 '20 15:04 Norbyte

After the manual extraction, everything appears to be working correctly. The DLL loading failure is probably due to Proton's DXVK overriding of DXGI.dll (in addition to the main exec check). It looks like the proton developers may be working on the DXGI issue: https://github.com/ValveSoftware/Proton/issues/2992 .

chicken42 avatar Apr 21 '20 22:04 chicken42

Looks like I'll bake a Zip library into the updater in newer versions, as there are too many issues with the shell API, i.e. it sometimes decides not to work even on Windows if people installed something that happens to interfere with it.

Not sure what can be done about DXGI.dll having a special override in Proton. I don't want to use any filename that ships with the game as game updates will wipe the extender entirely, and the other DLLs that the game imports have way too many exports so wrapping each one of them is not an option. I could add a launcher exe that injects the extender into the game, but then you'd have to use a separate launcher instead of just using the game exe.

Norbyte avatar Apr 23 '20 06:04 Norbyte

If it is not too much work for you, injecting it would probably the most quality of life solution for the end user. Alternatively, I'd suggest a step by step for linux users by those who made it work would be more appropriate as a native solution is not possible anyways.

keraldi avatar Apr 23 '20 08:04 keraldi

If there is an LD_PRELOAD equivalent in Wine/Proton that would also be helpful

Norbyte avatar Apr 23 '20 08:04 Norbyte

I don't know about that but any command can be executed before the game is launched through Steam launch options. So if environmental variables need to be set, all that could be done via a script that is launched beforehand. But my Linux knowledge (and Proton, especially) is lacking severely.

keraldi avatar Apr 23 '20 08:04 keraldi

The closest there is to LD_PRELOAD would be WINEDLLOVERRIDES but that doesn't really help here.

Marenz avatar Apr 23 '20 08:04 Marenz

Does launching the game exe directly work with Proton? i.e. does it redirect you to the Steam launcher or does it work without involving Steam? If it doesn't work directly, then launching via a custom injector could be similarly problematic.

Norbyte avatar Apr 26 '20 19:04 Norbyte

The way to launch it suggested i ProtonDB is the one I described with replacing SupportTool.exe with EoCApp.exe. As on linux, a shell script is executed when launching a game, any other executable can be launched simply by pointing at the executable that should be launched and discarding the original command.

To answer your question: Proton is used automatically by Steam to launch windows executables. Launching EoCApp.exe with WINE (not using Steam's Proton (which is a modified WINE), the game launches as well.

Although people would have to add some things to WINE themselves (patches that are in Proton), otherwise it's not playable on its own (because it doesn't utilize DXVK/Vulkan, for example, resulting in atrocious performance).

keraldi avatar Apr 26 '20 21:04 keraldi

Stumbled upon this thread trying to install the Script Extender on Proton, curious if there has been an update or if anyone has figured out any steps to get it installed?

EDIT - WORKING Steps to set up, in order:

  1. Get zip from github and place DLL in /DefED/bin
  2. Use winetricks or protontricks to add a DLL overwrite
  3. Select "dxgi" with the source as "native"
  4. First run will give the "Could not unzip Update.ZIP" error. Go to the folder, extract the individual files within the Update folder into /Application Data/OsirisExtender

lo4952 avatar May 14 '20 02:05 lo4952

while override dxgi to native does work, it causes game to routinely crash (there are reasons wine has its own dxgi.dll). Norbyte, can you make an injector or alternate dll hook? (like bink2w64 for example)?

Hark0nnen avatar Jun 16 '20 08:06 Hark0nnen

Thanks @lo4952 for the steps. I had to do native,builtin for dxgi, as 'native only' failed to start the game. Plus side is, after doing the unzipping manually it works!

ngoonee avatar Jun 19 '20 09:06 ngoonee

i did everything as instructed. However, i did not find a Update.ZIP folder in Local Settings/Application Data. Is there anyway to fix or get around this?

longmind avatar Jul 29 '20 14:07 longmind

You can get it from https://d1ov7wr93ghrd7.cloudfront.net/Release/Latest.zip

Norbyte avatar Jul 30 '20 15:07 Norbyte

I'm not sure if I'm doing it wrong but following the above steps stopped the game from even running for me (both native and native,builtin) I would also be interested in Linux compatibility for this tool if possible. Is there anything that we can do to help, beyond just testing?

caysilou avatar Aug 07 '20 19:08 caysilou

I rewrote quite a bit of the updater which should resolve some compatibility issues. In particular, it no longer uses WinHTTP or the Shell API for Zip extraction, so it should work properly under Wine now.

Test version: DXGI-curltest.zip

Norbyte avatar Aug 18 '20 16:08 Norbyte

So, I came here to write a new issue ticket asking Norbyte to tell Proton users in the release notes how to make this work using WINE, because it's really easy.

All you need to do is launch WINE/Proton using WINEDLLOVERRIDES="DXGI.dll=n,b" after following the other install instructions.

So, for Steam+Proton,

  1. Right-click the game in the games library in Steam
  2. Click Properties...
  3. Click SET LAUNCH OPTIONS... button
  4. Enter WINEDLLOVERRIDES="DXGI.dll=n,b" PROTON_NO_ESYNC=1 %command%

Close and launch, enjoy script-extended mods.

folknor avatar Sep 01 '20 15:09 folknor

Thanks for the info, I've amended the instructions on the release list

Norbyte avatar Sep 01 '20 19:09 Norbyte

@folknor I have done as you said, but it still cannot seem to load the dll successfully.

otakutyrant avatar Sep 17 '20 07:09 otakutyrant

@folknor Could you clarify "the other install instructions" more clear please? Are they just only mv ./bin ./bin.bak && ln -s DefEd/bin bin && cd bin && mv ./SupportTool.exe ./SupportTool.bak && ln -s EoCApp.exe SupportTool.exe?

otakutyrant avatar Sep 17 '20 08:09 otakutyrant

I have found out that actually I pasted the command WINEDLLOVERRIDES="DXGI.dll=n,b" PROTON_NO_ESYNC=1 %command% in the launch option for two times, because after the first paste, the launch option still seems empty, showing only the end of the paste actually, so I had to paste again, resulted in an invalid launch option. After fixing this, the extended script finally works!

otakutyrant avatar Sep 17 '20 09:09 otakutyrant

Thanks for this. Using WINEDLLOVERRIDES="DXGI.dll=n,b" %command% is enough with Proton-5.9-GE-8-ST. Confirmed I got achievements with several Gift Bag features enabled.

(Proton GE also has a built-in launch fix so none of the other steps with the moving and linking files are needed. Just install, choose Proton version, add the launch option and done.)

jn64 avatar Dec 31 '20 16:12 jn64