1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 03:02:53 +01:00

Emu: fixup message when the application has crashed

This commit is contained in:
Eladash 2022-11-01 09:10:40 +02:00 committed by Ivan
parent 68b68e676b
commit 9632d0ab8a
4 changed files with 29 additions and 8 deletions

View File

@ -2051,6 +2051,18 @@ bool Emulator::Pause(bool freeze_emulation)
return false;
}
}
// Perform the side effects of Resume here when transforming paused to frozen state
BlockingCallFromMainThread([this]()
{
for (auto& ref : m_pause_msgs_refs)
{
// Delete the message queued on pause
*ref = 0;
}
m_pause_msgs_refs.clear();
});
}
// Signal profilers to print results (if enabled)
@ -2073,7 +2085,9 @@ bool Emulator::Pause(bool freeze_emulation)
BlockingCallFromMainThread([this]()
{
if (IsStopped())
const auto status = Emu.GetStatus(false);
if (status != system_state::paused && status != system_state::frozen)
{
return;
}
@ -2081,17 +2095,19 @@ bool Emulator::Pause(bool freeze_emulation)
auto msg_ref = std::make_shared<atomic_t<u32>>(1);
// No timeout
rsx::overlays::queue_message(localized_string_id::EMULATION_PAUSED_RESUME_WITH_START, -1, msg_ref);
rsx::overlays::queue_message(status == system_state::paused ? localized_string_id::EMULATION_PAUSED_RESUME_WITH_START : localized_string_id::EMULATION_FROZEN, -1, msg_ref);
m_pause_msgs_refs.emplace_back(msg_ref);
auto refresh_l = [this, msg_ref]()
auto refresh_l = [this, msg_ref, status]()
{
while (*msg_ref && IsPaused())
while (*msg_ref && GetStatus(false) == status)
{
// Refresh Native UI
rsx::set_native_ui_flip();
thread_ctrl::wait_for(33'000);
}
msg_ref->release(0);
};
struct thread_t

View File

@ -149,4 +149,5 @@ enum class localized_string_id
EMULATION_PAUSED_RESUME_WITH_START,
EMULATION_RESUMING,
EMULATION_FROZEN,
};

View File

@ -403,7 +403,7 @@ void pad_thread::operator()()
u64 pad_sleep = g_cfg.io.pad_sleep;
if (Emu.IsPaused())
if (Emu.GetStatus(false) == system_state::paused)
{
pad_sleep = std::max<u64>(pad_sleep, 30'000);
@ -438,17 +438,20 @@ void pad_thread::operator()()
m_mask_start_press_to_unpause = 0;
m_track_start_press_begin_timestamp = 0;
sys_log.success("Unpausing emulation using the START button in a few seconds...");
rsx::overlays::queue_message(localized_string_id::EMULATION_RESUMING, 2'000'000);
sys_log.success("Resuming emulation using the START button in a few seconds...");
auto msg_ref = std::make_shared<atomic_t<u32>>(1);
rsx::overlays::queue_message(localized_string_id::EMULATION_RESUMING, 2'000'000, msg_ref);
m_resume_emulation_flag = true;
for (u32 i = 0; i < 40; i++)
{
if (!Emu.IsPaused())
if (Emu.GetStatus(false) != system_state::paused)
{
// Abort if emulation has been resumed by other means
m_resume_emulation_flag = false;
msg_ref->release(0);
break;
}

View File

@ -169,6 +169,7 @@ private:
case localized_string_id::RPCN_SUCCESS_LOGGED_ON: return tr("Successfully logged on RPCN!");
case localized_string_id::EMULATION_PAUSED_RESUME_WITH_START: return tr("Press and hold the START button to resume");
case localized_string_id::EMULATION_RESUMING: return tr("Resuming...!");
case localized_string_id::EMULATION_FROZEN: return tr("The PS3 application has likely crashed, you can close it.");
case localized_string_id::INVALID: return tr("Invalid");
default: return tr("Unknown");
}