Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt: Fix initial TSX selection in settings dialog #11117

Merged
merged 1 commit into from
Nov 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rpcs3/Emu/system_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

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();
}
4 changes: 2 additions & 2 deletions rpcs3/Emu/system_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct cfg_root : cfg::node
{
private:
/** We don't wanna include the sysinfo header here */
static bool has_rtm();
static bool enable_tsx_by_default();

public:
node_core(cfg::node* _this) : cfg::node(_this, "Core") {}
Expand Down Expand Up @@ -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, 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::_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_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
Expand Down
11 changes: 9 additions & 2 deletions rpcs3/rpcs3qt/settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
ui->enableTSX->removeItem(ui->enableTSX->findText(m_emu_settings->GetLocalizedSetting(tsx_enabled, emu_settings_type::EnableTSX, static_cast<int>(tsx_usage::enabled))));
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 current_text = ui->enableTSX->currentText();
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
Expand Down