Update title/status bar when pausing emulation.

This commit is contained in:
Rachel Bryk 2013-01-16 22:52:01 -05:00
parent 6f7f02aeaf
commit e74dc0b41f
3 changed files with 79 additions and 71 deletions

View File

@ -625,6 +625,56 @@ void VideoThrottle()
u32 ElapseTime = (u32)Timer.GetTimeDifference();
if ((ElapseTime >= 1000 && DrawnVideo > 0) || g_requestRefreshInfo)
{
UpdateTitle();
// Reset counter
Timer.Update();
Common::AtomicStore(DrawnFrame, 0);
DrawnVideo = 0;
}
DrawnVideo++;
}
// Executed from GPU thread
// reports if a frame should be skipped or not
// depending on the framelimit set
bool ShouldSkipFrame(int skipped)
{
const u32 TargetFPS = (SConfig::GetInstance().m_Framelimit > 1)
? SConfig::GetInstance().m_Framelimit * 5
: VideoInterface::TargetRefreshRate;
const u32 frames = Common::AtomicLoad(DrawnFrame);
const bool fps_slow = !(Timer.GetTimeDifference() < (frames + skipped) * 1000 / TargetFPS);
return fps_slow;
}
// --- Callbacks for backends / engine ---
// Should be called from GPU thread when a frame is drawn
void Callback_VideoCopiedToXFB(bool video_update)
{
if(video_update)
Common::AtomicIncrement(DrawnFrame);
Movie::FrameUpdate();
}
// Callback_ISOName: Let the DSP emulator get the game name
//
const char *Callback_ISOName()
{
SCoreStartupParameter& params =
SConfig::GetInstance().m_LocalCoreStartupParameter;
if (params.m_strName.length() > 0)
return params.m_strName.c_str();
else
return "";
}
void UpdateTitle()
{
u32 ElapseTime = (u32)Timer.GetTimeDifference();
g_requestRefreshInfo = false;
SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
@ -695,51 +745,6 @@ void VideoThrottle()
Host_UpdateTitle(scm_rev_str);
} else
Host_UpdateTitle(TMessage.c_str());
// Reset counter
Timer.Update();
Common::AtomicStore(DrawnFrame, 0);
DrawnVideo = 0;
}
DrawnVideo++;
}
// Executed from GPU thread
// reports if a frame should be skipped or not
// depending on the framelimit set
bool ShouldSkipFrame(int skipped)
{
const u32 TargetFPS = (SConfig::GetInstance().m_Framelimit > 1)
? SConfig::GetInstance().m_Framelimit * 5
: VideoInterface::TargetRefreshRate;
const u32 frames = Common::AtomicLoad(DrawnFrame);
const bool fps_slow = !(Timer.GetTimeDifference() < (frames + skipped) * 1000 / TargetFPS);
return fps_slow;
}
// --- Callbacks for backends / engine ---
// Should be called from GPU thread when a frame is drawn
void Callback_VideoCopiedToXFB(bool video_update)
{
if(video_update)
Common::AtomicIncrement(DrawnFrame);
Movie::FrameUpdate();
}
// Callback_ISOName: Let the DSP emulator get the game name
//
const char *Callback_ISOName()
{
SCoreStartupParameter& params =
SConfig::GetInstance().m_LocalCoreStartupParameter;
if (params.m_strName.length() > 0)
return params.m_strName.c_str();
else
return "";
}
} // Core

View File

@ -89,6 +89,8 @@ bool ShouldSkipFrame(int skipped);
void VideoThrottle();
void RequestRefreshInfo();
void UpdateTitle();
// waits until all systems are paused and fully idle, and acquires a lock on that state.
// or, if doLock is false, releases a lock on that state and optionally unpauses.
// calls must be balanced (once with doLock true, then once with doLock false) but may be recursive.

View File

@ -951,6 +951,7 @@ void CFrame::DoPause()
Core::SetState(Core::CORE_PAUSE);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxNullCursor);
Core::UpdateTitle();
}
else
{