From 0aaa40cd53d8f5ed9d03850eb6f16ba7f28ce40c Mon Sep 17 00:00:00 2001 From: kd-11 Date: Tue, 6 Dec 2022 18:26:38 +0300 Subject: [PATCH] ux: Update vcredist links and optionally disable help text from error dialog --- Utilities/Thread.cpp | 2 +- rpcs3/Emu/System.cpp | 2 +- rpcs3/main.cpp | 6 ++-- rpcs3/module_verifier.hpp | 16 ++++----- rpcs3/rpcs3qt/fatal_error_dialog.cpp | 54 +++++++++++++++++++--------- rpcs3/rpcs3qt/fatal_error_dialog.h | 2 +- 6 files changed, 52 insertions(+), 30 deletions(-) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index b0a58a4e2a..fdb695f85b 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, bool = false); +[[noreturn]] void report_fatal_error(std::string_view text, bool is_html = false, bool include_help_text = true); std::string dump_useful_thread_info() { diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 9367a6e207..410768c14a 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, bool = false); +[[noreturn]] void report_fatal_error(std::string_view text, bool is_html = false, bool include_help_text = true); void initialize_timebased_time(u64 timebased_init, bool reset = false); diff --git a/rpcs3/main.cpp b/rpcs3/main.cpp index 4c30de767e..682a04ec4d 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, bool is_html = false) +[[noreturn]] extern void report_fatal_error(std::string_view _text, bool is_html, bool include_help_text) { #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 = [is_html](std::string_view text) + static auto show_report = [is_html, include_help_text](std::string_view text) { - fatal_error_dialog dlg(text, is_html); + fatal_error_dialog dlg(text, is_html, include_help_text); dlg.exec(); }; diff --git a/rpcs3/module_verifier.hpp b/rpcs3/module_verifier.hpp index 6bb8fe566e..8f4817ba6f 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, bool); +[[noreturn]] void report_fatal_error(std::string_view text, bool is_html = false, bool include_help_text = true); // Validates that system modules are properly installed // Only relevant for WIN32 @@ -26,10 +26,10 @@ class WIN32_module_verifier const std::vector special_module_infos = { { L"vulkan-1.dll", "Vulkan Runtime", "https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-runtime.exe" }, - { L"msvcp140.dll", "C++ Redistributable for Visual Studio 2015", "https://www.microsoft.com/en-us/download/details.aspx?id=48145" }, - { L"vcruntime140.dll", "C++ Redistributable for Visual Studio 2015", "https://www.microsoft.com/en-us/download/details.aspx?id=48145" }, - { L"msvcp140_1.dll", "C++ Redistributable for Visual Studio 2015", "https://www.microsoft.com/en-us/download/details.aspx?id=48145" }, - { L"vcruntime140_1.dll", "C++ Redistributable for Visual Studio 2015", "https://www.microsoft.com/en-us/download/details.aspx?id=48145" } + { L"msvcp140.dll", "Microsoft Visual C++ 2015-2019 Redistributable", "https://aka.ms/vs/16/release/VC_redist.x64.exe" }, + { L"vcruntime140.dll", "Microsoft Visual C++ 2015-2019 Redistributable", "https://aka.ms/vs/16/release/VC_redist.x64.exe" }, + { L"msvcp140_1.dll", "Microsoft Visual C++ 2015-2019 Redistributable", "https://aka.ms/vs/16/release/VC_redist.x64.exe" }, + { L"vcruntime140_1.dll", "Microsoft Visual C++ 2015-2019 Redistributable", "https://aka.ms/vs/16/release/VC_redist.x64.exe" } }; // Unless we support ReactOS in future, this is a constant @@ -54,8 +54,8 @@ class WIN32_module_verifier { const auto error_message = fmt::format( "

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

", @@ -64,7 +64,7 @@ class WIN32_module_verifier module.dl_link, module.dl_link ); - report_fatal_error(error_message, true); + report_fatal_error(error_message, true, false); } } } diff --git a/rpcs3/rpcs3qt/fatal_error_dialog.cpp b/rpcs3/rpcs3qt/fatal_error_dialog.cpp index 4c79329487..0e9c2651ce 100644 --- a/rpcs3/rpcs3qt/fatal_error_dialog.cpp +++ b/rpcs3/rpcs3qt/fatal_error_dialog.cpp @@ -4,9 +4,44 @@ #include #include -fatal_error_dialog::fatal_error_dialog(std::string_view text, bool is_html) : QMessageBox() +const QString document_with_help_text = R"( + +

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

+)"; + +const QString document_without_help_text = R"( + +

+ %1
+

+)"; + +fatal_error_dialog::fatal_error_dialog(std::string_view text, bool is_html, bool include_help_text) : QMessageBox() { - const QString msg = QString::fromUtf8(text.data(), text.size()); + const QString qstr = QString::fromUtf8(text.data(), text.size()); + const QString msg = is_html ? qstr : Qt::convertFromPlainText(qstr); + + QString document_body; + if (include_help_text) [[likely]] + { + document_body = document_with_help_text + .arg(msg) + .arg(tr("HOW TO REPORT ERRORS:")) + .arg(tr("Please, don't send incorrect reports. Thanks for understanding.")); + } + else + { + document_body = document_without_help_text.arg(msg); + } #ifndef __APPLE__ setWindowIcon(QIcon(":/rpcs3.ico")); @@ -14,19 +49,6 @@ fatal_error_dialog::fatal_error_dialog(std::string_view text, bool is_html) : QM setWindowTitle(tr("RPCS3: Fatal Error")); 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(is_html ? msg : Qt::convertFromPlainText(msg)) - .arg(tr("HOW TO REPORT ERRORS:")) - .arg(tr("Please, don't send incorrect reports. Thanks for understanding."))); + setText(document_body); layout()->setSizeConstraint(QLayout::SetFixedSize); } diff --git a/rpcs3/rpcs3qt/fatal_error_dialog.h b/rpcs3/rpcs3qt/fatal_error_dialog.h index d2bf87e998..913daf2844 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, bool is_html); + explicit fatal_error_dialog(std::string_view text, bool is_html, bool include_help_text); };