The online racing simulator
.set file format
(28 posts, started )
.set file format
Aha, legend.

Damn silly RSC search was searching for what I typed in and not what I actually wanted...

Ooh, we have 7 gears now though. Will investigate and see what is different...
I'd imagine its simply 2 extra bytes for the 7th gear.

Then again we've not mentioned Traction Control either, which isn't featured by that.. arses.
Coo, some old skool threads there. Needless to say, I havent done a thing on working out .set formats for a long while. Still, its straightforward enough with a hex editor, I'm sure it wont take a man of your talents long
I'm chugging through it...
Hoorah, it's all done. Some interesting changes since the spec for 0.5P, obviously try to keep backwards compatibility...

0.5S .SET file specification.


char : 1-byte ASCII character
byte : 1-byte integer
word : 2-byte unsigned integer
float: 4-byte float

Offset Type num Description
------ ---- --- -----------

0 char 6 Description (always SRSETT)
6 byte 1 0
7 byte 1 Version? (always 250)
8 byte 1 Revision? (always 2) **alternatively a word value of 762...**
9 byte 3 0
12 byte 1 Traction Control + Asymmetrical Type (0=TC Off / Sym, 1=TC Off / Asym, 2=TC On / Sym, 3=TC On / Asym)
13 byte 2 0
15 byte 1 Tyre Brand (0=Cromo Plain, 1=Cromo, 2=Torro, 3=Michelin, 4=Evostar)
16 float 1 Brake Strength (Nm)
20 byte 1 Rear Wing Angle
21 byte 1 Front Wing Angle
22 byte 2 0
24 byte 1 Max Steering Lock
25 byte 1 Parallel Steering
26 byte 1 Brake Balance
27 byte 1 Engine Brake Reduction
28 byte 1 Centre Diff Type (0=Open, 1=Viscous)
29 byte 1 Centre Diff Viscous Torque
30 byte 1 0
31 byte 1 Centre Diff Torque Split
32 word 1 Gear Ratio 7 (0 to 65536 = 0.5 to 7.5)
34 word 1 Gear Ratio Final (0 to 65536 = 0.5 to 7.5)
36 word 1 Gear Ratio 1 (0 to 65536 = 0.5 to 7.5)
38 word 1 Gear Ratio 2 (0 to 65536 = 0.5 to 7.5)
40 word 1 Gear Ratio 3 (0 to 65536 = 0.5 to 7.5)
42 word 1 Gear Ratio 4 (0 to 65536 = 0.5 to 7.5)
44 word 1 Gear Ratio 5 (0 to 65536 = 0.5 to 7.5)
46 word 1 Gear Ratio 6 (0 to 65536 = 0.5 to 7.5)
48 byte 1 Passengers (how DO you relate to this??)
49 byte 1 Car Config (roof on LX4/6 and UF1)
50 byte 1 Traction Control Slip (divide by ten)
51 byte 1 Traction Control Engage Speed
52 float 1 Rear Spring Travel (NOT motion range)
56 float 1 Rear Spring Stiffness (N/mm)
60 float 1 Rear Compression/Bump Damping (N/mm)
64 float 1 Rear Rebound Damping (N/mm)
68 float 1 Rear Anti Roll Bar Stiffness (N/mm)
72 byte 4 0
76 byte 1 Rear Toe (0=-0.9deg, 9=0deg, 18=0.9deg)
77 byte 1 Rear Caster (i.e. always zero)
78 byte 1 Rear Tyre Type (0 through 7 is R1 through Knobbly, in order of grip)
79 byte 1 0
80 byte 1 LR Camber Adjust (0=-4.5deg, 45=0.0deg, 90=4.5deg)
81 byte 1 RR Camber Adjust (0=-4.5deg, 45=0.0deg, 90=4.5deg)
82 byte 2 0
84 byte 1 Rear Diff Type (0=Open, 1=Locked, 2=Viscous, 3=Clutch Pack)
85 byte 1 Rear Viscous Torque
86 byte 1 Rear Power Locking
87 byte 1 Rear Coast Locking
88 word 1 LR Tyre Pressure (kPa)
90 word 1 RR Tyre Pressure (kPa)
92 float 1 Front Spring Travel (NOT motion range)
96 float 1 Front Spring Stiffness (N/mm)
100 float 1 Front Bump/Compression Damping (N/mm)
104 float 1 Front Rebound Damping (N/mm)
108 float 1 Front Anti Roll Bar Stiffness (N/mm)
112 byte 4 0
116 byte 1 Front Toe In (0=-0.9deg, 9=0deg, 18=0.9deg)
117 byte 1 Front Caster (need to divide by ten)
118 byte 1 Front Tyre Type (0 through 7 is R1 through Knobbly, in order of grip)
119 byte 1 0
120 byte 1 LF Camber Adjust (0=-4.5deg, 45=0.0deg, 90=4.5deg)
121 byte 1 RF Camber Adjust (0=-4.5deg, 45=0.0deg, 90=4.5deg)
122 byte 2 0
124 byte 1 Front Diff Type (0=Open, 1=Locked, 2=Viscous, 3=Clutch Pack)
125 byte 1 Front Viscous Torque
126 byte 1 Front Power Locking
127 byte 1 Front Coast Locking
128 word 1 LF TyrePressure (kPa)
130 word 1 RF TyrePressure (kPa)

