Skip to content

Commit da607ed

Browse files
committed
Disable by default
1 parent 58a5eeb commit da607ed

File tree

3 files changed

+52
-7
lines changed

3 files changed

+52
-7
lines changed

Client/core/CClientVariables.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ void CClientVariables::LoadDefaults()
357357
DEFAULT("discord_rpc_share_data", false); // Consistent Rich Presence data sharing
358358
DEFAULT("discord_rpc_share_data_firsttime", false); // Display the user data sharing consent dialog box - for the first time
359359
DEFAULT("browser_enable_gpu", true); // Enable GPU in CEF? (allows stuff like WebGL to function)
360-
DEFAULT("process_cpu_affinity", true); // Set CPU 0 affinity to improve game performance and fix the known issue in single-threaded games
360+
DEFAULT("process_cpu_affinity", false); // Set CPU 0 affinity to improve game performance and fix the known issue in single-threaded games
361361

362362
if (!Exists("locale"))
363363
{

Client/core/CSettings.cpp

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,12 @@ void CSettings::CreateGUI()
405405
m_pCheckBoxAllowDiscordRPC->GetPosition(vecTemp, false);
406406
m_pCheckBoxAllowDiscordRPC->AutoSize(NULL, 20.0f);
407407

408+
// Enable camera photos getting saved to documents folder
409+
m_pPhotoSavingCheckbox = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabMultiplayer, _("Save photos taken by camera weapon to GTA San Andreas User Files folder"), true));
410+
m_pPhotoSavingCheckbox->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 20.0f));
411+
m_pPhotoSavingCheckbox->GetPosition(vecTemp, false);
412+
m_pPhotoSavingCheckbox->AutoSize(NULL, 20.0f);
413+
408414
m_pCheckBoxCustomizedSAFiles = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabMultiplayer, _("Use customized GTA:SA files"), true));
409415
m_pCheckBoxCustomizedSAFiles->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 20.0f));
410416
m_pCheckBoxCustomizedSAFiles->GetPosition(vecTemp, false);
@@ -1201,12 +1207,6 @@ void CSettings::CreateGUI()
12011207
m_pCachePathValue->AutoSize();
12021208
vecTemp.fY += fLineHeight;
12031209

1204-
// Enable camera photos getting saved to documents folder
1205-
m_pPhotoSavingCheckbox = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabAdvanced, _("Save photos taken by camera weapon to GTA San Andreas User Files folder"), true));
1206-
m_pPhotoSavingCheckbox->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY));
1207-
m_pPhotoSavingCheckbox->AutoSize(NULL, 20.0f);
1208-
vecTemp.fY += fLineHeight;
1209-
12101210
// Process affinity
12111211
m_pProcessAffinityCheckbox = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabAdvanced, _("Set CPU 0 affinity to improve game performance"), true));
12121212
m_pProcessAffinityCheckbox->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY));
@@ -1312,6 +1312,7 @@ void CSettings::CreateGUI()
13121312
m_pButtonBrowserWhitelistRemove->SetClickHandler(GUI_CALLBACK(&CSettings::OnBrowserWhitelistRemove, this));
13131313
m_pEditBrowserWhitelistAdd->SetActivateHandler(GUI_CALLBACK(&CSettings::OnBrowserWhitelistDomainAddFocused, this));
13141314
m_pEditBrowserWhitelistAdd->SetDeactivateHandler(GUI_CALLBACK(&CSettings::OnBrowserWhitelistDomainAddDefocused, this));
1315+
m_pProcessAffinityCheckbox->SetClickHandler(GUI_CALLBACK(&CSettings::OnAffinityClick, this));
13151316

13161317
// Set up the events for advanced description
13171318
m_pPriorityLabel->SetMouseEnterHandler(GUI_CALLBACK(&CSettings::OnShowAdvancedSettingDescription, this));
@@ -1380,6 +1381,9 @@ void CSettings::CreateGUI()
13801381
m_pUpdateAutoInstallCombo->SetMouseEnterHandler(GUI_CALLBACK(&CSettings::OnShowAdvancedSettingDescription, this));
13811382
m_pUpdateAutoInstallCombo->SetMouseLeaveHandler(GUI_CALLBACK(&CSettings::OnHideAdvancedSettingDescription, this));
13821383

