8 changes: 5 additions & 3 deletions Source/Core/Core/Src/Movie.h
Expand Up @@ -61,8 +61,9 @@ static_assert(sizeof(ControllerState) == 8, "ControllerState should be 8 bytes")
#pragma pack(pop)

// Global declarations
extern bool g_bFrameStep, g_bPolled, g_bReadOnly, g_bDiscChange;
extern bool g_bFrameStep, g_bPolled, g_bReadOnly, g_bDiscChange, g_bClearSave;
extern PlayMode g_playMode;
extern u64 g_titleID;

extern u32 g_framesToSkip, g_frameSkipCounter;

Expand Down Expand Up @@ -117,7 +118,7 @@ struct DTMHeader {
bool bUseXFB;
bool bUseRealXFB;
bool bMemcard;
bool bBlankMC; // Create a new memory card when playing back a movie if true
bool bClearSave; // Create a new memory card when playing back a movie if true
u8 reserved[16]; // Padding for any new config options
u8 discChange[40]; // Name of iso file to switch to, for two disc games.
u8 reserved2[47]; // Make heading 256 bytes, just because we can
Expand Down Expand Up @@ -148,9 +149,10 @@ bool IsSkipIdle();
bool IsDSPHLE();
bool IsFastDiscSpeed();
int GetCPUMode();
bool IsBlankMemcard();
bool IsStartingFromClearSave();
bool IsUsingMemcard();
void SetGraphicsConfig();
void GetSettings();

bool IsUsingPad(int controller);
bool IsUsingWiimote(int wiimote);
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/Src/State.cpp
Expand Up @@ -385,6 +385,7 @@ void LoadAs(const std::string& filename)
g_loadDepth++;

// Save temp buffer for undo load state
if (!Movie::IsJustStartingRecordingInputFromSaveState())
{
std::lock_guard<std::mutex> lk(g_cs_undo_load_buffer);
SaveToBuffer(g_undo_load_buffer);
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/DolphinWX/Src/Frame.cpp
Expand Up @@ -244,6 +244,8 @@ EVT_MENU(IDM_PLAYRECORD, CFrame::OnPlayRecording)
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)
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/DolphinWX/Src/Frame.h
Expand Up @@ -297,6 +297,8 @@ class CFrame : public CRenderFrame
void OnRecordExport(wxCommandEvent& event);
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);
Expand Down
18 changes: 17 additions & 1 deletion Source/Core/DolphinWX/Src/FrameTools.cpp
Expand Up @@ -142,9 +142,13 @@ void CFrame::CreateMenu()
emulationMenu->Append(IDM_RECORDEXPORT, GetMenuLabel(HK_EXPORT_RECORDING));
emulationMenu->Append(IDM_RECORDREADONLY, GetMenuLabel(HK_READ_ONLY_MODE), wxEmptyString, wxITEM_CHECK);
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;
Expand Down Expand Up @@ -702,6 +706,18 @@ void CFrame::OnTASInput(wxCommandEvent& event)
g_TASInputDlg->Show(true);
}

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);
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/DolphinWX/Src/Globals.h
Expand Up @@ -80,6 +80,8 @@ enum
IDM_RECORDEXPORT,
IDM_RECORDREADONLY,
IDM_TASINPUT,
IDM_TOGGLE_PAUSEMOVIE,
IDM_SHOWLAG,
IDM_FRAMESTEP,
IDM_SCREENSHOT,
IDM_BROWSE,
Expand Down
14 changes: 11 additions & 3 deletions Source/Plugins/Plugin_VideoDX11/Src/Render.cpp
Expand Up @@ -45,6 +45,7 @@
#include "BPFunctions.h"
#include "AVIDump.h"
#include "FPSCounter.h"
#include "ConfigManager.h"

namespace DX11
{
Expand Down Expand Up @@ -1094,25 +1095,32 @@ 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();

if (g_ActiveConfig.bOverlayStats)
{
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();
Expand Down
15 changes: 12 additions & 3 deletions Source/Plugins/Plugin_VideoDX9/Src/Render.cpp
Expand Up @@ -55,6 +55,7 @@
#include "Movie.h"
#include "BPFunctions.h"
#include "FPSCounter.h"
#include "ConfigManager.h"

namespace DX9
{
Expand Down Expand Up @@ -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, 36, 20, 20, 0.0f, 0xFF00FFFF, st);
}

OSD::DrawMessages();
Expand Down
4 changes: 4 additions & 0 deletions Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
Expand Up @@ -62,6 +62,7 @@
#include "Host.h"
#include "BPFunctions.h"
#include "FPSCounter.h"
#include "ConfigManager.h"

#include "main.h" // Local
#ifdef _WIN32
Expand Down Expand Up @@ -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());

Expand Down