PDA

View Full Version : LFS username in MPR


jscorrea
18th June 2007, 19:15
Victor,

Is possible to add LFS username in MPR and SPR file in the future?

Is better to link the results table to LFSWORD for example.

Regards,
JS

Kada_CZ
18th June 2007, 22:31
The LFS usernames are in MPR file header, but in an undocumented part :-). I wrote a program, that prints LFS usernames from MPR (finished order). Also players, that didn't finish are parsed by the program, but they are not printed. The C-sources are in the attachement (GPL licence). I have no idea, if it works when player gets false-start-spectate....

I can write some description of the mpr header, if my C code is too cryptic for you ;-).

jscorrea
19th June 2007, 15:28
Nice!

Coments below...

typedef struct {
char LFSMPR[6]; // 0 : do not read file if no match
byte game_version; // 6 : ignore
byte game_revision; // 7 : ignore
byte MPR_version; // 8 : ignore
byte immediate_start; // 9 : joined already running game
byte reserved1; // 10 : -
byte reserved2; // 11 : -
int rules; // 12 : -
int flags; // 16 : -
byte laps_byte; // 20 : laps / hours (see notes)
byte skill; // 21 : skill level (0,1,2,3,4)
byte wind; // 22 : 0=off 1=weak 2=strong
byte num_players; // 23 : players at start of race
char LFS_version[8]; // 24 : text, ends 0
char short_track_name[4]; // 32 : e.g. BL2R
int start_time; // 36 : seconds since 00:00 1/1/1970
char track_name[32]; // 40 : text, ends 0
byte config; // 72 : 1,2,3.. (first config is 1)
byte reversed; // 73 : 0=no 1=yes
byte weather; // 74 : 0,1,2.. (first weather is 0)
byte num_finished; // 75 : players in results table
int zero; // 76 : -
} __attribute__ ((packed)) MPR_HEADER;No news for me its OK :thumb:

typedef struct {
char player_name[24]; // 0 : text, ends 0, no colours
char number_plate[8]; // 24 : text, NOTE : NO ZERO AT END
char short_car_name[4]; // 32 : text, ends 0
byte zero1[24]; // 36 : -
word laps_done; // 60 : total laps completed
word player_flags; // 62 : driver settings (see NOTES)
byte confirm_flags; // 64 : penalties (see NOTES)
byte number_of_stops; // 65 : pit stops count
word penalty_seconds; // 66 : penalty time added
int overall_time; // 68 : milliseconds
int best_lap_time; // 72 : milliseconds
int zero2; // 76 : -
} __attribute__ ((packed)) RESULT_INFO;No news again:thumb:

This is a problem above, how to convert this to PHP...:shrug: ?

typedef struct {
word username_info_ident; //always 0x73C
byte unknown[3];
char player_name[24];
char number_plate[8];
char lfs_username[24];///this is my dream LOL
} __attribute__ ((packed)) LFS_USERNAME_INFO;
HELP
JS

traxxion
24th June 2007, 12:56
Just so you know, patch X2 mpr files contain LFS usernames:
http://www.lfsforum.net/showthread.php?p=464599#post464599

jscorrea
26th June 2007, 13:12
its a gift!

Nice:thumb: