import struct class Node: pass BaseNode = Node() BaseNode.mtx = [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0] BaseNode.brres_key = '3D00' BaseNode.model_name = 'GoldwoodBase' BaseNode.lm_type = 0 TreeNode = Node() TreeNode.mtx = [1.0,0.0,0.0,60.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0] TreeNode.brres_key = '3D00' TreeNode.model_name = 'RedTree' TreeNode.lm_type = 1 nodes = {} nodes['Base'] = BaseNode nodes['Tr00'] = TreeNode header = struct.pack('>4sI', b'MScn', len(nodes)) entrydata = b'' stringtable = b'' currentoffset = 8 + (0x40 * len(nodes)) for key,node in nodes.items(): #nodekey, brreskey, lmtype, nameoffset, matrix entrydata += struct.pack('>4s4sII', key.encode('Shift-JIS'), node.brres_key.encode('Shift-JIS'), node.lm_type, currentoffset) for f in node.mtx: entrydata += struct.pack('>f', f) stringtable += node.model_name.encode('Shift-JIS') stringtable += b'\0' currentoffset += len(node.model_name) + 1 open('scenedata.bin', 'wb').write(header + entrydata + stringtable)