From 82871ba1bac1d62f69e1933b66659e62d2e5e063 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Tue, 12 Sep 2023 20:53:09 +0300 Subject: another rewrite, v1.0.0 --- packets/header.go | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 packets/header.go (limited to 'packets/header.go') diff --git a/packets/header.go b/packets/header.go deleted file mode 100644 index c4172d9..0000000 --- a/packets/header.go +++ /dev/null @@ -1,33 +0,0 @@ -package packets - -import ( - "fmt" - - "github.com/pektezol/bitreader" -) - -func ParseHeader(reader *bitreader.ReaderType) { - header := Header{ - DemoFileStamp: reader.TryReadStringLen(8), - DemoProtocol: uint32(reader.TryReadInt32()), - NetworkProtocol: uint32(reader.TryReadInt32()), - ServerName: reader.TryReadStringLen(260), - ClientName: reader.TryReadStringLen(260), - MapName: reader.TryReadStringLen(260), - GameDirectory: reader.TryReadStringLen(260), - PlaybackTime: reader.TryReadFloat32(), - PlaybackTicks: int32(reader.TryReadInt32()), - PlaybackFrames: int32(reader.TryReadInt32()), - SignOnLength: uint32(reader.TryReadInt32()), - } - if header.DemoFileStamp != "HL2DEMO" { - panic("Invalid demo file stamp. Make sure a valid demo file is given.") - } - if header.DemoProtocol != 4 { - panic("Given demo is from old engine. This parser is only supported for new engine.") - } - if header.NetworkProtocol != 2001 { - panic("Given demo is not from Portal2. This parser currently only supports Portal 2.") - } - fmt.Println(header) -} -- cgit v1.2.3