VB6 Type

Private Type LFSSetupFile
Identifier As String * 6 '0
Blank1 As Byte '6
Version As Byte '7
Revision As Byte '8
Blank2 As Byte '9
Blank3 As Byte '10
Blank4 As Byte '11
AsymTCType As Byte '12
Blank5 As Byte '13
Blank6 As Byte '14
TyreBrand As Byte '15

BrakeStrength As Single '16

RearWingAngle As Byte '20
FrontWingAngle As Byte '21
Blank7 As Byte '22
Blank8 As Byte '23

SteeringLock As Byte '24
ParallelSteer As Byte '25
BrakeBalance As Byte '26
EngineBrakeReduction As Byte '27

'Centre Diff
CentreDiffType As Byte '28
CentreDiffVicous As Byte '29
Blank9 As Byte '30
CentreDiffTorqueSplit As Byte '31

GearRatio7 As Integer '32 'Actually unsigned integer, VB6 does not support these
FinalDrive As Integer '34 'Need to convert to unsigned before processing
GearRatio1 As Integer '36
GearRatio2 As Integer '38
GearRatio3 As Integer '40
GearRatio4 As Integer '42
GearRatio5 As Integer '44
GearRatio6 As Integer '46

Passengers As Byte '48
CarConfig As Byte '49
TCSlip As Byte '50
TCSpeed As Byte '51

'Rear suspension & wheels
RearRideHeight As Single '52
RearSpringStiffness As Single '56
RearBumpDamping As Single '60
RearReboundDamping As Single '64
RearAntiRollStiffness As Single '68
Blank10 As Byte '72
Blank11 As Byte '73
Blank12 As Byte '74
Blank13 As Byte '75
RearToeIn As Byte '76
RearCaster As Byte '77
RearTyreType As Byte '78
Blank14 As Byte '79
LRCamberAdjust As Byte '80
RRCamberAdjust As Byte '81
Blank15 As Byte '82
Blank16 As Byte '83
RearDiffType As Byte '84
RearViscousLock As Byte '85
RearPowerLock As Byte '86
RearCoastLock As Byte '87
LRTyrePressure As Integer '88
RRTyrePressure As Integer '90

'Front suspension & wheels
FrontRideHeight As Single '92
FrontSpringStiffness As Single '96
FrontBumpDamping As Single '100
FrontReboundDamping As Single '104
FrontAntiRollStiffness As Single '108
Blank17 As Byte '112
Blank18 As Byte '113
Blank19 As Byte '114
Blank20 As Byte '115
FrontToeIn As Byte '116
FrontCaster As Byte '117
FrontTyreType As Byte '118
Blank21 As Byte '119
LFCamberAdjust As Byte '120
RFCamberAdjust As Byte '121
Blank22 As Byte '122
Blank23 As Byte '123
FrontDiffType As Byte '124
FrontViscousLock As Byte '125
FrontPowerLock As Byte '126
FrontCoastLock As Byte '127
LFTyrePressure As Integer '128
RFTyrePressure As Integer '130
End Type

