File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -406,7 +406,7 @@ ViewXPos=-1
406406ViewYPos =-1
407407
408408; Set to 1 to force Fallout not to use multiple processor cores even if they are available
409- SingleCore =1
409+ SingleCore =0
410410
411411; Set to 1 to override the art_cache_size setting in fallout2.cfg
412412OverrideArtCacheSize =0
Original file line number Diff line number Diff line change @@ -928,13 +928,21 @@ void MiscPatches::init() {
928928 SafeWrite32 (0x444323 , (DWORD)&patchName);
929929 }
930930
931- if (IniReader::GetConfigInt (" Misc" , " SingleCore" , 1 )) {
931+ if (IniReader::GetConfigInt (" Misc" , " SingleCore" , 0 )) {
932932 SYSTEM_INFO sysInfo;
933933 GetSystemInfo (&sysInfo);
934934 if (sysInfo.dwNumberOfProcessors > 1 ) {
935- dlogr (" Applying single core patch." , DL_INIT);
936935 HANDLE process = GetCurrentProcess ();
937- SetProcessAffinityMask (process, 2 ); // use only CPU 1
936+ DWORD_PTR procAffinity, sysAffinity;
937+ if (GetProcessAffinityMask (process, &procAffinity, &sysAffinity)) {
938+ DWORD_PTR newMask = procAffinity & ~static_cast <DWORD_PTR>(1 ); // exclude CPU 0
939+ if (newMask == 0 ) newMask = procAffinity; // fall back if no other cores
940+ newMask &= -static_cast <LONG_PTR>(newMask); // pick the first available core
941+ if (newMask != 0 && newMask != procAffinity) {
942+ dlogr (" Applying single core patch." , DL_INIT);
943+ SetProcessAffinityMask (process, newMask);
944+ }
945+ }
938946 }
939947 }
940948
You can’t perform that action at this time.
0 commit comments