Removed CxbxKrnlTerminateThread and some unnecessary calls to TerminateProcess

This commit is contained in:
ergo720 2022-02-18 15:30:18 +01:00
parent 6867907a3c
commit bc98e164b2
3 changed files with 7 additions and 21 deletions

View File

@ -599,7 +599,6 @@ XBSYSAPI EXPORTNUM(49) xbox::void_xt DECLSPEC_NORETURN NTAPI xbox::HalReturnToFi
}
CxbxKrnlShutDown(is_reboot);
TerminateProcess(GetCurrentProcess(), EXIT_SUCCESS);
}
// ******************************************************************

View File

@ -145,6 +145,7 @@ xbox::void_xt NTAPI CxbxLaunchXbe(xbox::PVOID Entry)
{
EmuLogInit(LOG_LEVEL::DEBUG, "Calling XBE entry point...");
static_cast<void(*)()>(Entry)();
EmuLogInit(LOG_LEVEL::DEBUG, "XBE entry point returned");
}
// Entry point address XOR keys per Xbe type (Retail, Debug or Chihiro) :
@ -703,7 +704,6 @@ static bool CxbxrKrnlXbeSystemSelector(int BootFlags, unsigned& reserved_systems
// Launch Segaboot
CxbxLaunchNewXbe(chihiroSegaBootNew);
CxbxKrnlShutDown(true);
TerminateProcess(GetCurrentProcess(), EXIT_SUCCESS);
}
#endif // Chihiro wip block
@ -1514,16 +1514,11 @@ static void CxbxrKrnlInitHacks()
EmuKeFreePcr<true>();
// FIXME: Wait for Cxbx to exit or error fatally
Sleep(INFINITE);
EmuLogInit(LOG_LEVEL::DEBUG, "XBE entry point returned");
fflush(stdout);
CxbxUnlockFilePath();
// EmuShared::Cleanup(); FIXME: commenting this line is a bad workaround for issue #617 (https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/issues/617)
CxbxKrnlTerminateThread();
// This will wait forever
std::condition_variable cv;
std::mutex m;
std::unique_lock<std::mutex> lock(m);
cv.wait(lock, [] { return false; });
}
// REMARK: the following is useless, but PatrickvL has asked to keep it for documentation purposes
@ -1754,11 +1749,6 @@ void CxbxPrintUEMInfo(ULONG ErrorCode)
}
}
[[noreturn]] void CxbxKrnlTerminateThread()
{
TerminateThread(GetCurrentThread(), 0);
}
void CxbxKrnlPanic()
{
CxbxrKrnlAbort("Kernel Panic!");

View File

@ -152,7 +152,7 @@ void CxbxKrnlEmulate(unsigned int system, blocks_reserved_t blocks_reserved);
#define CxbxrKrnlAbort(fmt, ...) CxbxrKrnlAbortEx(LOG_PREFIX, fmt, ##__VA_ARGS__)
/*! terminate gracefully the emulation */
void CxbxKrnlShutDown(bool is_reboot = false);
[[noreturn]] void CxbxKrnlShutDown(bool is_reboot = false);
/*! display the fatal error message*/
void CxbxKrnlPrintUEM(ULONG ErrorCode);
@ -160,9 +160,6 @@ void CxbxKrnlPrintUEM(ULONG ErrorCode);
/*! display the cause of the fatal error message*/
void CxbxPrintUEMInfo(ULONG ErrorCode);
/*! terminate the calling thread */
[[noreturn]] void CxbxKrnlTerminateThread();
/*! kernel panic (trap for unimplemented kernel functions) */
void CxbxKrnlPanic();