diff --git a/src/xenia/ui/windowed_app_main_win.cc b/src/xenia/ui/windowed_app_main_win.cc index 24bf4cd63..3f25da10a 100644 --- a/src/xenia/ui/windowed_app_main_win.cc +++ b/src/xenia/ui/windowed_app_main_win.cc @@ -17,6 +17,9 @@ #include "xenia/ui/windowed_app.h" #include "xenia/ui/windowed_app_context_win.h" +// Autogenerated by `xb premake`. +#include "build/version.h" + DEFINE_bool(enable_console, false, "Open a console window with the main window", "Logging"); @@ -230,16 +233,23 @@ static bool exception_pointers_handler(HostExceptionReport* report) { DWORD64 last_rip = report->ExceptionInfo->ContextRecord->Rip; DWORD except_code = report->ExceptionInfo->ExceptionRecord->ExceptionCode; - char except_message_buf[256]; - sprintf_s(except_message_buf, - "Exception encountered!\nException address: %s\nStackpointer: " - "%s\nInstruction pointer: %s\nExceptionCode: 0x%X (%s)\n", - report->GetFormattedAddress(exception_addr), - report->GetFormattedAddress(last_stackpointer), - report->GetFormattedAddress(last_rip), except_code, - HostExceptionReport::ChompNewlines(Ntstatus_msg(except_code))); + std::string build = ( +#ifdef XE_BUILD_IS_PR + "PR#" XE_BUILD_PR_NUMBER " " XE_BUILD_PR_REPO " " XE_BUILD_PR_BRANCH + "@" XE_BUILD_PR_COMMIT_SHORT " against " +#endif + XE_BUILD_BRANCH "@" XE_BUILD_COMMIT_SHORT " on " XE_BUILD_DATE); - report->AddString(except_message_buf); + const std::string except_message = fmt::format( + "Exception encountered!\nBuild: {}\nException address: " + "{}\nStackpointer: " + "{}\nInstruction pointer: {}\nExceptionCode: 0x{} ({})\n", + build.c_str(), report->GetFormattedAddress(exception_addr), + report->GetFormattedAddress(last_stackpointer), + report->GetFormattedAddress(last_rip), except_code, + HostExceptionReport::ChompNewlines(Ntstatus_msg(except_code))); + + report->AddString(except_message.c_str()); return true; }