diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2015-12-22 12:50:30 +0000 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2015-12-22 12:52:43 +0000 |
commit | 835f6f56495be85457dbd0201be4e47700bcea7e (patch) | |
tree | a03528dcd9fd7392ee1754ad559baa6b36e07226 | |
parent | dd203a8b225e813307febe079ec8b64aff8c8278 (diff) |
d3dretrace: Create a single window per HWND.
-rw-r--r-- | retrace/d3d9retrace.py | 7 | ||||
-rw-r--r-- | retrace/d3dretrace.hpp | 3 | ||||
-rw-r--r-- | retrace/d3dretrace_ws.cpp | 22 |
3 files changed, 31 insertions, 1 deletions
diff --git a/retrace/d3d9retrace.py b/retrace/d3d9retrace.py index 7313acc9..ac6af73b 100644 --- a/retrace/d3d9retrace.py +++ b/retrace/d3d9retrace.py @@ -88,7 +88,12 @@ class D3DRetracer(Retracer): # create windows as neccessary if method.name in ('CreateDevice', 'CreateDeviceEx', 'CreateAdditionalSwapChain'): - print r' HWND hWnd = d3dretrace::createWindow(pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight);' + print r' HWND hWnd = pPresentationParameters->hDeviceWindow;' + if 'hFocusWindow' in method.argNames(): + print r' if (hWnd == NULL) {' + print r' hWnd = hFocusWindow;' + print r' }' + print r' hWnd = d3dretrace::createWindow(hWnd, pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight);' print r' pPresentationParameters->hDeviceWindow = hWnd;' if 'hFocusWindow' in method.argNames(): print r' hFocusWindow = hWnd;' diff --git a/retrace/d3dretrace.hpp b/retrace/d3dretrace.hpp index 034e6165..d0be5773 100644 --- a/retrace/d3dretrace.hpp +++ b/retrace/d3dretrace.hpp @@ -86,6 +86,9 @@ public: HWND createWindow(int width, int height); +HWND +createWindow(HWND hWnd, int width, int height); + void resizeWindow(HWND hWnd, int width, int height); diff --git a/retrace/d3dretrace_ws.cpp b/retrace/d3dretrace_ws.cpp index 22b973cc..62f3a9c7 100644 --- a/retrace/d3dretrace_ws.cpp +++ b/retrace/d3dretrace_ws.cpp @@ -47,6 +47,28 @@ createWindow(int width, int height) } +typedef std::map<HWND, HWND> HWND_MAP; +static HWND_MAP g_hWndMap; + + +HWND +createWindow(HWND hWnd, int width, int height) +{ + HWND_MAP::iterator it; + it = g_hWndMap.find(hWnd); + if (it == g_hWndMap.end()) { + // Create a new window + hWnd = createWindow(width, height); + g_hWndMap[hWnd] = hWnd; + } else { + // Reuse the existing window + hWnd = it->second; + ws::resizeWindow(hWnd, width, height); + } + return hWnd; +} + + void resizeWindow(HWND hWnd, int width, int height) { |