Qt: fix initial TSX selection

This commit is contained in:
Megamouse 2021-11-05 16:32:13 +01:00
parent 88bb26afb4
commit f9abe40494
3 changed files with 13 additions and 6 deletions

View File

@ -5,7 +5,7 @@
cfg_root g_cfg{}; cfg_root g_cfg{};
bool cfg_root::node_core::has_rtm() bool cfg_root::node_core::enable_tsx_by_default()
{ {
return utils::has_rtm(); return utils::has_rtm() && utils::has_mpx() && !utils::has_tsx_force_abort();
} }

View File

@ -14,7 +14,7 @@ struct cfg_root : cfg::node
{ {
private: private:
/** We don't wanna include the sysinfo header here */ /** We don't wanna include the sysinfo header here */
static bool has_rtm(); static bool enable_tsx_by_default();
public: public:
node_core(cfg::node* _this) : cfg::node(_this, "Core") {} node_core(cfg::node* _this) : cfg::node(_this, "Core") {}
@ -49,7 +49,7 @@ struct cfg_root : cfg::node
cfg::uint<0, 16> mfc_transfers_shuffling{ this, "MFC Commands Shuffling Limit", 0 }; cfg::uint<0, 16> mfc_transfers_shuffling{ this, "MFC Commands Shuffling Limit", 0 };
cfg::uint<0, 10000> mfc_transfers_timeout{ this, "MFC Commands Timeout", 0, true }; cfg::uint<0, 10000> mfc_transfers_timeout{ this, "MFC Commands Timeout", 0, true };
cfg::_bool mfc_shuffling_in_steps{ this, "MFC Commands Shuffling In Steps", false, true }; cfg::_bool mfc_shuffling_in_steps{ this, "MFC Commands Shuffling In Steps", false, true };
cfg::_enum<tsx_usage> enable_TSX{ this, "Enable TSX", has_rtm() ? tsx_usage::enabled : tsx_usage::disabled }; // Enable TSX. Forcing this on Haswell/Broadwell CPUs should be used carefully cfg::_enum<tsx_usage> enable_TSX{ this, "Enable TSX", enable_tsx_by_default() ? tsx_usage::enabled : tsx_usage::disabled }; // Enable TSX. Forcing this on Haswell/Broadwell CPUs should be used carefully
cfg::_bool spu_accurate_xfloat{ this, "Accurate xfloat", false }; cfg::_bool spu_accurate_xfloat{ this, "Accurate xfloat", false };
cfg::_bool spu_approx_xfloat{ this, "Approximate xfloat", true }; cfg::_bool spu_approx_xfloat{ this, "Approximate xfloat", true };
cfg::_bool llvm_accurate_dfma{ this, "LLVM Accurate DFMA", true }; // Enable accurate double-precision FMA for CPUs which do not support it natively cfg::_bool llvm_accurate_dfma{ this, "LLVM Accurate DFMA", true }; // Enable accurate double-precision FMA for CPUs which do not support it natively

View File

@ -250,8 +250,15 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
if (!utils::has_mpx() || utils::has_tsx_force_abort()) if (!utils::has_mpx() || utils::has_tsx_force_abort())
{ {
ui->enableTSX->removeItem(ui->enableTSX->findText(m_emu_settings->GetLocalizedSetting(tsx_enabled, emu_settings_type::EnableTSX, static_cast<int>(tsx_usage::enabled)))); const QString current_text = ui->enableTSX->currentText();
ui->enableTSX->setCurrentIndex(ui->enableTSX->findText(m_emu_settings->GetLocalizedSetting(tsx_default, emu_settings_type::EnableTSX, static_cast<int>(g_cfg.core.enable_TSX.def)))); const QString localized_tsx_enabled = m_emu_settings->GetLocalizedSetting(tsx_enabled, emu_settings_type::EnableTSX, static_cast<int>(tsx_usage::enabled));
ui->enableTSX->removeItem(ui->enableTSX->findText(localized_tsx_enabled));
if (current_text == localized_tsx_enabled)
{
ui->enableTSX->setCurrentText(m_emu_settings->GetLocalizedSetting(tsx_default, emu_settings_type::EnableTSX, static_cast<int>(g_cfg.core.enable_TSX.def)));
}
} }
// connect the toogled signal so that the stateChanged signal in EnhanceCheckBox can be prevented // connect the toogled signal so that the stateChanged signal in EnhanceCheckBox can be prevented