Difference between revisions of "File Formats"
m (→LYT: 0.6B update of LYT specification) |
m (→LYT) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 156: | Line 156: | ||
6 char 0 LFSLYT : do not read file if no match | 6 char 0 LFSLYT : do not read file if no match | ||
1 byte 6 version : do not read file if > 0 | 1 byte 6 version : do not read file if > 0 | ||
− | 1 byte 7 revision : do not read file if > | + | 1 byte 7 revision : do not read file if > 252 |
1 word 8 num added objects : number of OBJECT BLOCKS | 1 word 8 num added objects : number of OBJECT BLOCKS | ||
1 byte 10 laps : number | 1 byte 10 laps : number | ||
− | 1 byte 11 flags : | + | 1 byte 11 flags : see NOTE4 |
......OBJECT BLOCKS | ......OBJECT BLOCKS | ||
Line 176: | Line 176: | ||
------- | ------- | ||
How to distinguish between physical objects and control objects, like | How to distinguish between physical objects and control objects, like | ||
− | start positions, checkpoints, finish line and | + | start positions, checkpoints, finish line and marshal circles. |
if (Index >= 192) // either a circle or an unknown object | if (Index >= 192) // either a circle or an unknown object | ||
Line 264: | Line 264: | ||
− | NOTE4 : | + | NOTE4 : |
------- | ------- | ||
If the file is saved in the most recent format, the two lowest bits | If the file is saved in the most recent format, the two lowest bits | ||
Line 271: | Line 271: | ||
bit 0 : the file does not need correction for the Blackwood scaling | bit 0 : the file does not need correction for the Blackwood scaling | ||
bit 1 : the file does not need conversion for the new object indices | bit 1 : the file does not need conversion for the new object indices | ||
+ | bit 2 : unknown | ||
+ | bit 3 : unknown | ||
Some very old layouts may not have bit 0 set. | Some very old layouts may not have bit 0 set. | ||
Layouts saved up to 0.5Z34 will not have bit 1 set. | Layouts saved up to 0.5Z34 will not have bit 1 set. | ||
+ | |||
+ | (Newly created lyt files (ver 0.7f) have a flag value of 8 - Flag information is outdated) | ||
Line 542: | Line 546: | ||
24 chars user name | 24 chars user name | ||
__int64 Time | __int64 Time | ||
− | integer BanHours</pre> | + | integer BanHours |
+ | integer Space</pre> | ||
{{Guides}} | {{Guides}} | ||
+ | |||
+ | [[Category:Programming]] | ||
<!-- links to other languages --> | <!-- links to other languages --> | ||
[[de:Dateiformate]] | [[de:Dateiformate]] |
Latest revision as of 11:39, 15 October 2024
DDS
Texture files
So you want to edit LFS files that are in DDS format? Several textures in LFS are in DDS format including lights, interiors, track signage, seats, steering wheels and several other game and car components. To customise some textures in LFS You will need to edit the appropriate DDS file. DDS files can be handled by Paint Shop Pro and Photoshop after installing the DDS plugin which can be found here:
http://developer.nvidia.com/object/nv_texture_tools.html
Although these files are hosted by Nvidia, they are not GPU-specific, so you can use them with any brand card. You don't need all of the files shown on that site. You can download a DDS viewer which can enable thumbnails in windows explorer or my computer and view them easily. There are various viewers available and all seem to work well enough. Grab the plugin if you want to edit DDS with one of the programs mentioned above.
The DDS files can be found in your LFS/data/dds folder. There are a few things to be aware of before you begin:
- Once you have changed the DDS file all of the cars of that type will show that file, the texture is used universally. For example, if you customised the interior of the XF GTi, then all XF GTi's in your sim will have the customised interior. Unlike you car skin, these files are used on every car of that type.
- Be wary of texture size. Yes I know, you've got a fast PC and it can do anything except make your bed, but still be wary of texture size. The default textures in LFS work very well, replacing a 30KB texture with a 300KB texture will use more resources. It is very easy to overdo it so be sensible and back up your files first.
- When you save your customised file you will probably be presented with some complicated save options. Just try the default settings, in other words: don't worry too much about all the bells and whistles. If the option to generate mip maps is not selected then select it first but it should be on by default in most cases.
- There is a plugin that you will need and it works for Adobe Photoshop and Jasc (recently purchased by Corel) Paint Shop Pro only. Both of these programs use the same plugin file. There is a 3DS MAX plugin too, but MAX users check your version first to see if the plugin is even required.
Please note that DDS files use an alpha layer in many cases. If you don't know what that means I suggest you consult your software's documentation and try experimenting with the DDS format files.
Remember to save your files back into DDS format!
PTH
Path nodes are a series of points with direction and width that describe the track that you drive along. LFS uses it to watch your progress along the track, decides if you are driving in reverse. They provide the data for the echoes and the lightmaps, hold information about which objects you can see from that point, define the left and right boundaries for the AI drivers and are also used in yellow and blue flag systems, the position list, timing and some other things. Their length is not constant but there is approximately 0.2 seconds of time between passing one node and the next, when you are driving at a reasonable speed.
TXT
Language Files
Thanks to Eold, we have a translation utility program which makes it easier to make language packs. See the enclosed README.txt for more information.
http://www.lfs.net/file_lfs.php?name=LFSTranslator.zip
SET
Thanks to colcob for originally working this format out for v0.3H ([1]), Bob Smith for updating it for v0.5P([2]), Woz for updating the bit field values for passengers, and back to Bob Smith for updating it for v0.5X/Y.
TYPES : ======= 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 LFS Internal Version (was 250 for ages, now 251) [ignore this number] 8 byte 1 File format version (currently 2) [check this number] 9 byte 3 0 12 byte 1 Bit 7 (Patch X Setup=1, older set=0) - used for pre-load handling Bit 2 (ABS On=1, Off=0) Bit 1 (Traction Control On=1, Off=0) Bit 0 (Asymmetrical On=1, Off=0) 13 byte 1 Unknown, seems to hold random values 14 byte 1 Handicap Mass Position 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 1 Voluntary Handicap Mass 23 byte 1 Voluntary Intake Restriction 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 Passenger (4 2bit fields). Passengers are located in the byte at the following locations 76|54|32|10 --+--+--+-- RR|RC|RL|FR The individual passenger types are identified as follows. 00 = None 01 = Male 10 = Female 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 Ride Height (NOT spring 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 ( 45=0.0deg, 0=-4.5deg, 90=4.5deg) 81 byte 1 RR Camber Adjust ( 45=0.0deg, 0=-4.5deg, 90=4.5deg) 82 byte 1 0 83 byte 1 Rear Diff Clutch Pack Pre-load (multiply by ten) 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 Ride Height (NOT spring 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 ( 45=0.0deg, 0=-4.5deg, 90=4.5deg) 121 byte 1 RF Camber Adjust ( 45=0.0deg, 0=-4.5deg, 90=4.5deg) 122 byte 1 0 123 byte 1 Front Diff Clutch Pack Pre-load (multiply by ten) 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)
LYT
These are Layout files, and govern how things are set out on an AutoX track. You will notice that on some tracks you find a limit to the number of objects you can add; this is a limitation in the LFS engine. It is believed (although untested) that this has not significantly changed since S1 ([3]).
TYPES : ======= 1) short : 16 bit signed integer 2) word : 16 bit unsigned 3) char : 8 bit signed integer 4) byte : 8 bit unsigned FILE DESCRIPTION : ================== num unit offset description --- ---- ------ ----------- HEADER BLOCK : 6 char 0 LFSLYT : do not read file if no match 1 byte 6 version : do not read file if > 0 1 byte 7 revision : do not read file if > 252 1 word 8 num added objects : number of OBJECT BLOCKS 1 byte 10 laps : number 1 byte 11 flags : see NOTE4 ......OBJECT BLOCKS OBJECT BLOCK : 1 short 0 X : position (1 metre = 16) 1 short 2 Y : position (1 metre = 16) 1 char 4 Zchar : height (1m = 4) - see NOTE3 1 byte 5 Flags : 0 for objects - see NOTE1 1 byte 6 Index : object index - see NOTE5 1 byte 7 Heading : heading - see NOTE2 NOTE1 : ------- How to distinguish between physical objects and control objects, like start positions, checkpoints, finish line and marshal circles. if (Index >= 192) // either a circle or an unknown object { if (Index==255) // it's a marshall circle { if (Flags & 0x80) // highest bit set : restricted area { // Heading has its usual meaning // Flags byte contains the following data : // bits 0 to 1 : // 00 = no marshall // 01 = standing marshall // 10 = marshall pointing left // 11 = marshall pointing right // bits 2 to 6 : // radius in metres (1 to 31 - shifted left by 2 bits) } else // highest bit of flags is not set : route checker { // Heading is used not for heading, but the route index // bits 2 to 6 : // radius in metres (1 to 31 - shifted left by 2 bits) } } else { // unknown object - ignore } } else // could be an actual object or a control object { if (Flags & 0x80) // highest bit set : control object { // Heading has its usual meaning // Flags byte contains the following data : // bits 0 to 1 : // 00 = Start position (if width = 0) or finish line (if width > 0) // 01 = Checkpoint 1 // 10 = Checkpoint 2 // 11 = Checkpoint 3 // bits 2 to 6 : // half width in metres (1 to 31 - shifted left by 2 bits) } else // highest bit of flags is not set : autocross object { // Heading has its usual meaning // Flags byte contains the following data : // bits 0 to 2 : // Colour - only used for chalk (0-3) and tyres (0-5) } } NOTE2 : ------- Heading represents 360 degrees in 256 values. Heading = (heading_in_degrees + 180) * 256 / 360 128 : heading of zero 192 : heading of 90 degrees 0 : heading of 180 degrees 64 : heading of -90 degrees NOTE3 : ------- About Zchar, the approximate altitude : LFS does contact checks to place objects accurately on the ground. For output purposes : Zchar indicates the approximate altitude with a value from -80 (-20 metres) to 127 (31.75 metres). For input purposes : The ground check is performed with a test ray starting from 2 metres above Zchar. Using a value lower than 127 allows objects to be placed on the road below a bridge, for example. If you are creating objects from scratch and you are not sure of the approximate altitude, you can set Zchar to its maximum value (127). This will usually work unless there is a physical surface above the road where you are trying to place the object. NOTE4 : ------- If the file is saved in the most recent format, the two lowest bits of the flags byte must be set (total value 3). bit 0 : the file does not need correction for the Blackwood scaling bit 1 : the file does not need conversion for the new object indices bit 2 : unknown bit 3 : unknown Some very old layouts may not have bit 0 set. Layouts saved up to 0.5Z34 will not have bit 1 set. (Newly created lyt files (ver 0.7f) have a flag value of 8 - Flag information is outdated) NOTE5 : ------- Object indices are now the same at all tracks. The first valid object index is 4 (AXO_CHALK_LINE). There are many gaps to allow for future objects. Valid object indices are all less than 192. AXO_NULL AXO_1 AXO_2 AXO_3 AXO_CHALK_LINE AXO_CHALK_LINE2 AXO_CHALK_AHEAD AXO_CHALK_AHEAD2 AXO_CHALK_LEFT AXO_CHALK_LEFT2 AXO_CHALK_LEFT3 AXO_CHALK_RIGHT AXO_CHALK_RIGHT2 AXO_CHALK_RIGHT3 AXO_14 AXO_15 AXO_16 AXO_17 AXO_18 AXO_19 AXO_CONE_RED AXO_CONE_RED2 AXO_CONE_RED3 AXO_CONE_BLUE AXO_CONE_BLUE2 AXO_CONE_GREEN AXO_CONE_GREEN2 AXO_CONE_ORANGE AXO_CONE_WHITE AXO_CONE_YELLOW AXO_CONE_YELLOW2 AXO_31 AXO_32 AXO_33 AXO_34 AXO_35 AXO_36 AXO_37 AXO_38 AXO_39 AXO_CONE_PTR_RED AXO_CONE_PTR_BLUE AXO_CONE_PTR_GREEN AXO_CONE_PTR_YELLOW AXO_44 AXO_45 AXO_46 AXO_47 AXO_TYRE_SINGLE AXO_TYRE_STACK2 AXO_TYRE_STACK3 AXO_TYRE_STACK4 AXO_TYRE_SINGLE_BIG AXO_TYRE_STACK2_BIG AXO_TYRE_STACK3_BIG AXO_TYRE_STACK4_BIG AXO_56 AXO_57 AXO_58 AXO_59 AXO_60 AXO_61 AXO_62 AXO_63 AXO_MARKER_CURVE_L AXO_MARKER_CURVE_R AXO_MARKER_L AXO_MARKER_R AXO_MARKER_HARD_L AXO_MARKER_HARD_R AXO_MARKER_L_R AXO_MARKER_R_L AXO_MARKER_S_L AXO_MARKER_S_R AXO_MARKER_S2_L AXO_MARKER_S2_R AXO_MARKER_U_L AXO_MARKER_U_R AXO_78 AXO_79 AXO_80 AXO_81 AXO_82 AXO_83 AXO_DIST25 AXO_DIST50 AXO_DIST75 AXO_DIST100 AXO_DIST125 AXO_DIST150 AXO_DIST200 AXO_DIST250 AXO_92 AXO_93 AXO_94 AXO_95 AXO_ARMCO1 AXO_ARMCO3 AXO_ARMCO5 AXO_99 AXO_100 AXO_101 AXO_102 AXO_103 AXO_BARRIER_LONG AXO_BARRIER_RED AXO_BARRIER_WHITE AXO_107 AXO_108 AXO_109 AXO_110 AXO_111 AXO_BANNER1 AXO_BANNER2 AXO_114 AXO_115 AXO_116 AXO_117 AXO_118 AXO_119 AXO_RAMP1 AXO_RAMP2 AXO_122 AXO_123 AXO_124 AXO_125 AXO_126 AXO_127 AXO_SPEED_HUMP_10M AXO_SPEED_HUMP_6M AXO_130 AXO_131 AXO_132 AXO_133 AXO_134 AXO_135 AXO_POST_GREEN AXO_POST_ORANGE AXO_POST_RED AXO_POST_WHITE AXO_140 AXO_141 AXO_142 AXO_143 AXO_BALE AXO_145 AXO_146 AXO_147 AXO_RAILING AXO_149 AXO_150 AXO_151 AXO_152 AXO_153 AXO_154 AXO_155 AXO_156 AXO_157 AXO_158 AXO_159 AXO_SIGN_KEEP_LEFT AXO_SIGN_KEEP_RIGHT AXO_162 AXO_163 AXO_164 AXO_165 AXO_166 AXO_167 AXO_SIGN_SPEED_80 AXO_SIGN_SPEED_50 AXO_170 AXO_171 AXO_172 AXO_173 AXO_174 AXO_175 AXO_176 AXO_177 AXO_178 AXO_179 AXO_180 AXO_181 AXO_182 AXO_183 AXO_184 AXO_185 AXO_186 AXO_187 AXO_188 AXO_189 AXO_190 AXO_191
DRV
These files contain the data on the AI drivers. This format was "discovered" around 0.3G, and it is unknown if they have been changed recently ([4]).
TYPES : ======= char : 1-byte ascii character byte : 1-byte integer word : 2-byte integer int : 4-byte integer, lowest byte first FILE DESCRIPTION : ================== num unit offset description --- ---- ------ ----------- 6 char 0 SRAINM : do not read file if no match 1 byte 6 unknown : 0x00 ? 1 byte 7 unknown : 0xF6 Version? 1 byte 8 num AIs : Number of AI Names in that file? 3 byte 9 unknown : 3 bytes unknown AI Data: Repeat (num AIs) times. 24 char 0 Name : AI's playername (Fill with 0x00) 8 char 24 Plate : Numberplate label (Fill with 0x00) 1 byte 32 Gender : 0x00 == Male, 0x01 == Female 3 byte 33 unknown : 3 bytes unknown
BANS
The file format of the bans file ([5]).
Notes : The 64 bit "Time" values are obtained from GetSystemTimeAsFileTime. Meaning : number of 100-nanosecond intervals since January 1, 1601. One hour (HOUR_TIME) = 36000000000 Demo ban expiry : time - ban->Time > 12 * HOUR_TIME Name ban expiry : time - ban->Time > ban->BanHours * HOUR_TIME The bans are loaded into memory when : - the program starts up. The bans are saved to disk when : - bans are cleared - a new ban is added - the program exits file format ----------- 6 chars LFSBAN 1 byte 0 1 byte version (246 - do not read file if increased) 1 integer num_demo_bans [demo ban * num_demo_bans] 1 integer num_name_bans [name ban * num_name_bans] demo_ban -------- in_addr IP address __int64 Time name_ban -------- 24 chars user name __int64 Time integer BanHours integer Space