Repository navigation
Conversation
A console title's affinity masks name its own cores (7 by default, SMT on). Passed through unchanged they would pin a title onto half the host's physical cores, or name processors the host lacks. The shims now translate: - console core i maps to the host's i-th physical core in group 0 (both SMT siblings, from GetLogicalProcessorInformationEx(RelationProcessorCore) and the process mask), wrapping when the host has fewer cores; - SetThreadAffinityMask, Get/SetProcessAffinityMask, SetThreadIdealProcessor and SetThreadIdealProcessorEx translate masks and indices both ways; a mask with bits outside the console's cores is ERROR_INVALID_PARAMETER; - SetThreadSelectedCpuSets/SetProcessDefaultCpuSets pass host CPU-set IDs through unchanged; - LEONIDA_TITLE_CORES (1..64) overrides the console core count. Registered under kernel32, kernelbase and api-ms-win-core-processthreads l1-1-0..3. One bit per console core is an assumption until the executable can confirm it. cpu_affinity: 38/38 checks (synthetic topologies plus a real suspended thread). AI-assisted (written with Gemini, reviewed and tested with Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested AI-assisted independent run on a second machine with the same 8C/16T layout as yours, a different CPU generation (Zen 5 X3D).
Not covered: hosts with more than 64 logical processors or several processor groups, and fewer physical cores than the console's 7, except through the synthetic topologies in the test. |
|
Tested
A suggestion for the Wine/Proton path: the ideal processor is only a scheduling hint. AI-assisted. |
|
Tested 2b81aac merged onto The 7600X has 6 physical cores / 12 threads, fewer than the 7 console cores, so the real-thread checks run on a host where the mapping wraps (the PR's own run was on an 8-core host).
|
|
Tested
AI-assisted (Claude Code). No game files. |
|
Tested Windows 11 Pro 26300, MSVC 19.44 (VS 2022 Build Tools), Ninja RelWithDebInfo via
|
Claimed in #2300 (claim).
A console title's affinity masks name its own cores (7 by default, 2 SMT threads each). Passed through unchanged, a mask like
0x7Fpins a title onto 3.5 of the host's physical cores, and bits above the host's count fail.runtime/shims/cpu_affinity.cpptranslates them for mapped images:GetLogicalProcessorInformationEx(RelationProcessorCore)∩ the process mask), wrapping when the host has fewer cores;SetThreadAffinityMask,GetProcessAffinityMask,SetProcessAffinityMask,SetThreadIdealProcessor,SetThreadIdealProcessorExtranslate masks and indices both ways; bits outside the console's cores →ERROR_INVALID_PARAMETER;SetThreadSelectedCpuSets/SetProcessDefaultCpuSetsforward host CPU-set IDs unchanged (they come from the host'sGetSystemCpuSetInformation);LEONIDA_TITLE_CORES(1–64) overrides the console core count.Registered under
kernel32.dll,kernelbase.dllandapi-ms-win-core-processthreads-l1-1-{0..3}.dll. One bit per console core is an assumption (marked as such in the code and docs) until the executable can confirm it. Docs: new "Title CPU affinity" section indocs/runtime_imports.md.Tested on
49475796+ this branch, Windows 11 24H2, Ryzen 7 7800X3D (8 cores / 16 threads), RTX 5070 Ti (NVIDIA 621.01), MSVC 14.44, Ninja RelWithDebInfo:cpu_affinity: 38/38 checks — synthetic 8-core and 2-core SMT topologies, N=1/N=64 edges, env parsing, and the shims on a real suspended thread (confinement checked withGetThreadGroupAffinity).ctest(excludingd3d12_draw, which fails onmainon this GPU independently of this change): 124/124 passed, 5 skipped.No game files used or added. AI-assisted: written with Gemini, reviewed, built and tested with Claude Code.