Starting sa-mp with specified affinity on Windows 7 (Workarround for having no mouse input after pressing ESC)
#1

Hi,

those of you who have a multi core processor and having mouse issues with GTA (no mouse input after pressing ESC), might know how to workarround this problem by setting the processor affinity of GTA to a single core via task manager. It can be annoying setting this everytime after launching sa-mp, so I show you how to start sa-mp with the specified affinity with a batch file which will result in GTA having the same affinity.
First of all you have to create a batch file in the folder where you want to launch sa-mp, for example your Desktop. The file extension has to be .bat or .cmd
You can do this by opening editor and saving it as .bat or .cmd
Now edit the batch file and add following line:
Код:
cd C:\Program Files (x86)\Rockstar Games\Grand Theft Auto San Andreas
This will change the working directory to your sa-mp path, don't forget to change the path if you have installed sa-mp somewhere else.
Add this line for starting sa-mp with the specified affinity:
Код:
start /AFFINITY 80 samp.exe
This will start sa-mp with a process affinity set to processor 7 which is the last processor for me but you can also set the affinity to any other processor like processor 0. (Check with task manager which of your CPUs has normally the highest capacity and take it as the CPU for sa-mp).
The affinity mask has to be entered as hexadecimal number and is a combination of processor numbers, where 1 stands for the first CPU, 2 for the second, 4 for the third, 8 for the 4th and so on.
So if you need the hexadecimal number you have to do this calculation:
2 ^ Processor number (two to the power of the processor number)
Convert the resulting number to a hexadecimal number. (You can use the windows calculator and change the view to programming).
If this is too complicated, just pick the right number here:
Код:
CPU	-	Hex number
0	-	1
1	-	2
2	-	4
3	-	8
4	-	10
5	-	20
6	-	40
7	-	80
8	-	100
By now you should see how it continues...

If sa-mp is located on another drive than the batch file, for example E:, you have to add another line at the beginning of the file:
Код:
E:
Change the drive letter to the one where sa-mp is installed.

I hope this might help someone, if you have any questions feel free to ask.

And here is my question to the batch pros:
Код:
start /D "E:\Programme\GTA SA\Grand Theft Auto San Andreas\" /AFFINITY 1 samp.exe
starts sa-mp but doesn't set the affinity - why is that?

Edit: Maybe this fits better in Client Support? If so, move it there please, I can't remove it
Reply
#2

Wrong section, this is for scripting tutorials. Post it here.
http://forum.sa-mp.com/forumdisplay.php?f=16
Reply
#3

just add a line to your
Код:
Documents\GTA San Andreas User Files\SAMP\sa-mp.cfg
with
Код:
multicore=0
and you're done..
Reply
#4

Good find but you should really research the error.

Gamer_Z is completely right and that should've been really easy..
Reply
#5

Yes, that is the easiest way to do it, no doubt! I am just showing an alternative way with more options, like specifying the cores to have a better load balance. Also this method can be used for other programs or single player.

Quote:
Originally Posted by SchurmanCQC
Good find but you should really research the error.
?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)