Preview form in VB6:
Attached images
If memory serves, the passenger byte works like the flag fields in SPR/MPR files. ie. its a bitfield with each bit representing a seat, so each seat has a value of 1, 2, 4, or 8 etc. and they are added together to give a single value.
Nice work Bob I've edited the FAQ thread to point at this thread :up:
If your not against a little constructive critism in your VB6 reader...

It might be a good idea to bring camber down (or tyre pressure up) so they're next to each other, then label the four tyres. I can tell that the first is Rear Left, then Rear Right, ect..

Also, I'm pretty sure LFS saves if its Symentrical or Asymentrical somewhere, becasue even if I just click the asymentrical and leave all the settings, it still REMEMBERS that I clicked it. But I don't see a value for it anywhere. Depending on the goal of your project, that may nor may not matter. If its just to read setups, its not important. Also if its to write setup files, leaving it always asymentrical won't hurt either. But I'm not sure if you're reading a file thats symetrical, and you write it with diffrent values for the tyres, what sort of mayhem that will cause....
Quote from Shinrar :If your not against a little constructive critism in your VB6 reader...

Assuming you're talking about the GUI, thats most likely for testing purposes.

Quote from Shinrar :If its just to read setups, its not important.

Knowing Mr Smith, its for the next evolution of GRC.

With regards to the Asymmetric/Symmetric issues, its the 13th byte according to my very quick test, and can be 0 or 1, where 1 represents symmetric it seems (you need to update your format Ben )
It's at the 12th byte (zero based counting) and is combined with TC...

Edit: updated - and thanks for spotting it
Meh. I can't count
Identifier As String * 6 '0

I'm pretty sure that won't be 6 bytes. VB6 strings are unicode so they take 2 bytes each. Doing a LenB() on a string gives double its length. The way I've done it is to make it an array of bytes then use StrConv.

Unless, there is some secret you know that I don't. If so, please spill it.
Didn't know that... but it works OK for me?

Edit: hmm, Len(SetupData.Identifier) reports 6, LenB(SetupData.Identifier) reports 12. But everything works OK (so far). Weird. I'll ignore it unless it starts causing a problem.
Hello this is the code in php(not finished yet)

function data($file)
$rs fopen($file,"rb");
fread($rs6) == "SRSETT")
$traction = array("0" => "TC Off / Sym""1" => "TC Off / Asym""2" => "Tc On / Sym""3" => "Tc On / Asym");
$tyrebrand = array("0" => "Cromo Plain""1" => "Cromo""2" => "Torro""3" => "Michelin""4" => "Evostar");
$cendifftype = array("0" => "Open""1" => "Viscous");
$difftype = array("0" => "Open""1" => "Locked""2" =>"Viscous""3" => "Clutch Park");
$camb = array("45" => "0.0""0" => "-4.5""90" => "4.5");
$rs fopen($file,"rb");
$a["type"] = fread($rs,6);//SRSETT
$a["version"] = hexdec(bin2hex(fread($rs,1)));//250
$a["revision"] = hexdec(bin2hex(fread($rs,1)));//2
$tc hexdec(bin2hex(fread($rs,1)));
$a["tc"] = $traction[$tc];//traction control
$tb hexdec(bin2hex(fread($rs,1)));
$a["tb"] = $tyrebrand[$tb];//tire brand
$a["bst"] = (hexdec(bin2hex(fread($rs,4))))/32.0425;//brake strength (Nm)
$a["rwa"] = hexdec(bin2hex(fread($rs,1)));//rear wing angle
$a["fwa"] = hexdec(bin2hex(fread($rs,1)));//front wing angle
$a["msl"] = hexdec(bin2hex(fread($rs,1)));//max steering lock
$a["ps"] =  hexdec(bin2hex(fread($rs,1)));//parallel steering
$a["bb"] = hexdec(bin2hex(fread($rs,1)));//brake balance
$a["ebr"] = hexdec(bin2hex(fread($rs,1)));//engine brake reduction
 //Centre Diff
