diff --git a/Source/Core/Core/Src/BootManager.cpp b/Source/Core/Core/Src/BootManager.cpp index 187baf415c..e0fac1da87 100644 --- a/Source/Core/Core/Src/BootManager.cpp +++ b/Source/Core/Core/Src/BootManager.cpp @@ -118,13 +118,12 @@ bool BootCore(const std::string& _rFilename) if (Movie::IsPlayingInput() && Movie::IsConfigSaved()) { - Movie::Init(); StartUp.bCPUThread = Movie::IsDualCore(); StartUp.bSkipIdle = Movie::IsSkipIdle(); StartUp.bDSPHLE = Movie::IsDSPHLE(); StartUp.bProgressive = Movie::IsProgressive(); StartUp.bFastDiscSpeed = Movie::IsFastDiscSpeed(); - if (Movie::IsUsingMemcard() && Movie::IsBlankMemcard()) + if (Movie::IsUsingMemcard() && Movie::IsStartingFromClearSave() && !StartUp.bWii) { if (File::Exists("Movie.raw")) File::Delete("Movie.raw"); diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index dbb9bf52b6..cb274b5e4b 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -131,6 +131,7 @@ void SConfig::SaveSettings() // General ini.Set("General", "LastFilename", m_LastFilename); + ini.Set("General", "ShowLag", m_ShowLag); // ISO folders // clear removed folders @@ -247,6 +248,10 @@ void SConfig::SaveSettings() // GFX Backend ini.Set("Core", "GFXBackend", m_LocalCoreStartupParameter.m_strVideoBackend); + // Movie + ini.Set("Movie", "PauseMovie", m_PauseMovie); + ini.Set("Movie", "Author", m_strMovieAuthor); + ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX)); m_SYSCONF->Save(); } @@ -261,6 +266,7 @@ void SConfig::LoadSettings() // General { ini.Get("General", "LastFilename", &m_LastFilename); + ini.Get("General", "ShowLag", &m_ShowLag, false); m_ISOFolder.clear(); int numGCMPaths; @@ -386,6 +392,10 @@ void SConfig::LoadSettings() // GFX Backend ini.Get("Core", "GFXBackend", &m_LocalCoreStartupParameter.m_strVideoBackend, ""); + + // Movie + ini.Get("General", "PauseMovie", &m_PauseMovie, false); + ini.Get("Movie", "Author", &m_strMovieAuthor, ""); } m_SYSCONF = new SysConf(); diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index ae0dab119a..010dc40d2c 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -76,6 +76,9 @@ struct SConfig : NonCopyable bool m_ListTaiwan; bool m_ListUnknown; std::string m_WirelessMac; + bool m_PauseMovie; + bool m_ShowLag; + std::string m_strMovieAuthor; SysConf* m_SYSCONF; diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp index f65d8c6b8b..c157e55d1b 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp @@ -52,7 +52,7 @@ CEXIMemoryCard::CEXIMemoryCard(const int index) , m_bDirty(false) { m_strFilename = (card_index == 0) ? SConfig::GetInstance().m_strMemoryCardA : SConfig::GetInstance().m_strMemoryCardB; - if (Movie::IsUsingMemcard() && Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsBlankMemcard()) + if (Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsUsingMemcard() && Movie::IsStartingFromClearSave()) m_strFilename = "Movie.raw"; // we're potentially leaking events here, since there's no UnregisterEvent until emu shutdown, but I guess it's inconsequential diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp index e9e2842da8..fe53d46b0c 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -57,7 +57,11 @@ #include "NandPaths.h" #include "CommonPaths.h" #include "IPC_HLE/WII_IPC_HLE_Device_usb.h" +#include "../Movie.h" +#ifdef _WIN32 +#include +#endif std::string CWII_IPC_HLE_Device_es::m_ContentFile; @@ -894,6 +898,52 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz) File::CreateFullPath(tmdPath); File::CreateFullPath(Common::GetTitleDataPath(tmdTitleID)); + + Movie::g_titleID = tmdTitleID; + std::string savePath = Common::GetTitleDataPath(tmdTitleID); + if (Movie::IsRecordingInput()) + { + // TODO: Check for the actual save data + if (File::Exists((savePath + "banner.bin").c_str())) + Movie::g_bClearSave = false; + else + Movie::g_bClearSave = true; + } + + // TODO: Force the game to save to another location, instead of moving the user's save. + if (Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsStartingFromClearSave()) + { + if (File::Exists((savePath + "banner.bin").c_str())) + { + if (File::Exists((savePath + "../backup/").c_str())) + { + // The last run of this game must have been to play back a movie, so their save is already backed up. + File::DeleteDirRecursively(savePath.c_str()); + } + else + { + #ifdef _WIN32 + MoveFile(savePath.c_str(), (savePath + "../backup/").c_str()); + #else + File::CopyDir(savePath.c_str(),(savePath + "../backup/").c_str()); + File::DeleteDirRecursively(savePath.c_str()); + #endif + } + } + } + else if (File::Exists((savePath + "../backup/").c_str())) + { + // Delete the save made by a previous movie, and copy back the user's save. + if (File::Exists((savePath + "banner.bin").c_str())) + File::DeleteDirRecursively(savePath); + #ifdef _WIN32 + MoveFile((savePath + "../backup/").c_str(), savePath.c_str()); + #else + File::CopyDir((savePath + "../backup/").c_str(), savePath.c_str()); + File::DeleteDirRecursively((savePath + "../backup/").c_str()); + #endif + } + if(!File::Exists(tmdPath)) { File::IOFile _pTMDFile(tmdPath, "wb"); diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 28c082ce70..af33458523 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -35,6 +35,7 @@ #include "HW/EXI_Device.h" #include "HW/EXI_Channel.h" #include "HW/DVDInterface.h" +#include "../../Common/Src/NandPaths.h" // large enough for just over 24 hours of single-player recording #define MAX_DTM_LENGTH (40 * 1024 * 1024) @@ -60,19 +61,14 @@ u64 g_currentFrame = 0, g_totalFrames = 0; // VI u64 g_currentLagCount = 0, g_totalLagCount = 0; // just stats u64 g_currentInputCount = 0, g_totalInputCount = 0; // just stats u64 g_recordingStartTime; // seconds since 1970 that recording started -bool bSaveConfig = false; -bool bSkipIdle = false; -bool bDualCore = false; -bool bProgressive = false; -bool bDSPHLE = false; -bool bFastDiscSpeed = false; +bool bSaveConfig, bSkipIdle, bDualCore, bProgressive, bDSPHLE, bFastDiscSpeed = false; +bool bMemcard, g_bClearSave = false; std::string videoBackend = "opengl"; int iCPUCore = 1; -bool bMemcard; -bool bBlankMC = false; bool g_bDiscChange = false; std::string g_discChange = ""; std::string author = ""; +u64 g_titleID = 0; bool g_bRecordingFromSaveState = false; bool g_bPolled = false; @@ -96,6 +92,10 @@ std::string GetInputDisplay() void FrameUpdate() { + if (IsPlayingInput() && g_currentInputCount == g_totalInputCount -1 && SConfig::GetInstance().m_PauseMovie) + { + Core::SetState(Core::CORE_PAUSE); + } g_currentFrame++; if(!g_bPolled) g_currentLagCount++; @@ -105,6 +105,10 @@ void FrameUpdate() g_totalFrames = g_currentFrame; g_totalLagCount = g_currentLagCount; } + if (IsPlayingInput() && IsConfigSaved()) + { + SetGraphicsConfig(); + } if (g_bFrameStep) { @@ -135,11 +139,21 @@ void Init() if (IsPlayingInput()) { ReadHeader(); + if ((strncmp((char *)tmpHeader.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str(), 6))) + { + PanicAlert("The recorded game (%s) is not the same as the selected game (%s)", tmpHeader.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str()); + EndPlayInput(false); + } + } + if (IsRecordingInput()) + { + GetSettings(); } g_frameSkipCounter = g_framesToSkip; memset(&g_padState, 0, sizeof(g_padState)); if (!tmpHeader.bFromSaveState || !IsPlayingInput()) Core::SetStateFileName(""); + for (int i = 0; i < 8; ++i) g_InputDisplay[i].clear(); @@ -307,9 +321,9 @@ int GetCPUMode() return iCPUCore; } -bool IsBlankMemcard() +bool IsStartingFromClearSave() { - return bBlankMC; + return g_bClearSave; } bool IsUsingMemcard() @@ -376,19 +390,17 @@ bool BeginRecordingInput(int controllers) State::SaveAs(tmpStateFilename.c_str()); g_bRecordingFromSaveState = true; + + // This is only done here if starting from save state because otherwise we won't have the titleid. Otherwise it's set in WII_IPC_HLE_Device_es.cpp. + // TODO: find a way to GetTitleDataPath() from Movie::Init() + if (File::Exists((Common::GetTitleDataPath(g_titleID) + "banner.bin").c_str())) + Movie::g_bClearSave = false; + else + Movie::g_bClearSave = true; } g_playMode = MODE_RECORDING; - - bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle; - bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread; - bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive; - bDSPHLE = SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE; - bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed; - videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend; - iCPUCore = SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore; - bBlankMC = !File::Exists(SConfig::GetInstance().m_strMemoryCardA); - bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD; - + GetSettings(); + author = SConfig::GetInstance().m_strMovieAuthor; delete [] tmpInput; tmpInput = new u8[MAX_DTM_LENGTH]; g_currentByte = g_totalBytes = 0; @@ -475,15 +487,6 @@ void SetInputDisplayString(ControllerState padState, int controllerID) if(g_padState.DPadRight) g_InputDisplay[controllerID].append(" RIGHT"); - //if(g_padState.L) - //{ - // g_InputDisplay[controllerID].append(" L"); - //} - //if(g_padState.R) - //{ - // g_InputDisplay[controllerID].append(" R"); - //} - Analog1DToString(g_padState.TriggerL, " L", inp); g_InputDisplay[controllerID].append(inp); @@ -550,8 +553,6 @@ void SetWiiInputDisplayString(int remoteID, u8* const coreData, u8* const accelD g_InputDisplay[controllerID].append("\n"); } - - void RecordInput(SPADStatus *PadStatus, int controllerID) { if(!IsRecordingInput() || !IsUsingPad(controllerID)) @@ -628,24 +629,16 @@ void ReadHeader() bDSPHLE = tmpHeader.bDSPHLE; bFastDiscSpeed = tmpHeader.bFastDiscSpeed; iCPUCore = tmpHeader.CPUCore; - bBlankMC = tmpHeader.bBlankMC; + g_bClearSave = tmpHeader.bClearSave; bMemcard = tmpHeader.bMemcard; } else { + GetSettings(); bSaveConfig = false; - bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle; - bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread; - bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive; - bDSPHLE = SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE; - bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed; - videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend; - bBlankMC = !File::Exists(SConfig::GetInstance().m_strMemoryCardA); - bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD; } - videoBackend.resize(ARRAYSIZE(tmpHeader.videoBackend)); for (int i = 0; i < ARRAYSIZE(tmpHeader.videoBackend);i++) { @@ -695,19 +688,6 @@ bool PlayInput(const char *filename) Movie::LoadInput(filename); } - /* TODO: Put this verification somewhere we have the gameID of the played game - // TODO: Replace with Unique ID - if(tmpHeader.uniqueID != 0) { - PanicAlert("Recording Unique ID Verification Failed"); - goto cleanup; - } - - if(strncmp((char *)tmpHeader.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str(), 6)) { - PanicAlert("The recorded game (%s) is not the same as the selected game (%s)", header.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str()); - goto cleanup; - } - */ - ReadHeader(); g_totalFrames = tmpHeader.frameCount; g_totalLagCount = tmpHeader.lagCount; @@ -762,11 +742,8 @@ void LoadInput(const char *filename) ReadHeader(); if (!g_bReadOnly) { - if (g_rerecords > tmpHeader.numRerecords) - { - tmpHeader.numRerecords = g_rerecords; - } - tmpHeader.numRerecords++; + g_rerecords++; + tmpHeader.numRerecords = g_rerecords; t_record.Seek(0, SEEK_SET); t_record.WriteArray(&tmpHeader, 1); } @@ -892,10 +869,6 @@ void PlayController(SPADStatus *PadStatus, int controllerID) if (!IsPlayingInput() || !IsUsingPad(controllerID) || tmpInput == NULL) return; - if (IsConfigSaved()) - { - SetGraphicsConfig(); - } if (g_currentFrame == 1) { if (tmpHeader.bMemcard) @@ -915,8 +888,7 @@ void PlayController(SPADStatus *PadStatus, int controllerID) return; } - // dtm files don't save the mic button or error bit. not sure if they're actually - // used, but better safe than sorry + // dtm files don't save the mic button or error bit. not sure if they're actually used, but better safe than sorry signed char e = PadStatus->err; memset(PadStatus, 0, sizeof(SPADStatus)); PadStatus->err = e; @@ -992,7 +964,6 @@ void PlayController(SPADStatus *PadStatus, int controllerID) } else { - Core::SetState(Core::CORE_PAUSE); PanicAlert("Change the disc to %s", g_discChange.c_str()); } } @@ -1104,7 +1075,7 @@ void SaveRecording(const char *filename) header.bUseXFB = g_ActiveConfig.bUseXFB; header.bUseRealXFB = g_ActiveConfig.bUseRealXFB; header.bMemcard = bMemcard; - header.bBlankMC = bBlankMC; + header.bClearSave = g_bClearSave; strncpy((char *)header.discChange, g_discChange.c_str(),ARRAYSIZE(header.discChange)); strncpy((char *)header.author, author.c_str(),ARRAYSIZE(header.author)); @@ -1150,4 +1121,19 @@ void SetGraphicsConfig() g_Config.bUseXFB = tmpHeader.bUseXFB; g_Config.bUseRealXFB = tmpHeader.bUseRealXFB; } + +void GetSettings() +{ + bSaveConfig = true; + bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle; + bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread; + bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive; + bDSPHLE = SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE; + bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed; + videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend; + iCPUCore = SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore; + if (!Core::g_CoreStartupParameter.bWii) + g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA); + bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD; +} }; diff --git a/Source/Core/Core/Src/Movie.h b/Source/Core/Core/Src/Movie.h index 94e63a9e2b..0152a66879 100644 --- a/Source/Core/Core/Src/Movie.h +++ b/Source/Core/Core/Src/Movie.h @@ -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; @@ -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 @@ -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); diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index 3f3e367349..ab2313be4e 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -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 lk(g_cs_undo_load_buffer); SaveToBuffer(g_undo_load_buffer); diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 6b0e7b7678..9d59ca1788 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -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) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 770d459220..8c8285f842 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -297,6 +297,8 @@ private: 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); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 86cd372f51..a1f4355dd7 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -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; @@ -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); diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index 8089a2622c..36a37de6cc 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -80,6 +80,8 @@ enum IDM_RECORDEXPORT, 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..6a1a6c868c 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..b0997225cf 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, 36, 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..cce93d2115 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());