From 4501aeefbea7a83efc736b1fb604dc27c82c55d8 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Wed, 30 Jul 2014 12:03:09 +0200 Subject: [PATCH 1/3] CFrame: Check borderless fullscreen setting before enabling exclusive fullscreen in the video config. Fixes a bug where "Use Fullscreen" would initialize into exclusive fullscreen regardless of the borderless fullscreen setting. Also relieves the need for the video renderer to check the borderless fullscreen setting each time. --- Source/Core/DolphinWX/Frame.cpp | 3 ++- Source/Core/VideoBackends/D3D/Render.cpp | 2 +- Source/Core/VideoCommon/VideoConfig.h | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index e1ee904653..2f65d77284 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -1244,7 +1244,8 @@ void CFrame::DoFullscreen(bool enable_fullscreen) m_RenderFrame->Raise(); } - g_Config.bFullscreen = enable_fullscreen; + g_Config.bFullscreen = (g_Config.bBorderlessFullscreen || + SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain) ? false : enable_fullscreen; } const CGameListCtrl *CFrame::GetGameListCtrl() const diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 6b69c0a634..30b638d2b9 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -939,7 +939,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl SetWindowSize(fbWidth, fbHeight); const bool windowResized = CheckForResize(); - const bool fullscreen = g_ActiveConfig.ExclusiveFullscreenEnabled() && + const bool fullscreen = g_ActiveConfig.bFullscreen && !SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain; bool fullscreen_changed = s_last_fullscreen_mode != fullscreen; diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index 2ff29bf87b..bf329d658c 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -152,7 +152,6 @@ struct VideoConfig final bool VirtualXFBEnabled() const { return bUseXFB && !bUseRealXFB; } bool EFBCopiesToTextureEnabled() const { return bEFBCopyEnable && bCopyEFBToTexture; } bool EFBCopiesToRamEnabled() const { return bEFBCopyEnable && !bCopyEFBToTexture; } - bool ExclusiveFullscreenEnabled() const { return bFullscreen && !bBorderlessFullscreen; } }; extern VideoConfig g_Config; From 5bbd34637b5717914af6c6e8f84c6532ac5241e4 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Mon, 28 Jul 2014 22:45:53 +0200 Subject: [PATCH 2/3] CFrame: Don't check the video config fullscreen setting. Checking this flag could sometimes incorrectly have the UI assume fullscreen is already off when we're still exiting. --- Source/Core/DolphinWX/Frame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 2f65d77284..1659367488 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -450,7 +450,7 @@ bool CFrame::RendererIsFullscreen() if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE) { - fullscreen = m_RenderFrame->IsFullScreen() && g_Config.bFullscreen; + fullscreen = m_RenderFrame->IsFullScreen(); } #if defined(__APPLE__) From 3b5625c76bef2586af6fbdc98f3ec3ada99db696 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Mon, 28 Jul 2014 23:26:40 +0200 Subject: [PATCH 3/3] VideoConfig: Ignore Borderless Fullscreen setting when the backend does not support exclusive fullscreen. This was expected to be handled by VerifyValidity(), but that only verifies the validity of the INI files. --- Source/Core/DolphinWX/Frame.cpp | 6 +++--- Source/Core/DolphinWX/FrameTools.cpp | 2 +- Source/Core/VideoCommon/VideoConfig.cpp | 2 +- Source/Core/VideoCommon/VideoConfig.h | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 1659367488..057d20172a 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -1189,7 +1189,7 @@ void CFrame::OnMouse(wxMouseEvent& event) void CFrame::DoFullscreen(bool enable_fullscreen) { - if (!g_Config.bBorderlessFullscreen && + if (!g_Config.BorderlessFullscreenEnabled() && !SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain && Core::GetState() == Core::CORE_PAUSE) { @@ -1216,7 +1216,7 @@ void CFrame::DoFullscreen(bool enable_fullscreen) { m_RenderFrame->ShowFullScreen(true, wxFULLSCREEN_ALL); } - else if (g_Config.bBorderlessFullscreen || + else if (g_Config.BorderlessFullscreenEnabled() || SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain) { // Exiting exclusive fullscreen should be done from a Renderer callback. @@ -1244,7 +1244,7 @@ void CFrame::DoFullscreen(bool enable_fullscreen) m_RenderFrame->Raise(); } - g_Config.bFullscreen = (g_Config.bBorderlessFullscreen || + g_Config.bFullscreen = (g_Config.BorderlessFullscreenEnabled() || SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain) ? false : enable_fullscreen; } diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 7da062645f..8ef5fd19f4 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -1104,7 +1104,7 @@ void CFrame::DoStop() // If exclusive fullscreen is not enabled then we can pause the emulation // before we've exited fullscreen. If not then we need to exit fullscreen first. - if (!RendererIsFullscreen() || g_Config.bBorderlessFullscreen || + if (!RendererIsFullscreen() || g_Config.BorderlessFullscreenEnabled() || SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain) { Core::SetState(Core::CORE_PAUSE); diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index cf7685ada6..d6e2177b6b 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -209,7 +209,7 @@ void VideoConfig::VerifyValidity() // TODO: Check iMaxAnisotropy value if (iAdapter < 0 || iAdapter > ((int)backend_info.Adapters.size() - 1)) iAdapter = 0; if (iMultisampleMode < 0 || iMultisampleMode >= (int)backend_info.AAModes.size()) iMultisampleMode = 0; - if (!backend_info.bSupportsExclusiveFullscreen) bBorderlessFullscreen = true; + if (!backend_info.bSupportsExclusiveFullscreen) bBorderlessFullscreen = false; } void VideoConfig::Save(const std::string& ini_file) diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index bf329d658c..ea63a61763 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -152,6 +152,7 @@ struct VideoConfig final bool VirtualXFBEnabled() const { return bUseXFB && !bUseRealXFB; } bool EFBCopiesToTextureEnabled() const { return bEFBCopyEnable && bCopyEFBToTexture; } bool EFBCopiesToRamEnabled() const { return bEFBCopyEnable && !bCopyEFBToTexture; } + bool BorderlessFullscreenEnabled() const { return !backend_info.bSupportsExclusiveFullscreen || bBorderlessFullscreen; } }; extern VideoConfig g_Config;