The online racing simulator
MPR - content of "flags" bytes?
(9 posts, started )
MPR - content of "flags" bytes?
i'm trying to get as much data from mpr file as possibble.. and i found two undocumented integers... rules and flags
...
1 int 12 rules : -
1 int 16 flags : -
...

definition of "rules" can be found here, but i can't work out what does "flags" mean...

also i would like to know if there is some reliable way to find a list of usernames, other than searching the whole file for a specific pattern...
#2 - ikkah
(deleted lots of text here.. should have read the message properly first)

I haven't found a reliable way to find usernames in the replays, but I've had quite good results by playing with offsets. I can find most drivers this way, and it's more reliable than trying to find patterns. Try combining these two methods.
Are you trying to get the players with results or all players?

If you want players with results, I suggest re-reading the MPR format, as all the names are in the data block; http://www.liveforspeed.net/?page=MPR

i.e. offset 80 to 104 is player 1's name then + 81 to get the next offset boundary, for each number of players listed in the MPR header.

Edit:
As a suggestion, possibly the flags represent the flags allowed - although we cannot alter this at this stage.
#4 - ikkah
Hmm, OK, did a little bit of research, those look like car bits. Allowed cars on that server, that is. S1 cars are listed just above the rules bits, I guess the rest of the cars are in the same order as everywhere else, f.e. LFSWorld.

the_angry_angel, I think he's trying to find LFSWorld usernames.
Quote from the_angry_angel :Are you trying to get the players with results or all players?

If you want players with results, I suggest re-reading the MPR format, as all the names are in the data block; http://www.liveforspeed.net/?page=MPR

i.e. offset 80 to 104 is player 1's name then + 81 to get the next offset boundary, for each number of players listed in the MPR header.

Edit:
As a suggestion, possibly the flags represent the flags allowed - although we cannot alter this at this stage.

yes, but in the header there are just nicknames, not lfs-usernames...

right now, i find the usernames in mpr like this...
somewhere in mpr file is a block of data that consist of:

num unit offset description
--- ---- ------ -----------

CONNECTION INFO : size 61 bytes per connection

2 byte ???? always 0x3C07
1 byte 2 connection id? (host has always 0x01, and is always first in the list)
2 byte 3 ?? (host has always 0x00)
24 char 5 player name
8 char 29 number plate
24 char 37 user name

in s2, this block begins on a different offset in each mpr file, and i didn't found something like a pointer to this block yet...
so i just search the file for a sequence of bytes 0x3C, 0x07, 0x01, 0x00, 0x00 to find the block... it seems to work every time...

btw if someone wants a source for mpr parser in java, i can post it..

Quote from ikkah :Hmm, OK, did a little bit of research, those look like car bits. Allowed cars on that server, that is. S1 cars are listed just above the rules bits, I guess the rest of the cars are in the same order as everywhere else, f.e. LFSWorld.

yup, it looks like car bits.. thanks!
#6 - ikkah
http://www.lfs-suomi.com/uploads/mpr-parse.cpp

That's my parser, in C++. It's a bit hacky since I didn't think I'd show it to anyone

Look for "const int magic_offset", that's where I move to that block of data. The offset to the username block depends on the number of players, unlike in S1 where it was always in the same place.

My parser can find all the players that were ingame when the replay started, this means you can't find people who started from the pits, joined the game after spectating or connected to the server after the replay started. It's good enough for running a league, though.
#8 - ikkah
Here's the problem: right when you start the replay, it says "poa.agarash left the pits (FXO)". The race hasn't begun yet, but the countdown has. That's why Agarash's block of data is 282 bytes instead of 335. I don't know of a way to detect this, so I just tell my drivers to not pit when the race starts
thanks, i'll instruct racers to pit-out sooner

MPR - content of "flags" bytes?
(9 posts, started )
FGED GREDG RDFGDR GSFDG