Author Topic: Why modified "d3d9.dll" must NOT be put into Windows system folder  (Read 520 times)

Offline REV_BL!TZKR!EG

  • ...somewhere...below...
  • REViSi0N
  • one of the leaders
  • Posts: 2.000
  • ELiTE Skill Level:
    75%
  • TECH ADMiN
    • Links!!
First, I want to make clear that the following is not simply "my opinion".
The facts I summarize below match exactly what the inventor (Kegetys) and the programmer (Seeadler) wrote.


Thesis: A modified "d3d9.dll" must NOT be put into Windows system folder

It may well be in their best intentions to help...Several ignorami continuously post their advice like "Download the file and put it into Windows folder x". This advice is wrong and I wonder why people who write that do not use their brain. But that is how you get BEST-OF-badges on SuSi, is it not so?


Why?

The d3d9.dll provided in this fix is a so-called DirectX9 proxy, it intercepts calls to DirectX9 and manipulates such a command call before the call is relayed to the system. In order to do so it must always be placed in the folder of the .EXE which uses this fix. Otherwise this necessary intercept can NOT work and the changes made would influence other games and other processes which is in most cases not wanted.


Technical background

The explanation is a bit technical, but everybody who only wants, can easily understand it. Just give it some effort!

A proxy DLL exploits the fact that an .EXE looks for DLLs to load and use first in its own folder and only if not found it looks for them in the System32 folder. If now a d3d9.dll is present in the folder of the .EXE, this DLL will be used and not the DLL in the System32 folder. The new DLL intercepts calls to DirectX9 from the .EXE and passes them to the system instead of the original DLL in the System32 folder. This way entirely new commands and functions can be added, such as to set the number of pre-rendered images or override the resolution etc. That also explains why mods with different d3d9.dll are not and can not be compatible with each other until all the functions are merged into only one d3d9.dll.

To make this happen an installation of DirectX 9c is necessary because the original DX9 files must be in the Windows system folder. On newer OS you usually have newer versions of DX, e.g. 10 or newer, but it is no issue to have both installed at the same time (parallelly), the files do not collide because DX9 has a different file name convention than the newer versions, so do not worry, nothing of your newer DX-version is going to be overwritten!


Example: The d3d9.dll in the widescreen-resolution-fix

The SH3 engine usually calls the d3d9.dll to set the resolution with the settings saved in %userprofile%\Documents\SH3\data\cfg\main.cfg. Now the proxy DLL jumps in and takes its own settings from its own .CFG file. The proxy DLL then redirects this new data to the original d3d9.dll in the system folder. The proxy dll must be loaded by the .EXE with a delay, in earlier OS like WiN XP you needed to provide an SDB file (Shim Database), Vista and later versions of Windows do not need that anymore.


Different versions of d3d9.dll flying around

The HighRes-Fix from Kegetys (a full d3d9.dll replacement) supports only 4:3 resolution, i.e. no widescreen 16:9 or alike, because if you set to widescreen the GFX will be stretched.

Rubini's WS-GUI and MaGUI-WS both include Seeadler's implementation of d3d9.dll.

I started investigating this during development of module_SFSF() and keep the data updated in D3D9.DLL - different versions?, because users are too lazy to help with meaningful data.


Conclusio

Do not believe everything you read. Verify it. If those who give this advice are either too lazy or incapable to verify what they say then YOU can still verify it. Stop donating money to people who post false instructions! Support those who can explain what they do! And spread the word.
« Last Edit: 20220415, 19:16:58 by REV_BL!TZKR!EG »
» HONOR, AMISTAD Y RESPETO! Es mejor morir de pie que vivir toda una vida de rodillas! «

⚡️ Home of S3A - S3F - S3G - DEFTS3 -