Files
AnyPS5/core/libs/prx/libc/include/Shutdown.hpp
T
milescovielloandClaude Opus 5.5 5b072bc2c4 fix(libSceSystemService): park guest threads during LoadExec's shutdown as exit does
Metal Gear Solid 4 (PPSA18194) aborts on main when its launcher starts
the game: sceSystemServiceLoadExec runs the guest shutdown, a render
thread that then calls into the stopped AGC driver gets ProcessShutdown
back from LibcAwaitExit, and the exception unwinds into title code,
which terminates the process before the new executable starts.

LibcAwaitExit parks a thread only once an exit has been requested, and
LoadExec ran the shutdown without requesting one. It now starts the
shutdown the way exit does, so such threads wait until the process is
replaced.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 10:50:36 +00:00

22 lines
864 B
C++

#ifndef CORE_LIBS_PRX_LIBC_INCLUDE_SHUTDOWN_HPP
#define CORE_LIBS_PRX_LIBC_INCLUDE_SHUTDOWN_HPP
#include <stop_token>
class ProcessShutdown final {};
extern "C" void LibcRegisterShutdown_nid_postfix(void (*callback)());
extern "C" void LibcRunShutdown_nid_postfix();
extern "C" std::stop_token LibcShutdownToken_nid_postfix();
extern "C" void LibcRequestShutdown_nid_postfix();
extern "C" void LibcRequestExit_nid_postfix(int code);
extern "C" [[noreturn]] void LibcAwaitExit_nid_postfix();
extern "C" void LibcStartExit_nid_postfix();
extern "C" [[noreturn]] void LibcExit_nid_no_patch(int code);
extern "C" [[noreturn]] void LibcExitWithoutHandlers_nid_no_patch(int code);
extern "C" [[noreturn]] void LibcTerminate_nid_no_patch(int code);
extern "C" void LibcSetEndFlush_nid_no_patch(void (*flush)());
extern "C" void LibcRunEndFlush_nid_no_patch();
#endif