$cdt hexdec(bin2hex(fread($rs,1)));
$a["cdt"] = $cendifftype[$cdt];//centre diff type
$a["cdvt"] = hexdec(bin2hex(fread($rs,1)));//centre diff viscous torque
$a["cdts"] = hexdec(bin2hex(fread($rs,1)));//centre diff torque split
$a["gr7"] = hexdec(bin2hex(fread($rs,2)));//gear ratio 7
$a["grf"] = hexdec(bin2hex(fread($rs,2)));//gear ratio final
$a["gr1"] = hexdec(bin2hex(fread($rs,2)));//gear ratio 1
$a["gr2"] = hexdec(bin2hex(fread($rs,2)));//gear ratio 2
$a["gr3"] = hexdec(bin2hex(fread($rs,2)));//gear ratio 3
$a["gr4"] = hexdec(bin2hex(fread($rs,2)));//gear ratio 4
$a["gr5"] = hexdec(bin2hex(fread($rs,2)));//gear ratio 5
$a["gr6"] = hexdec(bin2hex(fread($rs,2)));//gear ratio 6
 //Misc 2
$a["pass"] = hexdec(bin2hex(fread($rs,1)));//passengers
$a["carconfig"] = hexdec(bin2hex(fread($rs,1)));//car config (roof on LX4/6 qnd UF1)
$a["tcs"] = (hexdec(bin2hex(fread($rs,1))))/10;//traction control slip
$a["tces"] = hexdec(bin2hex(fread($rs,1)));//traction control engage speed
 //Steering rear
$a["rst"] = hexdec(bin2hex(fread($rs,4)));//rear spring travel (NOT motion range)
$a["rss"] = hexdec(bin2hex(fread($rs,4)));//rear spring stiffness (N/mm)
$a["rcbd"] = hexdec(bin2hex(fread($rs,4)));//rear compression/bump damping (N/mm)
$a["rrd"] = hexdec(bin2hex(fread($rs,4)));//rear rebound damping( N/mm)
$a["rarbs"] = hexdec(bin2hex(fread($rs,4)));//rear anti-roll bar stiffness(N/mm)
$a["rtoe"] = hexdec(bin2hex(fread($rs,1)));//rear toe
$a["rcaster"] = hexdec(bin2hex(fread($rs,1)));//rear caster
$a["rtyretype"] = hexdec(bin2hex(fread($rs,1)));//rear tyre type
$a["lrca"] = hexdec(bin2hex(fread($rs,1)));//lr camber adjust
$a["rrca"] = hexdec(bin2hex(fread($rs,1)));//rr camber adjust
$a["rdt"] = $difftype[$rdt];//rear diff type
$a["rvt"] = hexdec(bin2hex(fread($rs,1)));//rear viscous torque
$a["rpl"] = hexdec(bin2hex(fread($rs,1)));//rear power locking
$a["rcl"] = hexdec(bin2hex(fread($rs,1)));//rear coast locking
$a["lrtp"] = hexdec(bin2hex(fread($rs,2)));//lr tyre pressure
$a["rrtp"] = hexdec(bin2hex(fread($rs,2)));//rr tyre pressure
 //Steering Front
