diff --git a/rpcs3/Emu/CMakeLists.txt b/rpcs3/Emu/CMakeLists.txt index 38013e8a5b..e14fa70571 100644 --- a/rpcs3/Emu/CMakeLists.txt +++ b/rpcs3/Emu/CMakeLists.txt @@ -48,6 +48,7 @@ target_include_directories(rpcs3_emu target_sources(rpcs3_emu PRIVATE ../util/atomic.cpp ../util/console.cpp + ../util/emu_utils.cpp ../util/media_utils.cpp ../util/video_provider.cpp ../util/logs.cpp diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index 520446e991..242dcb9d9f 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -1302,7 +1302,7 @@ cpu_thread* cpu_thread::get_next_cpu() return nullptr; } -std::shared_ptr make_disasm(const cpu_thread* cpu, shared_ptr handle); +extern std::shared_ptr make_disasm(const cpu_thread* cpu, shared_ptr handle); void cpu_thread::dump_all(std::string& ret) const { diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index 625d0502a4..18baa1265a 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -180,6 +180,7 @@ + NotUsing diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index 26723d0dc4..d724997822 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -1342,6 +1342,9 @@ Emu\GPU\RSX\Program + + Utilities + Utilities diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index 56b1ccb0a4..b62efcc716 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -44,41 +44,9 @@ extern atomic_t g_debugger_pause_all_threads_on_bp; extern const ppu_decoder g_ppu_itype; -extern bool is_using_interpreter(thread_class t_class) -{ - switch (t_class) - { - case thread_class::ppu: return g_cfg.core.ppu_decoder != ppu_decoder_type::llvm; - case thread_class::spu: return g_cfg.core.spu_decoder != spu_decoder_type::asmjit && g_cfg.core.spu_decoder != spu_decoder_type::llvm; - default: return true; - } -} +extern bool is_using_interpreter(thread_class t_class); -extern std::shared_ptr make_disasm(const cpu_thread* cpu, shared_ptr handle) -{ - if (!handle) - { - switch (cpu->get_class()) - { - case thread_class::ppu: handle = idm::get_unlocked>(cpu->id); break; - case thread_class::spu: handle = idm::get_unlocked>(cpu->id); break; - default: break; - } - } - - std::shared_ptr result; - - switch (cpu->get_class()) - { - case thread_class::ppu: result = std::make_shared(cpu_disasm_mode::interpreter, vm::g_sudo_addr); break; - case thread_class::spu: result = std::make_shared(cpu_disasm_mode::interpreter, static_cast(cpu)->ls); break; - case thread_class::rsx: result = std::make_shared(cpu_disasm_mode::interpreter, vm::g_sudo_addr, 0, cpu); break; - default: return result; - } - - result->set_cpu_handle(std::move(handle)); - return result; -} +extern std::shared_ptr make_disasm(const cpu_thread* cpu, shared_ptr handle); debugger_frame::debugger_frame(std::shared_ptr gui_settings, QWidget *parent) : custom_dock_widget(tr("Debugger [Press F1 for Help]"), parent) diff --git a/rpcs3/util/emu_utils.cpp b/rpcs3/util/emu_utils.cpp new file mode 100644 index 0000000000..02d4f9865e --- /dev/null +++ b/rpcs3/util/emu_utils.cpp @@ -0,0 +1,47 @@ +#include "stdafx.h" + +#include "Emu/IdManager.h" +#include "Emu/system_config.h" +#include "Emu/Cell/PPUDisAsm.h" +#include "Emu/Cell/SPUDisAsm.h" +#include "Emu/Cell/SPUThread.h" +#include "Emu/Cell/PPUThread.h" +#include "Emu/RSX/RSXDisAsm.h" +#include "Emu/Memory/vm.h" +#include "Utilities/Thread.h" + +bool is_using_interpreter(thread_class t_class) +{ + switch (t_class) + { + case thread_class::ppu: return g_cfg.core.ppu_decoder != ppu_decoder_type::llvm; + case thread_class::spu: return g_cfg.core.spu_decoder != spu_decoder_type::asmjit && g_cfg.core.spu_decoder != spu_decoder_type::llvm; + default: return true; + } +} + +std::shared_ptr make_disasm(const cpu_thread* cpu, shared_ptr handle) +{ + if (!handle) + { + switch (cpu->get_class()) + { + case thread_class::ppu: handle = idm::get_unlocked>(cpu->id); break; + case thread_class::spu: handle = idm::get_unlocked>(cpu->id); break; + default: break; + } + } + + std::shared_ptr result; + + switch (cpu->get_class()) + { + case thread_class::ppu: result = std::make_shared(cpu_disasm_mode::interpreter, vm::g_sudo_addr); break; + case thread_class::spu: result = std::make_shared(cpu_disasm_mode::interpreter, static_cast(cpu)->ls); break; + case thread_class::rsx: result = std::make_shared(cpu_disasm_mode::interpreter, vm::g_sudo_addr, 0, cpu); break; + default: return result; + } + + result->set_cpu_handle(std::move(handle)); + return result; +}