diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index 79548b5cba..09c71ff6d5 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -352,6 +352,8 @@ void debugger_frame::UpdateUI() } } +Q_DECLARE_METATYPE(std::weak_ptr); + void debugger_frame::UpdateUnitList() { const u64 threads_created = cpu_thread::g_threads_created; @@ -373,9 +375,11 @@ void debugger_frame::UpdateUnitList() m_choice_units->clear(); m_choice_units->addItem(NoThreadString); - const auto on_select = [&](u32, cpu_thread& cpu) + const auto on_select = [&](u32 id, cpu_thread& cpu) { - QVariant var_cpu = QVariant::fromValue(&cpu); + QVariant var_cpu = QVariant::fromValue>( + id >> 24 == 1 ? static_cast>(idm::get_unlocked>(id)) : idm::get_unlocked>(id)); + m_choice_units->addItem(qstr(cpu.get_name()), var_cpu); if (old_cpu == var_cpu) m_choice_units->setCurrentIndex(m_choice_units->count() - 1); }; @@ -405,21 +409,24 @@ void debugger_frame::OnSelectUnit() if (!m_no_thread_selected) { - const auto on_select = [&](u32, cpu_thread& cpu) + if (const auto cpu0 = m_choice_units->currentData().value>().lock()) { - cpu_thread* data = static_cast(m_choice_units->currentData().value()); - return data == &cpu; - }; - - if (auto ppu = idm::select>(on_select)) - { - m_disasm = std::make_unique(CPUDisAsm_InterpreterMode); - cpu = ppu.ptr; - } - else if (auto spu1 = idm::select>(on_select)) - { - m_disasm = std::make_unique(CPUDisAsm_InterpreterMode); - cpu = spu1.ptr; + if (cpu0->id_type() == 1) + { + if (cpu0.get() == idm::check>(cpu0->id)) + { + cpu = cpu0; + m_disasm = std::make_unique(CPUDisAsm_InterpreterMode); + } + } + else + { + if (cpu0.get() == idm::check>(cpu0->id)) + { + cpu = cpu0; + m_disasm = std::make_unique(CPUDisAsm_InterpreterMode); + } + } } }