Make FIFO frame count inclusive
The 'zero frames in the range' check can be removed because now there is always at least 1 frame; of course that might be the same frame over and over again, but that's still useful for e.g. Free Look (and the 1 frame repeating effect already occurred when frame count was exclusive).
This commit is contained in:
parent
263ca79aae
commit
58333d6feb
|
@ -51,7 +51,7 @@ bool FifoPlayer::Open(const std::string& filename)
|
|||
{
|
||||
FifoPlaybackAnalyzer::AnalyzeFrames(m_File.get(), m_FrameInfo);
|
||||
|
||||
m_FrameRangeEnd = m_File->GetFrameCount();
|
||||
m_FrameRangeEnd = m_File->GetFrameCount() - 1;
|
||||
}
|
||||
|
||||
if (m_FileLoadedCb)
|
||||
|
@ -131,13 +131,10 @@ private:
|
|||
|
||||
CPU::State FifoPlayer::AdvanceFrame()
|
||||
{
|
||||
if (m_CurrentFrame >= m_FrameRangeEnd)
|
||||
if (m_CurrentFrame > m_FrameRangeEnd)
|
||||
{
|
||||
if (!m_Loop)
|
||||
return CPU::State::PowerDown;
|
||||
// If there are zero frames in the range then sleep instead of busy spinning
|
||||
if (m_FrameRangeStart >= m_FrameRangeEnd)
|
||||
return CPU::State::Stepping;
|
||||
|
||||
// When looping, reload the contents of all the BP/CP/CF registers.
|
||||
// This ensures that each time the first frame is played back, the state of the
|
||||
|
@ -215,9 +212,9 @@ void FifoPlayer::SetFrameRangeStart(u32 start)
|
|||
{
|
||||
if (m_File)
|
||||
{
|
||||
u32 frameCount = m_File->GetFrameCount();
|
||||
if (start > frameCount)
|
||||
start = frameCount;
|
||||
const u32 lastFrame = m_File->GetFrameCount() - 1;
|
||||
if (start > lastFrame)
|
||||
start = lastFrame;
|
||||
|
||||
m_FrameRangeStart = start;
|
||||
if (m_FrameRangeEnd < start)
|
||||
|
@ -232,9 +229,9 @@ void FifoPlayer::SetFrameRangeEnd(u32 end)
|
|||
{
|
||||
if (m_File)
|
||||
{
|
||||
u32 frameCount = m_File->GetFrameCount();
|
||||
if (end > frameCount)
|
||||
end = frameCount;
|
||||
const u32 lastFrame = m_File->GetFrameCount() - 1;
|
||||
if (end > lastFrame)
|
||||
end = lastFrame;
|
||||
|
||||
m_FrameRangeEnd = end;
|
||||
if (m_FrameRangeStart > end)
|
||||
|
|
|
@ -301,12 +301,12 @@ void FIFOPlayerWindow::OnFIFOLoaded()
|
|||
auto object_count = FifoPlayer::GetInstance().GetMaxObjectCount();
|
||||
auto frame_count = file->GetFrameCount();
|
||||
|
||||
m_frame_range_to->setMaximum(frame_count);
|
||||
m_frame_range_to->setMaximum(frame_count - 1);
|
||||
m_object_range_to->setMaximum(object_count - 1);
|
||||
|
||||
m_frame_range_from->setValue(0);
|
||||
m_object_range_from->setValue(0);
|
||||
m_frame_range_to->setValue(frame_count);
|
||||
m_frame_range_to->setValue(frame_count - 1);
|
||||
m_object_range_to->setValue(object_count - 1);
|
||||
|
||||
UpdateInfo();
|
||||
|
@ -334,8 +334,8 @@ void FIFOPlayerWindow::OnLimitsChanged()
|
|||
|
||||
void FIFOPlayerWindow::UpdateLimits()
|
||||
{
|
||||
m_frame_range_from->setMaximum(std::max(m_frame_range_to->value() - 1, 0));
|
||||
m_frame_range_to->setMinimum(m_frame_range_from->value() + 1);
|
||||
m_frame_range_from->setMaximum(m_frame_range_to->value());
|
||||
m_frame_range_to->setMinimum(m_frame_range_from->value());
|
||||
m_object_range_from->setMaximum(m_object_range_to->value());
|
||||
m_object_range_to->setMinimum(m_object_range_from->value());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue