err, fuck. stringtables needs its own package.

because an entity class should process a string table, but ent can't
reference main.
master
Jordan Orelli 8 years ago
parent b9f254112a
commit 96ab319324

@ -137,49 +137,49 @@ func dump(n node, prefix string, w io.Writer) {
}
var hlist = nodeList{
lNode{"PlusOne", 0, 36271, func() {}},
lNode{"FieldPathEncodeFinish", 39, 25474, func() {}},
lNode{"PushOneLeftDeltaNRightNonZeroPack6Bits", 11, 10530, func() {}},
lNode{"PlusTwo", 1, 10334, func() {}},
lNode{"PlusN", 4, 4128, func() {}},
lNode{"PushOneLeftDeltaOneRightNonZero", 8, 2942, func() {}},
lNode{"PopAllButOnePlusOne", 29, 1837, func() {}},
lNode{"PlusThree", 2, 1375, func() {}},
lNode{"PlusFour", 3, 646, func() {}},
lNode{"PopAllButOnePlusNPack6Bits", 32, 634, func() {}},
lNode{"PushOneLeftDeltaNRightZero", 9, 560, func() {}},
lNode{"PushOneLeftDeltaOneRightZero", 7, 521, func() {}},
lNode{"PushOneLeftDeltaNRightNonZero", 10, 471, func() {}},
lNode{"PushNAndNonTopological", 26, 310, func() {}},
lNode{"PopAllButOnePlusNPack3Bits", 31, 300, func() {}},
lNode{"NonTopoPenultimatePlusOne", 37, 271, func() {}},
lNode{"PushOneLeftDeltaNRightNonZeroPack8Bits", 12, 251, func() {}},
lNode{"PopAllButOnePlusN", 30, 149, func() {}},
lNode{"NonTopoComplexPack4Bits", 38, 99, func() {}},
lNode{"NonTopoComplex", 36, 76, func() {}},
lNode{"PushOneLeftDeltaZeroRightZero", 5, 35, func() {}},
lNode{"PushOneLeftDeltaZeroRightNonZero", 6, 3, func() {}},
lNode{"PopOnePlusOne", 27, 2, func() {}},
lNode{"PopNAndNonTopographical", 35, 1, func() {}},
lNode{"PlusOne", 0, 36271, func() { panic("not implemented: PlusOne") }},
lNode{"FieldPathEncodeFinish", 39, 25474, func() { panic("not implemented: FieldPathEncodeFinish") }},
lNode{"PushOneLeftDeltaNRightNonZeroPack6Bits", 11, 10530, func() { panic("not implemented: PushOneLeftDeltaNRightNonZeroPack6Bits") }},
lNode{"PlusTwo", 1, 10334, func() { panic("not implemented: PlusTwo") }},
lNode{"PlusN", 4, 4128, func() { panic("not implemented: PlusN") }},
lNode{"PushOneLeftDeltaOneRightNonZero", 8, 2942, func() { panic("not implemented: PushOneLeftDeltaOneRightNonZero") }},
lNode{"PopAllButOnePlusOne", 29, 1837, func() { panic("not implemented: PopAllButOnePlusOne") }},
lNode{"PlusThree", 2, 1375, func() { panic("not implemented: PlusThree") }},
lNode{"PlusFour", 3, 646, func() { panic("not implemented: PlusFour") }},
lNode{"PopAllButOnePlusNPack6Bits", 32, 634, func() { panic("not implemented: PopAllButOnePlusNPack6Bits") }},
lNode{"PushOneLeftDeltaNRightZero", 9, 560, func() { panic("not implemented: PushOneLeftDeltaNRightZero") }},
lNode{"PushOneLeftDeltaOneRightZero", 7, 521, func() { panic("not implemented: PushOneLeftDeltaOneRightZero") }},
lNode{"PushOneLeftDeltaNRightNonZero", 10, 471, func() { panic("not implemented: PushOneLeftDeltaNRightNonZero") }},
lNode{"PushNAndNonTopological", 26, 310, func() { panic("not implemented: PushNAndNonTopological") }},
lNode{"PopAllButOnePlusNPack3Bits", 31, 300, func() { panic("not implemented: PopAllButOnePlusNPack3Bits") }},
lNode{"NonTopoPenultimatePlusOne", 37, 271, func() { panic("not implemented: NonTopoPenultimatePlusOne") }},
lNode{"PushOneLeftDeltaNRightNonZeroPack8Bits", 12, 251, func() { panic("not implemented: PushOneLeftDeltaNRightNonZeroPack8Bits") }},
lNode{"PopAllButOnePlusN", 30, 149, func() { panic("not implemented: PopAllButOnePlusN") }},
lNode{"NonTopoComplexPack4Bits", 38, 99, func() { panic("not implemented: NonTopoComplexPack4Bits") }},
lNode{"NonTopoComplex", 36, 76, func() { panic("not implemented: NonTopoComplex") }},
lNode{"PushOneLeftDeltaZeroRightZero", 5, 35, func() { panic("not implemented: PushOneLeftDeltaZeroRightZero") }},
lNode{"PushOneLeftDeltaZeroRightNonZero", 6, 3, func() { panic("not implemented: PushOneLeftDeltaZeroRightNonZero") }},
lNode{"PopOnePlusOne", 27, 2, func() { panic("not implemented: PopOnePlusOne") }},
lNode{"PopNAndNonTopographical", 35, 1, func() { panic("not implemented: PopNAndNonTopographical") }},
// all the other operations have weights of 0 in clarity, which makes no
// sense.
lNode{"PopNPlusN", 34, 1, func() {}},
lNode{"PopNPlusOne", 33, 1, func() {}},
lNode{"PopOnePlusN", 28, 1, func() {}},
lNode{"PushN", 25, 1, func() {}},
lNode{"PushThreePack5LeftDeltaN", 24, 1, func() {}},
lNode{"PushThreeLeftDeltaN", 23, 1, func() {}},
lNode{"PushTwoPack5LeftDeltaN", 22, 1, func() {}},
lNode{"PushTwoLeftDeltaN", 21, 1, func() {}},
lNode{"PushThreePack5LeftDeltaOne", 20, 1, func() {}},
lNode{"PushThreeLeftDeltaOne", 19, 1, func() {}},
lNode{"PushTwoPack5LeftDeltaOne", 18, 1, func() {}},
lNode{"PushTwoLeftDeltaOne", 17, 1, func() {}},
lNode{"PushThreePack5LeftDeltaZero", 16, 1, func() {}},
lNode{"PushThreeLeftDeltaZero", 15, 1, func() {}},
lNode{"PushTwoPack5LeftDeltaZero", 14, 1, func() {}},
lNode{"PushTwoLeftDeltaZero", 13, 1, func() {}},
lNode{"PopNPlusN", 34, 1, func() { panic("not implemented: PopNPlusN") }},
lNode{"PopNPlusOne", 33, 1, func() { panic("not implemented: PopNPlusOne") }},
lNode{"PopOnePlusN", 28, 1, func() { panic("not implemented: PopOnePlusN") }},
lNode{"PushN", 25, 1, func() { panic("not implemented: PushN") }},
lNode{"PushThreePack5LeftDeltaN", 24, 1, func() { panic("not implemented: PushThreePack5LeftDeltaN") }},
lNode{"PushThreeLeftDeltaN", 23, 1, func() { panic("not implemented: PushThreeLeftDeltaN") }},
lNode{"PushTwoPack5LeftDeltaN", 22, 1, func() { panic("not implemented: PushTwoPack5LeftDeltaN") }},
lNode{"PushTwoLeftDeltaN", 21, 1, func() { panic("not implemented: PushTwoLeftDeltaN") }},
lNode{"PushThreePack5LeftDeltaOne", 20, 1, func() { panic("not implemented: PushThreePack5LeftDeltaOne") }},
lNode{"PushThreeLeftDeltaOne", 19, 1, func() { panic("not implemented: PushThreeLeftDeltaOne") }},
lNode{"PushTwoPack5LeftDeltaOne", 18, 1, func() { panic("not implemented: PushTwoPack5LeftDeltaOne") }},
lNode{"PushTwoLeftDeltaOne", 17, 1, func() { panic("not implemented: PushTwoLeftDeltaOne") }},
lNode{"PushThreePack5LeftDeltaZero", 16, 1, func() { panic("not implemented: PushThreePack5LeftDeltaZero") }},
lNode{"PushThreeLeftDeltaZero", 15, 1, func() { panic("not implemented: PushThreeLeftDeltaZero") }},
lNode{"PushTwoPack5LeftDeltaZero", 14, 1, func() { panic("not implemented: PushTwoPack5LeftDeltaZero") }},
lNode{"PushTwoLeftDeltaZero", 13, 1, func() { panic("not implemented: PushTwoLeftDeltaZero") }},
}
var htree = makeTree(hlist)

