threads: replace magic number id_type with thread_class

This commit is contained in:
Megamouse 2024-05-16 01:28:58 +02:00
parent aff2588cce
commit dfee5b9a6c
18 changed files with 260 additions and 167 deletions

View file

@ -29,7 +29,7 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, C
const auto cpu = m_get_cpu();
m_cpu_offset = cpu && cpu->id_type() == 2 ? static_cast<spu_thread&>(*cpu).ls : vm::g_sudo_addr;
m_cpu_offset = cpu && cpu->get_class() == thread_class::spu ? static_cast<spu_thread&>(*cpu).ls : vm::g_sudo_addr;
QVBoxLayout* vbox_panel(new QVBoxLayout());
QHBoxLayout* hbox_panel(new QHBoxLayout());
@ -60,7 +60,7 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, C
vbox_right_panel->addWidget(m_instr);
vbox_right_panel->addWidget(m_preview);
if (cpu && cpu->id_type() == 2)
if (cpu && cpu->get_class() == thread_class::spu)
{
// Print block information as if this instruction is its beginning
vbox_left_panel->addWidget(new QLabel(tr("Block Info: ")));
@ -70,7 +70,7 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, C
m_func_info->setText(qstr(format_spu_func_info(m_pc, cpu)));
}
if (cpu && cpu->id_type() == 2)
if (cpu && cpu->get_class() == thread_class::spu)
{
const auto& spu = static_cast<spu_thread&>(*cpu);
@ -118,7 +118,7 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, C
const be_t<u32> swapped{static_cast<u32>(opcode)};
if (cpu->id_type() == 1)
if (cpu->get_class() == thread_class::ppu)
{
if (!ppu_patch(m_pc, static_cast<u32>(opcode)))
{