Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper support for polymorphic fields #506

Open
markus-wa opened this issue Feb 9, 2024 · 1 comment
Open

Proper support for polymorphic fields #506

markus-wa opened this issue Feb 9, 2024 · 1 comment

Comments

@markus-wa
Copy link
Owner

Follow up from #501

My hunch is that it has something to do with this:

message ProtoFlattenedSerializerField_t {
message polymorphic_field_t {
optional int32 polymorphic_field_serializer_name_sym = 1;
optional int32 polymorphic_field_serializer_version = 2;
}

optional int32 var_type_sym = 1;
optional int32 var_name_sym = 2;
optional int32 bit_count = 3;
optional float low_value = 4;
optional float high_value = 5;
optional int32 encode_flags = 6;
optional int32 field_serializer_name_sym = 7;
optional int32 field_serializer_version = 8;
optional int32 send_node_sym = 9;
optional int32 var_encoder_sym = 10;
repeated .ProtoFlattenedSerializerField_t.polymorphic_field_t polymorphic_types = 11;
}
Polymorphic fields are there for 8 months now, and in my parser (clarity) I made a weird fix for a pointer field which had a few bits I could not understand.

From a first glance, you also do not support polymorphic fields.

Now they start to use it, and this breaks it.

polymorphic pointers are indeed a thing. There is one entity in the replay I have here CCSGameModeRules, which uses it
When you decode a polymorphic pointer (if it is enabled, you can read a ubitvar (I think) to get the type it is referencing

Well, I would still recommend to look into polymorphic fields.
It got rid of this nasty workaround:

https://github.com/skadistats/clarity/blob/5cce7dc88f6718bac3293c3be883819c6fc3f609/src/main/java/skadistats/clarity/io/s2/field/PointerField.java#L17-L21

https://github.com/skadistats/clarity/blob/5cce7dc88f6718bac3293c3be883819c6fc3f609/src/main/java/skadistats/clarity/io/decoder/GameRulesModeFixDecoder.java

The six bits are the polymorphic type of the field (as ubitvar, so it might be even more bits in other replays).

@spheenik
Copy link

spheenik commented Feb 9, 2024

This is how I implemented it:

skadistats/clarity@ef98dbc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants