@@ -1769,43 +1769,44 @@ void CCore::OnPostColorFilterRender()
1769
1769
1770
1770
void CCore::ApplyCoreInitSettings ()
1771
1771
{
1772
- #if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN) // Windows Vista
1773
- bool bValue;
1774
- CVARS_GET (" process_dpi_aware" , bValue);
1772
+ #if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
1773
+ const auto aware = CVARS_GET_VALUE<bool >(" process_dpi_aware" );
1775
1774
1776
- if (bValue)
1777
- {
1778
- // Minimum supported client for the function below is Windows Vista
1779
- // See also: https://technet.microsoft.com/en-us/evalcenter/dn469266(v=vs.90)
1775
+ if (aware)
1780
1776
SetProcessDPIAware ();
1781
- }
1782
1777
#endif
1783
1778
1784
- if (int revision = GetApplicationSettingInt (" reset-settings-revision" ); revision < 21486 )
1785
- {
1786
- // Force users with default skin to the 2023 version by replacing "Default" with "Default 2023".
1787
- // The GUI skin "Default 2023" was introduced in commit 2d9e03324b07e355031ecb3263477477f1a91399.
1788
- std::string currentSkinName;
1789
- CVARS_GET (" current_skin" , currentSkinName);
1779
+ const auto revision = GetApplicationSettingInt (" reset-settings-revision" );
1790
1780
1791
- if (currentSkinName == " Default" )
1792
- {
1793
- CVARS_SET (" current_skin" , " Default 2023" );
1794
- }
1781
+ if (revision >= 21486 )
1782
+ return ;
1795
1783
1796
- SetApplicationSettingInt (" reset-settings-revision" , 21486 );
1797
- }
1784
+ const auto skin = CVARS_GET_VALUE<std::string>(" current_skin" );
1785
+
1786
+ if (skin == " Default" )
1787
+ CVARS_SET (" current_skin" , " Default 2023" );
1798
1788
1799
- // Set process settings
1800
- HANDLE currProc = GetCurrentProcess ();
1789
+ SetApplicationSettingInt (" reset-settings-revision" , 21486 );
1801
1790
1802
- // Process priority
1803
- int PriorityClassList[] = {NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, HIGH_PRIORITY_CLASS};
1804
- SetPriorityClass (currProc, PriorityClassList[CVARS_GET_VALUE<int >(" process_priority" ) % 3 ]);
1791
+ const auto process = GetCurrentProcess ();
1792
+ const int priorities[] = {NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, HIGH_PRIORITY_CLASS};
1793
+ const auto priority = CVARS_GET_VALUE<int >(" process_priority" ) % 3 ;
1794
+
1795
+ SetPriorityClass (process, priorities[priority]);
1796
+
1797
+ const auto affinity = CVARS_GET_VALUE<bool >(" process_cpu_affinity" );
1798
+
1799
+ if (!affinity)
1800
+ return ;
1801
+
1802
+ DWORD_PTR mask;
1803
+ DWORD_PTR sys;
1804
+ const auto result = GetProcessAffinityMask (process, &mask, &sys);
1805
+
1806
+ if (!result)
1807
+ return ;
1805
1808
1806
- // Process CPU affinity
1807
- if (CVARS_GET_VALUE<bool >(" process_cpu_affinity" ))
1808
- SetProcessAffinityMask (currProc, 1 << 0 );
1809
+ SetProcessAffinityMask (process, mask & ~1 );
1809
1810
}
1810
1811
1811
1812
//
0 commit comments