minolin / acplugins

R&D about the upcoming server plugin infrastrucure of Assetto Corsa, driving simulator by Kunos simulazioni
Apache License 2.0
18 stars 4 forks source link

Recheck Deserialization #2

Closed minolin closed 9 years ago

minolin commented 9 years ago

There is a problem with plain wrong values when deserializing messages from Stefano's sample plugin (at least in the current version of acPlugins4net).

The sample will ask for car info, realtime and both chat requests after receiving a new_session event. Communication looks good, but the server reads carIds 200-202 instead of 0, and both chat messages are broken.

Will come back here later, but first I need to implement the view for the new message types

minolin commented 9 years ago

Ah, it's in AcMessageParser.Parse - I forgot to fetch the first byte before the payloads are deserialized. Quickfixing led to other problems, basically everything went nuts. When I come back: ACSP_REALTIMEPOS_INTERVAL wasn't correctly mapped to the Msg, and after fixing this the binary serialization OR deserialization is now shifted by 1 or two byte.

minolin commented 9 years ago

Ok got it, it's wrong to serialize the string by bw.Write(string), had to create a char[] and serialize that.