示例#1
0
 def fields(self, const):
     param_c = self.F("param_count", U30())
     self.F("return_type", ConstIndex(const["multiname"]))
     self.F("param_types", Array(param_c.data, lambda: ConstIndex(const["multiname"])))
     self.F("name", ConstIndex(const["string"]))
     f = self.F("flags", Format("B"))
     if f.data & 0x08:
         c = self.F("option_count", U30())
         self.F("option", Array(c.data, OptionDetail))
     if f.data & 0x80:
         self.F("param_names", Array(param_c.data, lambda: ConstIndex(const["string"])))
示例#2
0
 def fields(self, const):
     self.F("name", ConstIndex(const["multiname"]))
     self.F("super_name", ConstIndex(const["multiname"]))
     f = self.F("flags", Format("B"))
     if f.data & 0x08:
         self.F("protected_ns", ConstIndex(const["namespace"]))
     c = self.F("intrf_count", U30())
     self.F("interface", Array(c.data, lambda: ConstIndex(const["multiname"])))
     self.F("iinit", U30())
     c = self.F("trait_count", U30())
     self.F("trait", Array(c.data, lambda: Trait(const)))
示例#3
0
 def fields(self, const):
     self.F("method", U30())
     self.F("max_stack", U30())
     self.F("local_count", U30())
     self.F("init_scope_depth", U30())
     self.F("max_scope_depth", U30())
     c = self.F("code_length", U30())
     self.F("code", Blob(c.data))
     c = self.F("exception_count", U30())
     self.F("exception", Array(c.data, lambda: Exception(const)))
     c = self.F("trait_count", U30())
     self.F("trait", Array(c.data, lambda: Trait(const)))
示例#4
0
 def fields(self, const):
     self.F("name", ConstIndex(const["multiname"]))
     k = self.F("kind", Format("B"))
     kind = k.data & 0x0F
     f = k.data >> 4
     if kind in [0, 6]:
         self.F("slot_id", U30())
         self.F("type_name", ConstIndex(const["multiname"]))
         v = self.F("vindex", U30())
         if v.data != 0:
             self.F("vkind", Format("B"))
     elif kind in [4]:
         self.F("slot_id", U30())
         self.F("classi", U30())
     elif kind in [5]:
         self.F("slot_id", U30())
         self.F("function", U30())
     elif kind in [1, 2, 3]:
         self.F("disp_id", U30())
         self.F("method", U30())
     else:
         assert False, kind
     if f & 0x04:
         c = self.F("metadata_count", U30())
         self.F("metadata", Array(c.data, U30))
示例#5
0
    def fields(self, include_attributes=True):
        self.F("magic", Magic("<!-- dmx encoding "))
        self.F("version", FixedString(len("binary 2 format pcf 1")))
        self.F("magic2", Magic(" -->\n\0"))
        version = self["version"].data
        assert version in ["binary 2 format pcf 1",
                           "binary 5 format pcf 2"], version

        if version == "binary 2 format pcf 1":
            prefix = Format("h")
        else:
            prefix = Format("I")
        strings = self.F("strings", PrefixedArray(prefix, String))

        if version == "binary 2 format pcf 1":
            namefield = lambda: Index(strings, Format("h"))
            stringfield = String
        else:
            namefield = lambda: Index(strings, Format("I"))
            stringfield = namefield
        self.F(
            "elements",
            PrefixedArray(Format("I"),
                          lambda: Element(namefield, stringfield)))
        if include_attributes:
            self.F(
                "attributes",
                Array(len(self["elements"]),
                      field_function=lambda i, f: PrefixedArray(
                          Format("I"), lambda: Attribute(
                              namefield, stringfield, lambda: ElementIndex(
                                  self["elements"], f, Format("i"))))))
            for i in range(len(self["elements"])):
                self["elements"][i].attribute = self["attributes"][i]
示例#6
0
    def fields(self):
        self.F("magic", Magic("VSIF"))
        self.F("version", Format("I"))
        assert self["version"].data == 3, "Expected version 3, got {}".format(
            self["version"].data)
        self.F("nscenes", Format("I"))
        self.F("nstrings", Format("I"))
        self.F("scenesoffset", Format("I"))
        self.F(
            "strings",
            Array(self["nstrings"].data,
                  lambda: DataPointer(Format("I"), String())))

        self.F(
            "scenes",
            Pointer(
                self["scenesoffset"].data,
                Array(self["nscenes"].data,
                      lambda: SceneEntry(self["strings"]))))