1384+
m_pProcessAffinityCheckbox->SetMouseEnterHandler(GUI_CALLBACK(&CSettings::OnShowAdvancedSettingDescription, this));
1385+
m_pProcessAffinityCheckbox->SetMouseLeaveHandler(GUI_CALLBACK(&CSettings::OnHideAdvancedSettingDescription, this));
1386+
13831387
// Load Chat presets
13841388
LoadChatPresets();
13851389

@@ -4749,6 +4753,44 @@ static void DPIAwareQuestionCallBack(void* userdata, unsigned int uiButton)
47494753
}
47504754
}
47514755

4756+
static void CPUAffinityQuestionCallBack(void* userdata, unsigned int button)
4757+
{
4758+
CCore::GetSingleton().GetLocalGUI()->GetMainMenu()->GetQuestionWindow()->Reset();
4759+
4760+
if (button == 0)
4761+
{
4762+
auto const checkBox = reinterpret_cast<CGUICheckBox*>(userdata);
4763+
checkBox->SetSelected(false);
4764+
}
4765+
}
4766+
4767+
bool CSettings::OnAffinityClick(CGUIElement* pElement)
4768+
{
4769+
static bool shownWarning = false;
4770+
4771+
if (m_pProcessAffinityCheckbox->GetSelected() && !shownWarning)
4772+
{
4773+
shownWarning = true;
4774+
4775+
std::string message = std::string(
4776+
_("Enabling this setting may improve game performance, but on some processors, it may worsen it.\n"
4777+
"We have observed issues with AMD Ryzen processors featuring 3D V-Cache.\n"
4778+
"The exact list of affected processors is unknown.\n"
4779+
"\nAre you sure you want to enable this option?"));
4780+
4781+
CQuestionBox* pQuestionBox = CCore::GetSingleton().GetLocalGUI()->GetMainMenu()->GetQuestionWindow();
4782+
pQuestionBox->Reset();
4783+
pQuestionBox->SetTitle(_("EXPERIMENTAL FEATURE"));
4784+
pQuestionBox->SetMessage(message);
4785+
pQuestionBox->SetButton(0, _("No"));
4786+
pQuestionBox->SetButton(1, _("Yes"));
4787+
pQuestionBox->SetCallback(CPUAffinityQuestionCallBack, m_pProcessAffinityCheckbox);
4788+
pQuestionBox->Show();
4789+
}
4790+
4791+
return true;
4792+
}
4793+
47524794
bool CSettings::OnBrowserBlacklistAdd(CGUIElement* pElement)
47534795
{
47544796
SString strDomain = m_pEditBrowserBlacklistAdd->GetText();
@@ -4912,6 +4954,8 @@ bool CSettings::OnShowAdvancedSettingDescription(CGUIElement* pElement)
49124954
strText = std::string(_("16-bit color:")) + " " + std::string(_("Enable 16 bit color modes - Requires MTA restart"));
49134955
else if (pCheckBox && pCheckBox == m_pWin8MouseCheckBox)
49144956
strText = std::string(_("Mouse fix:")) + " " + std::string(_("Mouse movement fix - May need PC restart"));
4957+
else if (pCheckBox && pCheckBox == m_pProcessAffinityCheckbox)
4958+
strText = std::string(_("CPU affinity:")) + " " + std::string(_("Experimental feature - It may improve performance or worsen it."));
49154959

49164960
if (strText != "")
49174961
m_pAdvancedSettingDescriptionLabel->SetText(strText.c_str());

Client/core/CSettings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ class CSettings
407407
bool OnShowAdvancedSettingDescription(CGUIElement* pElement);
408408
bool OnHideAdvancedSettingDescription(CGUIElement* pElement);
409409
bool OnTabChanged(CGUIElement* pElement);
410+
bool OnAffinityClick(CGUIElement* pElement);
410411
void ReloadBrowserLists();
411412

412413
private:

0 commit comments

Comments
 (0)