PPU: Sleep after returning from thread entry function

This commit is contained in:
Eladash 2023-06-06 14:05:07 +03:00 committed by Megamouse
parent 52575a44b2
commit 6d918b565f

View File

@ -2055,12 +2055,7 @@ void ppu_thread::fast_call(u32 addr, u64 rtoc)
auto at_ret = [&]()
{
if (std::uncaught_exceptions())
{
cpu_on_stop();
current_function = old_func;
}
else if (old_cia)
if (old_cia)
{
if (state & cpu_flag::again)
{
@ -2071,6 +2066,18 @@ void ppu_thread::fast_call(u32 addr, u64 rtoc)
gpr[2] = old_rtoc;
lr = old_lr;
}
else if (state & cpu_flag::ret && cia == g_fxo->get<ppu_function_manager>().func_addr(1, true) + 4)
{
std::string ret;
dump_all(ret);
ppu_log.error("Returning from the thread entry function! (func=0x%x)", entry_func.addr);
ppu_log.notice("Thread context: %s", ret);
lv2_obj::sleep(*this);
state += cpu_flag::again; // For savestates
}
current_function = old_func;
g_tls_log_prefix = old_fmt;