{{
from helpers import naturalsize

def bitfieldpp(fa):
    s = []
    for i in range(fa.count - 1, -1, -1):
        bit = fa.at(i)
        if bit.value:
            s.append("[color5]{}[/color5]([dim]{:X}[/dim])".format(bit.name, 1 << i))
    if s:
        return  " + ".join(s)
    else:
        return "[dim][/dim]"
}}

[color1]General infos[/color1]
  Flags: {{ write(bitfieldpp(analysis.struct["Main"]["Flags"])) }}

[color1]Files[/color1]
{{for s in analysis.struct:}}
{{if "HeadType" in s and s["HeadType"] == 0x74: }}
  [color3]{{ s["FileName"] }}[/color3] ({{write(naturalsize(s["UnpSize"], binary=True))}}, {{ write(s["UnpSize"] * 100 // len(s.bytes))}}%)
{{ :end }}
{{ :end }}