@ -39,6 +39,7 @@ func dumpEntities(m proto.Message) {
} else {
datap = data
}
fmt.Printf("{MaxEntries: %d UpdatedEntries: %v IsDelta: %t UpdateBaseline: %t Baseline: %d DeltaFrom: %d EntityData: %x PendingFullFrame: %t ActiveSpawngroupHandle: %d}\n", v.GetMaxEntries(), v.GetUpdatedEntries(), v.GetIsDelta(), v.GetUpdateBaseline(), v.GetBaseline(), v.GetDeltaFrom(), datap, v.GetPendingFullFrame(), v.GetActiveSpawngroupHandle())
br := bit.NewBytesReader(data)

@ -119,6 +119,7 @@ func main() {
flag.Parse()
if opts.v {
Debug.SetOutput(os.Stdout)
ent.Debug.SetOutput(os.Stdout)
}
@ -137,6 +138,9 @@ func main() {
handle = dumpClasses
case "entities":
handle = dumpEntities
case "baseline":
st := newStringTables()
handle = st.handleBaseline
default:
bail(1, "no such action: %s", flag.Arg(0))
}

@ -117,21 +117,34 @@ func (s stringTableEntry) String() string {
func (s *stringTables) handle(m proto.Message) {
switch v := m.(type) {
case *dota.CSVCMsg_CreateStringTable:
prettyPrint(m)
s.handleCreate(v)
// fmt.Println(s)
case *dota.CSVCMsg_UpdateStringTable:
prettyPrint(m)
s.handleUpdate(v)
case *dota.CSVCMsg_ClearAllStringTables:
// prettyPrint(m)
Debug.Println("stringTables: clear all string tables")
case *dota.CDemoStringTables:
// prettyPrint(m)
Debug.Println("stringTables: ignoring a full stringtable dump")
}
}
func (s *stringTables) handleBaseline(m proto.Message) {
switch v := m.(type) {
case *dota.CSVCMsg_CreateStringTable:
s.handleCreate(v)
if v.GetName() == "instancebaseline" {
s.idx["instancebaseline"]
fmt.Println("FART FART FART FART FART FART")
}
case *dota.CSVCMsg_UpdateStringTable:
s.handleUpdate(v)
if s.tables[int(v.GetTableId())].name == "instancebaseline" {
fmt.Println("FART FART FART FART FART FART")
}
}
}
func (s *stringTables) handleCreate(m *dota.CSVCMsg_CreateStringTable) {
fmt.Printf("create %s\n", m.GetName())
Debug.Printf("stringTable create: %s entries: %d", m.GetName(), m.GetNumEntries())
if m.GetUserDataFixedSize() {
s.tables = append(s.tables, stringTable{name: m.GetName(), byteSize: int(m.GetUserDataSize()), bitSize: int(m.GetUserDataSizeBits())})
} else {
@ -168,7 +181,6 @@ func (s *stringTables) handleUpdate(m *dota.CSVCMsg_UpdateStringTable) {
// hazard
table := &s.tables[m.GetTableId()]
s.br.SetSource(m.GetStringData())
fmt.Printf("update %s\n", table.name)
table.update(s.br, int(m.GetNumChangedEntries()))
}
@ -177,6 +189,7 @@ func (t *stringTable) update(br *bit.BufReader, changed int) {
idx = -1
entry *stringTableEntry
)
Debug.Printf("stringTable update table: %s changed: %d", t.name, changed)
h := newIntRing(32)
for i := 0; i < changed; i++ {
// sequential index flag should rarely be true in update
@ -193,7 +206,6 @@ func (t *stringTable) update(br *bit.BufReader, changed int) {
}
entry = &t.entries[idx]
fmt.Printf("%s -> ", entry)
// key flag
if bit.ReadBool(br) {
@ -227,6 +239,6 @@ func (t *stringTable) update(br *bit.BufReader, changed int) {
}
br.Read(entry.value)
}
fmt.Printf("%s\n", entry)
Debug.Printf("stringTable %s:%s = %x", t.name, entry.key, entry.value)
}
}

Loading…
Cancel
Save