]> git.cworth.org Git - apitrace/blobdiff - retrace/d3d9retrace.py
specs: Allow an API to spread across multiple modules.
[apitrace] / retrace / d3d9retrace.py
index 44104ce616e4676038ecabf43d8b2dfa23115920..c175705e2dd036f21b4903cb672856dca29e5945 100644 (file)
@@ -34,14 +34,28 @@ from specs.d3d9 import *
 
 class D3DRetracer(Retracer):
 
-    def retraceApi(self, api):
+    def retraceModule(self, api):
         print '// Swizzling mapping for lock addresses'
         print 'static std::map<void *, void *> _locks;'
         print
 
         self.table_name = 'd3dretrace::d3d_callbacks'
 
-        Retracer.retraceApi(self, api)
+        Retracer.retraceModule(self, api)
+
+    def invokeFunction(self, function):
+        if function.name in ('Direct3DCreate9', 'Direct3DCreate9Ex'):
+            print 'if (retrace::debug && !g_szD3D9DllName) {'
+            print '    /* '
+            print '     * XXX: D3D9D only works for simple things, it often introduces errors'
+            print '     * on complex traces, or traces which use unofficial D3D9 features.'
+            print '     */'
+            print '    if (0) {'
+            print '        g_szD3D9DllName = "d3d9d.dll";'
+            print '    }'
+            print '}'
+
+        Retracer.invokeFunction(self, function)
 
     def invokeInterfaceMethod(self, interface, method):
         # keep track of the last used device for state dumping
@@ -110,4 +124,4 @@ if __name__ == '__main__':
 '''
 
     retracer = D3DRetracer()
-    retracer.retraceApi(d3d9)
+    retracer.retraceModule(d3d9)