diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 8b32f895a1..fa24b9368b 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1419,7 +1419,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no { data2 = (SYS_MEMORY_PAGE_FAULT_TYPE_PPU_THREAD << 32) | cpu->id; } - else + else if (cpu->id_type() == 2) { const auto& spu = static_cast(*cpu); diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index 7f7a56ad3d..ef93cb4c77 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -671,7 +671,7 @@ bool cpu_thread::check_state() noexcept } verify(HERE), cpu_can_stop || !retval; - verify(HERE), cpu_can_stop || !(state & cpu_flag::wait); + verify(HERE), cpu_can_stop || Emu.IsStopped() || !(state & cpu_flag::wait); return retval; } diff --git a/rpcs3/Emu/Memory/vm.cpp b/rpcs3/Emu/Memory/vm.cpp index 6ef13a4eca..6c281a41e4 100644 --- a/rpcs3/Emu/Memory/vm.cpp +++ b/rpcs3/Emu/Memory/vm.cpp @@ -570,13 +570,15 @@ namespace vm if (_cpu && _cpu->id_type() == 1) { - thread_ctrl::emergency_exit("vm::reservation_escape"); + // TODO: PPU g_escape } if (_cpu && _cpu->id_type() == 2) { spu_runtime::g_escape(static_cast(_cpu)); } + + thread_ctrl::emergency_exit("vm::reservation_escape"); } static void _page_map(u32 addr, u8 flags, u32 size, utils::shm* shm, std::pair>>* (*search_shm)(vm::block_t* block, utils::shm* shm)) diff --git a/rpcs3/Emu/RSX/Capture/rsx_replay.cpp b/rpcs3/Emu/RSX/Capture/rsx_replay.cpp index 6cc3b39f86..e8f16c04c0 100644 --- a/rpcs3/Emu/RSX/Capture/rsx_replay.cpp +++ b/rpcs3/Emu/RSX/Capture/rsx_replay.cpp @@ -168,7 +168,7 @@ namespace rsx } } - void rsx_replay_thread::on_task() + void rsx_replay_thread::cpu_task() { be_t context_id = allocate_context(); @@ -239,9 +239,4 @@ namespace rsx std::this_thread::sleep_for(10ms); } } - - void rsx_replay_thread::operator()() - { - on_task(); - } } diff --git a/rpcs3/Emu/RSX/Capture/rsx_replay.h b/rpcs3/Emu/RSX/Capture/rsx_replay.h index 104e12c18c..19985615fb 100644 --- a/rpcs3/Emu/RSX/Capture/rsx_replay.h +++ b/rpcs3/Emu/RSX/Capture/rsx_replay.h @@ -1,5 +1,6 @@ #pragma once +#include "Emu/CPU/CPUThread.h" #include "Emu/Cell/PPUModule.h" #include "Emu/Cell/lv2/sys_sync.h" #include "Emu/RSX/rsx_methods.h" @@ -181,7 +182,7 @@ namespace rsx }; - class rsx_replay_thread + class rsx_replay_thread : public cpu_thread { struct rsx_context { @@ -209,12 +210,12 @@ namespace rsx public: rsx_replay_thread(std::unique_ptr&& frame_data) - :frame(std::move(frame_data)) + : cpu_thread(0) + , frame(std::move(frame_data)) { } - void on_task(); - void operator()(); + void cpu_task() override; private: be_t allocate_context(); std::vector alloc_write_fifo(be_t context_id); diff --git a/rpcs3/rpcs3qt/breakpoint_list.cpp b/rpcs3/rpcs3qt/breakpoint_list.cpp index 34ff2eceb6..31a52c816c 100644 --- a/rpcs3/rpcs3qt/breakpoint_list.cpp +++ b/rpcs3/rpcs3qt/breakpoint_list.cpp @@ -63,7 +63,7 @@ void breakpoint_list::AddBreakpoint(u32 pc) m_breakpoint_handler->AddBreakpoint(pc); const auto cpu = this->cpu.lock(); - const auto cpu_offset = cpu->id_type() != 1 ? static_cast(*cpu).ls : vm::g_sudo_addr; + const auto cpu_offset = cpu->id_type() == 2 ? static_cast(*cpu).ls : vm::g_sudo_addr; m_disasm->offset = cpu_offset; m_disasm->disasm(m_disasm->dump_pc = pc); diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index c1ff72e645..4b73dc9bc8 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -266,7 +266,7 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) { const auto cpu = this->cpu.lock(); - if (!cpu || cpu->id_type() == 1) + if (!cpu || cpu->id_type() != 2) { return; } @@ -298,7 +298,17 @@ u32 debugger_frame::GetPc() const return 0; } - return cpu->id_type() == 1 ? static_cast(cpu.get())->cia : static_cast(cpu.get())->pc; + if (cpu->id_type() == 1) + { + return static_cast(cpu.get())->cia; + } + + if (cpu->id_type() == 2) + { + return static_cast(cpu.get())->pc; + } + + return 0; } void debugger_frame::UpdateUI() @@ -416,7 +426,7 @@ void debugger_frame::OnSelectUnit() m_disasm = std::make_unique(CPUDisAsm_InterpreterMode); } } - else + else if (cpu0->id_type() == 2) { if (cpu0.get() == idm::check>(cpu0->id)) { diff --git a/rpcs3/rpcs3qt/debugger_list.cpp b/rpcs3/rpcs3qt/debugger_list.cpp index 949130d39a..3d1a0429ee 100644 --- a/rpcs3/rpcs3qt/debugger_list.cpp +++ b/rpcs3/rpcs3qt/debugger_list.cpp @@ -43,7 +43,17 @@ u32 debugger_list::GetPc() const return 0; } - return cpu->id_type() == 1 ? static_cast(cpu.get())->cia : static_cast(cpu.get())->pc; + if (cpu->id_type() == 1) + { + return static_cast(cpu.get())->cia; + } + + if (cpu->id_type() == 2) + { + return static_cast(cpu.get())->pc; + } + + return 0; } u32 debugger_list::GetCenteredAddress(u32 address) const diff --git a/rpcs3/rpcs3qt/instruction_editor_dialog.cpp b/rpcs3/rpcs3qt/instruction_editor_dialog.cpp index 0825a40a67..deccf04550 100644 --- a/rpcs3/rpcs3qt/instruction_editor_dialog.cpp +++ b/rpcs3/rpcs3qt/instruction_editor_dialog.cpp @@ -24,7 +24,7 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, c setMinimumSize(300, sizeHint().height()); const auto cpu = _cpu.get(); - m_cpu_offset = cpu->id_type() != 1 ? static_cast(*cpu).ls : vm::g_sudo_addr; + m_cpu_offset = cpu->id_type() == 2 ? static_cast(*cpu).ls : vm::g_sudo_addr; QString instruction = qstr(fmt::format("%08x", *reinterpret_cast*>(m_cpu_offset + m_pc))); QVBoxLayout* vbox_panel(new QVBoxLayout()); diff --git a/rpcs3/rpcs3qt/register_editor_dialog.cpp b/rpcs3/rpcs3qt/register_editor_dialog.cpp index 76f1f20f8f..18f5b83f9d 100644 --- a/rpcs3/rpcs3qt/register_editor_dialog.cpp +++ b/rpcs3/rpcs3qt/register_editor_dialog.cpp @@ -111,7 +111,7 @@ register_editor_dialog::register_editor_dialog(QWidget *parent, u32 _pc, const s m_register_combo->addItem("Priority", +PPU_PRIO); //m_register_combo->addItem("Priority 2", +PPU_PRIO2); } - else + else if (_cpu->id_type() == 2) { for (int i = spu_r0; i <= spu_r127; i++) m_register_combo->addItem(qstr(fmt::format("r%d", i % 128)), i); m_register_combo->addItem("MFC Pending Events", +MFC_PEVENTS); @@ -184,7 +184,7 @@ void register_editor_dialog::updateRegister(int reg) else if (reg == RESERVATION_LOST) str = sstr(ppu.raddr ? tr("Lose reservation on OK") : tr("Reservation is inactive")); else if (reg == PC) str = fmt::format("%08x", ppu.cia); } - else + else if (cpu->id_type() == 2) { const auto& spu = *static_cast(cpu.get()); @@ -310,7 +310,7 @@ void register_editor_dialog::OnOkay(const std::shared_ptr& _cpu) return; } } - else + else if (cpu->id_type() == 2) { auto& spu = *static_cast(cpu);