From 812224f7f78e716e11dab102644483f7ae00cd96 Mon Sep 17 00:00:00 2001 From: brian218 Date: Thu, 15 Dec 2022 11:12:03 +0800 Subject: [PATCH] Stop LV2 Watchdog when CELL_SYSUTIL_REQUEST_EXITGAME is issued --- rpcs3/Emu/Cell/Modules/cellSysutil.cpp | 5 +++++ rpcs3/Emu/Cell/lv2/sys_game.cpp | 9 +++++++++ rpcs3/Emu/Cell/lv2/sys_game.h | 2 ++ 3 files changed, 16 insertions(+) diff --git a/rpcs3/Emu/Cell/Modules/cellSysutil.cpp b/rpcs3/Emu/Cell/Modules/cellSysutil.cpp index bfe19004d8..3cf79ca6b5 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSysutil.cpp @@ -6,6 +6,7 @@ #include "Emu/Cell/PPUModule.h" #include "Emu/Cell/Modules/cellGame.h" +#include "Emu/Cell/lv2/sys_game.h" #include "Emu/Cell/lv2/sys_process.h" #include "cellSysutil.h" @@ -126,6 +127,10 @@ extern s32 sysutil_send_system_cmd(u64 status, u64 param) return -1; } } + else if (status == CELL_SYSUTIL_REQUEST_EXITGAME) + { + abort_lv2_watchdog(); + } for (sysutil_cb_manager::registered_cb cb : cbm->callbacks) { diff --git a/rpcs3/Emu/Cell/lv2/sys_game.cpp b/rpcs3/Emu/Cell/lv2/sys_game.cpp index 12dcf70865..6c898edc68 100644 --- a/rpcs3/Emu/Cell/lv2/sys_game.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_game.cpp @@ -82,6 +82,15 @@ struct watchdog_t static constexpr auto thread_name = "LV2 Watchdog Thread"sv; }; +void abort_lv2_watchdog() +{ + if (auto thr = g_fxo->try_get>()) + { + sys_game.notice("Aborting %s...", thr->thread_name); + *thr = thread_state::aborting; + } +} + error_code _sys_game_watchdog_start(u32 timeout) { sys_game.trace("sys_game_watchdog_start(timeout=%d)", timeout); diff --git a/rpcs3/Emu/Cell/lv2/sys_game.h b/rpcs3/Emu/Cell/lv2/sys_game.h index be2286dcde..9e66e407ba 100644 --- a/rpcs3/Emu/Cell/lv2/sys_game.h +++ b/rpcs3/Emu/Cell/lv2/sys_game.h @@ -1,5 +1,7 @@ #pragma once +void abort_lv2_watchdog(); + error_code _sys_game_watchdog_start(u32 timeout); error_code _sys_game_watchdog_stop(); error_code _sys_game_watchdog_clear();