kirides / GD3D11

D3D11-Renderer for Gothic and Gothic 2
GNU General Public License v3.0
201 stars 18 forks source link

Direct7toDirect11wrapper linux #14

Closed Smokolak closed 3 years ago

Smokolak commented 4 years ago

Hi, this is more a question, is it possible to run this under Wine? What packages I need to register in it to work? Is it even possible?

neVERberleRfellerER commented 4 years ago

Yes it is. It works well with staging (because of https://bugs.winehq.org/show_bug.cgi?id=48547) + DXVK+native d3dxXX (as specified in DXVK README) +native dsound (it seemingly work with builtin libs, but music sometimes does not work and some sound effects cause crashes). The only problem encountered by me is https://bugs.winehq.org/show_bug.cgi?id=48483 - and it's annoying enought to not use D3D11 renderer with Wine.

kirides commented 3 years ago

This issue is caused by forced borderless fullscreen mode. One way how to replicate is by setting zStartupWindowed=1 with systempack and then cursor is always visible even without GD3D11.

Can someone try this without windowed mode?

neVERberleRfellerER commented 3 years ago

It used to be the same with zStartupWindowed=0. This problem somehow vanished, but I don't know what fixed it, but my guess is that something in wine-staging did. I didn't have chance to test vanilla wine yet, because last time I tried I get crash at startup.

pm4rcin commented 3 years ago

@neVERberleRfellerER how did you manage the game to work? I installed G2NR from GOG via Lutris and applied patches like Union (Systempack), but it doesn't want to work. It worked with default install but with patches it starts and then it is stuck, game window isn't drawn. I haven't tried it with DX11 maybe that's the reason? Have you already tried without DX11?

neVERberleRfellerER commented 3 years ago

AFAIK union patches do not work, not even the systempack from union. I use standalone systempack.

stefson commented 3 years ago

it does work up to a certain point. How to reproduce:

fire up Gothic2 via GothicStarter.exe with env DXVK_HUD=devinfo,fps,gpuload WINEPREFIX=~/.gothic2-goldedition WINEARCH=win32 wine GothicStarter.exe

todo: add LAA execution bit, also known as 4GB Patch

tested with wine-6.0 on gentoo amd64 (multilib)

//Edit: updated to 2021

stefson commented 3 years ago

the whole prefix is broken, as soon as G3D11 is updated beyond dev11:

002c:err:winediag:WS_getaddrinfo Failed to resolve your host name IP
WARNING: Experimental compiler backend enabled. Here be dragons! Incorrect rendering, GPU hangs and/or resets are likely
0108:err:module:import_dll Loading library d3dcompiler_47.dll (which is needed by L"C:\\windows\\system32\\d3d10.dll") failed (error c000035a).
0108:err:module:find_forwarded_export module not found for forward 'd3d10.D3D10CreateStateBlock' used by L"C:\\windows\\system32\\d3d10_1.dll"
0108:err:module:import_dll Loading library d3dcompiler_47.dll (which is needed by L"C:\\windows\\system32\\d3d10.dll") failed (error c000035a).
0108:err:module:find_forwarded_export module not found for forward 'd3d10.D3D10StateBlockMaskEnableAll' used by L"C:\\windows\\system32\\d3d10_1.dll"
0108:err:module:import_dll Loading library D3DCOMPILER_47.dll (which is needed by L"C:\\Program Files\\JoWood\\Gothic II Gold\\System\\DDRAW.dll") failed (error c000035a).
0108:err:module:import_dll Library DDRAW.dll (which is needed by L"C:\\Program Files\\JoWood\\Gothic II Gold\\System\\Gothic2.exe") not found
0108:err:module:LdrInitializeThunk Importing dlls for L"C:\\Program Files\\JoWood\\Gothic II Gold\\System\\Gothic2.exe" failed, status c0000135

@Kirides do you maybe know why this happens? I know that you upgraded to dxgi-1.2 in https://github.com/Kirides/GD3D11/commit/8cd96bdea164b6c27f213e61db59099a53f309d7 , but dxvk does support it since 2018.

kirides commented 3 years ago

The error says it all, it tries to load d3dcompiler_47.dll but can not find it.

Maybe you have to add some wine dll shenanigans for it to properly work

stefson commented 3 years ago

thanks for your fast answer, do you think this data from Gothic2.exe proves your point? Main difference is more verbose find_forwarded_export module not found for forward error

$ env DXVK_HUD=devinfo,fps,gpuload WINEPREFIX=~/.gothic2-goldedition-reboot-mingw32 WINEARCH=win32 wine Gothic2.exe

0024:err:module:import_dll Loading library d3dcompiler_47.dll (which is needed by L"C:\\windows\\system32\\d3d10.dll") failed (error c000035a).
0024:err:module:find_forwarded_export module not found for forward 'd3d10.D3D10CreateStateBlock' used by L"C:\\windows\\system32\\d3d10_1.dll"
0024:err:module:import_dll Loading library d3dcompiler_47.dll (which is needed by L"C:\\windows\\system32\\d3d10.dll") failed (error c000035a).
0024:err:module:find_forwarded_export module not found for forward 'd3d10.D3D10StateBlockMaskEnableAll' used by L"C:\\windows\\system32\\d3d10_1.dll"
0024:err:module:import_dll Loading library D3DCOMPILER_47.dll (which is needed by L"C:\\Program Files\\JoWood\\Gothic II Gold\\System\\DDRAW.dll") failed (error c000035a).
0024:err:module:import_dll Library DDRAW.dll (which is needed by L"C:\\Program Files\\JoWood\\Gothic II Gold\\System\\Gothic2.exe") not found
0024:err:module:LdrInitializeThunk Importing dlls for L"C:\\Program Files\\JoWood\\Gothic II Gold\\System\\Gothic2.exe" failed, status c0000135

I've been talking to the dxvk author, he confirmed that dxvk has dxgi-1.2 support since 2018.

It doesn't work to use winetricks d3dcompiler_47

pm4rcin commented 3 years ago

@Kirides check that reply https://github.com/doitsujin/dxvk/issues/1844#issuecomment-739844878 and decide what to do now.

kirides commented 3 years ago

Just do as he says and remove the existing D3dcompiler_47.dll from the Gothic\System\ directory and try it after installing the dll using winetricks.

The D3DCompiler_47.dll is only released with this renderer because on some systems it was simply not working even though DirectX was installed using the dxweb-install.

stefson commented 3 years ago

just for the record: the wine builtin d3dcompiler_47.dll is not working, and to counter more problems down the road it is, as of now, best practice to remove the d3dcompiler_47.dll provided by the GD3D11 archive and use winetricks to provide your prefix with dll override of d3dcompiler_47.dll

I do have a question though: can the LAA flag (nicknamed 4GB patch) be set with linux tools?

kirides commented 3 years ago

LAA flag is a windows thing in windows binaries. You should be able to use any tool to set the LAA Bit, even use some windows tool inside that prefix and set it accordingly.

stefson commented 3 years ago

Yeah, it's possible to use the tool called LargeAddressAware Hack , but I need to boot into my old win7 to use that. I'll report back here, once I found a reasonable way to solve the issue with linux tools.

Smokolak commented 3 years ago

Hi, I need some clarifications. I want to get Gothic 1 running with GD3D11. I installed G1 with Lutris. I got a 32 bit prefix for it. Installed player kit 1.08, 2.08 and system pack 1.8. To this point everything works apart that i need to use BorderlessWindow=1. I'm using built in lutris wine 6.0 rc1 , dxvk 1.7.3L-03f11ba. In wine configuration I added d3dcompiler_47 and marked as builtin while renamming d3dcompiler_47.dll.old in Gothic/system. Still it doesn't work, what I'm I doing wrong here?

stefson commented 3 years ago

why don't you provide your relevant logs? from what you provided, one can only see you're using super bleeding edge packages.

neVERberleRfellerER commented 3 years ago

@Smokolak

d3dcompiler_47 and marked as builtin

should be set to native (builtin is from wine, native is from Windows). Builtin d3dcompilers are unsupported by dxvk.

Smokolak commented 3 years ago

image image image `

stefson commented 3 years ago

the GD3D11 renderer ships its own ddraw.dll, I think this one you have to set to override over the one provided by wine prefix: ddraw (Native,Builtin) this is at least true for Gothic2

Smokolak commented 3 years ago

Awesome! It works! Thanks! But I had to revert d3dcompiler_47.dll to game dir back.

Unfortunately I'm getting some errors and it crash after some time:

stefson commented 3 years ago

Correct, builtin d3dcompiler_47.dll implementation is somehow incomplete or broken. I may open a bug on wine bug tracker for that. Until it is fixed, you should use the provided d3dcompiler_47.dll and not remove or rename it. It might be possible to use winetricks to provide the d3dcompiler_47.dll override for you.

You are using super bleeding edge software, breakages can and will occure. GD3D11 itself is somehow alpha or pre alpha, and while it's a good thing you're out there and testing the snapshots of wine and dxvk for that matter, you should act on crashes and report them. But only if you're confident they don't happen with the latest stable, making them a regression.

In any case, for Gothic2 the frequent crashes can be solved by adding larg adress hack flag to Gothic2.exe. Just scroll up a bit, I talked about it in this thread before.

pm4rcin commented 3 years ago

If you have any problems or questions post it here so I could help you. :) So to successfully get the game working on Linux (I used Lutris) you have to:

  1. Install the game on prefix (I used gog version with automatic install from Lutris)
  2. Add vcrun2008, vcrun2010, directmusic with winetricks in prefix and make sure you have wine-mono installed globally
  3. Download Resource Manager and place it in the prefix folder
  4. In Resource Manager on Union tab install "PlayerKit 2.8 + Patch for 64-bit systems" AND Union (minimum 1.0j)
  5. Make sure that dsound is set to exactly "dsound(built-in, external)" and override ddraw to "ddraw(external, built-in) in winecfg
  6. Download and unpack DX11 files to System folder
  7. (Optional) Download normalmaps from here and unpack them in System/GD3D11/Textures/replacements
  8. (Optional) Add plugins with Resource Manager (I've tested zGamePad and it works flawlessly even with with SteamController)

Specs: CPU: Ryzen 5 4600H GPU: Geforce GTX 1650 RAM: 16GB 3200MHz Dist: Arch 5.11.16 Wine: System(vanilla 6.7)

stefson commented 3 years ago

@pm4rcin were you able to add the laa hack with linux tools?

bodziek666 commented 3 years ago

@stefson Thanks, your guide works fine! Instead of dxvk173 I went with dxvk181 and I also installed directmusic that way. I also used 4GB path.

stefson commented 3 years ago

sure, you can replace with latest dxvk and also with latest GD3D11 release tag, glad it still works. Did you use any linux tools for the 4gb patch?

bodziek666 commented 3 years ago

@stefson on, I just did WINEPREFIX="~/.wine/prefix/gothic2nk" WINEARCH="win32" wine ~/installers/LaaHack.exe and then I checked out Gothic2.exe and pressed exit. After doing so the game stopped crashing when I was watching in game loading movies.

pm4rcin commented 3 years ago

@pm4rcin were you able to add the laa hack with linux tools?

The patch for 64-bit systems includes 4GB Patch in it so I haven't had to do that. It's in description of that patch. ;)

bodziek666 commented 3 years ago

@pm4rcin The performance is good and in general the game works for me (G2: NoTR) but sometimes my screen goes blank and the only way to fix this is to kill the Gothic2.exe process and start the game again. Do you have any idea what can be the cause of the issue?

pm4rcin commented 3 years ago

@pm4rcin The performance is good and in general the game works for me (G2: NoTR) but sometimes my screen goes blank and the only way to fix this is to kill the Gothic2.exe process and start the game again. Do you have any idea what can be the cause of the issue?

  1. Did you install 4GB patch?
  2. Prefix 32 or 64-bit?
  3. Wine version?
  4. Kernel version, distro?
  5. SystemPack/Union and which version?
  6. DX11 installed and which version?
  7. If yes did you check with original renderer?
bodziek666 commented 3 years ago

@pm4rcin The performance is good and in general the game works for me (G2: NoTR) but sometimes my screen goes blank and the only way to fix this is to kill the Gothic2.exe process and start the game again. Do you have any idea what can be the cause of the issue?

1. Did you install 4GB patch?

Yes, otherwise the game crashed due to bad alloc.

  1. Prefix 32 or 64-bit? 32bit

  2. Wine version? 6.1

  3. Kernel version, distro? Linux pc 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

  4. SystemPack/Union and which version? System Pack 1.8

  5. DX11 installed and which version? dxvk 1.8.1 with GD3D11 17.7-dev11-fix2

  6. If yes did you check with original renderer? With original renderer the game menu is laggy so I haven't tried it yet. But I do play Gothic 1 with original renderer because it crashes with ddraw override.

stefson commented 3 years ago

first thing you should try is to upgrade the gd3d11 renderer with the latest snapshot. also posting your gpu and which drivers you're using can be helpfull.

bodziek666 commented 3 years ago

Sure. I will also update my Ubuntu to the recent version available.

My specs: AMD Ryzen 5 2600 Radeon RX580 8GB with amdgpu driver. 16GB DDR4 3200MHz (dual channel)

With the newest GD3D11 Gothic 1 still crashes due to bad alloc. I will try playing Gothic2 NoTR and see what happens.

pm4rcin commented 3 years ago

@bodzioslav using 32-bit prefix with 4GB patch is risky in my opinion. You could try these steps since I tested them many times and it always worked for me. But I have Nvidia graphics so AMD could be the issue on your side.

bodziek666 commented 3 years ago

So should I try using 64bit prefix instead?

pm4rcin commented 3 years ago

Sorry I meant https://github.com/Kirides/GD3D11/issues/14#issuecomment-827858549 since it's reproducible every time.

bodziek666 commented 3 years ago

I have updated GD3D11 and also the whole system. Now I'm running wine 6.7 and Linux kernel 5.11.0-16-generic I have managed to play for 2h 30m without any issues so for now I assume that in case of G2NoTR it helped.

In case of Gothic1 I haven't succeeded yet. It still crashes with GD3D11 enabled (dddraw override). I also tried to reinstall G1 inside of a wine64 prefix and the issue is still there. Unfortunately 4GB patch doesn't fix G1.