From ef26cb8eb5b983513a9276ee7c3aabff3f8baea5 Mon Sep 17 00:00:00 2001 From: Jose Fonseca Date: Wed, 27 Apr 2016 11:58:18 +0100 Subject: d3d9trace: Track volume/cube lock mappings per level too. That is, generalise commit e540b63da038aacc51664451491791d627aef1de to other resource types. --- wrappers/d3d9trace.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'wrappers') diff --git a/wrappers/d3d9trace.py b/wrappers/d3d9trace.py index 0850ba3e..7e7072fc 100644 --- a/wrappers/d3d9trace.py +++ b/wrappers/d3d9trace.py @@ -57,7 +57,7 @@ class D3D9Tracer(DllTracer): if interface.getMethodByName('Lock') is not None or \ interface.getMethodByName('LockRect') is not None or \ interface.getMethodByName('LockBox') is not None: - if interface.name in ['IDirect3DTexture9']: + if interface.base.name == 'IDirect3DBaseTexture9': variables += [ ('std::map >', '_MappedData', 'std::map >()'), ] @@ -71,13 +71,15 @@ class D3D9Tracer(DllTracer): def implementWrapperInterfaceMethodBody(self, interface, base, method): if method.name in ('Unlock', 'UnlockRect', 'UnlockBox'): - if interface.name in ['IDirect3DTexture9']: + if interface.base.name == 'IDirect3DBaseTexture9': + assert method.getArgByName('Level') is not None print ' std::map >::iterator it = _MappedData.find(Level);' print ' if (it != _MappedData.end()) {' self.emit_memcpy('(LPBYTE)it->second.second', 'it->second.first') print ' _MappedData.erase(it);' print ' }' else: + assert method.getArgByName('Level') is None print ' if (_MappedSize && m_pbData) {' self.emit_memcpy('(LPBYTE)m_pbData', '_MappedSize') print ' }' @@ -85,7 +87,8 @@ class D3D9Tracer(DllTracer): DllTracer.implementWrapperInterfaceMethodBody(self, interface, base, method) if method.name in ('Lock', 'LockRect', 'LockBox'): - if interface.name in ['IDirect3DTexture9']: + if interface.base.name == 'IDirect3DBaseTexture9': + assert method.getArgByName('Level') is not None print ' if (SUCCEEDED(_result) && !(Flags & D3DLOCK_READONLY)) {' print ' size_t mappedSize;' print ' VOID * pbData;' @@ -96,6 +99,7 @@ class D3D9Tracer(DllTracer): print ' }' else: # FIXME: handle recursive locks + assert method.getArgByName('Level') is None print ' if (SUCCEEDED(_result) && !(Flags & D3DLOCK_READONLY)) {' print ' _getMapInfo(_this, %s, m_pbData, _MappedSize);' % ', '.join(method.argNames()[:-1]) print ' } else {' -- cgit v1.2.3