crosire / d3d8to9

A D3D8 pseudo-driver which converts API calls and bytecode shaders to equivalent D3D9 ones.
BSD 2-Clause "Simplified" License
911 stars 83 forks source link

How to make nvidia's cp 3d settings work with d3d8to9? #103

Closed ImTimK closed 4 years ago

ImTimK commented 5 years ago

Hello,

None of the 3d settings from the cp panel seem to work while using d3d8to9, like AA, AF etc. Is there any way? The game I play is cnc generals btw.

elishacloud commented 4 years ago

This could be the same issue as mentioned in issue #63.

elishacloud commented 4 years ago

I believe I found the issue. Try this update: d3d8.zip

ImTimK commented 4 years ago

Hey Elisha, thanks alot, AF seems to be working now! AA however not.

Also, is there a way to disable v-sync? I play the game at 240 fps but it locks to 60 fps, making the gamespeed run 4x slower cause it's bound to fps.

elishacloud commented 4 years ago

AF seems to be working now! AA however not.

Are you testing this with Command & Conquer: Generals?

Also, is there a way to disable v-sync?

I will look into this and see if there is a bug. Also, you can force the game to disable vsync. See this thread here.

ImTimK commented 4 years ago

Yes and maybe not unimportant to mention, the Zero Hour expansion.

And ohhh wow, simply disabling v-sync in the CP does work, now the game seems to be a lot more stable too! Before I was only able to reliably use the replay mode with Reshade. During normal gameplay a crash was assured to happen, usually within 30 seconds. Thanks alot again!

elishacloud commented 4 years ago

And ohhh wow, simply disabling v-sync in the CP does work, now the game seems to be a lot more stable too!

Great. I'm glad you got it working!

I checked out the vsync and AA and both work correctly. Let me start out with the vsync. The game sends the following arguments to DirectX.

According to Microsoft's documentation this should enable vsync. So d3d8to9 is working correctly here.

For AA, I tried forcing AA to be enabled via dxwrapper and that worked fine. I also forced it via the Nvidia Control Panel and that worked fine.

image

The best way to verify this is to zoom into one of the buildings. See screenshots below. You will probably need to click on the images to see the difference. Look at the edges of the building and the shadows.

AA disabled (default):

image

AA enabled:

image

ImTimK commented 4 years ago

I'm running in windowed mode, should v-sync then be enabled by default too?

I don't really like fxaa, I use 8x via the override mode + 8x transparency, it Iooks amazing, like close to 4k (Especially with 8x + DSR 4k the picture is flawless but then windowed mode isn't possible unfortunately). But I will try the wrapper and see if that works!

update: I'm unsure which file I should pick from the stub folder, is it d3d8.dll ? And I can see d8to9 can be enabled in the ini, does this mean I don't need crosire's d8to9.dll anymore?

Another note: I'm also using another program/plugin called gentool, it's basically anti cheat software + bugfixes (needed for online play). This file is also a d3d8.dll, but I can use a wrapper by renaming it to d3d8x.dll or use a custom name and load it up via commandline (-proxy xxxx.dll) in a shortcut file to the game's exe. Last option is more convenient so I can choose wether to launch reshade+wrapper or not, however I'm not sure to set this up with the new wrapper.

elishacloud commented 4 years ago

I'm running in windowed mode, should v-sync then be enabled by default too?

I'm not sure how you are enabling window mode, but d3d8to9 will always tell DirectX9 to disable vsync in windowed mode. But the Windows Desktop Manager (WDM) on later versions of Windows (like Windows 8 and Windows 10) will limit the number of frames on every window, based on your refresh rate. So even though DirectX has vsync off, Windows still forces it for all windows. See this thread:

https://superuser.com/questions/844773/is-it-possible-to-turn-off-v-sync-in-windows-10-for-windowed-games

I'm unsure which file I should pick from the stub folder, is it d3d8.dll ? And I can see d8to9 can be enabled in the ini, does this mean I don't need crosire's d8to9.dll anymore?

Dxwrapper already includes the full crosire d3d8tod9 code in it. But I had not updated it yet. Below is an update of dxwrapper with the latest d3d8to9 code. If you want to continue using crosire's d3d8tod9 you can use d3d9.dll stub for dxwrapper. Or you can use the d3d8to9 code in dxwrapper and use the d3d8.dll stub.

Here is a download using d3d8.dll stub: dxwrapper.zip

This file is also a d3d8.dll, but I can use a wrapper by renaming it to d3d8x.dll or use a custom name and load it up via commandline (-proxy xxxx.dll) in a shortcut file to the game's exe.

Dxwrapper has a feature for this. Instead of modifying the command line you can add the file name to the dxwrapper.ini file. Just modify this line with the dll file name:

