diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 5f5330ec81..b0a58a4e2a 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -96,7 +96,7 @@ thread_local bool g_tls_access_violation_recovered = false; extern thread_local std::string(*g_tls_log_prefix)(); // Report error and call std::abort(), defined in main.cpp -[[noreturn]] void report_fatal_error(std::string_view); +[[noreturn]] void report_fatal_error(std::string_view, bool = false); std::string dump_useful_thread_info() { diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 1b91cda033..9367a6e207 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -93,7 +93,7 @@ thread_local std::string_view g_tls_serialize_name; extern thread_local std::string(*g_tls_log_prefix)(); // Report error and call std::abort(), defined in main.cpp -[[noreturn]] void report_fatal_error(std::string_view); +[[noreturn]] void report_fatal_error(std::string_view, bool = false); void initialize_timebased_time(u64 timebased_init, bool reset = false); diff --git a/rpcs3/main.cpp b/rpcs3/main.cpp index f2829eee58..4c30de767e 100644 --- a/rpcs3/main.cpp +++ b/rpcs3/main.cpp @@ -91,7 +91,7 @@ extern char **environ; LOG_CHANNEL(sys_log, "SYS"); LOG_CHANNEL(q_debug, "QDEBUG"); -[[noreturn]] extern void report_fatal_error(std::string_view _text) +[[noreturn]] extern void report_fatal_error(std::string_view _text, bool is_html = false) { #ifdef __linux__ extern void jit_announce(uptr, usz, std::string_view); @@ -151,9 +151,9 @@ LOG_CHANNEL(q_debug, "QDEBUG"); std::cerr << fmt::format("RPCS3: %s\n", text); } - static auto show_report = [](std::string_view text) + static auto show_report = [is_html](std::string_view text) { - fatal_error_dialog dlg(text); + fatal_error_dialog dlg(text, is_html); dlg.exec(); }; diff --git a/rpcs3/module_verifier.hpp b/rpcs3/module_verifier.hpp index 7b1ab646c3..6bb8fe566e 100644 --- a/rpcs3/module_verifier.hpp +++ b/rpcs3/module_verifier.hpp @@ -11,7 +11,7 @@ #include #include -[[noreturn]] void report_fatal_error(std::string_view); +[[noreturn]] void report_fatal_error(std::string_view, bool); // Validates that system modules are properly installed // Only relevant for WIN32 @@ -53,16 +53,18 @@ class WIN32_module_verifier if (s.find(system_root) != 0) { const auto error_message = fmt::format( - "The module '%s' was incorrectly installed.\n" - "This module is part of the '%s' package.\n" - "You can install this package from this URL:\n" - "%s", + "

" + "The module '%s' was incorrectly installed.
" + "This module is part of the '%s' package.
" + "You can install this package from this URL:
" + "%s" + "

", wchar_to_utf8(module.name), module.package_name, module.dl_link, module.dl_link ); - report_fatal_error(error_message); + report_fatal_error(error_message, true); } } } diff --git a/rpcs3/rpcs3qt/fatal_error_dialog.cpp b/rpcs3/rpcs3qt/fatal_error_dialog.cpp index fadd530733..4c79329487 100644 --- a/rpcs3/rpcs3qt/fatal_error_dialog.cpp +++ b/rpcs3/rpcs3qt/fatal_error_dialog.cpp @@ -4,19 +4,10 @@ #include #include -static QString process_dialog_text(std::string_view text) +fatal_error_dialog::fatal_error_dialog(std::string_view text, bool is_html) : QMessageBox() { - auto html = Qt::convertFromPlainText(QString::fromUtf8(text.data(), text.size())); + const QString msg = QString::fromUtf8(text.data(), text.size()); - // Let's preserve some html elements destroyed by convertFromPlainText - const QRegExp link_re{ R"(<a\shref='([a-z0-9?=&#:\/\.\-]+)'>([a-z0-9?=&#:\/\.\-]+)<\/a>)", Qt::CaseSensitive, QRegExp::RegExp2}; - html = html.replace(link_re, "\\2"); - - return html; -} - -fatal_error_dialog::fatal_error_dialog(std::string_view text) : QMessageBox() -{ #ifndef __APPLE__ setWindowIcon(QIcon(":/rpcs3.ico")); #endif @@ -24,14 +15,17 @@ fatal_error_dialog::fatal_error_dialog(std::string_view text) : QMessageBox() setIcon(QMessageBox::Icon::Critical); setTextFormat(Qt::TextFormat::RichText); setText(QString(R"( -

+ +

%1
%2
https://github.com/RPCS3/rpcs3/wiki/How-to-ask-for-Support
%3

)") - .arg(process_dialog_text(text)) + .arg(is_html ? msg : Qt::convertFromPlainText(msg)) .arg(tr("HOW TO REPORT ERRORS:")) .arg(tr("Please, don't send incorrect reports. Thanks for understanding."))); layout()->setSizeConstraint(QLayout::SetFixedSize); diff --git a/rpcs3/rpcs3qt/fatal_error_dialog.h b/rpcs3/rpcs3qt/fatal_error_dialog.h index 69f7d09cc9..d2bf87e998 100644 --- a/rpcs3/rpcs3qt/fatal_error_dialog.h +++ b/rpcs3/rpcs3qt/fatal_error_dialog.h @@ -9,5 +9,5 @@ class fatal_error_dialog : public QMessageBox Q_OBJECT public: - explicit fatal_error_dialog(std::string_view text); + explicit fatal_error_dialog(std::string_view text, bool is_html); };