diff --git a/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp b/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp index ef5572afdb..f5103e6290 100644 --- a/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_interrupt.cpp @@ -9,6 +9,19 @@ LOG_CHANNEL(sys_interrupt); +lv2_int_tag::lv2_int_tag() noexcept + : id(idm::last_id()) +{ +} + +lv2_int_serv::lv2_int_serv(const std::shared_ptr>& thread, u64 arg1, u64 arg2) noexcept + : id(idm::last_id()) + , thread(thread) + , arg1(arg1) + , arg2(arg2) +{ +} + void lv2_int_serv::exec() const { thread->cmd_list diff --git a/rpcs3/Emu/Cell/lv2/sys_interrupt.h b/rpcs3/Emu/Cell/lv2/sys_interrupt.h index 4472443a18..cc9be17dc1 100644 --- a/rpcs3/Emu/Cell/lv2/sys_interrupt.h +++ b/rpcs3/Emu/Cell/lv2/sys_interrupt.h @@ -10,23 +10,22 @@ struct lv2_int_tag final : lv2_obj { static const u32 id_base = 0x0a000000; + const u32 id; std::weak_ptr handler; + + lv2_int_tag() noexcept; }; struct lv2_int_serv final : lv2_obj { static const u32 id_base = 0x0b000000; + const u32 id; const std::shared_ptr> thread; const u64 arg1; const u64 arg2; - lv2_int_serv(const std::shared_ptr>& thread, u64 arg1, u64 arg2) - : thread(thread) - , arg1(arg1) - , arg2(arg2) - { - } + lv2_int_serv(const std::shared_ptr>& thread, u64 arg1, u64 arg2) noexcept; void exec() const; void join() const; diff --git a/rpcs3/Emu/Cell/lv2/sys_spu.cpp b/rpcs3/Emu/Cell/lv2/sys_spu.cpp index 8180fbc365..11f7e45cc9 100644 --- a/rpcs3/Emu/Cell/lv2/sys_spu.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_spu.cpp @@ -1948,25 +1948,13 @@ error_code raw_spu_destroy(ppu_thread& ppu, u32 id) // SLEEP lv2_obj::sleep(ppu); handler->join(); - to_remove.emplace_back(std::move(handler), 0); + to_remove.emplace_back(std::move(handler), +handler->id); } - to_remove.emplace_back(std::move(tag), 0); + to_remove.emplace_back(std::move(tag), +tag->id); } } - // Scan all kernel objects to determine IDs - idm::select([&](u32 id, lv2_obj& obj) - { - for (auto& pair : to_remove) - { - if (pair.first.get() == std::addressof(obj)) - { - pair.second = id; - } - } - }); - // Remove IDs for (auto&& pair : to_remove) {