From 9f5e8f230d35fffb106088b72e5fdb148905f450 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Thu, 10 Nov 2022 22:59:32 +0300 Subject: added almost all net/svc messages - currently broken --- packets/messages/types/SvcPacketEntities.go | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 packets/messages/types/SvcPacketEntities.go (limited to 'packets/messages/types/SvcPacketEntities.go') diff --git a/packets/messages/types/SvcPacketEntities.go b/packets/messages/types/SvcPacketEntities.go new file mode 100644 index 0000000..bc4c41a --- /dev/null +++ b/packets/messages/types/SvcPacketEntities.go @@ -0,0 +1,39 @@ +package types + +import ( + "fmt" + + "github.com/pektezol/bitreader" +) + +type SvcPacketEntities struct { + MaxEntries uint16 + IsDelta bool + DeltaFrom int32 + BaseLine bool + UpdatedEntries uint16 + UpdateBaseline bool + Data []byte +} + +func ParseSvcPacketEntities(reader *bitreader.ReaderType) SvcPacketEntities { + maxentries := reader.TryReadBits(11) + isdelta := reader.TryReadBool() + var deltafrom int32 + if isdelta { + deltafrom = int32(reader.TryReadInt32()) + } + baseline := reader.TryReadBool() + updatedentries := reader.TryReadBits(11) + length := reader.TryReadBits(20) + fmt.Println(length) + return SvcPacketEntities{ + MaxEntries: uint16(maxentries), + IsDelta: isdelta, + DeltaFrom: deltafrom, + BaseLine: baseline, + UpdatedEntries: uint16(updatedentries), + UpdateBaseline: reader.TryReadBool(), + Data: reader.TryReadBytesToSlice(int(length / 8)), + } +} -- cgit v1.2.3