jamesremuscat / pcars

Python client for Project CARS UDP data stream.
15 stars 16 forks source link

Add ParticipantInfoStringsAdditionalPacket #5

Closed ghost closed 7 years ago

ghost commented 8 years ago

This pr adds ParticipantInfoStringsAdditionalPacket it's only generated during multiplayer races with more than 16 participants (PC only).

Also all string parameters need checked for a null character and everything after the null character needs removed. This is a python unique thing as C/C++ always stop at the null character.

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-2.2%) to 85.463% when pulling d7ed7e68c8e7d850b87781b378d4eb8734365abc on fyfe:ParticipantInfoStringsAdditionalPacket into e76c6c04615708a7aec0461d35e334e4416127cf on jamesremuscat:master.

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-2.2%) to 85.398% when pulling c004d32ac0c2567c080d35a5c2eddccef0180443 on fyfe:ParticipantInfoStringsAdditionalPacket into e76c6c04615708a7aec0461d35e334e4416127cf on jamesremuscat:master.

ghost commented 8 years ago

I've added two extra commits to this pr c004d32 is just a minor code cleanup, 398e935 makes accessing the data in the packet classes more consistent.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+1.2%) to 88.793% when pulling 59435d2f1cf477238a6102b5d3fb490552268a1b on fyfe:ParticipantInfoStringsAdditionalPacket into e76c6c04615708a7aec0461d35e334e4416127cf on jamesremuscat:master.

ghost commented 8 years ago

It turns out the strings are utf-16 encoded. On Python 3 it works, on Python 2 it drops the characters that it can't convert to utf-8. This isn't ideal but it's the only working solution at the moment. Python 2 and unicode is painful.