X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fd3d9retrace.py;h=fd265ca50d31c1dbb15c74eb66b1702f15287d72;hb=2b4fc3f4c1204f190f9b7b264d68912d3a49d80d;hp=14b92ab4fe7503f50945412b4f34453273388865;hpb=2b46364c974c95b8e2568f1e3f13e888c46c9d04;p=apitrace diff --git a/retrace/d3d9retrace.py b/retrace/d3d9retrace.py index 14b92ab..fd265ca 100644 --- a/retrace/d3d9retrace.py +++ b/retrace/d3d9retrace.py @@ -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 _locks;' + print 'static std::map _maps;' print - self.table_name = 'd3dretrace::%s_callbacks' % api.name.lower() + 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 @@ -85,13 +99,13 @@ class D3DRetracer(Retracer): if method.name in ('Lock', 'LockRect', 'LockBox'): print ' VOID *_pbData = NULL;' - print ' size_t _LockedSize = 0;' - print ' _getLockInfo(_this, %s, _pbData, _LockedSize);' % ', '.join(method.argNames()[:-1]) - print ' _locks[_this] = _pbData;' + print ' size_t _MappedSize = 0;' + print ' _getMapInfo(_this, %s, _pbData, _MappedSize);' % ', '.join(method.argNames()[:-1]) + print ' _maps[_this] = _pbData;' if method.name in ('Unlock', 'UnlockRect', 'UnlockBox'): print ' VOID *_pbData = 0;' - print ' _pbData = _locks[_this];' + print ' _pbData = _maps[_this];' print ' if (_pbData) {' print ' retrace::delRegionByPointer(_pbData);' print ' }' @@ -110,4 +124,4 @@ if __name__ == '__main__': ''' retracer = D3DRetracer() - retracer.retraceApi(d3d9) + retracer.retraceModule(d3d9)