Move duplicate generic exception method into one function

This commit is contained in:
RadWolfie 2018-07-12 11:06:54 -05:00
parent 97cf31961b
commit 41119ad6a2
1 changed files with 20 additions and 31 deletions

View File

@ -224,6 +224,24 @@ bool IsXboxCodeAddress(xbaddr addr)
// for example by g_VMManager.CheckConflictingVMA(addr, 0). // for example by g_VMManager.CheckConflictingVMA(addr, 0).
return (addr >= XBE_IMAGE_BASE) && (addr <= XBE_MAX_VA); return (addr >= XBE_IMAGE_BASE) && (addr <= XBE_MAX_VA);
// Note : Not IS_USER_ADDRESS(), that would include host DLL code // Note : Not IS_USER_ADDRESS(), that would include host DLL code
}
void genericException(EXCEPTION_POINTERS *e) {
// Try to report this exception to the debugger, which may allow handling of this exception
if (CxbxDebugger::CanReport()) {
bool DebuggerHandled = false;
CxbxDebugger::ReportAndHandleException(e->ExceptionRecord, DebuggerHandled);
if (!DebuggerHandled) {
// Kill the process immediately without the Cxbx notifier
EmuExceptionExitProcess();
}
// Bypass exception
}
else {
// notify user
EmuExceptionNonBreakpointUnhandledShow(e);
}
} }
static thread_local bool bOverrideException; static thread_local bool bOverrideException;
@ -274,21 +292,7 @@ bool lleTryHandleException(EXCEPTION_POINTERS *e)
return true; return true;
} }
// Try to report this exception to the debugger, which may allow handling of this exception genericException(e);
if (CxbxDebugger::CanReport()) {
bool DebuggerHandled = false;
CxbxDebugger::ReportAndHandleException(e->ExceptionRecord, DebuggerHandled);
if (!DebuggerHandled) {
// Kill the process immediately without the Cxbx notifier
EmuExceptionExitProcess();
}
// Bypass exception
}
else {
// notify user
EmuExceptionNonBreakpointUnhandledShow(e);
}
// Unhandled exception : // Unhandled exception :
bOverrideException = true; bOverrideException = true;
@ -327,22 +331,7 @@ bool EmuTryHandleException(EXCEPTION_POINTERS *e)
} }
} }
// Try to report this exception to the debugger, which may allow handling of this exception genericException(e);
if (CxbxDebugger::CanReport()) {
bool DebuggerHandled = false;
CxbxDebugger::ReportAndHandleException(e->ExceptionRecord, DebuggerHandled);
if (DebuggerHandled) {
// Bypass exception
return false;
}
// Kill the process immediately without the Cxbx notifier
EmuExceptionExitProcess();
}
else {
// notify user
EmuExceptionNonBreakpointUnhandledShow(e);
}
// Unhandled exception : // Unhandled exception :
return false; return false;