Skip to content

Commit

Permalink
VideoConfig: Add exclusive mode flag.
Browse files Browse the repository at this point in the history
Allows the UI to easily check the current exclusive mode state.
This simplifies a few checks and prevents the user from ever getting stuck in fullscreen.
  • Loading branch information
CrossVR committed Jan 19, 2015
1 parent 8d69658 commit 332d588
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
11 changes: 4 additions & 7 deletions Source/Core/DolphinWX/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1319,13 +1319,11 @@ void CFrame::OnMouse(wxMouseEvent& event)

void CFrame::DoFullscreen(bool enable_fullscreen)
{
if (g_Config.ExclusiveFullscreenEnabled() &&
!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain &&
Core::GetState() == Core::CORE_PAUSE)
if (g_Config.bExclusiveMode && Core::GetState() == Core::CORE_PAUSE)
{
// A responsive renderer is required for exclusive fullscreen, but the
// renderer can only respond in the running state. Therefore we ignore
// fullscreen switches if we support exclusive fullscreen, but the
// fullscreen switches if we are in exclusive fullscreen, but the
// renderer is not running.
// TODO: Allow the renderer to switch fullscreen modes while paused.
return;
Expand All @@ -1346,11 +1344,10 @@ void CFrame::DoFullscreen(bool enable_fullscreen)
{
m_RenderFrame->ShowFullScreen(true, wxFULLSCREEN_ALL);
}
else if (!g_Config.ExclusiveFullscreenEnabled() ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
else if (!g_Config.bExclusiveMode)
{
// Exiting exclusive fullscreen should be done from a Renderer callback.
// Therefore we don't exit fullscreen from here if we support exclusive mode.
// Therefore we don't exit fullscreen from here if we are in exclusive mode.
m_RenderFrame->ShowFullScreen(false, wxFULLSCREEN_ALL);
}
#endif
Expand Down
10 changes: 4 additions & 6 deletions Source/Core/VideoBackends/D3D/Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ namespace DX11
static u32 s_last_multisample_mode = 0;
static bool s_last_stereo_mode = false;
static bool s_last_xfb_mode = false;
static bool s_last_fullscreen = false;

static Television s_television;

Expand Down Expand Up @@ -231,7 +230,6 @@ Renderer::Renderer(void *&window_handle)
s_last_efb_scale = g_ActiveConfig.iEFBScale;
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
s_last_fullscreen = g_ActiveConfig.bFullscreen;
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height);

SetupDeviceObjects();
Expand Down Expand Up @@ -887,16 +885,16 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
{
if (fullscreen && !exclusive_mode)
{
if (s_last_fullscreen)
if (g_Config.bExclusiveMode)
OSD::AddMessage("Lost exclusive fullscreen.");

s_last_fullscreen = false;

// Exclusive fullscreen is enabled in the configuration, but we're
// not in exclusive mode. Either exclusive fullscreen was turned on
// or the render frame lost focus. When the render frame is in focus
// we can apply exclusive mode.
fullscreen_changed = Host_RendererHasFocus();

g_Config.bExclusiveMode = false;
}
else if (!fullscreen && exclusive_mode)
{
Expand All @@ -922,7 +920,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
// Apply fullscreen state
if (fullscreen_changed)
{
s_last_fullscreen = fullscreen;
g_Config.bExclusiveMode = fullscreen;

if (fullscreen)
OSD::AddMessage("Entered exclusive fullscreen.");
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/VideoCommon/VideoConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ void UpdateActiveConfig()
VideoConfig::VideoConfig()
{
bRunning = false;

// Exclusive fullscreen flags
bFullscreen = false;
bExclusiveMode = false;

// Needed for the first frame, I think
fAspectRatioHackW = 1;
Expand Down
1 change: 1 addition & 0 deletions Source/Core/VideoCommon/VideoConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ struct VideoConfig final
// General
bool bVSync;
bool bFullscreen;
bool bExclusiveMode;
bool bRunning;
bool bWidescreenHack;
int iAspectRatio;
Expand Down

0 comments on commit 332d588

Please sign in to comment.