dumpin it

master
Jordan Orelli 8 years ago
parent 927ce6e9e3
commit cf1f6e39fd

@ -68,8 +68,18 @@ func (m *message) check(dump bool) error {
if br.Err() != nil {
break
}
e := entity{t: uint32(t), size: uint32(s), body: b}
fmt.Printf("\t%v\n", e)
fmt.Printf("\t%v\n", entity{t: uint32(t), size: uint32(s), body: b})
e := entFactory.BuildMessage(int(t))
if e == nil {
fmt.Printf("\tno known entity for type id %d\n", int(t))
continue
}
err := proto.Unmarshal(b, e)
if err != nil {
fmt.Printf("entity unmarshal error: %v\n", err)
} else {
fmt.Printf("\t\t%v\n", e)
}
}
}
return nil

@ -5,6 +5,7 @@ import (
"fmt"
"io"
"github.com/golang/protobuf/proto"
"github.com/jordanorelli/hyperstone/dota"
)
@ -49,6 +50,16 @@ func (p *parser) run() error {
if err := msg.check(p.dumpPackets); err != nil {
fmt.Printf("error: %v\n", err)
}
default:
m := cmdFactory.BuildMessage(int(msg.cmd))
if m != nil {
err := proto.Unmarshal(msg.body, m)
if err != nil {
fmt.Printf("cmd unmarshal error: %v\n", err)
} else {
fmt.Println(m)
}
}
}
}
}

Loading…
Cancel
Save