From a95636afcd67b8740c355ae878d06bf529fa4f18 Mon Sep 17 00:00:00 2001 From: ergo720 <45463469+ergo720@users.noreply.github.com> Date: Thu, 29 Apr 2021 12:18:41 +0200 Subject: [PATCH 1/3] Reworded fatal error message popup --- src/core/kernel/support/Emu.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/kernel/support/Emu.cpp b/src/core/kernel/support/Emu.cpp index a89ef301f..2d181f8aa 100644 --- a/src/core/kernel/support/Emu.cpp +++ b/src/core/kernel/support/Emu.cpp @@ -191,15 +191,15 @@ void EmuExceptionNonBreakpointUnhandledShow(LPEXCEPTION_POINTERS e) { EmuExceptionPrintDebugInformation(e, /*IsBreakpointException=*/false); - char buffer[256]; - sprintf(buffer, - "Received Exception Code 0x%.08X @ EIP := %s\n" + std::printf("Received Exception Code 0x%.08X @ EIP := %s\n", + e->ExceptionRecord->ExceptionCode, EIPToString(e->ContextRecord->Eip).c_str()); + std::fflush(stdout); + + if (PopupFatalEx(nullptr, PopupButtons::OkCancel, PopupReturn::Ok, + " The running xbe has encountered an unrecoverable error.\n" "\n" " Press \"OK\" to terminate emulation.\n" - " Press \"Cancel\" to debug.", - e->ExceptionRecord->ExceptionCode, EIPToString(e->ContextRecord->Eip).c_str()); - - if (PopupFatalEx(nullptr, PopupButtons::OkCancel, PopupReturn::Ok, buffer) == PopupReturn::Ok) + " Press \"Cancel\" to debug.") == PopupReturn::Ok) { EmuExceptionExitProcess(); } From 2d10c1ffe24e90027e6595e057e856b6b6fb3470 Mon Sep 17 00:00:00 2001 From: ergo720 <45463469+ergo720@users.noreply.github.com> Date: Thu, 29 Apr 2021 12:56:37 +0200 Subject: [PATCH 2/3] Also print exception code and address --- src/core/kernel/support/Emu.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/kernel/support/Emu.cpp b/src/core/kernel/support/Emu.cpp index 2d181f8aa..2be02bac8 100644 --- a/src/core/kernel/support/Emu.cpp +++ b/src/core/kernel/support/Emu.cpp @@ -196,10 +196,11 @@ void EmuExceptionNonBreakpointUnhandledShow(LPEXCEPTION_POINTERS e) std::fflush(stdout); if (PopupFatalEx(nullptr, PopupButtons::OkCancel, PopupReturn::Ok, - " The running xbe has encountered an unrecoverable error.\n" + " The running xbe has encountered an unhandled exception (Code := 0x%.8X) at address 0x%.08X.\n" "\n" " Press \"OK\" to terminate emulation.\n" - " Press \"Cancel\" to debug.") == PopupReturn::Ok) + " Press \"Cancel\" to debug.", + e->ExceptionRecord->ExceptionCode, e->ContextRecord->Eip) == PopupReturn::Ok) { EmuExceptionExitProcess(); } From d74a9a1dfb568e158f61a837ef71c09aebd44316 Mon Sep 17 00:00:00 2001 From: ergo720 <45463469+ergo720@users.noreply.github.com> Date: Thu, 29 Apr 2021 13:09:49 +0200 Subject: [PATCH 3/3] Removed the original message, because it's already printed by EmuExceptionPrintDebugInformation --- src/core/kernel/support/Emu.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/core/kernel/support/Emu.cpp b/src/core/kernel/support/Emu.cpp index 2be02bac8..13162d849 100644 --- a/src/core/kernel/support/Emu.cpp +++ b/src/core/kernel/support/Emu.cpp @@ -191,10 +191,6 @@ void EmuExceptionNonBreakpointUnhandledShow(LPEXCEPTION_POINTERS e) { EmuExceptionPrintDebugInformation(e, /*IsBreakpointException=*/false); - std::printf("Received Exception Code 0x%.08X @ EIP := %s\n", - e->ExceptionRecord->ExceptionCode, EIPToString(e->ContextRecord->Eip).c_str()); - std::fflush(stdout); - if (PopupFatalEx(nullptr, PopupButtons::OkCancel, PopupReturn::Ok, " The running xbe has encountered an unhandled exception (Code := 0x%.8X) at address 0x%.08X.\n" "\n"