ThirteenAG / WidescreenFixesPack

Plugins to make or improve widescreen resolutions support in games, add more features and fix bugs.
https://thirteenag.github.io/wfp
MIT License
2.29k stars 218 forks source link

[NFSMW] Pin threads to single core (& rework the UG2 one a bit) #1439

Open xan1242 opened 1 year ago

xan1242 commented 1 year ago

Basically I had a bit of a misunderstanding what the thing from CrabJournal did (until I actually read the PR).

Anyhow, this should be done to improve game stability and performance.

Only the sound and main threads should be pinned, others are related to networking and shouldn't be touched unless necessary.

Maybe Carbon could use this too. Needs further testing.

xan1242 commented 1 year ago

Disabling "SingleCoreAffinity" (which should be renamed to something like "PinThreads" instead because it legitimately confused me with the Windows' process affinity) causes UG2 to crash somewhere during EAXSound::Update, so it's basically just as I suspected earlier (in another thread, can't find it) - the sound thread and main thread desync in some way and things go unstable.

So yeah, pinning main and sound threads onto their own CPU threads should do the trick.

ThirteenAG commented 1 year ago

Is there a way to tell which is which?

xan1242 commented 1 year ago

Yeah, I can tell easily in the disassembly and the start locations of each CreateThread. Should be no problem.