X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=wrappers%2Fd3d9trace.py;h=df401da5d090e7cd67b75018d8ba13f35cf20335;hb=621d0b3f841872e7d73465a7ec55afebad17bfdb;hp=fc6e65ef2ae86982df2f74f340aea5dfda51e799;hpb=4647f208f5a2b87391281e0f1202f66c23943bd9;p=apitrace diff --git a/wrappers/d3d9trace.py b/wrappers/d3d9trace.py index fc6e65e..df401da 100644 --- a/wrappers/d3d9trace.py +++ b/wrappers/d3d9trace.py @@ -25,7 +25,8 @@ from dlltrace import DllTracer -from specs.d3d9 import d3d9, D3DSHADER9 +from specs.stdapi import API, Pointer, ObjPointer +from specs.d3d9 import d3d9, D3DSHADER9, IDirect3DSwapChain9Ex import specs.d3d9dxva2 @@ -40,6 +41,16 @@ class D3D9Tracer(DllTracer): DllTracer.serializeArgValue(self, function, arg) + def wrapArg(self, function, arg): + # Correctly handle the wrapping of IDirect3DSwapChain9Ex objects + if function.name in ('GetSwapChain', 'CreateAdditionalSwapChain') \ + and self.interface.name == 'IDirect3DDevice9Ex' \ + and arg.name == 'pSwapChain': + self.wrapValue(Pointer(ObjPointer(IDirect3DSwapChain9Ex)), '((IDirect3DSwapChain9Ex**)pSwapChain)') + return + + DllTracer.wrapArg(self, function, arg) + def enumWrapperInterfaceVariables(self, interface): variables = DllTracer.enumWrapperInterfaceVariables(self, interface) @@ -48,7 +59,7 @@ class D3D9Tracer(DllTracer): interface.getMethodByName('LockRect') is not None or \ interface.getMethodByName('LockBox') is not None: variables += [ - ('size_t', '_LockedSize', '0'), + ('size_t', '_MappedSize', '0'), ('VOID *', 'm_pbData', '0'), ] @@ -56,8 +67,8 @@ class D3D9Tracer(DllTracer): def implementWrapperInterfaceMethodBody(self, interface, base, method): if method.name in ('Unlock', 'UnlockRect', 'UnlockBox'): - print ' if (_LockedSize && m_pbData) {' - self.emit_memcpy('(LPBYTE)m_pbData', '(LPBYTE)m_pbData', '_LockedSize') + print ' if (_MappedSize && m_pbData) {' + self.emit_memcpy('(LPBYTE)m_pbData', '(LPBYTE)m_pbData', '_MappedSize') print ' }' DllTracer.implementWrapperInterfaceMethodBody(self, interface, base, method) @@ -65,10 +76,10 @@ class D3D9Tracer(DllTracer): if method.name in ('Lock', 'LockRect', 'LockBox'): # FIXME: handle recursive locks print ' if (SUCCEEDED(_result) && !(Flags & D3DLOCK_READONLY)) {' - print ' _getLockInfo(_this, %s, m_pbData, _LockedSize);' % ', '.join(method.argNames()[:-1]) + print ' _getMapInfo(_this, %s, m_pbData, _MappedSize);' % ', '.join(method.argNames()[:-1]) print ' } else {' print ' m_pbData = NULL;' - print ' _LockedSize = 0;' + print ' _MappedSize = 0;' print ' }' @@ -83,17 +94,8 @@ if __name__ == '__main__': print '#include "d3d9shader.hpp"' print '#include "dxvaint.h"' print - print ''' -static inline size_t -_declCount(const D3DVERTEXELEMENT9 *pVertexElements) { - size_t count = 0; - if (pVertexElements) { - while (pVertexElements[count++].Stream != 0xff) - ; - } - return count; -} -''' - tracer = D3D9Tracer('d3d9.dll') - tracer.traceApi(d3d9) + api = API() + api.addModule(d3d9) + tracer = D3D9Tracer() + tracer.traceApi(api)