Fixup emulation stopping

This commit is contained in:
Eladash 2024-03-27 10:40:25 +02:00 committed by Elad Ashkenazi
parent 8588b2b11a
commit 750359d780
2 changed files with 13 additions and 8 deletions

View File

@ -3377,11 +3377,12 @@ static bool ppu_store_reservation(ppu_thread& ppu, u32 addr, u64 reg_value)
data += 0;
auto range_lock = vm::alloc_range_lock();
bool success = false;
{
rsx::reservation_lock rsx_lock(addr, 128);
auto& super_data = *vm::get_super_ptr<spu_rdata_t>(addr);
const bool success = [&]()
success = [&]()
{
// Full lock (heavyweight)
// TODO: vm::check_addr

View File

@ -2736,6 +2736,17 @@ void Emulator::GracefulShutdown(bool allow_autoexit, bool async_op, bool savesta
return;
}
if (!savestate && m_emu_state_close_pending)
{
while (!async_op && m_state != system_state::stopped)
{
process_qt_events();
std::this_thread::sleep_for(16ms);
}
return;
}
if (old_state == system_state::paused)
{
Resume();
@ -2759,11 +2770,6 @@ void Emulator::GracefulShutdown(bool allow_autoexit, bool async_op, bool savesta
auto perform_kill = [read_counter, allow_autoexit, this, info = GetEmulationIdentifier()]()
{
if (m_emu_state_close_pending.exchange(true))
{
return;
}
bool read_sysutil_signal = false;
for (u32 i = 100; i < 140; i++)
@ -2786,7 +2792,6 @@ void Emulator::GracefulShutdown(bool allow_autoexit, bool async_op, bool savesta
if (static_cast<u64>(info) != m_stop_ctr)
{
m_emu_state_close_pending = false;
return;
}
}
@ -2794,7 +2799,6 @@ void Emulator::GracefulShutdown(bool allow_autoexit, bool async_op, bool savesta
// An inevitable attempt to terminate the *current* emulation course will be issued after 7s
CallFromMainThread([allow_autoexit, this]()
{
m_emu_state_close_pending = false;
Kill(allow_autoexit);
}, info);
};