示例#7
0
    def fields(self, strings):
        self.F("type", Mapping(Format("B"), self.event_types))
        self.F("name", Index(strings, Format("I")))
        self.F("time", Format("ff"))
        self.F("params", Array(3, lambda: Index(strings, Format("I"))))
        self.F("ramp", PrefixedArray(Format("B"), BVCDRamp))
        self.F("flags", Flags(Format("B"), self.flag_types))
        self.F("distancetotarget", Format("f"))
        self.F(
            "tags",
            PrefixedArray(
                Format("B"),
                lambda: BVCDTag(strings, ScaledField(Format("B"), 255.))))
        self.F(
            "flextimingtags",
            PrefixedArray(
                Format("B"),
                lambda: BVCDTag(strings, ScaledField(Format("B"), 255.))))
        self.F(
            "shifted_time",
            PrefixedArray(
                Format("B"),
                lambda: BVCDTag(strings, ScaledField(Format("H"), 4096.))))
        self.F(
            "playback_time",
            PrefixedArray(
                Format("B"),
                lambda: BVCDTag(strings, ScaledField(Format("H"), 4096.))))
        if self["type"].data == "gesture":
            self.F("sequenceduration", Format("f"))
        self.F(
            "relativetag",
            PrefixedArray(
                Format("B"),
                lambda: BVCDTag(strings, Index(strings, Format("I")))))

        self.F("flex",
               PrefixedArray(Format("B"), lambda: BVCDFlexTrack(strings)))

        if self["type"].data == "loop":
            self.F("loopcount", Format("B"))

        if self["type"].data == "speak":
            self.F("cctype", Format("B"))
            self.F("cctoken", Index(strings, Format("I")))
            self.F("ccflags", Flags(Format("B"), self.cc_flag_types))
示例#8
0
    def fields(self):
        base = self.F("base", Offset())
        self.F("baseptr", BasePointer("i"))
        self.F("labelindex", RelativeString(base, "i"))
        self.F("activitynameindex", RelativeString(base, "i"))
        self.F("flags", Format("I"))
        self.F("activity", Format("i"))
        self.F("actweight", Format("I"))
        self.F("numevents", Format("I"))
        self.F("eventindex", Relative(base, "i"))
        self.F("bbmin", Format("3f"))
        self.F("bbmax", Format("3f"))
        self.F("numblends", Format("I"))
        self.F("animindex", Relative(base, "i"))
        self.F("movementindex", Relative(base, "i"))
        self.F("groupsize", Format("2I"))
        self.F("paramindex", Format("2i"))
        self.F("paramstart", Format("2f"))
        self.F("paramend", Format("2f"))
        self.F("paremparent", Format("I"))
        self.F("fadeintime", Format("f"))
        self.F("fadeouttime", Format("f"))
        self.F("localentrynode", Format("I"))
        self.F("localexitnode", Format("I"))
        self.F("nodeflags", Format("I"))
        self.F("entryphase", Format("f"))
        self.F("exitphase", Format("f"))
        self.F("lastframe", Format("f"))
        self.F("nextseg", Format("I"))
        self.F("pose", Format("I"))
        self.F("numikrules", Format("I"))
        self.F("numautolayers", Format("I"))
        self.F("autolayerindex", Relative(base, "i"))
        self.F("weightlistindex", Relative(base, "i"))
        self.F("posekeyindex", Relative(base, "i"))
        self.F("numiklocks", Format("I"))
        self.F("iklockindex", Format("I"))
        self.F("keyvalueindex", Relative(base, "i"))
        self.F("keyvaluesize", Format("I"))
        self.F("cycleposeindex", Relative(base, "i"))
        self.F("activitymodifierindex", Relative(base, "i"))
        self.F("numactivitymodifier", Format("I"))
        self.F("unused", Format("5I"))

        # self.F("event", Pointer(self["eventindex"].data, Array(self["numevents"].data, Event)))
        self.F("activitymodifier", Pointer(self["activitymodifierindex"].data, Array(self["numactivitymodifier"].data, ActivityModifier)))
示例#9
0
 def fields(self):
     c = self.F("int_count", U30())
     self.F("integer", Array(c.data-1, S32))
     c = self.F("uint_count", U30())
     self.F("uinteger", Array(c.data-1, U32))
     c = self.F("double_count", U30())
     self.F("double", Array(c.data-1, lambda: Format("d")))
     c = self.F("string_count", U30())
     s = self.F("string", Array(c.data-1, PrefixedString))
     c = self.F("namespace_count", U30())
     ns = self.F("namespace", Array(c.data-1, lambda: Namespace(s)))
     c = self.F("namespaceset_count", U30())
     nss = self.F("namespaceset", Array(c.data-1, lambda: NamespaceSet(ns)))
     c = self.F("multiname_count", U30())
     self.F("multiname", Array(c.data-1, lambda: Multiname(s, ns, nss)))
