fix false positive emulation is either still running or stopped

This commit is contained in:
RadWolfie 2023-02-10 06:59:16 -06:00
parent 0b695637ce
commit f4488c0270
2 changed files with 16 additions and 19 deletions

View File

@ -583,6 +583,7 @@ XBSYSAPI EXPORTNUM(49) xbox::void_xt DECLSPEC_NORETURN NTAPI xbox::HalReturnToFi
case ReturnFirmwareFatal:
{
xbox::HalWriteSMBusValue(SMBUS_ADDRESS_SYSTEM_MICRO_CONTROLLER, SMC_COMMAND_SCRATCH, 0, SMC_SCRATCH_DISPLAY_FATAL_ERROR);
is_reboot = true;
g_VMManager.SavePersistentMemory();

View File

@ -2331,29 +2331,25 @@ void WndMain::CrashMonitor(DWORD dwChildProcID)
HANDLE hProcess = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION, FALSE, dwChildProcID);
// If we do receive valid handle, let's do the next step.
if (hProcess != NULL) {
// If we do receive valid handle, let's do the next step.
if (hProcess != NULL) {
WaitForSingleObject(hProcess, INFINITE);
WaitForSingleObject(hProcess, INFINITE);
GetExitCodeProcess(hProcess, &dwExitCode);
CloseHandle(hProcess);
GetExitCodeProcess(hProcess, &dwExitCode);
CloseHandle(hProcess);
g_EmuShared->GetBootFlags(&iBootFlags);
g_EmuShared->GetBootFlags(&iBootFlags);
if (!iBootFlags) {
if (dwExitCode == EXIT_SUCCESS) {// StopEmulation
return;
}
// Or else, it's a crash
}
else {
// multi-xbe
// destroy this thread and start a new one
return;
}
}
// Check if reboot did occur.
if (iBootFlags) {
// Destroy this thread and start a new one
// since emulation is still running.
return;
}
// Otherwise emulation did stopped or crashed
// But need to tell GUI that emulation did end.
}
}
// Crash clean up.