michael-fadely / sadx-dc-lighting

Sonic Adventure 1 palette lighting for SADX PC.
MIT License
39 stars 3 forks source link

Can't find d3d8.dll on Steam Play (Linux) #79

Closed AlexOxorn closed 3 years ago

AlexOxorn commented 3 years ago

Playing on Linux

Before I describe the bug, I want to start by saying that I'm playing SADX on Linux using Steam Proton. (Steam's Specialized version of Wine, optimized for gaming + DirectX translation layer) To that end, I understand that this might not be fixable considering how many layers of Windows Steam would have to go through, but I would still like your input if possible

Encountered behavior

There are sort of two bugs... kind of: First Issue) When trying to run SADX from steam, before it starts I get the error message

SADX Lantern Engine will not function without d3d8to9 saved to your Sonic Adventure DX folder. Download d3d8.dll from from https://github.com/crosire/d3d8to9 Lantern Engine Error: Missing d3d8.dll

And when I went to github to find the file and add it to the folder, I noticed that I had a d3d8.dll I decided to replace it, yet I still get the same error

Second issue) For the most part, after that error message, the game runs fine, seeming like it's not using the engine. HOWEVER, if this and the Dreamcast Conversion Mod are enabled, upon entering Casino Night (update: and pre Egg Viper cutscene), the game crashes. The level works fine with only one or the other (keeping in mind that the lighting mod isn't even working for me right now)

Expected behavior

To... uh, see the d3d8.dll that's right there Also to not crash Casino Night

Installed mods

Screenshot from 2021-05-31 21-26-51

Steps to reproduce:

  1. Get a Debian Installation of Steam (It was a pain in the ass when I did it, and I don't remember how I got it to work in the end)
  2. Get SADX on Linux Steam
  3. Run PkR's Mod installer in offline mode (wine didn't seem to want to work with the internet I guess)
  4. Set directory as "{HOME}/.steam/debian-installation/steamapps/common/Sonic Adventure DX" ("Z:{HOME}.steam\debian-installation\steamapps\common\Sonic Adventure DX" on the wine gui)
  5. Apply Lantern Engine Mod
  6. Start the game via Steam
  7. (optionally go to Casino Night with DC Conversion Mod)

Linux... Stuff

I took some liberty to do (admittedly mild) poking around for information that you might find useful First, using this as the launch options: echo "%command%" > ~/sadx_exec.txt

I was able to figure out that this was the command used to start SADX from Steam

'/home/alexoxorn/.steam/debian-installation/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/alexoxorn/.steam/debian-installation/steamapps/common/Proton 6.3'/proton waitforexitandrun  '/home/alexoxorn/.steam/debian-installation/steamapps/common/Sonic Adventure DX/AppLauncher.exe' -bootgame

In addition, some of the folders thing are found in aren't consistent. For example, the Game Files are located at:

{HOME}/.steam/debian-installation/steamapps/common/Sonic Adventure DX

While the Steam Save data is saved in:

{HOME}/.steam/debian-installation/steamapps/compatdata/71250/pfx/drive_c/users/steamuser/My Documents/SEGA/Sonic Adventure DX

If you are able to help, or otherwise have questions for me, or want me to try something, let me know. Thank you for your time.

michael-fadely commented 3 years ago

The error message is a little misleading. The code that detects d3d8to9 works by detecting that d3d9.dll has been loaded, as seen here: https://github.com/michael-fadely/sadx-dc-lighting/blob/master/sadx-dc-lighting/mod.cpp#L482-L492 - there's no actual filesystem detection going on.

This works on native Windows because:

In the case of Proton, I could imagine d3d8to9's d3d8.dll actually might not be getting loaded at all, and if it is, there could be some dxvk trickery going on. This is ultimately what I would need to know in order to resolve the issue.

HOWEVER, if this and the Dreamcast Conversion Mod are enabled, upon entering Casino Night (update: and pre Egg Viper cutscene), the game crashes.

This is likely because Dreamcast Conversion is attempting to use Lantern Engine APIs. Lantern Engine doesn't have a way to communicate to other mods that initialization failed. The only thing other mods can do is check that Lantern Engine is loaded (which it still is in this scenario).

AlexOxorn commented 3 years ago

That's really interesting thank you.

In the case of Proton, I could imagine d3d8to9's d3d8.dll actually might not be getting loaded at all, and if it is, there could be some dxvk trickery going on. This is ultimately what I would need to know in order to resolve the issue.

Is there anything I can do to help with this? I want to help make things as Linux Compatible as Possible

michael-fadely commented 3 years ago

Since Proton is Wine derived, I would imagine it shares the ability to prefer native DLLs over built-in DLLs. I haven't used Wine in a long time though, and I haven't really poked around with Proton, so I'm not sure this is the case. But maybe you can get it working with d3d8to9's d3d8.dll.

AlexOxorn commented 3 years ago

I looked into that and found the environment variable WINEDLLOVERRIDES So i set the launch command to WINEDLLOVERRIDES="d3d8.dll=n,b" %command% which tells wine to prefer the native d3d8.dll over a builtin. This does cause the game to launch without the "can't find d3d8.dll" message, so that's good. However, upon launching, the screen just displays a white background and freezes. :")

LidiaRock1 commented 3 years ago

i set the launch command to WINEDLLOVERRIDES="d3d8.dll=n,b" %command% which tells wine to prefer the native d3d8.dll over a builtin. This does cause the game to launch without the "can't find d3d8.dll" message, so that's good. However, upon launching, the screen just displays a white background and freezes.

you need to change the Proton version, i tried with Proton-6.9-GE-1 and its working, maybe it works with the latest version of Proton GE too

AlexOxorn commented 3 years ago

you need to change the Proton version, i tried with Proton-6.9-GE-1 and its working, maybe it works with the latest version of Proton GE too

Combining the new version of Proton and my launch command thing works. Plus the CGI cutscenes play again :) Thank you.

michael-fadely commented 3 years ago

Glad it all worked out. Thanks you two!