1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

ux: Update vcredist links and optionally disable help text from error dialog

This commit is contained in:
kd-11 2022-12-06 18:26:38 +03:00 committed by Megamouse
parent a6b44ea1bb
commit 0aaa40cd53
6 changed files with 52 additions and 30 deletions

View File

@ -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()
{

View File

@ -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);

View File

@ -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();
};

View File

@ -11,7 +11,7 @@
#include <Utilities/StrUtil.h>
#include <Utilities/StrFmt.h>
[[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<module_info_t> 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(
"<p>"
"The module '%s' was incorrectly installed.<br>"
"This module is part of the '%s' package.<br>"
"The module <strong>%s</strong> was incorrectly installed.<br>"
"This module is part of the <strong>%s</strong> package.<br>"
"You can install this package from this URL:<br>"
"<a href='%s'>%s</a>"
"</p>",
@ -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);
}
}
}

View File

@ -4,9 +4,44 @@
#include <QTextDocument>
#include <QIcon>
fatal_error_dialog::fatal_error_dialog(std::string_view text, bool is_html) : QMessageBox()
const QString document_with_help_text = R"(
<style>
p {white-space: nowrap;}
</style>
<p>
%1<br>
%2<br>
<a href='https://github.com/RPCS3/rpcs3/wiki/How-to-ask-for-Support'>https://github.com/RPCS3/rpcs3/wiki/How-to-ask-for-Support</a><br>
%3<br>
</p>
)";
const QString document_without_help_text = R"(
<style>
p {white-space: nowrap;}
</style>
<p>
%1<br>
</p>
)";
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"(
<style>
p {white-space: nowrap;}
</style>
<p>
%1<br>
%2<br>
<a href='https://github.com/RPCS3/rpcs3/wiki/How-to-ask-for-Support'>https://github.com/RPCS3/rpcs3/wiki/How-to-ask-for-Support</a><br>
%3<br>
</p>
)")
.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);
}

View File

@ -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);
};