diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 714ca4cb75..df0ce1aa02 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -132,6 +132,7 @@ void SConfig::SaveSettings() // General ini.Set("General", "LastFilename", m_LastFilename); ini.Set("General", "PauseMovie", m_pauseMovie); + ini.Set("General", "ShowLag", m_showLag); // ISO folders // clear removed folders @@ -262,6 +263,7 @@ void SConfig::LoadSettings() { ini.Get("General", "LastFilename", &m_LastFilename); ini.Get("General", "PauseMovie", &m_pauseMovie, false); + ini.Get("General", "ShowLag", &m_showLag, false); m_ISOFolder.clear(); int numGCMPaths; diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index 8b9a11881c..1235e23eac 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -76,6 +76,7 @@ struct SConfig : NonCopyable bool m_ListTaiwan; bool m_ListUnknown; bool m_pauseMovie; + bool m_showLag; SysConf* m_SYSCONF; diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index bf09915db4..9d59ca1788 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -245,6 +245,7 @@ EVT_MENU(IDM_RECORDEXPORT, CFrame::OnRecordExport) 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_FRAMESTEP, CFrame::OnFrameStep) EVT_MENU(IDM_SCREENSHOT, CFrame::OnScreenshot) EVT_MENU(wxID_PREFERENCES, CFrame::OnConfigMain) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 9aa434f6da..8c8285f842 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -298,6 +298,7 @@ private: void OnRecordReadOnly(wxCommandEvent& event); void OnTASInput(wxCommandEvent& event); void OnTogglePauseMovie(wxCommandEvent& event); + void OnShowLag(wxCommandEvent& event); void OnChangeDisc(wxCommandEvent& event); void OnScreenshot(wxCommandEvent& event); void OnActive(wxActivateEvent& event); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 6691641292..e4a7ed8986 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -144,9 +144,11 @@ void CFrame::CreateMenu() emulationMenu->Append(IDM_TASINPUT, _("TAS Input")); emulationMenu->AppendCheckItem(IDM_TOGGLE_PAUSEMOVIE, _("Pause at end of movie")); emulationMenu->Check(IDM_TOGGLE_PAUSEMOVIE, SConfig::GetInstance().m_pauseMovie); + emulationMenu->AppendCheckItem(IDM_SHOWLAG, _("Show lag counter")); + emulationMenu->Check(IDM_SHOWLAG, SConfig::GetInstance().m_showLag); emulationMenu->Check(IDM_RECORDREADONLY, true); emulationMenu->AppendSeparator(); - + emulationMenu->Append(IDM_FRAMESTEP, GetMenuLabel(HK_FRAME_ADVANCE), wxEmptyString); wxMenu *skippingMenu = new wxMenu; @@ -709,6 +711,13 @@ void CFrame::OnTogglePauseMovie(wxCommandEvent& WXUNUSED (event)) SConfig::GetInstance().m_pauseMovie = !SConfig::GetInstance().m_pauseMovie; SConfig::GetInstance().SaveSettings(); } + +void CFrame::OnShowLag(wxCommandEvent& WXUNUSED (event)) +{ + SConfig::GetInstance().m_showLag = !SConfig::GetInstance().m_showLag; + SConfig::GetInstance().SaveSettings(); +} + void CFrame::OnFrameStep(wxCommandEvent& event) { bool wasPaused = (Core::GetState() == Core::CORE_PAUSE); diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index 854efb6235..36a37de6cc 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -81,6 +81,7 @@ enum IDM_RECORDREADONLY, IDM_TASINPUT, IDM_TOGGLE_PAUSEMOVIE, + IDM_SHOWLAG, IDM_FRAMESTEP, IDM_SCREENSHOT, IDM_BROWSE, diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 81efa3623f..079692b76b 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -45,6 +45,7 @@ #include "BPFunctions.h" #include "AVIDump.h" #include "FPSCounter.h" +#include "ConfigManager.h" namespace DX11 { @@ -1094,11 +1095,18 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons D3D::font.DrawTextScaled(0, 0, 20, 0.0f, 0xFF00FFFF, fps); } + if (SConfig::GetInstance().m_showLag) + { + char lag[10]; + StringCchPrintfA(lag, 1000, "Lag: %d\n", Movie::g_currentLagCount); + D3D::font.DrawTextScaled(0, 18, 20, 0.0f, 0xFF00FFFF, lag); + } + if (g_ActiveConfig.bShowInputDisplay) { char inputDisplay[1000]; StringCchPrintfA(inputDisplay, 1000, Movie::GetInputDisplay().c_str()); - D3D::font.DrawTextScaled(0, 30, 20, 0.0f, 0xFF00FFFF, inputDisplay); + D3D::font.DrawTextScaled(0, 36, 20, 0.0f, 0xFF00FFFF, inputDisplay); } Renderer::DrawDebugText(); @@ -1106,13 +1114,13 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons { char buf[32768]; Statistics::ToString(buf); - D3D::font.DrawTextScaled(0, 30, 20, 0.0f, 0xFF00FFFF, buf); + D3D::font.DrawTextScaled(0, 36, 20, 0.0f, 0xFF00FFFF, buf); } else if (g_ActiveConfig.bOverlayProjStats) { char buf[32768]; Statistics::ToStringProj(buf); - D3D::font.DrawTextScaled(0, 30, 20, 0.0f, 0xFF00FFFF, buf); + D3D::font.DrawTextScaled(0, 36, 20, 0.0f, 0xFF00FFFF, buf); } OSD::DrawMessages(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index a59adb4793..c4e37e761e 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -55,6 +55,7 @@ #include "Movie.h" #include "BPFunctions.h" #include "FPSCounter.h" +#include "ConfigManager.h" namespace DX9 { @@ -1091,23 +1092,31 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons D3D::font.DrawTextScaled(0, 0, 20, 20, 0.0f, 0xFF00FFFF, fps); } + if (SConfig::GetInstance().m_showLag) + { + char lag[10]; + StringCchPrintfA(lag, 1000, "Lag: %d\n", Movie::g_currentLagCount); + D3D::font.DrawTextScaled(0, 18, 20, 20, 0.0f, 0xFF00FFFF, lag); + } + if (g_ActiveConfig.bShowInputDisplay) { char inputDisplay[1000]; StringCchPrintfA(inputDisplay, 1000, Movie::GetInputDisplay().c_str()); - D3D::font.DrawTextScaled(0, 30, 20, 20, 0.0f, 0xFF00FFFF, inputDisplay); + D3D::font.DrawTextScaled(0, 36, 20, 20, 0.0f, 0xFF00FFFF, inputDisplay); } + Renderer::DrawDebugText(); if (g_ActiveConfig.bOverlayStats) { Statistics::ToString(st); - D3D::font.DrawTextScaled(0, 30, 20, 20, 0.0f, 0xFF00FFFF, st); + D3D::font.DrawTextScaled(0, 36, 20, 20, 0.0f, 0xFF00FFFF, st); } else if (g_ActiveConfig.bOverlayProjStats) { Statistics::ToStringProj(st); - D3D::font.DrawTextScaled(0, 30, 20, 20, 0.0f, 0xFF00FFFF, st); + D3D::font.DrawTextScaled(0, 35, 20, 20, 0.0f, 0xFF00FFFF, st); } OSD::DrawMessages(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index a6121e1436..4f74454ece 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -62,6 +62,7 @@ #include "Host.h" #include "BPFunctions.h" #include "FPSCounter.h" +#include "ConfigManager.h" #include "main.h" // Local #ifdef _WIN32 @@ -531,6 +532,9 @@ void Renderer::DrawDebugInfo() if (g_ActiveConfig.bShowFPS) p+=sprintf(p, "FPS: %d\n", s_fps); + if (SConfig::GetInstance().m_showLag) + p+=sprintf(p, "Lag: %d\n", Movie::g_currentLagCount); + if (g_ActiveConfig.bShowInputDisplay) p+=sprintf(p, "%s", Movie::GetInputDisplay().c_str());