crosire / d3d8to9

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

Make d3dx9_xx.dll load dynamically #16

Closed elishacloud closed 7 years ago

elishacloud commented 7 years ago

d3dx8_43.dll was loaded statically before. Some systems have different versions of this dll. Changed it to load dynamically based on the version available on the system.

Note: This is also done by other programs. Check out the log from ts3overlay here.

crosire commented 7 years ago

I don't think this is necessary. D3DX is deprecated and won't be updated anymore (https://blogs.msdn.microsoft.com/chuckw/2013/08/20/living-without-d3dx/), meaning d3dx9_43.dll is the last version of that DLL that will ever exist. It's also the version that is installed by the last available DirectSetup. From Windows 8 onward DirectX is part of the operating system and does not include D3DX, so the only way to get that DLL is to install via the DirectSetup from 2010 which contains this specific version of the DLL. Unfortunately there don't seem to be any alternatives to assemble D3D8 shaders from assembler code, other than the deprecated D3DX, which is why it's in use here.

elishacloud commented 7 years ago

Yes, you are probably right. However I use this project inside a larger project and I did not want this dll to be static because the dll is not always needed for me. I suspect others may do the same thing.

Also on my test system (Windows 7) I only have d3dx9_32.dll and other users who use my project my not have the latest dll also. I don't want them to be required to update their DirectX libraries to use my project.

If you want I can change the number to start counting down at a smaller number rather than 99, like we can start at 50. I did see some references to d3dx9_47.dll on the web, but they could be bogus.

crosire commented 7 years ago

As soon as you install a DirectX game via Steam it will almost always install the DirectX libraries including d3dx9_43.dll too. The only systems I saw without that file were usually freshly set up. I don't feel like merging this. It adds complexity that is rarely required. But that doesn't have to stop you from using this change in your own fork.

elishacloud commented 7 years ago

Ok, understood. Thanks for looking at it. I will just have this on my branch.

CookiePLMonster commented 7 years ago

While I don't like the way this is trying for different DLL versions, loading it dynamically could still be beneficial since not everyone has DX redists installed (you'd be surprised how many people do not have them!) and I don't think shaders were a common thing in d3d8 days - so most games would be unaffected.

elishacloud commented 7 years ago

Ok, let me change that to dynamically load d3dx9_43.dll.

elishacloud commented 7 years ago

Ok, good call. Just updated this to support Unicode, as requested.

crosire commented 7 years ago

Alright. You got me convinced. I'll clean this up a little in a follow-up commit though.