From f6757272f76575b71954ecc55db810f58febcf13 Mon Sep 17 00:00:00 2001 From: Jose Fonseca Date: Fri, 13 May 2016 07:23:45 -0700 Subject: d3d9trace: Capture IDirectXVideoDecoder buffer mappings. By emitting fake memcpys. --- wrappers/d3d9trace.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'wrappers') diff --git a/wrappers/d3d9trace.py b/wrappers/d3d9trace.py index 5f111979..5b966cb0 100644 --- a/wrappers/d3d9trace.py +++ b/wrappers/d3d9trace.py @@ -67,6 +67,11 @@ class D3D9Tracer(DllTracer): ('VOID *', 'm_pbData', '0'), ] + if interface.name == 'IDirectXVideoDecoder': + variables += [ + ('std::map >', '_MappedData', None), + ] + return variables def implementWrapperInterfaceMethodBody(self, interface, base, method): @@ -84,6 +89,13 @@ class D3D9Tracer(DllTracer): self.emit_memcpy('(LPBYTE)m_pbData', '_MappedSize') print ' }' + if interface.name == 'IDirectXVideoDecoder' and method.name == 'ReleaseBuffer': + print ' std::map >::iterator it = _MappedData.find(BufferType);' + print ' if (it != _MappedData.end()) {' + self.emit_memcpy('it->second.first', 'it->second.second') + print ' _MappedData.erase(it);' + print ' }' + DllTracer.implementWrapperInterfaceMethodBody(self, interface, base, method) if method.name in ('Lock', 'LockRect', 'LockBox'): @@ -112,6 +124,13 @@ class D3D9Tracer(DllTracer): print ' _MappedSize = 0;' print ' }' + if interface.name == 'IDirectXVideoDecoder' and method.name == 'GetBuffer': + print ' if (SUCCEEDED(_result)) {' + print ' _MappedData[BufferType] = std::make_pair(*ppBuffer, *pBufferSize);' + print ' } else {' + print ' _MappedData[BufferType] = std::make_pair(nullptr, 0);' + print ' }' + if __name__ == '__main__': print '#define INITGUID' -- cgit v1.2.3