diff --git a/Source/Core/DolphinWX/Src/FrameAui.cpp b/Source/Core/DolphinWX/Src/FrameAui.cpp index 42c5bfcd8d..a3c7914f22 100644 --- a/Source/Core/DolphinWX/Src/FrameAui.cpp +++ b/Source/Core/DolphinWX/Src/FrameAui.cpp @@ -661,10 +661,10 @@ void CFrame::ResetToolbarStyle() void CFrame::TogglePaneStyle(bool On, int EventId) { - wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes(); - for (u32 i = 0; i < AllPanes.GetCount(); ++i) - { - wxAuiPaneInfo& Pane = AllPanes.Item(i); + wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes(); + for (u32 i = 0; i < AllPanes.GetCount(); ++i) + { + wxAuiPaneInfo& Pane = AllPanes.Item(i); if (Pane.window->IsKindOf(CLASSINFO(wxAuiNotebook))) { // Default @@ -685,28 +685,28 @@ void CFrame::TogglePaneStyle(bool On, int EventId) } Pane.Dockable(!m_bNoDocking); } - } + } m_Mgr->Update(); } void CFrame::ToggleNotebookStyle(bool On, long Style) { - wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes(); - for (int i = 0, Count = (int)AllPanes.GetCount(); i < Count; ++i) - { - wxAuiPaneInfo& Pane = AllPanes.Item(i); - if (Pane.window->IsKindOf(CLASSINFO(wxAuiNotebook))) - { - wxAuiNotebook* NB = (wxAuiNotebook*)Pane.window; + wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes(); + for (int i = 0, Count = (int)AllPanes.GetCount(); i < Count; ++i) + { + wxAuiPaneInfo& Pane = AllPanes.Item(i); + if (Pane.window->IsKindOf(CLASSINFO(wxAuiNotebook))) + { + wxAuiNotebook* NB = (wxAuiNotebook*)Pane.window; if (On) NB->SetWindowStyleFlag(NB->GetWindowStyleFlag() | Style); else NB->SetWindowStyleFlag(NB->GetWindowStyleFlag() &~ Style); - NB->Refresh(); - } - } + NB->Refresh(); + } + } } void CFrame::OnSelectPerspective(wxCommandEvent& event) { diff --git a/Source/PluginSpecs/pluginspecs_video.h b/Source/PluginSpecs/pluginspecs_video.h index a08da9bf86..a9f9977784 100644 --- a/Source/PluginSpecs/pluginspecs_video.h +++ b/Source/PluginSpecs/pluginspecs_video.h @@ -21,7 +21,7 @@ typedef void (*TRequestWindowSize)(int _iWidth, int _iHeight, bool _bFullscree typedef void (*TCopiedToXFB)(bool video_update); typedef unsigned int (*TPeekMessages)(void); typedef void (*TUpdateFPSDisplay)(const char* text); // sets the window title -typedef void (*TKeyPressed)(int keycode, bool shift, bool control); // sets the window title +typedef void (*TKeyPressed)(int keycode, bool shift, bool control); // passes keys to the hotkey function enum FieldType { diff --git a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp index 1be8380df8..76c22340f9 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp @@ -84,13 +84,14 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) } break; } + // Tell the hotkey function that this key was pressed g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0); break; /* case WM_SYSKEYDOWN: switch( LOWORD( wParam )) { - case VK_RETURN: // Pressing Esc switch FullScreen/Windowed + case VK_RETURN: // Pressing Alt+Enter switch FullScreen/Windowed if (g_ActiveConfig.bFullscreen) { DestroyWindow(hWnd); @@ -112,26 +113,15 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) break; case WM_CLOSE: - Fifo_ExitLoopNonBlocking(); - //Shutdown(); - // Simple hack to easily exit without stopping. Hope to fix the stopping errors soon. - //ExitProcess(0); + // When the user closes the window, we post an event to the main window to call Stop() + // Which then handles all the necessary steps to Shutdown the core + the plugins + PostMessage( m_hMain, WM_USER, WM_USER_STOP, 0 ); return 0; - case WM_DESTROY: - //Shutdown(); - //PostQuitMessage( 0 ); - break; - case WM_USER: // if (wParam == TOGGLE_FULLSCREEN) // TODO : Insert some toggle fullscreen code here, kthx :d - break; - - case WM_SIZE: - // Reset the D3D Device here - // Also make damn sure that this is not called from inside rendering a frame :P - // Renderer::ReinitView(); + // see TODO ^ upper break; case WM_SYSCOMMAND: diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index b8f7d8d670..f9d85fb11d 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -451,7 +451,7 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y) if (g_VideoInitialize.bOnThread) { - while (Common::AtomicLoadAcquire(s_efbAccessRequested)) + while (Common::AtomicLoadAcquire(s_efbAccessRequested) && s_initialized) Common::YieldCPU(); } else diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp index ff9c5e3840..303abdcbbf 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp @@ -342,7 +342,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) OnKeyDown(lParam); FreeLookInput(wParam, lParam); } - if (wParam == TOGGLE_FULLSCREEN) + if (wParam == TOGGLE_FULLSCREEN && !g_Config.RenderToMainframe) ToggleFullscreen(m_hWnd); break; @@ -479,7 +479,7 @@ void ToggleFullscreen(HWND hParent) SetWindowPos(hParent, NULL, X, Y, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER); // Set new window style FS -> Windowed - SetWindowLong(hParent, GWL_STYLE, WS_OVERLAPPEDWINDOW); + SetWindowLongPtr(hParent, GWL_STYLE, WS_OVERLAPPEDWINDOW); // Eventually show the window! EmuWindow::Show(); @@ -497,18 +497,18 @@ void ToggleFullscreen(HWND hParent) dmScreenSettings.dmSize = sizeof(dmScreenSettings); dmScreenSettings.dmPelsWidth = w_fs; dmScreenSettings.dmPelsHeight = h_fs; - dmScreenSettings.dmBitsPerPel = 32; - dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT; - if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) + dmScreenSettings.dmFields = DM_PELSWIDTH|DM_PELSHEIGHT; + if (ChangeDisplaySettings(&dmScreenSettings, 0) != DISP_CHANGE_SUCCESSFUL) return; // Set new window style -> PopUp - SetWindowLong(hParent, GWL_STYLE, WS_POPUP); - g_Config.bFullscreen = true; - ShowCursor(FALSE); + SetWindowLongPtr(hParent, GWL_STYLE, WS_POPUP); // SetWindowPos to the upper-left corner of the screen - SetWindowPos(hParent, NULL, 0, 0, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER); + SetWindowPos(hParent, HWND_TOP, 0, 0, w_fs, h_fs, SWP_NOREPOSITION); + + g_Config.bFullscreen = true; + ShowCursor(FALSE); // Eventually show the window! EmuWindow::Show(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 393ed3d438..2db8ea7d7e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -410,6 +410,7 @@ void Video_Prepare(void) void Shutdown(void) { s_PluginInitialized = false; + ForceSwap = true; s_efbAccessRequested = FALSE; s_swapRequested = FALSE; @@ -516,7 +517,7 @@ void Video_BeginField(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) // Make sure previous swap request has made it to the screen if (g_VideoInitialize.bOnThread) { - while (Common::AtomicLoadAcquire(s_swapRequested)) + while (Common::AtomicLoadAcquire(s_swapRequested) && s_PluginInitialized) Common::YieldCPU(); } else @@ -569,7 +570,7 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y) if (g_VideoInitialize.bOnThread) { - while (Common::AtomicLoadAcquire(s_efbAccessRequested)) + while (Common::AtomicLoadAcquire(s_efbAccessRequested) && s_PluginInitialized) Common::YieldCPU(); } else