PowerShell to Set PAYDAY: The heist process CPU Affinity (CPU 0, 1, 2, 3) for Avoid Win11 24H2 freezing.
Extract in mods folder (requirement DorHUD)
If you are using fullscreen, the game may lose focus(Alt+Tab) once when it starts, because PowerShell is running.
About Freezing
Some users have experienced freezing issues, which were commonly observed on Windows 11 24H2.
This is presumed to be related to CPU core allocation in the 24H2 version. The issue was resolved when the number of threads was limited to four or fewer, Because the Payday series, which uses only up to the maximum number of threads (not 4 cores).
This problem may have been 25H2? idk.
About mod
Anyway, this mod addresses it by using Windows PowerShell to set PD:TH process CPU affinity.
This method is functionally identical to setting CPU affinity through Task Manager, but it must be applied every time the game is run and crash. It can also be automated using other external programs with the same approach.
However, this mod, as a DAHM/DorHUD format mod, automatically runs PowerShell via the "os.execute()" command the first time Payday is launched to adjust CPU affinity.
As a result, when starting the game in fullscreen, the game temporarily loses focus once. Running PowerShell minimized did not resolve this issue. If anyone knows a solution, please let me know.
You can check its working in Task Manager
If you want change other Affinity option
This mod is configured to use CPUs 0, 1, 2, 3 but you can change this by modifying 'local CPU_Affinity = 15' in the 'setup.lua' file.
The value 15 represents the selected CPUs in binary, converted to a HEX value, corresponding to CPUs 0, 1, 2, 3.
For users with more than four cores (excluding low-power cores), setting it to 85 (0, 2, 4, 6) may provide better performance by assigning one thread per core.
As a result, using four threads or fewer is recommended.


