Good practice for patching/hooking DirectX

  • if Present() returns D3DERR_DEVICELOST, then free every resource you are holding
  • hook TestCooperativeLevel and Reset to be in sync with what the game is thinking (and again, if you get D3DERR_DEVICELOST, free everything and wait)
  • what’s important is freeing everything allocated into the D3DPOOL_DEFAULT memory class. But if you are holding resources, you’ll prevent the app from closing DirectX (which it might want to do in order to do a stronger version of reset).

Lost Devices (Direct3D 9)

IDirect3DDevice9::Present method


Create DirectX9Texture from RGBA (const char*) buffer

Direct3D 9 to Direct3D 10 Considerations (Direct3D 10)

Help with DirectX 9 Textures

Tutorial 11: 2D Rendering

Directly Mapping Texels to Pixels (Direct3D 9)

2D in Direct3D using Textured Quads

Drawing a Texture to the Screen

IDirect3DDevice9::UpdateTexture method

IDirect3DTexture9::LockRect method

IDirect3DDevice9::UpdateSurface method