TrinityCore / WowPacketParser

World of Warcraft Packet Parser
GNU General Public License v3.0
410 stars 352 forks source link

Add Initialize method to IPacketProcessor #795

Closed BAndysc closed 9 months ago

BAndysc commented 9 months ago

IPacketProcessor is an interface used to process a protobuf stored sniff.

Before it contained only one method T? Process(PacketHolder packet) used to process a single parsed packet. However, this means the processor itself doesn't know which game build was sniffed, which sometimes is important to know (*). This PR adds a Initialize(ulong gameBuild) method which can be used to save the game build version and later use this information.


* yes, the general idea is that protobuf format is game build-agnostic and mostly it is (i.e. instead of using game build specific spline flags, protobuf format has its own enum UniversalSplineFlag), but it is not always the case. I.e. UNIT_BYTES_0 is not split into separate bytes at the moment, thus knowing game build version is important to properly parse it.

mdX7 commented 9 months ago

maybe we should actually save the build at parsing time somewhere even?

BAndysc commented 9 months ago

maybe we should actually save the build at parsing time somewhere even?

It is already saved, https://github.com/TrinityCore/WowPacketParser/blob/master/WowPacketParser.Proto/PacketStructures/structures.proto#L15 https://github.com/TrinityCore/WowPacketParser/blob/d5dea28243a9f32c5921d438990e27fad6b552ce/WowPacketParser/Loading/SniffFile.cs#L207