]> git.cworth.org Git - apitrace/blobdiff - retrace/d3dretrace.py
Rename d3dsize.hpp to d3d9size.hpp
[apitrace] / retrace / d3dretrace.py
index a43289cc64ea6ef9b855ddc4c851d1c4ee4f4009..14b92ab4fe7503f50945412b4f34453273388865 100644 (file)
@@ -35,7 +35,8 @@ from specs.d3d9 import *
 class D3DRetracer(Retracer):
 
     def retraceApi(self, api):
-        print 'static const GUID GUID_D3DRETRACE = {0x7D71CAC9,0x7F58,0x432C,{0xA9,0x75,0xA1,0x9F,0xCF,0xCE,0xFD,0x14}};'
+        print '// Swizzling mapping for lock addresses'
+        print 'static std::map<void *, void *> _locks;'
         print
 
         self.table_name = 'd3dretrace::%s_callbacks' % api.name.lower()
@@ -54,6 +55,11 @@ class D3DRetracer(Retracer):
             if 'hFocusWindow' in method.argNames():
                 print r'    hFocusWindow = hWnd;'
 
+        if method.name in ('Reset', 'ResetEx'):
+            print r'    if (pPresentationParameters->Windowed) {'
+            print r'        d3dretrace::resizeWindow(pPresentationParameters->hDeviceWindow, pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight);'
+            print r'    }'
+
         # notify frame has been completed
         if method.name == 'Present':
             print r'    retrace::frameComplete(call);'
@@ -67,6 +73,10 @@ class D3DRetracer(Retracer):
 
         Retracer.invokeInterfaceMethod(self, interface, method)
 
+        # process events after presents
+        if method.name == 'Present':
+            print r'    d3dretrace::processEvents();'
+
         # check errors
         if str(method.type) == 'HRESULT':
             print r'    if (FAILED(_result)) {'
@@ -77,12 +87,11 @@ class D3DRetracer(Retracer):
             print '    VOID *_pbData = NULL;'
             print '    size_t _LockedSize = 0;'
             print '    _getLockInfo(_this, %s, _pbData, _LockedSize);' % ', '.join(method.argNames()[:-1])
-            print '    _this->SetPrivateData(GUID_D3DRETRACE, &_pbData, sizeof _pbData, 0);'
+            print '    _locks[_this] = _pbData;'
         
         if method.name in ('Unlock', 'UnlockRect', 'UnlockBox'):
             print '    VOID *_pbData = 0;'
-            print '    DWORD dwSizeOfData = sizeof _pbData;'
-            print '    _this->GetPrivateData(GUID_D3DRETRACE, &_pbData, &dwSizeOfData);'
+            print '    _pbData = _locks[_this];'
             print '    if (_pbData) {'
             print '        retrace::delRegionByPointer(_pbData);'
             print '    }'
@@ -95,7 +104,7 @@ if __name__ == '__main__':
 #include <iostream>
 
 #include "d3d9imports.hpp"
-#include "d3dsize.hpp"
+#include "d3d9size.hpp"
 #include "d3dretrace.hpp"
 
 '''