From 69a90ef9e713ff574138875ac42a7d7d4fb5b450 Mon Sep 17 00:00:00 2001 From: Eladash <18193363+elad335@users.noreply.github.com> Date: Thu, 7 Mar 2024 12:33:15 +0200 Subject: [PATCH] rsx/cpu_thread: Fix cpu_thread::get_name() for RSX --- rpcs3/Emu/CPU/CPUThread.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index 53fc8ddb06..5be9cb7809 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -1072,17 +1072,31 @@ void cpu_thread::add_remove_flags(bs_t to_add, bs_t to_remov std::string cpu_thread::get_name() const { // Downcast to correct type - if (id_type() == 1) + switch (id_type()) + { + case 1: { return thread_ctrl::get_name(*static_cast*>(this)); } - - if (id_type() == 2) + case 2: { return thread_ctrl::get_name(*static_cast*>(this)); } + default: + { + if (cpu_thread::get_current() == this && thread_ctrl::get_current()) + { + return thread_ctrl::get_name(); + } - fmt::throw_exception("Invalid cpu_thread type"); + if (id_type() == 0x55) + { + return fmt::format("rsx::thread"); + } + + return fmt::format("Invalid cpu_thread type (0x%x)", id_type()); + } + } } u32 cpu_thread::get_pc() const