implement "Enable TSX" combobox

This commit is contained in:
Megamouse 2018-06-13 13:54:16 +02:00 committed by Ivan
parent 2bc4cb4e58
commit af71cf0922
8 changed files with 98 additions and 6 deletions

View file

@ -20,6 +20,7 @@
#include "stdafx.h"
#include "Emu/System.h"
#include "Crypto/unself.h"
#include "Utilities/sysinfo.h"
#include <unordered_set>
#include <thread>
@ -1079,6 +1080,40 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
xemu_settings->EnhanceCheckBox(ui->spuDebug, emu_settings::SPUDebug);
SubscribeTooltip(ui->spuDebug, json_debug["spuDebug"].toString());
if (utils::has_rtm())
{
xemu_settings->EnhanceComboBox(ui->enableTSX, emu_settings::EnableTSX);
SubscribeTooltip(ui->enableTSX, json_debug["enableTSX"].toString());
static const QString tsx_forced = qstr(fmt::format("%s", tsx_usage::forced));
static const QString tsx_default = qstr(xemu_settings->GetSettingDefault(emu_settings::EnableTSX));
// connect the toogled signal so that the stateChanged signal in EnhanceCheckBox can be prevented
connect(ui->enableTSX, &QComboBox::currentTextChanged, [this](const QString& text)
{
if (text == tsx_forced && !utils::has_mpx() && QMessageBox::No == QMessageBox::critical(this, tr("Haswell/Broadwell TSX Warning"), tr(
R"(
<p style="white-space: nowrap;">
RPCS3 has detected you are using TSX functions on a Haswell or Broadwell CPU.<br>
Intel has deactivated these functions in newer Microcode revisions, since they can lead to unpredicted behaviour.<br>
That means using TSX may break games or even <font color="red"><b>damage</b></font> your data.<br>
We recommend to disable this feature and update your computer BIOS.<br><br>
Do you wish to use TSX anyway?
</p>
)"
), QMessageBox::Yes, QMessageBox::No))
{
// Reset if the messagebox was answered with no. This prevents the currentIndexChanged signal in EnhanceComboBox
ui->enableTSX->setCurrentText(tsx_default);
}
});
}
else
{
ui->label_enableTSX->setHidden(true);
ui->enableTSX->setHidden(true);
}
//
// Layout fix for High Dpi