.lco files and engine stats editing?

Creating and Editing Rollingstock
User avatar
Gumboots
CEO
Posts: 4828
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: .lco files and engine stats editing? Unread post

Ah, sorry. Yes that is about the .car file. There are notes for the .lco files as well. You can find those here.

I've also attached a screenshot of an .lco file with the different code blocks highlighted. That might be helpful for some.
lco_file.png
lco_file.png (37.2 KiB) Viewed 1745 times
I explained the Little-Endian notation earlier in this thread.
Gumboots wrote:What is probably messing you up is the formatting, which is Little-Endian hex. They do this just to annoy you, but you can outsmart them. :mrgreen:

In hex, the last column at the right is ones (same as decimal). This is just the base raised to the power of 0. Anything to the power of zero is 1, whether the base is 2 or 8 or 10 or 16.

The second last column is the base to the power of 1, which is 16 in the case of hex (10 in the case of decimal of course). Third last column in hex counts in increments of 256 (base to the power of 2).

That's for "normal" hexadecimal, which is called ""Big Endian" because it puts the biggest values first, much like normal decimal does. RRT3 hex files uses the opposite order (Little Endian) with the smallest values first. This is done for programming reasons and is a bit of a nuisance. You just have to flip the order for it to make more sense.

Taking the start year for this locomotive, the bytes are 9A 07 00 00. Flip the order of that and you get 00 00 07 9A. The leading zeros are unimportant, so the value in question is actually 79A.

That's (7 x 256) + (9 x 16) + 10 when converted to decimal, and equals 1946.

The end year is A8 07 00 00, which equals 1960 in standard decimal. (0!!0)
There's a bit of an explanation of IEEE 754 floats here, which is another thing that will confuse some people (sure confused me). Wherever Pj's and Milo's and WP&P's notes say something is a "float", they mean it uses this format. Where the notes say "int" it's just basic hex.
Post Reply