Sets CPU affinity and priority for the Steam-based PoE2 process. This is done by automtically changing the Launch Options for PoE2 in Steam.
- Searches system for Steam and PoE2 via registry keys, the default install location, then recursive drive search. If multiple locations are found, prompt user for preferred location.
- Determines available threads on system, ask how many threads to withhold from PoE2, then calculate affinity mask.
- Find the Steam localconfig.vdf and libraryfolders.vdf files.
- Create a single-line batch file in PoE2's folder that launches PoE2 with CPU affinity settings.
- Read the localconfig.vdf in a PSObject and add launch options for PoE2.
- Create a backup of Steam's localconfig.vdf file.
- Saves changes to localconfig.vdf
- Creates a log file in the same location and of the same name as this script.
- Requires Powershell 3+ (Windows 11, 10, 8, and Server 2025, 2022, 2019, 2016, 2012)
- Use System.IO.File.WriteAllLines instead of Out-File to ensure UTF-8 encoding. Steam will reject UTF-16 encoded files.
- Feel free to take and re-work this script, according to its license, for use with other Steam games.
- Inspiration and reworked code from Steam-GetOnTop by ChiefIntegrator: https://github.com/ChiefIntegrator/Steam-GetOnTop
- Compiled with PS2EXE-GUI [Invoke-PS2EXE] v0.5.0.30 by Ingo Karstein & Markus Scholtes: https://github.com/MScholtes/PS2EXE
Download from the current release (https://github.com/ciphernemo/PoE2-Affinity/releases/download/1.0/poe2_affinity.exe), then run the executable.