Use Qt for error reports

This commit is contained in:
Nekotekina 2017-11-23 18:37:08 +03:00
parent cc4bc41cf4
commit 7d3a528871
5 changed files with 77 additions and 35 deletions

View file

@ -37,32 +37,6 @@ thread_local u64 g_tls_fault_all = 0;
thread_local u64 g_tls_fault_rsx = 0;
thread_local u64 g_tls_fault_spu = 0;
static void report_fatal_error(const std::string& msg)
{
static semaphore<> g_report_only_once;
g_report_only_once.wait();
std::string _msg = msg + "\n"
"HOW TO REPORT ERRORS: https://github.com/RPCS3/rpcs3/wiki/How-to-ask-for-Support\n"
"Please, don't send incorrect reports. Thanks for understanding.\n";
#ifdef _WIN32
_msg += "\nPress Yes or Enter to visit the URL above immediately.";
const std::size_t buf_size = _msg.size() + 1;
const int size = static_cast<int>(buf_size);
std::unique_ptr<wchar_t[]> buffer(new wchar_t[buf_size]);
MultiByteToWideChar(CP_UTF8, 0, _msg.c_str(), size, buffer.get(), size);
if (MessageBoxW(0, buffer.get(), L"Fatal error", MB_ICONERROR | MB_YESNO) == IDYES)
{
ShellExecuteW(0, L"open", L"https://github.com/RPCS3/rpcs3/wiki/How-to-ask-for-Support", 0, 0, SW_SHOWNORMAL);
}
#else
std::printf("Fatal error: \n%s", _msg.c_str());
#endif
}
[[noreturn]] void catch_all_exceptions()
{
try
@ -77,8 +51,6 @@ static void report_fatal_error(const std::string& msg)
{
report_fatal_error("Unhandled exception (unknown)");
}
std::abort();
}
enum x64_reg_t : u32
@ -1497,13 +1469,11 @@ const bool s_exception_handler_set = []() -> bool
if (!AddVectoredExceptionHandler(1, (PVECTORED_EXCEPTION_HANDLER)exception_handler))
{
report_fatal_error("AddVectoredExceptionHandler() failed.");
std::abort();
}
if (!SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)exception_filter))
{
report_fatal_error("SetUnhandledExceptionFilter() failed.");
std::abort();
}
return true;
@ -1550,7 +1520,6 @@ static void signal_handler(int sig, siginfo_t* info, void* uct)
// TODO (debugger interaction)
report_fatal_error(fmt::format("Segfault %s location %p at %p.", cause, info->si_addr, RIP(context)));
std::abort();
}
const bool s_exception_handler_set = []() -> bool