Skip to content

Commit 2b9957c

Browse files
authored
Change the description and behavior of the CPU affinity setting (#4167)
1 parent d34f603 commit 2b9957c

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

Client/core/CSettings.cpp

+27-22
Original file line numberDiff line numberDiff line change
@@ -4765,34 +4765,39 @@ static void CPUAffinityQuestionCallBack(void* userdata, unsigned int button)
47654765
{
47664766
CCore::GetSingleton().GetLocalGUI()->GetMainMenu()->GetQuestionWindow()->Reset();
47674767

4768-
if (button == 0)
4769-
{
4770-
auto const checkBox = reinterpret_cast<CGUICheckBox*>(userdata);
4771-
checkBox->SetSelected(false);
4772-
}
4768+
auto* checkbox = static_cast<CGUICheckBox*>(userdata);
4769+
4770+
if (!checkbox)
4771+
return;
4772+
4773+
if (button != 0)
4774+
return;
4775+
4776+
checkbox->SetSelected(true);
47734777
}
47744778

47754779
bool CSettings::OnAffinityClick(CGUIElement* pElement)
47764780
{
4777-
static bool shownWarning = false;
4781+
static bool shown = false;
47784782

4779-
if (m_pProcessAffinityCheckbox->GetSelected() && !shownWarning)
4780-
{
4781-
shownWarning = true;
4783+
if (m_pProcessAffinityCheckbox->GetSelected() || shown)
4784+
return true;
47824785

4783-
std::string message = std::string(
4784-
_("This option should only be changed if you experience performance issues.\n"
4785-
"\nAre you sure you want to enable this option?"));
4786+
shown = true;
47864787

4787-
CQuestionBox* pQuestionBox = CCore::GetSingleton().GetLocalGUI()->GetMainMenu()->GetQuestionWindow();
4788-
pQuestionBox->Reset();
4789-
pQuestionBox->SetTitle(_("EXPERIMENTAL FEATURE"));
4790-
pQuestionBox->SetMessage(message);
4791-
pQuestionBox->SetButton(0, _("No"));
4792-
pQuestionBox->SetButton(1, _("Yes"));
4793-
pQuestionBox->SetCallback(CPUAffinityQuestionCallBack, m_pProcessAffinityCheckbox);
4794-
pQuestionBox->Show();
4795-
}
4788+
std::string title = _("EXPERIMENTAL FEATURE");
4789+
std::string message =
4790+
std::string(_("Disabling this option is not recommended unless you are experiencing performance issues.\n\n"
4791+
"Are you sure you want to disable it?"));
4792+
4793+
CQuestionBox* pQuestionBox = CCore::GetSingleton().GetLocalGUI()->GetMainMenu()->GetQuestionWindow();
4794+
pQuestionBox->Reset();
4795+
pQuestionBox->SetTitle(title);
4796+
pQuestionBox->SetMessage(message);
4797+
pQuestionBox->SetButton(0, _("No"));
4798+
pQuestionBox->SetButton(1, _("Yes"));
4799+
pQuestionBox->SetCallback(CPUAffinityQuestionCallBack, m_pProcessAffinityCheckbox);
4800+
pQuestionBox->Show();
47964801

47974802
return true;
47984803
}
@@ -4961,7 +4966,7 @@ bool CSettings::OnShowAdvancedSettingDescription(CGUIElement* pElement)
49614966
else if (pCheckBox && pCheckBox == m_pWin8MouseCheckBox)
49624967
strText = std::string(_("Mouse fix:")) + " " + std::string(_("Mouse movement fix - May need PC restart"));
49634968
else if (pCheckBox && pCheckBox == m_pProcessAffinityCheckbox)
4964-
strText = std::string(_("CPU affinity:")) + " " + std::string(_("Experimental feature - Change only if you experience performance issues"));
4969+
strText = std::string(_("CPU affinity:")) + " " + std::string(_("Only disable if you're having performance issues."));
49654970

49664971
if (strText != "")
49674972
m_pAdvancedSettingDescriptionLabel->SetText(strText.c_str());

0 commit comments

Comments
 (0)