$a["fst"] = hexdec(bin2hex(fread($rs,4)));//front spring travel(NOT motion range)
$a["fss"] = hexdec(bin2hex(fread($rs,4)));//front spring stiffness(N/mm)
$a["fbc"] = hexdec(bin2hex(fread($rs,4)));//front bump/compression dampin (N/mm)
$a["frd"] = hexdec(bin2hex(fread($rs,4)));//front resbound damping
$a["farbs"] = hexdec(bin2hex(fread($rs,4)));//front anti-roll bar stiffness
$a["fti"] = hexdec(bin2hex(fread($rs,1)));//front toe in
$a["fc"] = (hexdec(bin2hex(fread($rs,1))))/10;//front caster
$a["ftt"] = hexdec(bin2hex(fread($rs,1)));//front tyre type
$a["lfca"] = hexdec(bin2hex(fread($rs,1)));//lf camber adjust
$a["rfca"] = hexdec(bin2hex(fread($rs,1)));//rf camber adjust
$fdt hexdec(bin2hex(fread($rs,1)));
$a["fdt"] = $difftype[$fdt];//front diff type
$a["fvt"] = hexdec(bin2hex(fread($rs,1)));//front viscous torque
$a["fpl"] = hexdec(bin2hex(fread($rs,1)));//front power locking
$a["fcl"] = hexdec(bin2hex(fread($rs,1)));//front coast locking
$a["lftp"] = hexdec(bin2hex(fread($rs,2)));//lr tyre pressure
$a["rftp"] = hexdec(bin2hex(fread($rs,2)));//rf tyre pressure


Have you thought of using the unpack function? You just enter a single string which represents your file format and it spits you back the array with all the values in. If the setup format changes you just change the string.

Here's mine for an early S2 patch.

function ReadSetData ($setFile){

    if (!
"File opening failed";

$setContents fread($setFile132);
$setData unpack ("@16/fbrakeStrength/crearWing/cfrontWing/x2

    return (

I dont suppose its technically any different from yours, just skips a bit of typing
Nice ColCob!

How i use your function?

For ie:

$setData = ReadSetData ("file.set");

$RFTP = $setData[RFtyrePressure];


Erm, its a while since I wrote it, and its part of a general set file library that probably relies on other functions.

If memory serves, $setFile is a file pointer not a path, so you should already have done:

$setFile = fopen("../setup.set", rb);

To be honest, the function isnt really designed to be used on its own, it was just to show you how unpack() works.

The array that you get back from ReadSetData() then got sent to a function called SetDataToValues() which converts binary values to actual numerical values for things like gear ratios etc.

Im using a function posted by me above and the gear ratios dont show the rigth values.

The type WORD 2byte represents the gears.
This "WORD" is hexadecimal value of 16bits.

In my case im using the following line:

["gr1"] = $gear[hexdec(bin2hex(fread($rs,2)))];//gear ratio 1

$gear is a array to return the corrected value (0 to 65536 => 0 to 7.5).

This is a code:

$gear = array();
for (
$i 0.5$i 7.5$i += 0.0001068115234375) {

Is very strange the values returned is totally different of the set!

Any sugestion?

I don't know PHP very well, so I'm not totally sure what that is doing, but this was my solution for VB6:

NewGearRatio(1) = (SetupData.GearRatio1 / ConvertGearRatio) + 0.5
NewGearRatio(2) = (SetupData.GearRatio2 / ConvertGearRatio) + 0.5

where ConvertGearRatio is a constant of 9362.

Perhaps that helps?

Oh and I update the wiki to reflect the .set file changes.
I suspect its because you are converting a couple of binary bits into an ASCII string representation of a hexidecimal number, then converting it again into a decimal number.

I take it you havent actually got this code working yet, because looking at your code for dealing with 4 byte floats, there is no way that will work.

Really unpack() is the most appropriate function for converting any binary data type (float, short, byte etc.) into a variable.

EDIT: Just looking into it some more, there isn't any need to do hexdec(bin2hex()) anyway, because there is a bindec() function which goes straight from binary to decimal on anything up to a 4byte integer.
Quote from jscorrea :
$gear is a array to return the corrected value (0 to 65536 => 0 to 7.5).

This is a code:

$gear = array();
for (
$i 0.5$i 7.5$i += 0.0001068115234375) {

Is very strange the values returned is totally different of the set!

Any sugestion?


Erk, that is the freakiest way of scaling a value I've ever seen, you have any array with 65536 values in it!

Can I suggest the following:

function ShortToGear ($short){
$factor $short/pow(2,16);
$gear = ($factor*7)+0.5;
    return (


Congrats to all, in my site the setups module is functional with "see setup".

"See setup" is a printable view of the setup.


.set file format
(28 posts, started )