From fe7933b0d2cf13986a7b2e91ade494baac1b27a3 Mon Sep 17 00:00:00 2001 From: Eladash Date: Thu, 16 Apr 2020 19:33:36 +0300 Subject: [PATCH] Make ESTAT consistent in sys_spu_thread_group_terminate --- rpcs3/Emu/Cell/lv2/sys_spu.cpp | 6 +++++- rpcs3/Emu/Cell/lv2/sys_spu.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_spu.cpp b/rpcs3/Emu/Cell/lv2/sys_spu.cpp index 66e5d44b78..c98cf7d4c3 100644 --- a/rpcs3/Emu/Cell/lv2/sys_spu.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_spu.cpp @@ -668,6 +668,7 @@ error_code sys_spu_thread_group_start(ppu_thread& ppu, u32 id) group->join_state = 0; group->running = max_threads; + group->set_terminate = false; for (auto& thread : group->threads) { @@ -859,11 +860,14 @@ error_code sys_spu_thread_group_terminate(ppu_thread& ppu, u32 id, s32 value) if (group->run_state <= SPU_THREAD_GROUP_STATUS_INITIALIZED || group->run_state == SPU_THREAD_GROUP_STATUS_WAITING || - group->run_state == SPU_THREAD_GROUP_STATUS_WAITING_AND_SUSPENDED) + group->run_state == SPU_THREAD_GROUP_STATUS_WAITING_AND_SUSPENDED || + group->set_terminate) { return CELL_ESTAT; } + group->set_terminate = true; + for (auto& thread : group->threads) { if (thread) diff --git a/rpcs3/Emu/Cell/lv2/sys_spu.h b/rpcs3/Emu/Cell/lv2/sys_spu.h index e9cb133021..7e1fd0b6f3 100644 --- a/rpcs3/Emu/Cell/lv2/sys_spu.h +++ b/rpcs3/Emu/Cell/lv2/sys_spu.h @@ -270,6 +270,7 @@ struct lv2_spu_group cond_variable cond; // used to signal waiting PPU thread atomic_t stop_count; class ppu_thread* waiter = nullptr; + bool set_terminate = false; std::array>, 8> threads; // SPU Threads std::array threads_map; // SPU Threads map based number