Skip to content

Commit 318ee0b

Browse files
Synchronize changes from 1.6 master branch [ci skip]
e415977 CPU Affinity description (#4140)
2 parents 587a302 + e415977 commit 318ee0b

File tree

3 files changed

+18
-28
lines changed

3 files changed

+18
-28
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", false); // Set CPU 0 affinity to improve game performance and fix the known issue in single-threaded games
360+
DEFAULT("process_cpu_affinity", true); // 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/CCore.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,7 @@ void CCore::OnPostColorFilterRender()
17701770
void CCore::ApplyCoreInitSettings()
17711771
{
17721772
#if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
1773-
const auto aware = CVARS_GET_VALUE<bool>("process_dpi_aware");
1773+
bool aware = CVARS_GET_VALUE<bool>("process_dpi_aware");
17741774

17751775
// The minimum supported client for the function below is Windows Vista (Longhorn).
17761776
// For more information, refer to the Microsoft Learn article:
@@ -1779,39 +1779,35 @@ void CCore::ApplyCoreInitSettings()
17791779
SetProcessDPIAware();
17801780
#endif
17811781

1782-
const auto revision = GetApplicationSettingInt("reset-settings-revision");
1782+
int revision = GetApplicationSettingInt("reset-settings-revision");
17831783

17841784
// Users with the default skin will be switched to the 2023 version by replacing "Default" with "Default 2023".
17851785
// The "Default 2023" GUI skin was introduced in commit 2d9e03324b07e355031ecb3263477477f1a91399.
17861786
if (revision < 21486)
17871787
{
1788-
const auto skin = CVARS_GET_VALUE<std::string>("current_skin");
1788+
auto skin = CVARS_GET_VALUE<std::string>("current_skin");
17891789

17901790
if (skin == "Default")
17911791
CVARS_SET("current_skin", "Default 2023");
17921792

17931793
SetApplicationSettingInt("reset-settings-revision", 21486);
17941794
}
17951795

1796-
const auto process = GetCurrentProcess();
1797-
const int priorities[] = {NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, HIGH_PRIORITY_CLASS};
1798-
const auto priority = CVARS_GET_VALUE<int>("process_priority") % 3;
1796+
HANDLE process = GetCurrentProcess();
1797+
const int priorities[] = {NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, HIGH_PRIORITY_CLASS};
1798+
int priority = CVARS_GET_VALUE<int>("process_priority") % 3;
17991799

18001800
SetPriorityClass(process, priorities[priority]);
18011801

1802-
const auto affinity = CVARS_GET_VALUE<bool>("process_cpu_affinity");
1803-
1802+
bool affinity = CVARS_GET_VALUE<bool>("process_cpu_affinity");
18041803
if (!affinity)
18051804
return;
18061805

18071806
DWORD_PTR mask;
18081807
DWORD_PTR sys;
1809-
const auto result = GetProcessAffinityMask(process, &mask, &sys);
1810-
1811-
if (!result)
1812-
return;
1813-
1814-
SetProcessAffinityMask(process, mask & ~1);
1808+
BOOL result = GetProcessAffinityMask(process, &mask, &sys);
1809+
if (result)
1810+
SetProcessAffinityMask(process, mask & ~1);
18151811
}
18161812

18171813
//

Client/core/CSettings.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3245,13 +3245,11 @@ void CSettings::LoadData()
32453245
DWORD_PTR mask;
32463246
DWORD_PTR sys;
32473247

3248-
const auto process = GetCurrentProcess();
3249-
const auto result = GetProcessAffinityMask(process, &mask, &sys);
3248+
HANDLE process = GetCurrentProcess();
3249+
BOOL result = GetProcessAffinityMask(process, &mask, &sys);
32503250

32513251
if (bVar && result)
3252-
{
32533252
SetProcessAffinityMask(process, mask & ~1);
3254-
}
32553253
else
32563254
{
32573255
SYSTEM_INFO info;
@@ -3657,19 +3655,17 @@ void CSettings::SaveData()
36573655
CScreenShot::SetPhotoSavingInsideDocuments(photoSaving);
36583656

36593657
// Process CPU Affinity
3660-
const auto affinity = m_pProcessAffinityCheckbox->GetSelected();
3658+
bool affinity = m_pProcessAffinityCheckbox->GetSelected();
36613659
CVARS_SET("process_cpu_affinity", affinity);
36623660

36633661
DWORD_PTR mask;
36643662
DWORD_PTR sys;
36653663

3666-
const auto process = GetCurrentProcess();
3667-
const auto result = GetProcessAffinityMask(process, &mask, &sys);
3664+
HANDLE process = GetCurrentProcess();
3665+
BOOL result = GetProcessAffinityMask(process, &mask, &sys);
36683666

36693667
if (affinity && result)
3670-
{
36713668
SetProcessAffinityMask(process, mask & ~1);
3672-
}
36733669
else
36743670
{
36753671
SYSTEM_INFO info;
@@ -4785,9 +4781,7 @@ bool CSettings::OnAffinityClick(CGUIElement* pElement)
47854781
shownWarning = true;
47864782

47874783
std::string message = std::string(
4788-
_("Enabling this setting may improve game performance, but on some processors, it may worsen it.\n"
4789-
"We have observed issues with AMD Ryzen processors featuring 3D V-Cache.\n"
4790-
"The exact list of affected processors is unknown.\n"
4784+
_("This option should only be changed if you experience performance issues.\n"
47914785
"\nAre you sure you want to enable this option?"));
47924786

47934787
CQuestionBox* pQuestionBox = CCore::GetSingleton().GetLocalGUI()->GetMainMenu()->GetQuestionWindow();
@@ -4967,7 +4961,7 @@ bool CSettings::OnShowAdvancedSettingDescription(CGUIElement* pElement)
49674961
else if (pCheckBox && pCheckBox == m_pWin8MouseCheckBox)
49684962
strText = std::string(_("Mouse fix:")) + " " + std::string(_("Mouse movement fix - May need PC restart"));
49694963
else if (pCheckBox && pCheckBox == m_pProcessAffinityCheckbox)
4970-
strText = std::string(_("CPU affinity:")) + " " + std::string(_("Experimental feature - It may improve performance or worsen it."));
4964+
strText = std::string(_("CPU affinity:")) + " " + std::string(_("Experimental feature - Change only if you experience performance issues"));
49714965

49724966
if (strText != "")
49734967
m_pAdvancedSettingDescriptionLabel->SetText(strText.c_str());

0 commit comments

Comments
 (0)