]> git.cworth.org Git - apitrace/blobdiff - retrace/d3d9retrace.py
d3dretrace: Basic D3D11 snap-shooting.
[apitrace] / retrace / d3d9retrace.py
index fd265ca50d31c1dbb15c74eb66b1702f15287d72..7c292f93aba8ce42c7e35e8ba6cde09cd67a8031 100644 (file)
 
 
 from dllretrace import DllRetracer as Retracer
-import specs.stdapi as stdapi
+from specs.stdapi import API
 from specs.d3d9 import *
 
 
 class D3DRetracer(Retracer):
 
-    def retraceModule(self, api):
+    def retraceApi(self, api):
+        print '''static d3dretrace::D3DDumper<IDirect3DDevice9> d3d9Dumper;'''
+        print
+
         print '// Swizzling mapping for lock addresses'
         print 'static std::map<void *, void *> _maps;'
         print
 
-        self.table_name = 'd3dretrace::d3d_callbacks'
+        self.table_name = 'd3dretrace::d3d9_callbacks'
 
-        Retracer.retraceModule(self, api)
+        Retracer.retraceApi(self, api)
 
     def invokeFunction(self, function):
         if function.name in ('Direct3DCreate9', 'Direct3DCreate9Ex'):
@@ -60,7 +63,10 @@ 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;'
+            if method.name == 'Release':
+                print r'    d3d9Dumper.unbindDevice(_this);'
+            else:
+                print r'    d3d9Dumper.bindDevice(_this);'
 
         # create windows as neccessary
         if method.name in ('CreateDevice', 'CreateDeviceEx', 'CreateAdditionalSwapChain'):
@@ -120,8 +126,11 @@ if __name__ == '__main__':
 #include "d3d9imports.hpp"
 #include "d3d9size.hpp"
 #include "d3dretrace.hpp"
+#include "d3dstate.hpp"
 
 '''
 
+    api = API()
+    api.addModule(d3d9)
     retracer = D3DRetracer()
-    retracer.retraceModule(d3d9)
+    retracer.retraceApi(api)