From 5c3dcc50bcf7e0a4a9f3cebb4c058b16e0987623 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sun, 18 Aug 2013 21:25:16 +0200 Subject: [PATCH] Add an INI option to not loop FIFO playback and stop emulation when it's done --- Source/Core/Core/Src/ConfigManager.cpp | 5 +++++ Source/Core/Core/Src/CoreParameter.cpp | 5 ++++- Source/Core/Core/Src/CoreParameter.h | 3 +++ Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp | 18 +++++++++++++++--- Source/Core/Core/Src/FifoPlayer/FifoPlayer.h | 2 ++ 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 79f7d4686e..bff6665bc1 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -276,6 +276,9 @@ void SConfig::SaveSettings() ini.Set("DSP", "Backend", sBackend); ini.Set("DSP", "Volume", m_Volume); + // Fifo Player + ini.Set("FifoPlayer", "LoopReplay", m_LocalCoreStartupParameter.bLoopFifoReplay); + ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX)); m_SYSCONF->Save(); } @@ -448,6 +451,8 @@ void SConfig::LoadSettings() ini.Get("DSP", "Backend", &sBackend, BACKEND_NULLSOUND); #endif ini.Get("DSP", "Volume", &m_Volume, 100); + + ini.Get("FifoPlayer", "LoopReplay", &m_LocalCoreStartupParameter.bLoopFifoReplay, true); } m_SYSCONF = new SysConf(); diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index bfa8f5d896..579158c7c8 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -47,7 +47,8 @@ SCoreStartupParameter::SCoreStartupParameter() bRenderWindowAutoSize(false), bKeepWindowOnTop(false), bFullscreen(false), bRenderToMain(false), bProgressive(false), bDisableScreenSaver(false), - iPosX(100), iPosY(100), iWidth(800), iHeight(600) + iPosX(100), iPosY(100), iWidth(800), iHeight(600), + bLoopFifoReplay(true) { LoadDefaults(); } @@ -84,6 +85,8 @@ void SCoreStartupParameter::LoadDefaults() iWidth = 800; iHeight = 600; + bLoopFifoReplay = true; + bJITOff = false; // debugger only settings bJITLoadStoreOff = false; bJITLoadStoreFloatingOff = false; diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 23d1b96481..b33d090ed2 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -162,6 +162,9 @@ struct SCoreStartupParameter int iPosX, iPosY, iWidth, iHeight; + // Fifo Player related settings + bool bLoopFifoReplay; + enum EBootBS2 { BOOT_DEFAULT, diff --git a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp index 45455683be..f660b41f9e 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp +++ b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp @@ -6,7 +6,10 @@ #include "FifoPlayer.h" #include "Common.h" +#include "ConfigManager.h" +#include "Core.h" #include "CoreTiming.h" +#include "Host.h" #include "HW/GPFifo.h" #include "HW/Memmap.h" @@ -68,10 +71,18 @@ bool FifoPlayer::Play() { if (m_CurrentFrame >= m_FrameRangeEnd) { - m_CurrentFrame = m_FrameRangeStart; + if (m_Loop) + { + m_CurrentFrame = m_FrameRangeStart; - CoreTiming::downcount = 0; - CoreTiming::Advance(); + CoreTiming::downcount = 0; + CoreTiming::Advance(); + } + else + { + PowerPC::Stop(); + Host_Message(WM_USER_STOP); + } } else { @@ -150,6 +161,7 @@ FifoPlayer::FifoPlayer() : m_FrameWrittenCb(NULL), m_File(NULL) { + m_Loop = SConfig::GetInstance().m_LocalCoreStartupParameter.bLoopFifoReplay; } void FifoPlayer::WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo &info) diff --git a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.h b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.h index 5d23e109f8..bad936cca9 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.h +++ b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.h @@ -86,6 +86,8 @@ private: bool ShouldLoadBP(u8 address); + bool m_Loop; + u32 m_CurrentFrame; u32 m_FrameRangeStart; u32 m_FrameRangeEnd;