From cb62468fb9fa9140fc636c720cc1dc2ff1264232 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 27 Dec 2014 11:03:29 -0800 Subject: [PATCH] dx9: Fix a shadowing issue in D3D9_Init(). Oops, wasn't getting the right hWnd before. Somehow my dx9 doesn't care. --- Windows/D3D9Base.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Windows/D3D9Base.cpp b/Windows/D3D9Base.cpp index 820421ca71..184e23f943 100644 --- a/Windows/D3D9Base.cpp +++ b/Windows/D3D9Base.cpp @@ -61,7 +61,9 @@ static void GetRes(int &xres, int &yres) { yres = rc.bottom - rc.top; } -bool D3D9_Init(HWND hWnd, bool windowed, std::string *error_message) { +bool D3D9_Init(HWND wnd, bool windowed, std::string *error_message) { + hWnd = wnd; + DIRECT3DCREATE9EX g_pfnCreate9ex; HMODULE hD3D9 = LoadLibrary(TEXT("d3d9.dll")); @@ -137,7 +139,7 @@ bool D3D9_Init(HWND hWnd, bool windowed, std::string *error_message) { pp.MultiSampleType = D3DMULTISAMPLE_NONE; pp.SwapEffect = D3DSWAPEFFECT_DISCARD; pp.Windowed = windowed; - pp.hDeviceWindow = hWnd; + pp.hDeviceWindow = wnd; pp.EnableAutoDepthStencil = true; pp.AutoDepthStencilFormat = D3DFMT_D24S8; pp.PresentationInterval = (g_Config.bVSync) ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE; @@ -149,10 +151,10 @@ bool D3D9_Init(HWND hWnd, bool windowed, std::string *error_message) { //pp.BackBufferCount = 2; //pp.SwapEffect = D3DSWAPEFFECT_FLIPEX; } - hr = d3dEx->CreateDeviceEx(adapterId, D3DDEVTYPE_HAL, hWnd, dwBehaviorFlags, &pp, NULL, &deviceEx); + hr = d3dEx->CreateDeviceEx(adapterId, D3DDEVTYPE_HAL, wnd, dwBehaviorFlags, &pp, NULL, &deviceEx); device = deviceEx; } else { - hr = d3d->CreateDevice(adapterId, D3DDEVTYPE_HAL, hWnd, dwBehaviorFlags, &pp, &device); + hr = d3d->CreateDevice(adapterId, D3DDEVTYPE_HAL, wnd, dwBehaviorFlags, &pp, &device); } if (FAILED(hr)) {