示例#10
0
 def fields(self, s, ns, nss):
     k = self.F("kind", Format("B"))
     if k.data in [0x07, 0x0D]:
         self.F("ns", ConstIndex(ns))
         self.F("name", ConstIndex(s))
     elif k.data in [0x0F, 0x10]:
         self.F("name", ConstIndex(s))
     elif k.data in [0x11, 0x12]:
         pass
     elif k.data in [0x09, 0x0E]:
         self.F("name", ConstIndex(s))
         self.F("nsset", ConstIndex(nss))
     elif k.data in [0x1B, 0x1C]:
         self.F("nsset", ConstIndex(nss))
     elif k.data in [0x1D]:
         self.F("typedef", U30())
         c = self.F("numparams", U30())
         self.F("params", Array(c.data, U30))
     else:
         assert False, k.data
示例#11
0
 def fields(self):
     self.F("minor", Format("H"))
     self.F("major", Format("H"))
     const = self.F("constant_pool", ConstantPool())
     c = self.F("method_count", U30())
     self.F("method", Array(c.data, lambda: Method(const)))
     c = self.F("metadatacount", U30())
     self.F("metadata", Array(c.data, lambda: MetaData(const)))
     c = self.F("class_count", U30())
     self.F("instance", Array(c.data, lambda: Instance(const)))
     self.F("class", Array(c.data, lambda: Class(const)))
     c = self.F("script_count", U30())
     self.F("script", Array(c.data, lambda: Script(const)))
     c = self.F("methodbody_count", U30())
     self.F("methodbody", Array(c.data, lambda: MethodBody(const)))
示例#12
0
    def fields(self):
        self.F("magic", Magic("IDST"))
        self.F("version", Format("I"))
        self.F("checksum", Format("I"))
        self.F("name", FixedString(64))
        self.F("datalength", Format("I"))

        self.F("eyepos", Format("3f"))
        self.F("illum", Format("3f"))
        self.F("hull_min", Format("3f"))
        self.F("hull_max", Format("3f"))
        self.F("view_bbmin", Format("3f"))
        self.F("view_bbmax", Format("3f"))

        self.F("flags", Format("I"))

        self.F("bone", Format("II"))
        self.F("bonecontroller", Format("II"))
        self.F("hitbox", Format("II"))

        self.F("numlocalanim", Format("I"))
        self.F("localanimoffset", Format("I"))

        self.F("numlocalsequence", Format("I"))
        self.F("localsequenceoffset", Format("I"))

        self.F("texture", Format("II"))
        self.F("cdtexture", Format("II"))

        self.F("unknown", Format("II"))

        self.F("numskinref", Format("I"))
        self.F("numskinfamilies", Format("I"))
        self.F("skinindex", Format("I"))

        self.F("bodypart", Format("II"))
        self.F("localattachment", Format("II"))

        self.F("numlocalnodes", Format("I"))
        self.F("localnodeindex", Format("I"))
        self.F("localnodenameindex", Format("I"))

        self.F("flexdesc", Format("II"))
        self.F("flexcontroller", Format("II"))
        self.F("flexrule", Format("II"))
        self.F("ikchain", Format("II"))
        self.F("mouth", Format("II"))

        self.F("localposeparameters", Format("II"))
        self.F("surfacepropindex", Format("I"))

        self.F("keyvalueindex", Format("I"))
        self.F("keyvaluesize", Format("I"))

        # pointed fields
        # self.F("localanim", Pointer(self["localanimoffset"].data, Array(self["numlocalanim"].data, LocalAnim)))
        self.F("localsequence", Pointer(self["localsequenceoffset"].data, Array(self["numlocalsequence"].data, LocalSequence)))
        self.F("skin",
            Pointer(self["skinindex"].data,
                Array(self["numskinfamilies"].data,
                    lambda: Array(self["numskinref"].data,
                        lambda: Format("h")))))
        self.F("keyvalue", Pointer(self["keyvalueindex"].data, FixedString(self["keyvaluesize"].data)))

        # here be dragons
        return

        self.F("localikautoplaylock", Format("II"))

        self.F("mass", Format("f"))
        self.F("contents", Format("I"))

        self.F("includemodels", Format("II"))

        self.F("bonetablebynameindex", Format("I"))
        self.F("vertexbase", Format("I"))
        self.F("indexbase", Format("I"))
        self.F("constdirectionallightdot", Format("B"))
        self.F("rootLOD", Format("B"))
        self.F("numAllowedRootLODs", Format("B"))
        self.F("unused", Format("B"))
        self.F("unused4", Format("I"))

        self.F("flexcontrollerui", Format("II"))

        self.F("unused3", Format("2I"))
        self.F("studiohdr2index", Format("I"))
        self.F("unused2", Format("1I"))
示例#13
0
 def fields(self, ns):
     c = self.F("count", U30())
     self.F("ns", Array(c.data, lambda: ConstIndex(ns)))
示例#14
0
 def fields(self, const):
     self.F("init", U30())
     c = self.F("trait_count", U30())
     self.F("trait", Array(c.data, lambda: Trait(const)))
示例#15
0
 def fields(self, const):
     self.F("name", ConstIndex(const["string"]))
     c = self.f("item_count", U30())
     self.F("items", Array(c.data, lambda: Item(const)))