From 2f8c92f261586f68a976efce0cfcdd0401f402e0 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Mon, 6 Nov 2023 18:37:11 +0300 Subject: dont try to understand it, feel it --- pkg/packets/headers.go | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 pkg/packets/headers.go (limited to 'pkg/packets/headers.go') diff --git a/pkg/packets/headers.go b/pkg/packets/headers.go deleted file mode 100644 index ba5482b..0000000 --- a/pkg/packets/headers.go +++ /dev/null @@ -1,45 +0,0 @@ -package packets - -import ( - "github.com/pektezol/bitreader" -) - -type Headers struct { - DemoFileStamp string - DemoProtocol int32 - NetworkProtocol int32 - ServerName string - ClientName string - MapName string - GameDirectory string - PlaybackTime float32 - PlaybackTicks int32 - PlaybackFrames int32 - SignOnLength int32 -} - -func ParseHeaders(reader *bitreader.Reader) Headers { - headers := Headers{ - DemoFileStamp: reader.TryReadString(), - DemoProtocol: int32(reader.TryReadSInt32()), - NetworkProtocol: int32(reader.TryReadSInt32()), - ServerName: reader.TryReadStringLength(260), - ClientName: reader.TryReadStringLength(260), - MapName: reader.TryReadStringLength(260), - GameDirectory: reader.TryReadStringLength(260), - PlaybackTime: reader.TryReadFloat32(), - PlaybackTicks: int32(reader.TryReadSInt32()), - PlaybackFrames: int32(reader.TryReadSInt32()), - SignOnLength: int32(reader.TryReadSInt32()), - } - if headers.DemoFileStamp != "HL2DEMO" { - panic("invalid demo file stamp") - } - if headers.DemoProtocol != 4 { - panic("this parser only supports demos from new engine") - } - if headers.NetworkProtocol != 2001 { - panic("this parser only supports demos from portal 2") - } - return headers -} -- cgit v1.2.3