Fix same object count being used for all frames in the FIFO analyzer
If the number of objects varied, this would result in either missing objects on some frames, or too many objects on some frames; the latter case could cause crashes. Since it used the current frame to get the count, if the FIFO is started before the FIFO analyzer is opened, then the current frame is effectively random, making it hard to reproduce consistently. This issue has existed since the FIFO analyzer was implemented for Qt.
This commit is contained in:
parent
ef75381a84
commit
28b71c65af
|
@ -198,16 +198,21 @@ u32 FifoPlayer::GetMaxObjectCount() const
|
|||
return result;
|
||||
}
|
||||
|
||||
u32 FifoPlayer::GetFrameObjectCount() const
|
||||
u32 FifoPlayer::GetFrameObjectCount(u32 frame) const
|
||||
{
|
||||
if (m_CurrentFrame < m_FrameInfo.size())
|
||||
if (frame < m_FrameInfo.size())
|
||||
{
|
||||
return (u32)(m_FrameInfo[m_CurrentFrame].objectStarts.size());
|
||||
return static_cast<u32>(m_FrameInfo[frame].objectStarts.size());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 FifoPlayer::GetCurrentFrameObjectCount() const
|
||||
{
|
||||
return GetFrameObjectCount(m_CurrentFrame);
|
||||
}
|
||||
|
||||
void FifoPlayer::SetFrameRangeStart(u32 start)
|
||||
{
|
||||
if (m_File)
|
||||
|
|
|
@ -75,7 +75,8 @@ public:
|
|||
|
||||
FifoDataFile* GetFile() const { return m_File.get(); }
|
||||
u32 GetMaxObjectCount() const;
|
||||
u32 GetFrameObjectCount() const;
|
||||
u32 GetFrameObjectCount(u32 frame) const;
|
||||
u32 GetCurrentFrameObjectCount() const;
|
||||
u32 GetCurrentFrameNum() const { return m_CurrentFrame; }
|
||||
const AnalyzedFrameInfo& GetAnalyzedFrameInfo(u32 frame) const { return m_FrameInfo[frame]; }
|
||||
// Frame range
|
||||
|
|
|
@ -139,23 +139,22 @@ void FIFOAnalyzer::UpdateTree()
|
|||
|
||||
auto* file = FifoPlayer::GetInstance().GetFile();
|
||||
|
||||
int object_count = FifoPlayer::GetInstance().GetFrameObjectCount();
|
||||
int frame_count = file->GetFrameCount();
|
||||
|
||||
for (int i = 0; i < frame_count; i++)
|
||||
const u32 frame_count = file->GetFrameCount();
|
||||
for (u32 frame = 0; frame < frame_count; frame++)
|
||||
{
|
||||
auto* frame_item = new QTreeWidgetItem({tr("Frame %1").arg(i)});
|
||||
auto* frame_item = new QTreeWidgetItem({tr("Frame %1").arg(frame)});
|
||||
|
||||
recording_item->addChild(frame_item);
|
||||
|
||||
for (int j = 0; j < object_count; j++)
|
||||
const u32 object_count = FifoPlayer::GetInstance().GetFrameObjectCount(frame);
|
||||
for (u32 object = 0; object < object_count; object++)
|
||||
{
|
||||
auto* object_item = new QTreeWidgetItem({tr("Object %1").arg(j)});
|
||||
auto* object_item = new QTreeWidgetItem({tr("Object %1").arg(object)});
|
||||
|
||||
frame_item->addChild(object_item);
|
||||
|
||||
object_item->setData(0, FRAME_ROLE, i);
|
||||
object_item->setData(0, OBJECT_ROLE, j);
|
||||
object_item->setData(0, FRAME_ROLE, frame);
|
||||
object_item->setData(0, OBJECT_ROLE, object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ void FIFOPlayerWindow::UpdateInfo()
|
|||
m_info_label->setText(
|
||||
tr("%1 frame(s)\n%2 object(s)\nCurrent Frame: %3")
|
||||
.arg(QString::number(file->GetFrameCount()),
|
||||
QString::number(FifoPlayer::GetInstance().GetFrameObjectCount()),
|
||||
QString::number(FifoPlayer::GetInstance().GetCurrentFrameObjectCount()),
|
||||
QString::number(FifoPlayer::GetInstance().GetCurrentFrameNum())));
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue