X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fd3d9retrace.py;h=0564c0040989f0074f31ab8a6377f94cf7dd240c;hb=e381485454721e6e714784c43df21e8205d3d3ad;hp=fd265ca50d31c1dbb15c74eb66b1702f15287d72;hpb=8512a4b2ec582407bbfe743772af506c4133e34f;p=apitrace diff --git a/retrace/d3d9retrace.py b/retrace/d3d9retrace.py index fd265ca..0564c00 100644 --- a/retrace/d3d9retrace.py +++ b/retrace/d3d9retrace.py @@ -34,14 +34,38 @@ from specs.d3d9 import * class D3DRetracer(Retracer): - def retraceModule(self, api): + def retraceApi(self, api): + print ''' +static IDirect3DDevice9 * +pLastDirect3DDevice9 = NULL; + +image::Image * +retrace::getSnapshot(void) { + if (!pLastDirect3DDevice9) { + return NULL; + } + return d3dstate::getRenderTargetImage(pLastDirect3DDevice9); +} + + +bool +retrace::dumpState(std::ostream &os) +{ + if (!pLastDirect3DDevice9) { + return false; + } + d3dstate::dumpDevice(os, pLastDirect3DDevice9); + return true; +} +''' + print '// Swizzling mapping for lock addresses' print 'static std::map _maps;' print self.table_name = 'd3dretrace::d3d_callbacks' - Retracer.retraceModule(self, api) + Retracer.retraceApi(self, api) def invokeFunction(self, function): if function.name in ('Direct3DCreate9', 'Direct3DCreate9Ex'): @@ -60,7 +84,7 @@ class D3DRetracer(Retracer): def invokeInterfaceMethod(self, interface, method): # keep track of the last used device for state dumping if interface.name in ('IDirect3DDevice9', 'IDirect3DDevice9Ex'): - print r' d3dretrace::pLastDirect3DDevice9 = _this;' + print r' pLastDirect3DDevice9 = _this;' # create windows as neccessary if method.name in ('CreateDevice', 'CreateDeviceEx', 'CreateAdditionalSwapChain'): @@ -120,6 +144,7 @@ if __name__ == '__main__': #include "d3d9imports.hpp" #include "d3d9size.hpp" #include "d3dretrace.hpp" +#include "d3d9state.hpp" '''