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).