File tree Expand file tree Collapse file tree 5 files changed +34
-2
lines changed Expand file tree Collapse file tree 5 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ require (
1212 github.com/markus-wa/quickhull-go/v2 v2.2.0
1313 github.com/oklog/ulid/v2 v2.1.0
1414 github.com/pkg/errors v0.9.1
15+ github.com/samber/lo v1.38.1
1516 github.com/stretchr/testify v1.8.4
1617 golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
1718 google.golang.org/protobuf v1.31.0
Original file line number Diff line number Diff line change @@ -25,8 +25,6 @@ github.com/markus-wa/gobitread v0.2.3 h1:COx7dtYQ7Q+77hgUmD+O4MvOcqG7y17RP3Z7Bbj
2525github.com/markus-wa/gobitread v0.2.3 /go.mod h1:PcWXMH4gx7o2CKslbkFkLyJB/aHW7JVRG3MRZe3PINg =
2626github.com/markus-wa/godispatch v1.4.1 h1:Cdff5x33ShuX3sDmUbYWejk7tOuoHErFYMhUc2h7sLc =
2727github.com/markus-wa/godispatch v1.4.1 /go.mod h1:tk8L0yzLO4oAcFwM2sABMge0HRDJMdE8E7xm4gK/+xM =
28- github.com/markus-wa/ice-cipher-go v0.0.0-20220823210642-1fcccd18c6c1 h1:YH4WI14HARrM3C6mKUMFDBz93O25oWSlLEYGeL27G0w =
29- github.com/markus-wa/ice-cipher-go v0.0.0-20220823210642-1fcccd18c6c1 /go.mod h1:JIsht5Oa9P50VnGJTvH2a6nkOqDFJbUeU1YRZYvdplw =
3028github.com/markus-wa/ice-cipher-go v0.0.0-20230901094113-348096939ba7 h1:aR9pvnlnBxifXBmzidpAiq2prLSGlkhE904qnk2sCz4 =
3129github.com/markus-wa/ice-cipher-go v0.0.0-20230901094113-348096939ba7 /go.mod h1:JIsht5Oa9P50VnGJTvH2a6nkOqDFJbUeU1YRZYvdplw =
3230github.com/markus-wa/quickhull-go/v2 v2.2.0 h1:rB99NLYeUHoZQ/aNRcGOGqjNBGmrOaRxdtqTnsTUPTA =
@@ -38,6 +36,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
3836github.com/pkg/errors v0.9.1 /go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0 =
3937github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
4038github.com/pmezard/go-difflib v1.0.0 /go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4 =
39+ github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM =
40+ github.com/samber/lo v1.38.1 /go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA =
4141github.com/stretchr/objx v0.1.0 /go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME =
4242github.com/stretchr/objx v0.4.0 /go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw =
4343github.com/stretchr/objx v0.5.0 /go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo =
Original file line number Diff line number Diff line change @@ -18,13 +18,15 @@ import (
1818 "time"
1919
2020 dispatch "github.com/markus-wa/godispatch"
21+ "github.com/samber/lo"
2122 "github.com/stretchr/testify/assert"
2223 "google.golang.org/protobuf/proto"
2324
2425 demoinfocs "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs"
2526 common "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/common"
2627 events "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events"
2728 msg "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/msg"
29+ "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/msgs2"
2830)
2931
3032const (
@@ -214,6 +216,12 @@ func TestS2(t *testing.T) {
214216
215217 p := demoinfocs .NewParserWithConfig (f , cfg )
216218
219+ if * update {
220+ p .RegisterNetMessageHandler (func (gel * msgs2.CMsgSource1LegacyGameEventList ) {
221+ lo .Must0 (os .WriteFile ("s2_CMsgSource1LegacyGameEventList.pb.bin" , lo .Must (proto .Marshal (gel )), 0600 ))
222+ })
223+ }
224+
217225 t .Log ("Parsing header" )
218226 _ , err = p .ParseHeader ()
219227 assertions .NoError (err , "error returned by Parser.ParseHeader()" )
Original file line number Diff line number Diff line change 11package demoinfocs
22
33import (
4+ _ "embed"
45 "fmt"
56
67 "github.com/golang/geo/r3"
78 "github.com/markus-wa/go-unassert"
89 "github.com/pkg/errors"
10+ "google.golang.org/protobuf/proto"
911
1012 common "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/common"
1113 events "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events"
@@ -78,7 +80,28 @@ func (p *parser) handleGameEvent(ge *msg.CSVCMsg_GameEvent) {
7880 })
7981}
8082
83+ //go:embed s2_CMsgSource1LegacyGameEventList.pb.bin
84+ var gameEventListS2 []byte
85+
8186func (p * parser ) handleGameEventS2 (ge * msgs2.CMsgSource1LegacyGameEvent ) {
87+ if p .gameEventDescs == nil {
88+ p .eventDispatcher .Dispatch (events.ParserWarn {
89+ Message : "received GameEvent but event descriptors are missing" ,
90+ Type : events .WarnTypeGameEventBeforeDescriptors ,
91+ })
92+
93+ list := new (msgs2.CMsgSource1LegacyGameEventList )
94+
95+ err := proto .Unmarshal (gameEventListS2 , list )
96+ if err != nil {
97+ p .setError (err )
98+
99+ return
100+ }
101+
102+ p .handleGameEventListS2 (list )
103+ }
104+
82105 keys := make ([]* msg.CSVCMsg_GameEventKeyT , 0 , len (ge .Keys ))
83106
84107 for _ , k := range ge .Keys {
You can’t perform that action at this time.
0 commit comments