Make parameters, arguments etc. constant
This commit is contained in:
parent
18979129f3
commit
e7a95f082d
|
@ -46,7 +46,7 @@ FIFOAnalyzer::FIFOAnalyzer(FifoPlayer& fifo_player) : m_fifo_player(fifo_player)
|
|||
|
||||
UpdateTree();
|
||||
|
||||
auto& settings = Settings::GetQSettings();
|
||||
const auto& settings = Settings::GetQSettings();
|
||||
|
||||
m_object_splitter->restoreState(
|
||||
settings.value(QStringLiteral("fifoanalyzer/objectsplitter")).toByteArray());
|
||||
|
@ -146,7 +146,7 @@ void FIFOAnalyzer::UpdateTree()
|
|||
|
||||
m_tree_widget->addTopLevelItem(recording_item);
|
||||
|
||||
auto* file = m_fifo_player.GetFile();
|
||||
const auto* file = m_fifo_player.GetFile();
|
||||
|
||||
const u32 frame_count = file->GetFrameCount();
|
||||
|
||||
|
@ -201,9 +201,9 @@ namespace
|
|||
class DetailCallback : public OpcodeDecoder::Callback
|
||||
{
|
||||
public:
|
||||
explicit DetailCallback(CPState cpmem) : m_cpmem(cpmem) {}
|
||||
explicit DetailCallback(const CPState& cpmem) : m_cpmem(cpmem) {}
|
||||
|
||||
OPCODE_CALLBACK(void OnCP(u8 command, u32 value))
|
||||
OPCODE_CALLBACK(void OnCP(const u8 command, const u32 value))
|
||||
{
|
||||
// Note: No need to update m_cpmem as it already has the final value for this object
|
||||
|
||||
|
@ -216,7 +216,7 @@ public:
|
|||
.arg(QString::fromStdString(name));
|
||||
}
|
||||
|
||||
OPCODE_CALLBACK(void OnXF(u16 address, u8 count, const u8* data))
|
||||
OPCODE_CALLBACK(void OnXF(const u16 address, const u8 count, const u8* data))
|
||||
{
|
||||
const auto [name, desc] = GetXFTransferInfo(address, count, data);
|
||||
ASSERT(!name.empty());
|
||||
|
@ -235,7 +235,7 @@ public:
|
|||
text += QStringLiteral(" ") + QString::fromStdString(name);
|
||||
}
|
||||
|
||||
OPCODE_CALLBACK(void OnBP(u8 command, u32 value))
|
||||
OPCODE_CALLBACK(void OnBP(const u8 command, const u32 value))
|
||||
{
|
||||
const auto [name, desc] = GetBPRegInfo(command, value);
|
||||
ASSERT(!name.empty());
|
||||
|
@ -245,15 +245,17 @@ public:
|
|||
.arg(value, 6, 16, QLatin1Char('0'))
|
||||
.arg(QString::fromStdString(name));
|
||||
}
|
||||
OPCODE_CALLBACK(void OnIndexedLoad(CPArray array, u32 index, u16 address, u8 size))
|
||||
OPCODE_CALLBACK(void OnIndexedLoad(const CPArray array, const u32 index, const u16 address,
|
||||
const u8 size))
|
||||
{
|
||||
const auto [desc, written] = GetXFIndexedLoadInfo(array, index, address, size);
|
||||
text = QStringLiteral("LOAD INDX %1 %2")
|
||||
.arg(QString::fromStdString(fmt::to_string(array)))
|
||||
.arg(QString::fromStdString(desc));
|
||||
}
|
||||
OPCODE_CALLBACK(void OnPrimitiveCommand(OpcodeDecoder::Primitive primitive, u8 vat,
|
||||
u32 vertex_size, u16 num_vertices, const u8* vertex_data))
|
||||
OPCODE_CALLBACK(void OnPrimitiveCommand(const OpcodeDecoder::Primitive primitive, const u8 vat,
|
||||
const u32 vertex_size, const u16 num_vertices,
|
||||
const u8* vertex_data))
|
||||
{
|
||||
const auto name = fmt::to_string(primitive);
|
||||
|
||||
|
@ -283,14 +285,14 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
OPCODE_CALLBACK(void OnDisplayList(u32 address, u32 size))
|
||||
OPCODE_CALLBACK(void OnDisplayList(const u32 address, const u32 size))
|
||||
{
|
||||
text = QObject::tr("Call display list at %1 with size %2")
|
||||
.arg(address, 8, 16, QLatin1Char('0'))
|
||||
.arg(size, 8, 16, QLatin1Char('0'));
|
||||
}
|
||||
|
||||
OPCODE_CALLBACK(void OnNop(u32 count))
|
||||
OPCODE_CALLBACK(void OnNop(const u32 count))
|
||||
{
|
||||
if (count > 1)
|
||||
text = QStringLiteral("NOP (%1x)").arg(count);
|
||||
|
@ -313,7 +315,7 @@ public:
|
|||
|
||||
OPCODE_CALLBACK(CPState& GetCPState()) { return m_cpmem; }
|
||||
|
||||
OPCODE_CALLBACK(u32 GetVertexSize(u8 vat))
|
||||
OPCODE_CALLBACK(u32 GetVertexSize(const u8 vat))
|
||||
{
|
||||
return VertexLoaderBase::GetVertexSize(GetCPState().vtx_desc, GetCPState().vtx_attr[vat]);
|
||||
}
|
||||
|
@ -472,7 +474,7 @@ void FIFOAnalyzer::FindNext()
|
|||
const int index = m_detail_list->currentRow();
|
||||
ASSERT(index >= 0);
|
||||
|
||||
auto next_result = std::ranges::find_if(
|
||||
const auto next_result = std::ranges::find_if(
|
||||
m_search_results, [index](auto& result) { return result.m_cmd > static_cast<u32>(index); });
|
||||
if (next_result != m_search_results.end())
|
||||
{
|
||||
|
@ -485,7 +487,7 @@ void FIFOAnalyzer::FindPrevious()
|
|||
const int index = m_detail_list->currentRow();
|
||||
ASSERT(index >= 0);
|
||||
|
||||
auto prev_result =
|
||||
const auto prev_result =
|
||||
std::ranges::find_if(m_search_results | std::views::reverse, [index](auto& result) {
|
||||
return result.m_cmd < static_cast<u32>(index);
|
||||
});
|
||||
|
@ -495,7 +497,7 @@ void FIFOAnalyzer::FindPrevious()
|
|||
}
|
||||
}
|
||||
|
||||
void FIFOAnalyzer::ShowSearchResult(size_t index)
|
||||
void FIFOAnalyzer::ShowSearchResult(const size_t index)
|
||||
{
|
||||
if (m_search_results.empty())
|
||||
return;
|
||||
|
@ -526,7 +528,7 @@ class DescriptionCallback : public OpcodeDecoder::Callback
|
|||
public:
|
||||
explicit DescriptionCallback(const CPState& cpmem) : m_cpmem(cpmem) {}
|
||||
|
||||
OPCODE_CALLBACK(void OnBP(u8 command, u32 value))
|
||||
OPCODE_CALLBACK(void OnBP(const u8 command, const u32 value))
|
||||
{
|
||||
const auto [name, desc] = GetBPRegInfo(command, value);
|
||||
ASSERT(!name.empty());
|
||||
|
@ -541,7 +543,7 @@ public:
|
|||
text += QString::fromStdString(desc);
|
||||
}
|
||||
|
||||
OPCODE_CALLBACK(void OnCP(u8 command, u32 value))
|
||||
OPCODE_CALLBACK(void OnCP(const u8 command, const u32 value))
|
||||
{
|
||||
// Note: No need to update m_cpmem as it already has the final value for this object
|
||||
|
||||
|
@ -558,7 +560,7 @@ public:
|
|||
text += QString::fromStdString(desc);
|
||||
}
|
||||
|
||||
OPCODE_CALLBACK(void OnXF(u16 address, u8 count, const u8* data))
|
||||
OPCODE_CALLBACK(void OnXF(const u16 address, const u8 count, const u8* data))
|
||||
{
|
||||
const auto [name, desc] = GetXFTransferInfo(address, count, data);
|
||||
ASSERT(!name.empty());
|
||||
|
@ -573,7 +575,8 @@ public:
|
|||
text += QString::fromStdString(desc);
|
||||
}
|
||||
|
||||
OPCODE_CALLBACK(void OnIndexedLoad(CPArray array, u32 index, u16 address, u8 size))
|
||||
OPCODE_CALLBACK(void OnIndexedLoad(const CPArray array, const u32 index, const u16 address,
|
||||
const u8 size))
|
||||
{
|
||||
const auto [desc, written] = GetXFIndexedLoadInfo(array, index, address, size);
|
||||
|
||||
|
@ -605,7 +608,8 @@ public:
|
|||
}
|
||||
|
||||
OPCODE_CALLBACK(void OnPrimitiveCommand(OpcodeDecoder::Primitive primitive, u8 vat,
|
||||
u32 vertex_size, u16 num_vertices, const u8* vertex_data))
|
||||
const u32 vertex_size, const u16 num_vertices,
|
||||
const u8* vertex_data))
|
||||
{
|
||||
const auto name = fmt::format("{} VAT {}", primitive, vat);
|
||||
|
||||
|
@ -618,8 +622,8 @@ public:
|
|||
const auto& vtx_attr = m_cpmem.vtx_attr[vat];
|
||||
|
||||
u32 i = 0;
|
||||
const auto process_component = [&](VertexComponentFormat cformat, ComponentFormat format,
|
||||
u32 non_indexed_count, u32 indexed_count = 1) {
|
||||
const auto process_component = [&](const VertexComponentFormat cformat, ComponentFormat format,
|
||||
const u32 non_indexed_count, const u32 indexed_count = 1) {
|
||||
u32 count;
|
||||
if (cformat == VertexComponentFormat::NotPresent)
|
||||
return;
|
||||
|
@ -655,7 +659,7 @@ public:
|
|||
}
|
||||
text += QLatin1Char{' '};
|
||||
};
|
||||
const auto process_simple_component = [&](u32 size) {
|
||||
const auto process_simple_component = [&](const u32 size) {
|
||||
for (u32 component_off = 0; component_off < size; component_off++)
|
||||
{
|
||||
text += QStringLiteral("%1").arg(vertex_data[i + component_off], 2, 16, QLatin1Char('0'));
|
||||
|
@ -733,7 +737,7 @@ public:
|
|||
|
||||
OPCODE_CALLBACK(CPState& GetCPState()) { return m_cpmem; }
|
||||
|
||||
OPCODE_CALLBACK(u32 GetVertexSize(u8 vat))
|
||||
OPCODE_CALLBACK(u32 GetVertexSize(const u8 vat))
|
||||
{
|
||||
return VertexLoaderBase::GetVertexSize(GetCPState().vtx_desc, GetCPState().vtx_attr[vat]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue