diff --git a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp index f33c38289b..d30678e207 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp @@ -130,10 +130,11 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) break; case WM_CLOSE: - Fifo_ExitLoopNonBlocking(); - Shutdown(); + //Fifo_ExitLoopNonBlocking(); + //Shutdown(); + PostMessage( m_hParent, WM_USER, OPENGL_WM_USER_STOP, 0 ); // Simple hack to easily exit without stopping. Hope to fix the stopping errors soon. - ExitProcess(0); + //ExitProcess(0); return 0; case WM_DESTROY: @@ -184,16 +185,16 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T m_hInstance = hInstance; RegisterClassEx( &wndClass ); - if (parent) + if (g_Config.RenderToMainframe) { - m_hWnd = CreateWindow(m_szClassName, title, - WS_CHILD, - CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT, - parent, NULL, hInstance, NULL ); - m_hParent = parent; - ShowWindow(m_hWnd, SW_SHOWMAXIMIZED); + m_hWnd = CreateWindowEx(0, m_szClassName, title, WS_CHILD, + 0, 0, width, height, + m_hParent, NULL, hInstance, NULL); + + if( !g_Config.bFullscreen ) + SetWindowPos( GetParent(m_hParent), NULL, 0, 0, width, height, SWP_NOMOVE|SWP_NOZORDER ); } else { @@ -210,14 +211,9 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T rc.top = (1024 - h)/2; rc.bottom = rc.top + h; - m_hWnd = CreateWindow(m_szClassName, title, - style, + m_hWnd = CreateWindowEx(0, m_szClassName, title, style, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, - parent, NULL, hInstance, NULL ); - - g_winstyle = GetWindowLong( m_hWnd, GWL_STYLE ); - g_winstyle &= ~WS_MAXIMIZE & ~WS_MINIMIZE; // remove minimize/maximize style - + NULL, NULL, hInstance, NULL ); } return m_hWnd; @@ -225,14 +221,16 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T void Show() { - ShowWindow(m_hWnd, SW_SHOW); + ShowWindow(m_hWnd, SW_SHOWNORMAL); BringWindowToTop(m_hWnd); UpdateWindow(m_hWnd); } HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title) { - return OpenWindow(hParent, hInstance, 640, 480, title); + int width=640, height=480; + sscanf( g_Config.bFullscreen ? g_Config.cFSResolution : g_Config.cInternalRes, "%dx%d", &width, &height ); + return OpenWindow(hParent, hInstance, width, height, title); } void Close() @@ -244,7 +242,8 @@ void Close() void SetSize(int width, int height) { RECT rc = {0, 0, width, height}; - AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, false); + DWORD style = GetWindowLong(m_hWnd, GWL_STYLE); + AdjustWindowRect(&rc, style, false); int w = rc.right - rc.left; int h = rc.bottom - rc.top; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index 6f6aa210e6..3b5fa59aab 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -118,13 +118,6 @@ bool Renderer::Init() { UpdateActiveConfig(); int fullScreenRes, w_temp, h_temp; - sscanf(g_Config.cInternalRes, "%dx%d", &w_temp, &h_temp); - if (w_temp <= 0 || h_temp <= 0) - { - w_temp = 640; - h_temp = 480; - } - EmuWindow::SetSize(w_temp, h_temp); s_blendMode = 0; int backbuffer_ms_mode = 0; // g_ActiveConfig.iMultisampleMode; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index 8e3720aff5..a62de52e7f 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -235,9 +235,9 @@ void Initialize(void *init) UpdateProjectionHack(g_Config.iPhackvalue); // DX9 projection hack could be disabled by commenting out this line // create the window - if (!g_Config.RenderToMainframe || g_VideoInitialize.pWindowHandle == NULL) // ignore parent for this plugin + /*if (!g_Config.RenderToMainframe || g_VideoInitialize.pWindowHandle == NULL) // ignore parent for this plugin g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create(NULL, g_hInstance, _T("Loading - Please wait.")); - else + else*/ g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create((HWND)g_VideoInitialize.pWindowHandle, g_hInstance, _T("Loading - Please wait.")); if (g_VideoInitialize.pWindowHandle == NULL) {