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()
print r' d3dretrace::pLastDirect3DDevice9 = _this;'
# create windows as neccessary
- if method.name in ('CreateDevice', 'CreateDeviceEx'):
+ if method.name in ('CreateDevice', 'CreateDeviceEx', 'CreateAdditionalSwapChain'):
print r' HWND hWnd = d3dretrace::createWindow(pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight);'
- print r' hFocusWindow = hWnd;'
print r' pPresentationParameters->hDeviceWindow = hWnd;'
+ 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);'
+ print r' hDestWindowOverride = NULL;'
if 'pSharedHandle' in method.argNames():
print r' if (pSharedHandle) {'
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)) {'
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 ' }'