LoadCustomDllPath = xxxx.dll
ImTimK commented 4 years ago

I run windowed mode also via the commandline -win in the shortcut.

Still not sure about the installation, it kinda worked but dof effects within reshade didn't (color grading and other effects did work), I also got this message when launching the game (dunno how I did this, I removed all files again as it wasn't working properly):

Desktop Screenshot 2020 02 04 - 21 22 03 63

Anyway, below is how I had set it up before and still wish to have it. This allows me to launch the game normally without reshade/wrapper or with reshade using the special shortcut with "-proxy d3d8to9.dll" commandline. These are the files the game's directory: d3d8.dll (gentool, should launch with either shortcut) d3d9.dll (reshade) d3d8to9.dll (crosire's one updated by you so that AF 16x works, 8x msaa doesn't).

So how would a proper installation look like with the dxwrapper, while still using seperate shortcuts like I described above?

elishacloud commented 4 years ago
  1. Rename the gentool to something else, like gentool.dll or gentool.plg.
  2. Delete the crosire dll files (this is not needed with the build of dxwrapper I gave you).
  3. Unzip all three files from dxwrapper.zip into the game folder.
  4. Edit the dxwrapper.ini file (which was unzipped from step 3) and modify the LoadCustomDllPath to make it match whatever you named the gentool to in step 1:
LoadCustomDllPath = gentool.dll

Edit: you no longer need a special shortcut for this. You can just launch the game as normal.

elishacloud commented 4 years ago

So how would a proper installation look like with the dxwrapper, while still using seperate shortcuts like I described above?

What shortcuts are you trying to create? One with ReShade and one without? You know you can disable ReShade in-game.

ImTimK commented 4 years ago

I already had tried this, 3 issues:

  1. I do want to have a special shortcut launcher because I don't want any additional wrappers or programs running while playing competitive, only gentool.
  2. gentool doesn't actually launch (renamed both files: gentool.dll & gentool.cfg + put this name into the dxwrapper.ini config).
  3. not all effects within reshade work, like dof.

If it's not possible having a setup like this with the dxwrapper I'm very sorry to waste your time. d3d8to9 works fine except msaa. Thanks alot anyhow for taking your time to help me!

elishacloud commented 4 years ago

Yes, this can be done. Here is how the configuration would look:

Shortcuts:

generals.exe - Just gentool generals.exe -proxy dxwrapper.dll - For enabling gentool plus dxwrapper (including d3d8to9) and ReShade features

Note: the d3d8.dll stub from the dxwrapper package would no longer be needed.

Edit: You may need to modify the WrapperMode line into dxwrapper and set it to d3d8.dll like below:

WrapperMode = d3d8.dll
ImTimK commented 4 years ago

Amazing, that's it. it works!

I also realised why dof effects don't work, that's because msaa is now enabled, it's one or another. So this is literally the best solution possible, thanks alot!!

Here an example what it looks like in 1080p with msaa:

Desktop Screenshot 2020 02 04 - 22 46 40 24

And here in 4k dsr with the depth buffer so no msaa: Epic Carpet

elishacloud commented 4 years ago

Beautiful! Glad you got it working!

ImTimK commented 4 years ago

Only logical crosire's wrapper version wouldn't allow msaa, That would disable all those depth buffer effects.

Found another solution for vsync, so disabling that in the cp introduces tearing, but this can be fixed by choosing the fast sync option instead. This also unlocks the fps and the game will run alot more stable and faster.

GektorUA commented 4 years ago

Hi!

3. Unzip all three files from dxwrapper.zip into the game folder.

Yes, this can be done. Here is how the configuration would look:

* d3d8.dll (gentool, should launch with either shortcut)

* d3d9.dll (reshade)

* dxwrapper.dll (from the package I gave you)

* dxwrapper.ini (from the package I gave you)

Note: the d3d8.dll stub from the dxwrapper package would no longer be needed.

So, i need d3d9.dll (reshade) in game folder or not (d3d8.dll from zip i didn't use at all)? I have run game without it (just with dxwrapper dll and ini file with WrapperMode = d3d8.dll on GenTool), and seems that all works. Seems that with this dxwrapper.dll it's the most stable solution for my notebook hardware, except old bug with "Heat Effects = On" and USA Microwave Tank — when it out from factory, area of it get Black Screen, in dxwrapper-generals.log gets two messages:

12668 23:17:10.940 m_IDirect3DSurface9::LockRect Emulating the surface lock. Data may be lost here! 12668 23:17:10.940 m_IDirect3DSurface9::LockRect Emulating the surface lock. Data may be lost here!

Can it be fixed with dxwrapper?