I got this logic from cspack.exe. I had no idea, so i kept it the same in case it changes...