From e74dc0b41f85595edc4dfee9079831a8161c4564 Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Wed, 16 Jan 2013 22:52:01 -0500 Subject: [PATCH] Update title/status bar when pausing emulation. --- Source/Core/Core/Src/Core.cpp | 147 ++++++++++++----------- Source/Core/Core/Src/Core.h | 2 + Source/Core/DolphinWX/Src/FrameTools.cpp | 1 + 3 files changed, 79 insertions(+), 71 deletions(-) diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index be75f67550..dadc89d140 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -625,77 +625,7 @@ void VideoThrottle() u32 ElapseTime = (u32)Timer.GetTimeDifference(); if ((ElapseTime >= 1000 && DrawnVideo > 0) || g_requestRefreshInfo) { - g_requestRefreshInfo = false; - SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter; - - if (ElapseTime == 0) - ElapseTime = 1; - - u32 FPS = Common::AtomicLoad(DrawnFrame) * 1000 / ElapseTime; - u32 VPS = DrawnVideo * 1000 / ElapseTime; - u32 Speed = DrawnVideo * (100 * 1000) / (VideoInterface::TargetRefreshRate * ElapseTime); - - // Settings are shown the same for both extended and summary info - std::string SSettings = StringFromFormat("%s %s", cpu_core_base->GetName(), _CoreParameter.bCPUThread ? "DC" : "SC"); - - // Use extended or summary information. The summary information does not print the ticks data, - // that's more of a debugging interest, it can always be optional of course if someone is interested. - //#define EXTENDED_INFO - #ifdef EXTENDED_INFO - u64 newTicks = CoreTiming::GetTicks(); - u64 newIdleTicks = CoreTiming::GetIdleTicks(); - - u64 diff = (newTicks - ticks) / 1000000; - u64 idleDiff = (newIdleTicks - idleTicks) / 1000000; - - ticks = newTicks; - idleTicks = newIdleTicks; - - float TicksPercentage = (float)diff / (float)(SystemTimers::GetTicksPerSecond() / 1000000) * 100; - - std::string SFPS = StringFromFormat("FPS: %u - VPS: %u - SPEED: %u%%", FPS, VPS, Speed); - SFPS += StringFromFormat(" | CPU: %s%i MHz [Real: %i + IdleSkip: %i] / %i MHz (%s%3.0f%%)", - _CoreParameter.bSkipIdle ? "~" : "", - (int)(diff), - (int)(diff - idleDiff), - (int)(idleDiff), - SystemTimers::GetTicksPerSecond() / 1000000, - _CoreParameter.bSkipIdle ? "~" : "", - TicksPercentage); - - #else // Summary information - std::string SFPS; - if (Movie::IsPlayingInput()) - SFPS = StringFromFormat("VI: %u/%u - Frame: %u/%u - FPS: %u - VPS: %u - SPEED: %u%%", (u32)Movie::g_currentFrame, (u32)Movie::g_totalFrames, (u32)Movie::g_currentInputCount, (u32)Movie::g_totalInputCount, FPS, VPS, Speed); - else if (Movie::IsRecordingInput()) - SFPS = StringFromFormat("VI: %u - Frame: %u - FPS: %u - VPS: %u - SPEED: %u%%", (u32)Movie::g_currentFrame, (u32)Movie::g_currentInputCount, FPS, VPS, Speed); - else - SFPS = StringFromFormat("FPS: %u - VPS: %u - SPEED: %u%%", FPS, VPS, Speed); - #endif - - // This is our final "frame counter" string - std::string SMessage = StringFromFormat("%s | %s", - SSettings.c_str(), SFPS.c_str()); - std::string TMessage = StringFromFormat("%s | ", scm_rev_str) + - SMessage; - - // Show message - g_video_backend->UpdateFPSDisplay(SMessage.c_str()); - - // Update the audio timestretcher with the current speed - if (soundStream) - { - CMixer* pMixer = soundStream->GetMixer(); - pMixer->UpdateSpeed((float)Speed / 100); - } - - if (_CoreParameter.bRenderToMain && - SConfig::GetInstance().m_InterfaceStatusbar) { - Host_UpdateStatusBar(SMessage.c_str()); - Host_UpdateTitle(scm_rev_str); - } else - Host_UpdateTitle(TMessage.c_str()); - + UpdateTitle(); // Reset counter Timer.Update(); @@ -742,4 +672,79 @@ const char *Callback_ISOName() return ""; } +void UpdateTitle() +{ + u32 ElapseTime = (u32)Timer.GetTimeDifference(); + g_requestRefreshInfo = false; + SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter; + + if (ElapseTime == 0) + ElapseTime = 1; + + u32 FPS = Common::AtomicLoad(DrawnFrame) * 1000 / ElapseTime; + u32 VPS = DrawnVideo * 1000 / ElapseTime; + u32 Speed = DrawnVideo * (100 * 1000) / (VideoInterface::TargetRefreshRate * ElapseTime); + + // Settings are shown the same for both extended and summary info + std::string SSettings = StringFromFormat("%s %s", cpu_core_base->GetName(), _CoreParameter.bCPUThread ? "DC" : "SC"); + + // Use extended or summary information. The summary information does not print the ticks data, + // that's more of a debugging interest, it can always be optional of course if someone is interested. + //#define EXTENDED_INFO + #ifdef EXTENDED_INFO + u64 newTicks = CoreTiming::GetTicks(); + u64 newIdleTicks = CoreTiming::GetIdleTicks(); + + u64 diff = (newTicks - ticks) / 1000000; + u64 idleDiff = (newIdleTicks - idleTicks) / 1000000; + + ticks = newTicks; + idleTicks = newIdleTicks; + + float TicksPercentage = (float)diff / (float)(SystemTimers::GetTicksPerSecond() / 1000000) * 100; + + std::string SFPS = StringFromFormat("FPS: %u - VPS: %u - SPEED: %u%%", FPS, VPS, Speed); + SFPS += StringFromFormat(" | CPU: %s%i MHz [Real: %i + IdleSkip: %i] / %i MHz (%s%3.0f%%)", + _CoreParameter.bSkipIdle ? "~" : "", + (int)(diff), + (int)(diff - idleDiff), + (int)(idleDiff), + SystemTimers::GetTicksPerSecond() / 1000000, + _CoreParameter.bSkipIdle ? "~" : "", + TicksPercentage); + + #else // Summary information + std::string SFPS; + if (Movie::IsPlayingInput()) + SFPS = StringFromFormat("VI: %u/%u - Frame: %u/%u - FPS: %u - VPS: %u - SPEED: %u%%", (u32)Movie::g_currentFrame, (u32)Movie::g_totalFrames, (u32)Movie::g_currentInputCount, (u32)Movie::g_totalInputCount, FPS, VPS, Speed); + else if (Movie::IsRecordingInput()) + SFPS = StringFromFormat("VI: %u - Frame: %u - FPS: %u - VPS: %u - SPEED: %u%%", (u32)Movie::g_currentFrame, (u32)Movie::g_currentInputCount, FPS, VPS, Speed); + else + SFPS = StringFromFormat("FPS: %u - VPS: %u - SPEED: %u%%", FPS, VPS, Speed); + #endif + + // This is our final "frame counter" string + std::string SMessage = StringFromFormat("%s | %s", + SSettings.c_str(), SFPS.c_str()); + std::string TMessage = StringFromFormat("%s | ", scm_rev_str) + + SMessage; + + // Show message + g_video_backend->UpdateFPSDisplay(SMessage.c_str()); + + // Update the audio timestretcher with the current speed + if (soundStream) + { + CMixer* pMixer = soundStream->GetMixer(); + pMixer->UpdateSpeed((float)Speed / 100); + } + + if (_CoreParameter.bRenderToMain && + SConfig::GetInstance().m_InterfaceStatusbar) { + Host_UpdateStatusBar(SMessage.c_str()); + Host_UpdateTitle(scm_rev_str); + } else + Host_UpdateTitle(TMessage.c_str()); + } + } // Core diff --git a/Source/Core/Core/Src/Core.h b/Source/Core/Core/Src/Core.h index 312c446744..ac55419db3 100644 --- a/Source/Core/Core/Src/Core.h +++ b/Source/Core/Core/Src/Core.h @@ -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. diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index eb139bd5c1..304c5ff0d3 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -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 {