diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 3942fd87c965..8d0f8d2cb038 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -172,6 +172,7 @@ void SConfig::SaveGeneralSettings(IniFile& ini) // General general->Set("LastFilename", m_LastFilename); general->Set("ShowLag", m_ShowLag); + general->Set("ShowFrameCount", m_ShowFrameCount); // ISO folders // Clear removed folders @@ -379,6 +380,7 @@ void SConfig::LoadGeneralSettings(IniFile& ini) general->Get("LastFilename", &m_LastFilename); general->Get("ShowLag", &m_ShowLag, false); + general->Get("ShowFrameCount", &m_ShowFrameCount, false); #ifdef USE_GDBSTUB general->Get("GDBPort", &(m_LocalCoreStartupParameter.iGDBPort), -1); #endif diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index eeadd35a2966..de7e45b316e5 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -86,6 +86,7 @@ struct SConfig : NonCopyable std::string m_WirelessMac; bool m_PauseMovie; bool m_ShowLag; + bool m_ShowFrameCount; std::string m_strMovieAuthor; unsigned int m_FrameSkip; diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 519993e5b510..bd98c974cacb 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -230,6 +230,7 @@ EVT_MENU(IDM_RECORDREADONLY, CFrame::OnRecordReadOnly) EVT_MENU(IDM_TASINPUT, CFrame::OnTASInput) EVT_MENU(IDM_TOGGLE_PAUSEMOVIE, CFrame::OnTogglePauseMovie) EVT_MENU(IDM_SHOWLAG, CFrame::OnShowLag) +EVT_MENU(IDM_SHOWFRAMECOUNT, CFrame::OnShowFrameCount) EVT_MENU(IDM_FRAMESTEP, CFrame::OnFrameStep) EVT_MENU(IDM_SCREENSHOT, CFrame::OnScreenshot) EVT_MENU(wxID_PREFERENCES, CFrame::OnConfigMain) diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h index 7e8988a1f4ad..7fda38f043e8 100644 --- a/Source/Core/DolphinWX/Frame.h +++ b/Source/Core/DolphinWX/Frame.h @@ -270,6 +270,7 @@ class CFrame : public CRenderFrame void OnTASInput(wxCommandEvent& event); void OnTogglePauseMovie(wxCommandEvent& event); void OnShowLag(wxCommandEvent& event); + void OnShowFrameCount(wxCommandEvent& event); void OnChangeDisc(wxCommandEvent& event); void OnScreenshot(wxCommandEvent& event); void OnActive(wxActivateEvent& event); diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 0d62bd5b5348..94db9866b026 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -213,6 +213,8 @@ wxMenuBar* CFrame::CreateMenu() movieMenu->Check(IDM_TOGGLE_PAUSEMOVIE, SConfig::GetInstance().m_PauseMovie); movieMenu->AppendCheckItem(IDM_SHOWLAG, _("Show lag counter")); movieMenu->Check(IDM_SHOWLAG, SConfig::GetInstance().m_ShowLag); + movieMenu->AppendCheckItem(IDM_SHOWFRAMECOUNT, _("Show frame counter")); + movieMenu->Check(IDM_SHOWFRAMECOUNT, SConfig::GetInstance().m_ShowFrameCount); movieMenu->Check(IDM_RECORDREADONLY, true); menubar->Append(movieMenu, _("&Movie")); @@ -717,6 +719,12 @@ void CFrame::OnShowLag(wxCommandEvent& WXUNUSED (event)) SConfig::GetInstance().SaveSettings(); } +void CFrame::OnShowFrameCount(wxCommandEvent& WXUNUSED (event)) +{ + SConfig::GetInstance().m_ShowFrameCount = !SConfig::GetInstance().m_ShowFrameCount; + SConfig::GetInstance().SaveSettings(); +} + void CFrame::OnFrameStep(wxCommandEvent& event) { bool wasPaused = (Core::GetState() == Core::CORE_PAUSE); diff --git a/Source/Core/DolphinWX/Globals.h b/Source/Core/DolphinWX/Globals.h index 9460a6976d0d..3e331ddec1c0 100644 --- a/Source/Core/DolphinWX/Globals.h +++ b/Source/Core/DolphinWX/Globals.h @@ -91,6 +91,7 @@ enum IDM_TASINPUT, IDM_TOGGLE_PAUSEMOVIE, IDM_SHOWLAG, + IDM_SHOWFRAMECOUNT, IDM_FRAMESTEP, IDM_SCREENSHOT, IDM_BROWSE, diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 47b3fe372bd8..8f28379fbf5f 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -896,9 +896,23 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co D3D::context->RSSetViewports(1, &vp); // Finish up the current frame, print some stats - if (g_ActiveConfig.bShowFPS) + if (g_ActiveConfig.bShowFPS || SConfig::GetInstance().m_ShowFrameCount) { - std::string fps = StringFromFormat("FPS: %d\n", m_fps_counter.m_fps); + std::string fps = ""; + if (g_ActiveConfig.bShowFPS) + fps = StringFromFormat("FPS: %d", m_fps_counter.m_fps); + + if (g_ActiveConfig.bShowFPS && SConfig::GetInstance().m_ShowFrameCount) + fps += " - "; + if (SConfig::GetInstance().m_ShowFrameCount) + { + fps += StringFromFormat("Frame: %d", Movie::g_currentFrame); + if (Movie::IsPlayingInput()) + fps += StringFromFormat(" / %d", Movie::g_totalFrames); + } + + fps += "\n"; + D3D::font.DrawTextScaled(0, 0, 20, 0.0f, 0xFF00FFFF, fps); } diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 052f6c0444da..ba49db732ae0 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -709,8 +709,23 @@ void Renderer::DrawDebugInfo() // Draw various messages on the screen, like FPS, statistics, etc. std::string debug_info; - if (g_ActiveConfig.bShowFPS) - debug_info += StringFromFormat("FPS: %d\n", m_fps_counter.m_fps); + if (g_ActiveConfig.bShowFPS || SConfig::GetInstance().m_ShowFrameCount) + { + std::string fps = ""; + if (g_ActiveConfig.bShowFPS) + debug_info += StringFromFormat("FPS: %d", m_fps_counter.m_fps); + + if (g_ActiveConfig.bShowFPS && SConfig::GetInstance().m_ShowFrameCount) + debug_info += " - "; + if (SConfig::GetInstance().m_ShowFrameCount) + { + debug_info += StringFromFormat("Frame: %d", Movie::g_currentFrame); + if (Movie::IsPlayingInput()) + debug_info += StringFromFormat(" / %d", Movie::g_totalFrames); + } + + debug_info += "\n"; + } if (SConfig::GetInstance().m_ShowLag) debug_info += StringFromFormat("Lag: %" PRIu64 "\n", Movie::g_currentLagCount);