The online racing simulator
Searching in All forums
(5 results)
zakret
S3 licensed
Thank You, very much. Now it works.

Best Regards
TZ
zakret
S3 licensed
Hi

Thank you for answer. But i have also a little problem with reading from file. I don't know how to exactly read player flags from file and convert it to input variable for Your function. I tried:


<?php 
$stream 
fopen($file,"rb"))
//1     word    132     player flags        : driver settings (see NOTES)
fseek($stream,132);

$player_flags bin2hex(fread($stream,2));
or
$player_flags bin2hex(fread($stream,1));
or
$player_flags unpack("v*",bin2hex(fread($stream,2)));
or
$player_flags unpack("v*",bin2hex(fread($stream,1)));
or
$player_flags unpack("h*",bin2hex(fread($stream,2)));
or
$player_flags unpack("h*",bin2hex(fread($stream,2)));

$player_flags convert_flags_hlaps($player_flags);
print_r($player_flags);
?>

but results are wrong with some downloaded hotlap from lfsworld.net (on lfsworld.net page for this hotlap I see: mouse, break help, auto gear,auto clutch and left side) but my code for this hot lap shows me:Lefthand,shifter, wheel or right hand,gear change cut,auto gear,auto-clutch, KS. I tried many ways to read this but always wrong. Could You help?
Spr file and player flags (driver settings)
zakret
S3 licensed
Hi

Could someone explain me how to read and understand player flags from spr file? I would like to read if driver used mouse or keyboard, braking help etc.

This is how I do it in php:

<?php 
fseek
($stream,132);
$player_flags hexdec(bin2hex(fread($stream,1)));
$player_flags unpack("C*",$player_flags);
 
fseek($stream,133);
$player_flags2 hexdec(bin2hex(fread($stream,1)));
$player_flags2 unpack("C*",$player_flags2);
?>

After that when I print to screen I see for example:
playerFlags -> Array ( [1] => 55 [2] => 51 )
playerFlags2 -> Array ( [1] => 54 )

so playerFlags is 73 (from ascii code 55=7, 51=3) and playerFlags2 = 6

I don't know how to split those two values:
1.
73 = 64(Braking help) + 8(auto shift)+1(left hand drive)
6 = 4(gear change blip) + 2(gear change cut)

2.
736 = 512(auto clutch) + 128(axis clutch)+64(braking help)+32(reserved ?)

3.673 = 512(auto clutch) + 128(axis clutch) + 32(reserved ?) + 1(left hand drive)

Or maybe during reading,converting (unpack) file there is a bug?

Best Regards
Tomasz Zakrecki
zakret
S3 licensed
tnx, it works
spr - player flags
zakret
S3 licensed
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
FGED GREDG RDFGDR GSFDG