Example #1
0
    def compileData(self):
        stream = StreamWriter()
        stream.writeInt(len(self.children))

        for child in self.children.values():
            stream.write(child.formatData())

        stream.write(b'\0' * (0x4408 - stream.tell()))

        return stream.getvalue()
Example #2
0
 def formatData(self):
     output = StreamWriter()
     output.writeString(self.string.ljust(0x100, "\0"))
     output.writeInt(0)
     output.writeInt(self.type)
     if self.type == 0:
         output.write(b'\xff' * 8)
     else:
         output.writeInt(self.decompressed_size)
         output.write(b'\00' * 4)
     return output.getvalue()
Example #3
0
    def compileData(self):
        stream = StreamWriter()
        stream.writeInt(len(self.children))
        self.recalculateOffsets()

        for child in self.children.values():
            stream.write(child.formatData())

        for child in self.children.values():
            stream.write(child.data)

        return stream.getvalue()
Example #4
0
 def formatData(self):
     output = StreamWriter()
     output.writeInt(self.offset)
     output.writeInt(self.size)
     # if scene data, don't write a string
     if self.string == "SceneData":
         output.writeInt(0)
     else:
         output.writeInt(self.string_length)
         output.writeString(self.string, encoding="utf-8")
     output.writeInt(self.type)
     # write padding
     output.write(b"\x00" * 8)
     return output.getvalue()
Example #5
0
 def formatData(self):
     output = StreamWriter()
     output.writeString(self.string.ljust(0x108, "\0"))
     output.writeInt(1)
     output.writeInt(self.width)
     output.writeInt(self.height)
     output.writeInt(1)
     output.writeInt(self.mip_map_count)
     output.writeInt(self.face_count)
     output.writeInt(self.type)
     output.write(b'\0' * 8)
     output.writeInt(self.size)
     output.writeInt(0)
     output.writeInt(self.size2)
     output.writeInt(self.offset)
     output.writeInt(0)
     output.writeInt(self.size3)
     output.writeInt(0)
     return output.getvalue()
Example #6
0
def imeta_from_scenedata(scenedata, inplace1_loc, inplace2_loc):
    inplace1 = inplace1_loc
    inplace2 = inplace2_loc

    if type(inplace1_loc) != Ipak:
        print("Loading inplace1..")
        print("\t" + inplace1_loc)
        inplace1 = Ipak(inplace1_loc)
    if type(inplace1_loc) != Ipak:
        print("Loading inplace2..")
        print("\t" + inplace2_loc)
        inplace2 = Ipak(inplace1_loc)

    print("Finding dependancies")
    output = StreamWriter()

    output.writeInt(len(scenedata.Textures) + 14)
    output.writeInt(0)

    unlisted_names = [
        'arifle_display_i1', 'expl_flame', 'font_main_00', 'menu_common_i17',
        'menu_common_i7', 'menu_manager_i54', 'menu_manager_i5f', 'msg_box_i6',
        'part_alias_akill', 'part_alias_normal', 'part_alias_transp',
        'part_plasma', 'scorch_pak_parallax', 'xbox_rt_b', 'smoke_sm',
        'part_rmp_flame_01'
    ]

    dependancies = scenedata.Textures + unlisted_names
    dependancies.sort()

    print("Writing dependancies")
    for texture in dependancies:
        dependant = inplace1.items.get(texture, None)
        dependant = inplace2.items.get(texture, dependant)
        if dependant:
            output.write(dependant.compile_data())

    print("Finalizing")
    output.write(b'\0' * (0x00290008 - output.tell()))
    return output.getvalue()
Example #7
0
File: ipak.py Project: Zatarita/SeT
    def compileData(self):
        stream = StreamWriter()

        offset = 0x290008
        names = self.imeta.names()
        for i in range(len(self.children)):
            self.imeta.children[names[i]].offset = offset
            offset += len(self.children[names[i]].data) + 64

        stream.write(self.imeta.compileData())

        for child in self.children.values():
            stream.write(child.formatData())
        stream.write(b'\0' * 0x200000)

        return stream.getvalue()
Example #8
0
File: ipak.py Project: Zatarita/SeT
        def formatData(self):
            output = StreamWriter()

            # don't worry about it. it doesn't need explanation
            output.write(
                b"\xf0\x00\xff\xff\xff\xff\x54\x43\x49\x50\x02\x01\xff\xff\xff\xff"
            )
            output.writeInt(self.width)
            output.writeInt(self.height)
            output.writeInt(1)
            output.writeInt(self.face_count)
            output.write(b"\xf2\x00\xff\xff\xff\xff")
            output.writeInt(self.type)
            output.write(b"\xf9\x00\xff\xff\xff\xff")
            output.writeInt(self.mip_map_count)
            output.write(b"\xff\x00\xff\xff\xff\xff")
            output.write(self.data)
            output.write(b"\x01\x00\xff\xff\xff\xff")

            return output.getvalue()