Skip to content

Commit

Permalink
WIP: parse Source 2 protos
Browse files Browse the repository at this point in the history
  • Loading branch information
markus-wa committed Mar 23, 2023
1 parent 1c11b45 commit 4b58d56
Show file tree
Hide file tree
Showing 25 changed files with 56,042 additions and 16 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module github.com/markus-wa/demoinfocs-golang/v3

require (
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551
github.com/golang/snappy v0.0.4
github.com/llgcode/draw2d v0.0.0-20210904075650-80aa0a2a901d
github.com/markus-wa/go-heatmap/v2 v2.0.0
github.com/markus-wa/go-unassert v0.1.3
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ github.com/golang/geo v0.0.0-20180826223333-635502111454/go.mod h1:vgWZ7cu0fq0KY
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 h1:gtexQ/VGyN+VVFRXSFiguSNcXmS6rkKT+X7FdIrTtfo=
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
Expand Down
25 changes: 25 additions & 0 deletions pkg/demoinfocs/demoinfocs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (
csDemosPath = testDataPath + "/cs-demos"
demSetPath = csDemosPath + "/set"
defaultDemPath = csDemosPath + "/default.dem"
s2DemPath = csDemosPath + "/s2-gotv.dem"
retakeDemPath = csDemosPath + "/retake_unknwon_bombsite_index.dem"
unexpectedEndOfDemoPath = csDemosPath + "/unexpected_end_of_demo.dem"
)
Expand Down Expand Up @@ -194,6 +195,30 @@ func TestDemoInfoCs(t *testing.T) {
assertGolden(t, assertions, "default", actual.Bytes())
}

func TestS2(t *testing.T) {
t.Parallel()

if testing.Short() {
t.Skip("skipping test due to -short flag")
}

f, err := os.Open(s2DemPath)
assertions := assert.New(t)
assertions.NoError(err, "error opening demo %q", s2DemPath)

defer mustClose(t, f)

p := demoinfocs.NewParser(f)

t.Log("Parsing header")
_, err = p.ParseHeader()
assertions.NoError(err, "error returned by Parser.ParseHeader()")

t.Log("Parsing to end")
err = p.ParseToEnd()
assertions.NoError(err, "error occurred in ParseToEnd()")
}

func TestEncryptedNetMessages(t *testing.T) {
t.Parallel()

Expand Down
17,385 changes: 17,385 additions & 0 deletions pkg/demoinfocs/msgs2/cstrike15_gcmessages.pb.go

Large diffs are not rendered by default.

7,737 changes: 7,737 additions & 0 deletions pkg/demoinfocs/msgs2/cstrike15_usermessages.pb.go

Large diffs are not rendered by default.

Loading

0 comments on commit 4b58d56

Please sign in to comment.