Skip to content

ran-j/dx9cKiller

Repository files navigation

dx9cKiller

dx9cKiller is an experimental Direct3D 9 interceptor with a simple goal:
let you replace (mod) a game’s shaders and textures, and still make old FFP-only games work by auto-generating shaders for them.

It watches what the game does (render states, texture stages, transforms, lights, shader constants…) and then spits out HLSL for a vertex shader and a pixel shader. Along the way it can also notice when the game uses its own shaders and capture/restore constants around that.

This is not finished software but kind of works..


What it does (right now)

  • Hooks a D3D9 device and intercepts:

    • SetVertexShader / SetPixelShader
    • SetVertexShaderConstantF / SetPixelShaderConstantF
    • SetTransform, SetRenderState, SetTextureStageState, SetSamplerState
    • texture bindings
    • the main draw calls and many more
  • Generates FFP-like shaders on the fly

    • generate shaders based on FFP calls
    • binds the generated VS/PS instead of whatever DX9 would have done for FFP
    • caches the result
  • Tracks textures and texture stages

    • so the generated shader knows which stages are actually enabled
    • and what the colour/alpha ops are supposed to do
    • it also can dump and replace textures

Replacement flow

The repo supports a simple “drop-in replacement” approach:

  • generated/dumped shaders and textures can be matched by a key/hash
  • you can place custom shaders and texture under this folders:
    • replacements/vs/…
    • replacements/ps/…
    • replacements/tex/…dds
  • at runtime, if a replacement with the expected name is found, the library will load that instead of the generated one

So: capture → dump → edit → replace.

The repo will list replacements on startup so if you change on the fly you will need to restart the game.


How to build (short)

  1. Open the solution/project in Visual Studio.
  2. Make sure the Direct3D 9 SDK (or Windows SDK with d3d9) is present.
  3. Build the DLL.
  4. Load it alongside your DX9 game.

Experimental warning

This is experimental code:

  • it assumes a fairly normal D3D9 device vtable layout
  • it assumes the game isn’t doing too many exotic things with constants
  • it some time make wrong FFP translation

Contributing / reporting bugs

Grab the log and open an issue with:

  • the game name
  • the log around the draw
  • and, if possible, what the effect should look like

About

dx9cKiller is an experimental Direct3D 9 interceptor to dump/replace shaders and textures

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages