types
Jordan Orelli 8 years ago
parent 36dbc9aaa9
commit 1dff55ca67

@ -14,6 +14,7 @@ var atom_types = map[string]typeFn{
func atomType(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) tÿpe { func atomType(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) tÿpe {
var_type := env.symbol(int(flat.GetVarTypeSym())) var_type := env.symbol(int(flat.GetVarTypeSym()))
if t, ok := atom_types[var_type]; ok { if t, ok := atom_types[var_type]; ok {
Debug.Printf(" atom type")
return t return t
} }
return nil return nil

@ -20,6 +20,7 @@ func (f *field) fromProto(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) e
return wrap(err, "unable to parse type %s", prettyFlatField(flat, env)) return wrap(err, "unable to parse type %s", prettyFlatField(flat, env))
} }
Debug.Printf(" type: %v", t)
f.tÿpe = t f.tÿpe = t
f.name = env.symbol(int(flat.GetVarNameSym())) f.name = env.symbol(int(flat.GetVarNameSym()))
return nil return nil

@ -14,8 +14,12 @@ const (
) )
func floatType(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) tÿpe { func floatType(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) tÿpe {
if env.symbol(int(flat.GetVarTypeSym())) == "CNetworkedQuantizedFloat" { switch env.symbol(int(flat.GetVarTypeSym())) {
case "CNetworkedQuantizedFloat":
return qFloatType(flat, env) return qFloatType(flat, env)
case "float32":
default:
return nil
} }
if env.symbol(int(flat.GetVarEncoderSym())) == "coord" { if env.symbol(int(flat.GetVarEncoderSym())) == "coord" {
return nil return nil
@ -25,9 +29,10 @@ func floatType(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) tÿpe {
} }
switch flat.GetBitCount() { switch flat.GetBitCount() {
case 0, 32: case 0, 32:
Debug.Printf(" std float type")
return typeFn(float_t) return typeFn(float_t)
default: default:
return nil return qFloatType(flat, env)
} }
} }
@ -62,6 +67,7 @@ func qFloatType(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) tÿpe {
} }
} }
Debug.Printf(" qfloat type")
return t return t
} }

@ -14,6 +14,7 @@ func handleType(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) tÿpe {
return nil return nil
} }
Debug.Printf(" handle type")
return typeFn(func(r bit.Reader) (value, error) { return typeFn(func(r bit.Reader) (value, error) {
return handle(bit.ReadVarInt(r)), r.Err() return handle(bit.ReadVarInt(r)), r.Err()
}) })

@ -11,6 +11,7 @@ func qAngleType(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) tÿpe {
} }
switch flat.GetBitCount() { switch flat.GetBitCount() {
case 0: case 0:
Debug.Printf(" qangle type")
return typeFn(func(r bit.Reader) (value, error) { return typeFn(func(r bit.Reader) (value, error) {
x, y, z := bit.ReadBool(r), bit.ReadBool(r), bit.ReadBool(r) x, y, z := bit.ReadBool(r), bit.ReadBool(r), bit.ReadBool(r)
var v vector var v vector

@ -33,6 +33,7 @@ func parseType(flat *dota.ProtoFlattenedSerializerFieldT, env *Env) tÿpe {
// unable to correctly parse. It can be interpreted as an error or as a type; // unable to correctly parse. It can be interpreted as an error or as a type;
// when interpreted as a type, it errors every time it tries to read a value. // when interpreted as a type, it errors every time it tries to read a value.
func typeError(t string, args ...interface{}) tÿpe { func typeError(t string, args ...interface{}) tÿpe {
Debug.Printf(" type error: %s", fmt.Sprintf(t, args...))
return error_t(fmt.Sprintf(t, args...)) return error_t(fmt.Sprintf(t, args...))
} }

Loading…
Cancel
Save