PDA

View Full Version : spr - player flags


zakret
6th February 2008, 07:22
Hi

I can't find about player flags in spr file. I'm reading this file using php. I'm reading byte by byte so because player flags is word (word: 2-byte integer) after read I have two numbers:

fseek($stream,132);
$player_flags1 = hexdec(bin2hex(fread($stream,1)));
fseek($stream,133);
$player_flags2 = hexdec(bin2hex(fread($stream,1)));

$player_flags1 stores first byte .. $player_flags2 stores second byte. How to split them?
For example from my file:
$player_flags1 = 1
$plyer_flags2=6

result is 16 or 7 or ??

LEFT HAND DRIVE 1
GEAR CHANGE CUT 2
GEAR CHANGE BLIP 4
AUTO SHIFT 8
SHIFTER 16
RESERVED 32

After split how to read flags using those rules?

--
Best regards
Tomasz Zakrecki

the_angry_angel
6th February 2008, 08:12
Take a look at the unpack function, which is part of PHP by default. That should help you out.

zakret
6th February 2008, 19:17
tnx, it works :D