From: José Fonseca Date: Mon, 22 Nov 2010 21:05:26 +0000 (+0000) Subject: More opaque pointer cleanup. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=31524197f9120f57c7df45525a95fa331194e02c;p=apitrace More opaque pointer cleanup. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 27df9f8..262eda9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,16 +124,16 @@ if (WIN32) endif (DirectX_D3DX9_FOUND) # d3d10.dll - if (DirectX_D3D10_FOUND) - include_directories (${DirectX_D3D10_INCLUDE_DIR}) - add_custom_command ( - OUTPUT d3d10.cpp - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10misc.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10.cpp - DEPENDS d3d10misc.py windows.py base.py - ) - add_library (d3d10 SHARED d3d10.def d3d10.cpp log.cpp os_win32.cpp) - set_target_properties (d3d10 PROPERTIES PREFIX "") - endif (DirectX_D3D10_FOUND) + #if (DirectX_D3D10_FOUND) + # include_directories (${DirectX_D3D10_INCLUDE_DIR}) + # add_custom_command ( + # OUTPUT d3d10.cpp + # COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10misc.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10.cpp + # DEPENDS d3d10misc.py windows.py base.py + # ) + # add_library (d3d10 SHARED d3d10.def d3d10.cpp log.cpp os_win32.cpp) + # set_target_properties (d3d10 PROPERTIES PREFIX "") + #endif (DirectX_D3D10_FOUND) # opengl32.dll add_custom_command ( diff --git a/base.py b/base.py index 0e6ae9f..615549a 100644 --- a/base.py +++ b/base.py @@ -238,10 +238,7 @@ class Pointer(Type): def dump(self, instance): print ' if(%s) {' % instance print ' Log::BeginPointer("%s", (const void *)%s);' % (self.type, instance) - try: - self.type.dump("*" + instance) - except NotImplementedError: - pass + self.type.dump("*" + instance) print ' Log::EndPointer();' print ' }' print ' else' @@ -507,6 +504,11 @@ class Function: pass +def FunctionPointer(type, name, args, **kwargs): + # XXX + return Opaque(name) + + class Interface(Type): def __init__(self, name, base=None): @@ -515,6 +517,9 @@ class Interface(Type): self.base = base self.methods = [] + def dump(self, instance): + print ' Log::LiteralOpaque((const void *)%s);' % instance + def itermethods(self): if self.base is not None: for method in self.base.itermethods(): diff --git a/d3d8.py b/d3d8.py index 92000d7..aaa0285 100644 --- a/d3d8.py +++ b/d3d8.py @@ -81,7 +81,7 @@ PDIRECT3DSURFACE8 = WrapPointer(IDirect3DSurface8) PDIRECT3DVOLUME8 = WrapPointer(IDirect3DVolume8) IDirect3D8.methods += [ - Method(HRESULT, "RegisterSoftwareDevice", [(Pointer(Void), "pInitializeFunction")]), + Method(HRESULT, "RegisterSoftwareDevice", [(OpaquePointer(Void), "pInitializeFunction")]), Method(UINT, "GetAdapterCount", []), Method(HRESULT, "GetAdapterIdentifier", [(UINT, "Adapter"), (DWORD, "Flags"), Out(Pointer(D3DADAPTER_IDENTIFIER8), "pIdentifier")]), Method(UINT, "GetAdapterModeCount", [(UINT, "Adapter")]), @@ -159,24 +159,24 @@ IDirect3DDevice8.methods += [ Method(HRESULT, "GetTextureStageState", [(DWORD, "Stage"), (D3DTEXTURESTAGESTATETYPE, "Type"), Out(Pointer(DWORD), "pValue")]), Method(HRESULT, "SetTextureStageState", [(DWORD, "Stage"), (D3DTEXTURESTAGESTATETYPE, "Type"), (DWORD, "Value")]), Method(HRESULT, "ValidateDevice", [Out(Pointer(DWORD), "pNumPasses")]), - Method(HRESULT, "GetInfo", [(DWORD, "DevInfoID"), Out(Pointer(Void), "pDevInfoStruct"), (DWORD, "DevInfoStructSize")]), + Method(HRESULT, "GetInfo", [(DWORD, "DevInfoID"), Out(OpaquePointer(Void), "pDevInfoStruct"), (DWORD, "DevInfoStructSize")]), Method(HRESULT, "SetPaletteEntries", [(UINT, "PaletteNumber"), (ConstPointer(PALETTEENTRY), "pEntries")]), Method(HRESULT, "GetPaletteEntries", [(UINT, "PaletteNumber"), Out(Pointer(PALETTEENTRY), "pEntries")]), Method(HRESULT, "SetCurrentTexturePalette", [(UINT, "PaletteNumber")]), Method(HRESULT, "GetCurrentTexturePalette", [Out(Pointer(UINT), "PaletteNumber")]), Method(HRESULT, "DrawPrimitive", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "StartVertex"), (UINT, "PrimitiveCount")]), Method(HRESULT, "DrawIndexedPrimitive", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "minIndex"), (UINT, "NumVertices"), (UINT, "startIndex"), (UINT, "primCount")]), - Method(HRESULT, "DrawPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "PrimitiveCount"), (ConstPointer(Void), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]), - Method(HRESULT, "DrawIndexedPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "MinVertexIndex"), (UINT, "NumVertexIndices"), (UINT, "PrimitiveCount"), (ConstPointer(Void), "pIndexData"), (D3DFORMAT, "IndexDataFormat"), (ConstPointer(Void), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]), + Method(HRESULT, "DrawPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "PrimitiveCount"), (OpaquePointer(Const(Void)), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]), + Method(HRESULT, "DrawIndexedPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "MinVertexIndex"), (UINT, "NumVertexIndices"), (UINT, "PrimitiveCount"), (OpaquePointer(Const(Void)), "pIndexData"), (D3DFORMAT, "IndexDataFormat"), (OpaquePointer(Const(Void)), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]), Method(HRESULT, "ProcessVertices", [(UINT, "SrcStartIndex"), (UINT, "DestIndex"), (UINT, "VertexCount"), (PDIRECT3DVERTEXBUFFER8, "pDestBuffer"), (DWORD, "Flags")]), Method(HRESULT, "CreateVertexShader", [(ConstPointer(DWORD), "pDeclaration"), (ConstPointer(DWORD), "pFunction"), Out(Pointer(DWORD), "pHandle"), (DWORD, "Usage")]), Method(HRESULT, "SetVertexShader", [(DWORD, "Handle")]), Method(HRESULT, "GetVertexShader", [Out(Pointer(DWORD), "pHandle")]), Method(HRESULT, "DeleteVertexShader", [(DWORD, "Handle")]), - Method(HRESULT, "SetVertexShaderConstant", [(DWORD, "Register"), (ConstPointer(Void), "pConstantData"), (DWORD, "ConstantCount")]), - Method(HRESULT, "GetVertexShaderConstant", [(DWORD, "Register"), Out(Pointer(Void), "pConstantData"), (DWORD, "ConstantCount")]), - Method(HRESULT, "GetVertexShaderDeclaration", [(DWORD, "Handle"), Out(Pointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), - Method(HRESULT, "GetVertexShaderFunction", [(DWORD, "Handle"), Out(Pointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), + Method(HRESULT, "SetVertexShaderConstant", [(DWORD, "Register"), (OpaquePointer(Const(Void)), "pConstantData"), (DWORD, "ConstantCount")]), + Method(HRESULT, "GetVertexShaderConstant", [(DWORD, "Register"), Out(OpaquePointer(Void), "pConstantData"), (DWORD, "ConstantCount")]), + Method(HRESULT, "GetVertexShaderDeclaration", [(DWORD, "Handle"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), + Method(HRESULT, "GetVertexShaderFunction", [(DWORD, "Handle"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), Method(HRESULT, "SetStreamSource", [(UINT, "StreamNumber"), (PDIRECT3DVERTEXBUFFER8, "pStreamData"), (UINT, "Stride")]), Method(HRESULT, "GetStreamSource", [(UINT, "StreamNumber"), Out(Pointer(PDIRECT3DVERTEXBUFFER8), "ppStreamData"), Out(Pointer(UINT), "pStride")]), Method(HRESULT, "SetIndices", [(PDIRECT3DINDEXBUFFER8, "pIndexData"), (UINT, "BaseVertexIndex")]), @@ -185,9 +185,9 @@ IDirect3DDevice8.methods += [ Method(HRESULT, "SetPixelShader", [(DWORD, "Handle")]), Method(HRESULT, "GetPixelShader", [Out(Pointer(DWORD), "pHandle")]), Method(HRESULT, "DeletePixelShader", [(DWORD, "Handle")]), - Method(HRESULT, "SetPixelShaderConstant", [(DWORD, "Register"), (ConstPointer(Void), "pConstantData"), (DWORD, "ConstantCount")]), - Method(HRESULT, "GetPixelShaderConstant", [(DWORD, "Register"), Out(Pointer(Void), "pConstantData"), (DWORD, "ConstantCount")]), - Method(HRESULT, "GetPixelShaderFunction", [(DWORD, "Handle"), Out(Pointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), + Method(HRESULT, "SetPixelShaderConstant", [(DWORD, "Register"), (OpaquePointer(Const(Void)), "pConstantData"), (DWORD, "ConstantCount")]), + Method(HRESULT, "GetPixelShaderConstant", [(DWORD, "Register"), Out(OpaquePointer(Void), "pConstantData"), (DWORD, "ConstantCount")]), + Method(HRESULT, "GetPixelShaderFunction", [(DWORD, "Handle"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), Method(HRESULT, "DrawRectPatch", [(UINT, "Handle"), (ConstPointer(Float), "pNumSegs"), (ConstPointer(D3DRECTPATCH_INFO), "pRectPatchInfo")]), Method(HRESULT, "DrawTriPatch", [(UINT, "Handle"), (ConstPointer(Float), "pNumSegs"), (ConstPointer(D3DTRIPATCH_INFO), "pTriPatchInfo")]), Method(HRESULT, "DeletePatch", [(UINT, "Handle")]), @@ -200,8 +200,8 @@ IDirect3DSwapChain8.methods += [ IDirect3DResource8.methods += [ Method(HRESULT, "GetDevice", [Out(Pointer(PDIRECT3DDEVICE8), "ppDevice")]), - Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (ConstPointer(Void), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]), - Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), Out(Pointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), + Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (OpaquePointer(Const(Void)), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]), + Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]), Method(DWORD, "SetPriority", [(DWORD, "PriorityNew")]), Method(DWORD, "GetPriority", []), @@ -253,10 +253,10 @@ IDirect3DIndexBuffer8.methods += [ IDirect3DSurface8.methods += [ Method(HRESULT, "GetDevice", [Out(Pointer(PDIRECT3DDEVICE8), "ppDevice")]), - Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (ConstPointer(Void), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]), - Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), Out(Pointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), + Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (OpaquePointer(Const(Void)), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]), + Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]), - Method(HRESULT, "GetContainer", [(REFIID, "riid"), Out(Pointer(Pointer(Void)), "ppContainer")]), + Method(HRESULT, "GetContainer", [(REFIID, "riid"), Out(Pointer(OpaquePointer(Void)), "ppContainer")]), Method(HRESULT, "GetDesc", [Out(Pointer(D3DSURFACE_DESC), "pDesc")]), Method(HRESULT, "LockRect", [Out(Pointer(D3DLOCKED_RECT), "pLockedRect"), (ConstPointer(RECT), "pRect"), (DWORD, "Flags")]), Method(HRESULT, "UnlockRect", []), @@ -264,10 +264,10 @@ IDirect3DSurface8.methods += [ IDirect3DVolume8.methods += [ Method(HRESULT, "GetDevice", [Out(Pointer(PDIRECT3DDEVICE8), "ppDevice")]), - Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (ConstPointer(Void), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]), - Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), Out(Pointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), + Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (OpaquePointer(Const(Void)), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]), + Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]), - Method(HRESULT, "GetContainer", [(REFIID, "riid"), Out(Pointer(Pointer(Void)), "ppContainer")]), + Method(HRESULT, "GetContainer", [(REFIID, "riid"), Out(Pointer(OpaquePointer(Void)), "ppContainer")]), Method(HRESULT, "GetDesc", [Out(Pointer(D3DVOLUME_DESC), "pDesc")]), Method(HRESULT, "LockBox", [Out(Pointer(D3DLOCKED_BOX), "pLockedVolume"), (ConstPointer(D3DBOX), "pBox"), (DWORD, "Flags")]), Method(HRESULT, "UnlockBox", []), diff --git a/d3d9.py b/d3d9.py index 5071a5a..7049d1d 100644 --- a/d3d9.py +++ b/d3d9.py @@ -108,7 +108,7 @@ PDIRECT3DDEVICE9EX = WrapPointer(IDirect3DDevice9Ex) PDIRECT3DSWAPCHAIN9EX = WrapPointer(IDirect3DSwapChain9Ex) IDirect3D9.methods += [ - Method(HRESULT, "RegisterSoftwareDevice", [(Pointer(Void), "pInitializeFunction")]), + Method(HRESULT, "RegisterSoftwareDevice", [(OpaquePointer(Void), "pInitializeFunction")]), Method(UINT, "GetAdapterCount", []), Method(HRESULT, "GetAdapterIdentifier", [(UINT, "Adapter"), (DWORD, "Flags"), Out(Pointer(D3DADAPTER_IDENTIFIER9), "pIdentifier")]), Method(UINT, "GetAdapterModeCount", [(UINT, "Adapter"), (D3DFORMAT, "Format")]), @@ -205,8 +205,8 @@ IDirect3DDevice9.methods += [ Method(Float, "GetNPatchMode", []), Method(HRESULT, "DrawPrimitive", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "StartVertex"), (UINT, "PrimitiveCount")]), Method(HRESULT, "DrawIndexedPrimitive", [(D3DPRIMITIVETYPE, "PrimitiveType"), (INT, "BaseVertexIndex"), (UINT, "MinVertexIndex"), (UINT, "NumVertices"), (UINT, "startIndex"), (UINT, "primCount")]), - Method(HRESULT, "DrawPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "PrimitiveCount"), (ConstPointer(Void), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]), - Method(HRESULT, "DrawIndexedPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "MinVertexIndex"), (UINT, "NumVertices"), (UINT, "PrimitiveCount"), (ConstPointer(Void), "pIndexData"), (D3DFORMAT, "IndexDataFormat"), (ConstPointer(Void), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]), + Method(HRESULT, "DrawPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "PrimitiveCount"), (OpaquePointer(Const(Void)), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]), + Method(HRESULT, "DrawIndexedPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "MinVertexIndex"), (UINT, "NumVertices"), (UINT, "PrimitiveCount"), (OpaquePointer(Const(Void)), "pIndexData"), (D3DFORMAT, "IndexDataFormat"), (OpaquePointer(Const(Void)), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]), Method(HRESULT, "ProcessVertices", [(UINT, "SrcStartIndex"), (UINT, "DestIndex"), (UINT, "VertexCount"), (PDIRECT3DVERTEXBUFFER9, "pDestBuffer"), (PDIRECT3DVERTEXDECLARATION9, "pVertexDecl"), (DWORD, "Flags")]), Method(HRESULT, "CreateVertexDeclaration", [(ConstPointer(D3DVERTEXELEMENT9), "pVertexElements"), Out(Pointer(PDIRECT3DVERTEXDECLARATION9), "ppDecl")]), Method(HRESULT, "SetVertexDeclaration", [(PDIRECT3DVERTEXDECLARATION9, "pDecl")]), @@ -261,8 +261,8 @@ IDirect3DSwapChain9.methods += [ IDirect3DResource9.methods += [ Method(HRESULT, "GetDevice", [Out(Pointer(PDIRECT3DDEVICE9), "ppDevice")]), - Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (ConstPointer(Void), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]), - Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), Out(Pointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), + Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (OpaquePointer(Const(Void)), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]), + Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]), Method(DWORD, "SetPriority", [(DWORD, "PriorityNew")]), Method(DWORD, "GetPriority", []), @@ -277,12 +277,12 @@ IDirect3DVertexDeclaration9.methods += [ IDirect3DVertexShader9.methods += [ Method(HRESULT, "GetDevice", [Out(Pointer(PDIRECT3DDEVICE9), "ppDevice")]), - Method(HRESULT, "GetFunction", [Out(Pointer(Void), "pData"), Out(Pointer(UINT), "pSizeOfData")]), + Method(HRESULT, "GetFunction", [Out(OpaquePointer(Void), "pData"), Out(Pointer(UINT), "pSizeOfData")]), ] IDirect3DPixelShader9.methods += [ Method(HRESULT, "GetDevice", [Out(Pointer(PDIRECT3DDEVICE9), "ppDevice")]), - Method(HRESULT, "GetFunction", [Out(Pointer(Void), "pData"), Out(Pointer(UINT), "pSizeOfData")]), + Method(HRESULT, "GetFunction", [Out(OpaquePointer(Void), "pData"), Out(Pointer(UINT), "pSizeOfData")]), ] IDirect3DBaseTexture9.methods += [ @@ -319,19 +319,19 @@ IDirect3DCubeTexture9.methods += [ ] IDirect3DVertexBuffer9.methods += [ - Method(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), Out(Pointer(Pointer(Void)), "ppbData"), (DWORD, "Flags")]), + Method(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), Out(Pointer(OpaquePointer(Void)), "ppbData"), (DWORD, "Flags")]), Method(HRESULT, "Unlock", []), Method(HRESULT, "GetDesc", [Out(Pointer(D3DVERTEXBUFFER_DESC), "pDesc")]), ] IDirect3DIndexBuffer9.methods += [ - Method(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), Out(Pointer(Pointer(Void)), "ppbData"), (DWORD, "Flags")]), + Method(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), Out(Pointer(OpaquePointer(Void)), "ppbData"), (DWORD, "Flags")]), Method(HRESULT, "Unlock", []), Method(HRESULT, "GetDesc", [Out(Pointer(D3DINDEXBUFFER_DESC), "pDesc")]), ] IDirect3DSurface9.methods += [ - Method(HRESULT, "GetContainer", [(REFIID, "riid"), Out(Pointer(Pointer(Void)), "ppContainer")]), + Method(HRESULT, "GetContainer", [(REFIID, "riid"), Out(Pointer(OpaquePointer(Void)), "ppContainer")]), Method(HRESULT, "GetDesc", [Out(Pointer(D3DSURFACE_DESC), "pDesc")]), Method(HRESULT, "LockRect", [Out(Pointer(D3DLOCKED_RECT), "pLockedRect"), (ConstPointer(RECT), "pRect"), (DWORD, "Flags")]), Method(HRESULT, "UnlockRect", []), @@ -341,10 +341,10 @@ IDirect3DSurface9.methods += [ IDirect3DVolume9.methods += [ Method(HRESULT, "GetDevice", [Out(Pointer(PDIRECT3DDEVICE9), "ppDevice")]), - Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (ConstPointer(Void), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]), - Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), Out(Pointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), + Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (OpaquePointer(Const(Void)), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]), + Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]), Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]), - Method(HRESULT, "GetContainer", [(REFIID, "riid"), Out(Pointer(Pointer(Void)), "ppContainer")]), + Method(HRESULT, "GetContainer", [(REFIID, "riid"), Out(Pointer(OpaquePointer(Void)), "ppContainer")]), Method(HRESULT, "GetDesc", [Out(Pointer(D3DVOLUME_DESC), "pDesc")]), Method(HRESULT, "LockBox", [Out(Pointer(D3DLOCKED_BOX), "pLockedVolume"), (ConstPointer(D3DBOX), "pBox"), (DWORD, "Flags")]), Method(HRESULT, "UnlockBox", []), @@ -355,7 +355,7 @@ IDirect3DQuery9.methods += [ Method(D3DQUERYTYPE, "GetType", []), Method(DWORD, "GetDataSize", []), Method(HRESULT, "Issue", [(DWORD, "dwIssueFlags")]), - Method(HRESULT, "GetData", [Out(Pointer(Void), "pData"), (DWORD, "dwSize"), (DWORD, "dwGetDataFlags")]), + Method(HRESULT, "GetData", [Out(OpaquePointer(Void), "pData"), (DWORD, "dwSize"), (DWORD, "dwGetDataFlags")]), ] IDirect3D9Ex.methods += [ diff --git a/d3d9types.py b/d3d9types.py index 13e21a7..e9e1280 100644 --- a/d3d9types.py +++ b/d3d9types.py @@ -1130,7 +1130,7 @@ D3DVOLUME_DESC = Struct("D3DVOLUME_DESC", [ D3DLOCKED_RECT = Struct("D3DLOCKED_RECT", [ (INT, "Pitch"), - (Pointer(Void), "pBits"), + (OpaquePointer(Void), "pBits"), ]) D3DBOX = Struct("D3DBOX", [ @@ -1145,7 +1145,7 @@ D3DBOX = Struct("D3DBOX", [ D3DLOCKED_BOX = Struct("D3DLOCKED_BOX", [ (INT, "RowPitch"), (INT, "SlicePitch"), - (Pointer(Void), "pBits"), + (OpaquePointer(Void), "pBits"), ]) D3DRANGE = Struct("D3DRANGE", [ diff --git a/ddraw.py b/ddraw.py index aec4c85..8f3f241 100644 --- a/ddraw.py +++ b/ddraw.py @@ -509,8 +509,8 @@ DDDEVICEIDENTIFIER2 = Struct("DDDEVICEIDENTIFIER2", [ ]) LPDDDEVICEIDENTIFIER2 = Pointer(DDDEVICEIDENTIFIER2) -LPCLIPPERCALLBACK = Pointer(Function("DWORD", "CLIPPERCALLBACK", [(LPDIRECTDRAWCLIPPER, "lpDDClipper"), (HWND, "hWnd"), (DWORD, "code"), (LPVOID, "lpContext")])) -LPSURFACESTREAMINGCALLBACK = Pointer(Function("DWORD", "SURFACESTREAMINGCALLBACK", [DWORD])) +LPCLIPPERCALLBACK = FunctionPointer("DWORD", "LPCLIPPERCALLBACK", [(LPDIRECTDRAWCLIPPER, "lpDDClipper"), (HWND, "hWnd"), (DWORD, "code"), (LPVOID, "lpContext")]) +LPSURFACESTREAMINGCALLBACK = FunctionPointer("DWORD", "LPSURFACESTREAMINGCALLBACK", [DWORD]) DDSURFACEDESC = Struct("DDSURFACEDESC", [ (DWORD, "dwSize"), @@ -1240,11 +1240,11 @@ HRESULT = Enum("HRESULT", [ "DDERR_NOTINITIALIZED", ]) -LPDDENUMMODESCALLBACK = Pointer(Function(HRESULT, "LPDDENUMMODESCALLBACK", [LPDDSURFACEDESC, LPVOID])) -LPDDENUMMODESCALLBACK2 = Pointer(Function(HRESULT, "LPDDENUMMODESCALLBACK2", [LPDDSURFACEDESC2, LPVOID])) -LPDDENUMSURFACESCALLBACK = Pointer(Function(HRESULT, "LPDDENUMSURFACESCALLBACK", [LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID])) -LPDDENUMSURFACESCALLBACK2 = Pointer(Function(HRESULT, "LPDDENUMSURFACESCALLBACK2", [LPDIRECTDRAWSURFACE4, LPDDSURFACEDESC2, LPVOID])) -LPDDENUMSURFACESCALLBACK7 = Pointer(Function(HRESULT, "LPDDENUMSURFACESCALLBACK7", [LPDIRECTDRAWSURFACE7, LPDDSURFACEDESC2, LPVOID])) +LPDDENUMMODESCALLBACK = FunctionPointer(HRESULT, "LPDDENUMMODESCALLBACK", [LPDDSURFACEDESC, LPVOID]) +LPDDENUMMODESCALLBACK2 = FunctionPointer(HRESULT, "LPDDENUMMODESCALLBACK2", [LPDDSURFACEDESC2, LPVOID]) +LPDDENUMSURFACESCALLBACK = FunctionPointer(HRESULT, "LPDDENUMSURFACESCALLBACK", [LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID]) +LPDDENUMSURFACESCALLBACK2 = FunctionPointer(HRESULT, "LPDDENUMSURFACESCALLBACK2", [LPDIRECTDRAWSURFACE4, LPDDSURFACEDESC2, LPVOID]) +LPDDENUMSURFACESCALLBACK7 = FunctionPointer(HRESULT, "LPDDENUMSURFACESCALLBACK7", [LPDIRECTDRAWSURFACE7, LPDDSURFACEDESC2, LPVOID]) IDirectDraw.methods += [ Method(HRESULT, "Compact", []), @@ -1587,14 +1587,10 @@ IDirectDrawGammaControl.methods += [ Method(HRESULT, "SetGammaRamp", [DWORD, LPDDGAMMARAMP]), ] -#LPDDENUMCALLBACKA = WrapPointer(Function(BOOL, "LPDDENUMCALLBACKA", [Pointer(GUID), LPSTR, LPSTR, LPVOID])) -#LPDDENUMCALLBACKW = WrapPointer(Function(BOOL, "LPDDENUMCALLBACKW", [Pointer(GUID), LPWSTR, LPWSTR, LPVOID])) -#LPDDENUMCALLBACKEXA = WrapPointer(Function(BOOL, "LPDDENUMCALLBACKEXA", [Pointer(GUID), LPSTR, LPSTR, LPVOID, HMONITOR])) -#LPDDENUMCALLBACKEXW = WrapPointer(Function(BOOL, "LPDDENUMCALLBACKEXW", [Pointer(GUID), LPWSTR, LPWSTR, LPVOID, HMONITOR])) -LPDDENUMCALLBACKA = Alias("LPDDENUMCALLBACKA", Pointer(Void)) -LPDDENUMCALLBACKW = Alias("LPDDENUMCALLBACKW", Pointer(Void)) -LPDDENUMCALLBACKEXA = Alias("LPDDENUMCALLBACKEXA", Pointer(Void)) -LPDDENUMCALLBACKEXW = Alias("LPDDENUMCALLBACKEXW", Pointer(Void)) +LPDDENUMCALLBACKA = FunctionPointer(BOOL, "LPDDENUMCALLBACKA", [Pointer(GUID), LPSTR, LPSTR, LPVOID]) +LPDDENUMCALLBACKW = FunctionPointer(BOOL, "LPDDENUMCALLBACKW", [Pointer(GUID), LPWSTR, LPWSTR, LPVOID]) +LPDDENUMCALLBACKEXA = FunctionPointer(BOOL, "LPDDENUMCALLBACKEXA", [Pointer(GUID), LPSTR, LPSTR, LPVOID, HMONITOR]) +LPDDENUMCALLBACKEXW = FunctionPointer(BOOL, "LPDDENUMCALLBACKEXW", [Pointer(GUID), LPWSTR, LPWSTR, LPVOID, HMONITOR]) DDENUM = Flags(DWORD, [ "DDENUM_ATTACHEDSECONDARYDEVICES", @@ -1613,9 +1609,9 @@ ddraw.functions += [ DllFunction(HRESULT, "DirectDrawEnumerateA", [(LPDDENUMCALLBACKA, "lpCallback"), (LPVOID, "lpContext")]), DllFunction(HRESULT, "DirectDrawEnumerateExW", [(LPDDENUMCALLBACKEXW, "lpCallback"), (LPVOID, "lpContext"), (DDENUM, "dwFlags")]), DllFunction(HRESULT, "DirectDrawEnumerateExA", [(LPDDENUMCALLBACKEXA, "lpCallback"), (LPVOID, "lpContext"), (DDENUM, "dwFlags")]), - DllFunction(HRESULT, "DirectDrawCreate", [(Pointer(GUID), "lpGUID"), (OutPointer(LPDIRECTDRAW), "lplpDD"), (Pointer(IUnknown), "pUnkOuter")]), - DllFunction(HRESULT, "DirectDrawCreateEx", [(Pointer(GUID), "lpGuid"), (OutPointer(LPVOID), "lplpDD"), (REFIID, "iid"), (Pointer(IUnknown), "pUnkOuter")]), - DllFunction(HRESULT, "DirectDrawCreateClipper", [(DWORD, "dwFlags"), (OutPointer(LPDIRECTDRAWCLIPPER), "lplpDDClipper"), (Pointer(IUnknown), "pUnkOuter")]), + DllFunction(HRESULT, "DirectDrawCreate", [(Pointer(GUID), "lpGUID"), Out(Pointer(LPDIRECTDRAW), "lplpDD"), (Pointer(IUnknown), "pUnkOuter")]), + DllFunction(HRESULT, "DirectDrawCreateEx", [(Pointer(GUID), "lpGuid"), Out(Pointer(LPVOID), "lplpDD"), (REFIID, "iid"), (Pointer(IUnknown), "pUnkOuter")]), + DllFunction(HRESULT, "DirectDrawCreateClipper", [(DWORD, "dwFlags"), Out(Pointer(LPDIRECTDRAWCLIPPER), "lplpDDClipper"), (Pointer(IUnknown), "pUnkOuter")]), ] if __name__ == '__main__': diff --git a/windows.py b/windows.py index 245a16b..9c6b96f 100644 --- a/windows.py +++ b/windows.py @@ -139,12 +139,12 @@ RGNDATA = Struct("RGNDATA", [ ]) LPRGNDATA = Pointer(RGNDATA) -HMODULE = Alias("HMODULE", LPVOID) +HMODULE = Opaque("HMODULE") IUnknown = Interface("IUnknown") IUnknown.methods = ( - Method(HRESULT, "QueryInterface", ((REFIID, "riid"), (Pointer(Pointer(Void)), "ppvObj"))), + Method(HRESULT, "QueryInterface", ((REFIID, "riid"), (Pointer(OpaquePointer(Void)), "ppvObj"))), Method(ULONG, "AddRef", ()), Method(ULONG, "Release", ()), )