From 635235c86cd902e95caa0bc3cdbd29044897f446 Mon Sep 17 00:00:00 2001 From: TuxSH <1922548+TuxSH@users.noreply.github.com> Date: Mon, 9 Jan 2023 14:22:37 +0000 Subject: [PATCH] pm: fix racecond regression introduced by 7074ac1 It prevented games such as Mario & Luigi: Bowser's Inside Story from booting. g_manager.runningApplicationData needs to be accessed through the lock. --- sysmodules/pm/source/launch.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sysmodules/pm/source/launch.c b/sysmodules/pm/source/launch.c index 30c9b2b..e6a1893 100644 --- a/sysmodules/pm/source/launch.c +++ b/sysmodules/pm/source/launch.c @@ -389,19 +389,25 @@ Result LaunchTitle(u32 *outPid, const FS_ProgramInfo *programInfo, u32 launchFla Result LaunchTitleUpdate(const FS_ProgramInfo *programInfo, const FS_ProgramInfo *programInfoUpdate, u32 launchFlags) { + ProcessList_Lock(&g_manager.processList); + if (g_manager.preparingForReboot) { + ProcessList_Unlock(&g_manager.processList); return 0xC8A05801; } - if (!(launchFlags & ~PMLAUNCHFLAG_NORMAL_APPLICATION)) { - return 0xD8E05802; - } - ProcessList_Lock(&g_manager.processList); if (g_manager.runningApplicationData != NULL) { ProcessList_Unlock(&g_manager.processList); return 0xC8A05BF0; } + if (!(launchFlags & ~PMLAUNCHFLAG_NORMAL_APPLICATION)) { + ProcessList_Unlock(&g_manager.processList); + return 0xD8E05802; + } + + ProcessList_Unlock(&g_manager.processList); + bool originallyDebugged = launchFlags & PMLAUNCHFLAG_QUEUE_DEBUG_APPLICATION; launchFlags |= PMLAUNCHFLAG_USE_UPDATE_TITLE;