markus-wa / demoinfocs-golang

A Counter-Strike 2 & CS:GO demo parser for Go (demoinfo)
https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs?tab=doc
MIT License
690 stars 93 forks source link

Fully Support Parsing of POV Demos #2

Closed markus-wa closed 4 years ago

markus-wa commented 7 years ago

When adding a POV demo to the test demo-set in test/cs-demos the parser crashes.

Parsing header
Registering handlers
Parsing to end
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x18 pc=0x744af6]

goroutine 19 [running]:
github.com/markus-wa/demoinfocs-golang/st.(*Entity).ApplyUpdate(0x0, 0xc0428a8000)
        C:/Dev/GoPath/src/github.com/markus-wa/demoinfocs-golang/st/entity.go:53 +0xc6
github.com/markus-wa/demoinfocs-golang.(*Parser).handlePacketEntities(0xc0420ec000, 0xc0425ea0c0)
        C:/Dev/GoPath/src/github.com/markus-wa/demoinfocs-golang/packet_handlers.go:47 +0x2d0
github.com/markus-wa/demoinfocs-golang.(*Parser).(github.com/markus-wa/demoinfocs-golang.handlePacketEntities)-fm(0xc0425ea0c0)
        C:/Dev/GoPath/src/github.com/markus-wa/demoinfocs-golang/parser.go:120 +0x3b
reflect.Value.call(0x79e7e0, 0xc042041040, 0x13, 0x829e20, 0x4, 0xc042c51f60, 0x1, 0x1, 0xc042c51e78, 0xc042c51e70, ...)
        C:/Go/src/reflect/value.go:434 +0x926
reflect.Value.Call(0x79e7e0, 0xc042041040, 0x13, 0xc042c51f60, 0x1, 0x1, 0x4, 0xc04213e000, 0xa53e00)
        C:/Go/src/reflect/value.go:302 +0xab
github.com/markus-wa/godispatch.(*Dispatcher).Dispatch.func1(0xc0420ec068, 0xc042c51f48, 0xc042c51f60, 0x1, 0x1)
        C:/Dev/GoPath/src/github.com/markus-wa/godispatch/dispatch.go:49 +0xa1
github.com/markus-wa/godispatch.(*Dispatcher).Dispatch(0xc0420ec068, 0x811500, 0xc0425ea0c0)
        C:/Dev/GoPath/src/github.com/markus-wa/godispatch/dispatch.go:50 +0x220
github.com/markus-wa/godispatch.(*Dispatcher).dispatchQueue(0xc0420ec068, 0xc04203eb40)
        C:/Dev/GoPath/src/github.com/markus-wa/godispatch/dispatch.go:93 +0x11e
created by github.com/markus-wa/godispatch.(*Dispatcher).AddQueues
        C:/Dev/GoPath/src/github.com/markus-wa/godispatch/dispatch.go:79 +0x189
exit status 2
FAIL    github.com/markus-wa/demoinfocs-golang  0.245s
markus-wa commented 7 years ago

See test/cs-demos/broken/POV-orbit-skytten-vs-cloud9-gfinity15sm1-nuke.dem

markus-wa commented 6 years ago

Valve's parser doesn't work for the skytten demo either and I can't even find any other POVs since HLTV removed them from their site last year.

Wont fix (unless someone can provide a demo, maybe).

markus-wa commented 4 years ago

broken-POV-demo.zip

(demo courtesy of @huertasdanny)

leads to

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x94c9ad]

goroutine 19 [running]:
github.com/markus-wa/demoinfocs-golang.recoverFromUnexpectedEOF(0x9e4f80, 0xde8780, 0x0, 0x0)
    C:/Users/Daniel/sdk/go1.13.1/pkg/mod/github.com/markus-wa/demoinfocs-golang@v1.3.3/parsing.go:119 +0x1d7
github.com/markus-wa/demoinfocs-golang.(*Parser).handlePacketEntities.func1(0xc00010a000)
    C:/Users/Daniel/sdk/go1.13.1/pkg/mod/github.com/markus-wa/demoinfocs-golang@v1.3.3/entities.go:14 +0x54
panic(0x9e4f80, 0xde8780)
    C:/Go/src/runtime/panic.go:679 +0x1ee
github.com/markus-wa/demoinfocs-golang/sendtables.(*Entity).Destroy(0x0)
    C:/Users/Daniel/sdk/go1.13.1/pkg/mod/github.com/markus-wa/demoinfocs-golang@v1.3.3/sendtables/entity.go:290 +0x2d
github.com/markus-wa/demoinfocs-golang.(*Parser).handlePacketEntities(0xc00010a000, 0xc0008eef30)
    C:/Users/Daniel/sdk/go1.13.1/pkg/mod/github.com/markus-wa/demoinfocs-golang@v1.3.3/entities.go:29 +0x1ee
reflect.Value.call(0x9c1be0, 0xc0000664f0, 0x13, 0xa63914, 0x4, 0xc00044bf30, 0x1, 0x1, 0x0, 0x0, ...)
    C:/Go/src/reflect/value.go:460 +0x11a9
reflect.Value.Call(0x9c1be0, 0xc0000664f0, 0x13, 0xc00044bf30, 0x1, 0x1, 0x0, 0x0, 0x0)
    C:/Go/src/reflect/value.go:321 +0xd1
github.com/markus-wa/godispatch.(*Dispatcher).Dispatch(0xc00010a020, 0xa4bb60, 0xc0008eef30)
    C:/Users/Daniel/sdk/go1.13.1/pkg/mod/github.com/markus-wa/godispatch@v1.1.0/dispatch.go:48 +0x319
github.com/markus-wa/godispatch.(*Dispatcher).dispatchQueue(0xc00010a020, 0xc00015a000)
    C:/Users/Daniel/sdk/go1.13.1/pkg/mod/github.com/markus-wa/godispatch@v1.1.0/dispatch.go:97 +0x18f
created by github.com/markus-wa/godispatch.(*Dispatcher).AddQueues
    C:/Users/Daniel/sdk/go1.13.1/pkg/mod/github.com/markus-wa/godispatch@v1.1.0/dispatch.go:83 +0x30b
markus-wa commented 4 years ago

Note to self: The Valve parser crashes some time after LeChris killing The Goose with a CZ-75 while the game actually goes on a fair bit longer.

markus-wa commented 4 years ago

@huertasdanny - POV demos are now partially supported.

According to my testing, support is as good or better than other parsers, but still very bad. Many demos result in a out-of-bounds panic etc. even if they play nicely inside CSGO.

What worked for me:

What didn't work:

Untested:

markus-wa commented 4 years ago

see #227

markus-wa commented 4 years ago

Released in v2.3.0 - https://github.com/markus-wa/demoinfocs-golang/releases/tag/v2.3.0