]> git.cworth.org Git - apitrace/commitdiff
Handle pointers correctly.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Mon, 7 Jul 2008 09:04:53 +0000 (18:04 +0900)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Mon, 7 Jul 2008 09:04:53 +0000 (18:04 +0900)
base.py
d3d8.py
d3d8types.py
windows.py

diff --git a/base.py b/base.py
index abc0aaac8bd4a309e09e5af320f1b503af80047a..1da4bceec20f23d6ce0159fcda393be5dbf79729 100644 (file)
--- a/base.py
+++ b/base.py
@@ -62,10 +62,14 @@ class Pointer(Type):
         return str(self.type) + " *"
     
     def dump(self, instance):
+        print '    if(%s) {' % instance
         try:
-            print '    g_pLog->TextF("%%p", %s);' % instance
-        except NotImplementedError:
             self.type.dump("*" + instance)
+        except NotImplementedError:
+            print '        g_pLog->TextF("%%p", %s);' % instance
+        print '    }'
+        print '    else'
+        print '        g_pLog->Text("NULL");'
 
     def wrap_instance(self, instance):
         self.type.wrap_instance("*" + instance)
@@ -213,6 +217,9 @@ class Interface(Type):
                 print '    %s result;' % method.type
                 result = 'result = '
             print '    g_pLog->BeginCall("%s");' % (self.name + '::' + method.name)
+            print '    g_pLog->BeginParam("this", "%s *");' % self.name
+            print '    g_pLog->TextF("%p", m_pInstance);'
+            print '    g_pLog->EndParam();'
             for type, name in method.args:
                 if not type.isoutput():
                     type.unwrap_instance(name)
@@ -228,7 +235,7 @@ class Interface(Type):
                     type.wrap_instance(name)
             if method.type is not Void:
                 print '    g_pLog->BeginReturn("%s");' % method.type
-                type.dump("result")
+                method.type.dump("result")
                 print '    g_pLog->EndReturn();'
                 method.type.wrap_instance('result')
             print '    g_pLog->EndCall();'
diff --git a/d3d8.py b/d3d8.py
index 42cd10b31c37953e29335b78cf13203f6093659f..4802149d80d9168436d1ebccc6c1be46f6990f8e 100755 (executable)
--- a/d3d8.py
+++ b/d3d8.py
@@ -190,13 +190,13 @@ IDirect3DCubeTexture8.methods += [
 ]
 
 IDirect3DVertexBuffer8.methods += [
-       Method(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), (Pointer(Pointer(BYTE)), "ppbData"), (DWORD, "Flags")]),
+       Method(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), (OutPointer(Pointer(BYTE)), "ppbData"), (DWORD, "Flags")]),
        Method(HRESULT, "Unlock", []),
        Method(HRESULT, "GetDesc", [(Pointer(D3DVERTEXBUFFER_DESC), "pDesc")]),
 ]
 
 IDirect3DIndexBuffer8.methods += [
-       Method(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), (Pointer(Pointer(BYTE)), "ppbData"), (DWORD, "Flags")]),
+       Method(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), (OutPointer(Pointer(BYTE)), "ppbData"), (DWORD, "Flags")]),
        Method(HRESULT, "Unlock", []),
        Method(HRESULT, "GetDesc", [(Pointer(D3DINDEXBUFFER_DESC), "pDesc")]),
 ]
@@ -206,7 +206,7 @@ IDirect3DSurface8.methods += [
        Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (Const(Pointer(Void)), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]),
        Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), (Pointer(Void), "pData"), (Pointer(DWORD), "pSizeOfData")]),
        Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]),
-       Method(HRESULT, "GetContainer", [(REFIID, "riid"), (Pointer(Pointer(Void)), "ppContainer")]),
+       Method(HRESULT, "GetContainer", [(REFIID, "riid"), (OutPointer(Pointer(Void)), "ppContainer")]),
        Method(HRESULT, "GetDesc", [(Pointer(D3DSURFACE_DESC), "pDesc")]),
        Method(HRESULT, "LockRect", [(Pointer(D3DLOCKED_RECT), "pLockedRect"), (Pointer(Const(RECT)), "pRect"), (DWORD, "Flags")]),
        Method(HRESULT, "UnlockRect", []),
@@ -217,7 +217,7 @@ IDirect3DVolume8.methods += [
        Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (Const(Pointer(Void)), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]),
        Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), (Pointer(Void), "pData"), (Pointer(DWORD), "pSizeOfData")]),
        Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]),
-       Method(HRESULT, "GetContainer", [(REFIID, "riid"), (Pointer(Pointer(Void)), "ppContainer")]),
+       Method(HRESULT, "GetContainer", [(REFIID, "riid"), (OutPointer(Pointer(Void)), "ppContainer")]),
        Method(HRESULT, "GetDesc", [(Pointer(D3DVOLUME_DESC), "pDesc")]),
        Method(HRESULT, "LockBox", [(Pointer(D3DLOCKED_BOX), "pLockedVolume"), (Pointer(Const(D3DBOX)), "pBox"), (DWORD, "Flags")]),
        Method(HRESULT, "UnlockBox", []),
index 8e6d1fa274c3e7447a0cbd2d583cd5c0afbe4e65..b49307f43172ccd538334408922aadbf646be500 100644 (file)
@@ -983,8 +983,6 @@ D3DADAPTER_IDENTIFIER8 = Struct("D3DADAPTER_IDENTIFIER8", (
     (String, "Driver"),
     (String, "Description"),
     (LARGE_INTEGER, "DriverVersion"),
-    (DWORD, "DriverVersionLowPart"),
-    (DWORD, "DriverVersionHighPart"),
     (DWORD, "VendorId"),
     (DWORD, "DeviceId"),
     (DWORD, "SubSysId"),
index f0bb7929f5de4ca703cee6f6758fe5eeaa1ece1f..3b20de8cdc494646b0d756f3afd000024e9ba911 100644 (file)
@@ -13,7 +13,7 @@ DWORD = Intrinsic("DWORD", "0x%08lu")
 
 BOOL = Intrinsic("BOOL", "%i")
 
-LARGE_INTEGER = Intrinsic("LARGE_INTEGER", "0x%x")
+LARGE_INTEGER = Intrinsic("LARGE_INTEGER", "0x%llx")
 
 HRESULT = Alias("HRESULT", Int)