private static void CreateSceneMetadataTypeTree(ClassDatabaseFile cldb, AssetsFileInstance inst) { Type_0D type = C2T5.Cldb2TypeTree(cldb, 0x72); type.scriptIndex = 0x0001; type.unknown1 = Constants.sceneMetadataScriptNEHash[0]; type.unknown2 = Constants.sceneMetadataScriptNEHash[1]; type.unknown3 = Constants.sceneMetadataScriptNEHash[2]; type.unknown4 = Constants.sceneMetadataScriptNEHash[3]; TypeTreeEditor editor = new TypeTreeEditor(type); TypeField_0D baseField = type.pTypeFieldsEx[0]; uint sceneName = editor.AddField(baseField, editor.CreateTypeField("string", "sceneName", 1, uint.MaxValue, 0, false, false, Flags.AnyChildUsesAlignBytesFlag)); uint Array = editor.AddField(editor.type.pTypeFieldsEx[sceneName], editor.CreateTypeField("Array", "Array", 2, uint.MaxValue, 0, true, true, Flags.HideInEditorMask)); editor.AddField(editor.type.pTypeFieldsEx[Array], editor.CreateTypeField("int", "size", 3, 4, 0, false, false, Flags.HideInEditorMask)); editor.AddField(editor.type.pTypeFieldsEx[Array], editor.CreateTypeField("char", "data", 3, 1, 0, false, false, Flags.HideInEditorMask)); uint usedIds = editor.AddField(baseField, editor.CreateTypeField("vector", "usedIds", 1, uint.MaxValue, 0, false, false, Flags.AnyChildUsesAlignBytesFlag)); uint Array2 = editor.AddField(editor.type.pTypeFieldsEx[usedIds], editor.CreateTypeField("Array", "Array", 2, uint.MaxValue, 0, true, true)); editor.AddField(editor.type.pTypeFieldsEx[Array2], editor.CreateTypeField("int", "size", 3, 4, 0, false)); editor.AddField(editor.type.pTypeFieldsEx[Array2], editor.CreateTypeField("SInt64", "data", 3, 8, 0, false)); editor.AddField(baseField, editor.CreateTypeField("int", "hkweVersion", 1, 4, 0, false)); type = editor.SaveType(); inst.file.typeTree.pTypes_Unity5 = inst.file.typeTree.pTypes_Unity5.Concat(new Type_0D[] { type }).ToArray(); inst.file.typeTree.fieldCount++; }
///////////////////////////////////////////////////////// private static Type_0D CreateEditDifferTypeTree(ClassDatabaseFile cldb) { Type_0D type = C2T5.Cldb2TypeTree(cldb, 0x72); type.scriptIndex = 0x0000; type.unknown1 = Constants.editDifferScriptNEHash[0]; type.unknown2 = Constants.editDifferScriptNEHash[1]; type.unknown3 = Constants.editDifferScriptNEHash[2]; type.unknown4 = Constants.editDifferScriptNEHash[3]; TypeTreeEditor editor = new TypeTreeEditor(type); TypeField_0D baseField = type.pTypeFieldsEx[0]; editor.AddField(baseField, editor.CreateTypeField("unsigned int", "fileId", 1, 4, 0, false)); editor.AddField(baseField, editor.CreateTypeField("UInt64", "pathId", 1, 8, 0, false)); editor.AddField(baseField, editor.CreateTypeField("UInt64", "origPathId", 1, 8, 0, false)); editor.AddField(baseField, editor.CreateTypeField("UInt8", "newAsset", 1, 1, 0, true)); uint componentIds = editor.AddField(baseField, editor.CreateTypeField("vector", "componentIds", 1, uint.MaxValue, 0, false, false, Flags.AnyChildUsesAlignBytesFlag)); uint Array = editor.AddField(editor.type.pTypeFieldsEx[componentIds], editor.CreateTypeField("Array", "Array", 2, uint.MaxValue, 0, true, true)); editor.AddField(editor.type.pTypeFieldsEx[Array], editor.CreateTypeField("int", "size", 3, 4, 0, false)); editor.AddField(editor.type.pTypeFieldsEx[Array], editor.CreateTypeField("SInt64", "data", 3, 8, 0, false)); editor.AddField(baseField, editor.CreateTypeField("int", "instanceId", 1, 4, 0, false)); type = editor.SaveType(); return(type); }
///////////////////////////////////////////////////////// private static void CreateEditDifferTypeTree(ClassDatabaseFile cldb, AssetsFileInstance inst) { Type_0D type = C2T5.Cldb2TypeTree(cldb, 0x72); type.scriptIndex = 0x0000; type.unknown1 = Constants.editDifferScriptNEHash[0]; type.unknown2 = Constants.editDifferScriptNEHash[1]; type.unknown3 = Constants.editDifferScriptNEHash[2]; type.unknown4 = Constants.editDifferScriptNEHash[3]; TypeTreeEditor editor = new TypeTreeEditor(type); TypeField_0D baseField = type.pTypeFieldsEx[0]; editor.AddField(baseField, editor.CreateTypeField("unsigned int", "fileId", 1, 4, 0, false)); editor.AddField(baseField, editor.CreateTypeField("UInt64", "pathId", 1, 8, 0, false)); editor.AddField(baseField, editor.CreateTypeField("UInt64", "origPathId", 1, 8, 0, false)); editor.AddField(baseField, editor.CreateTypeField("UInt8", "newAsset", 1, 1, 0, true)); editor.AddField(baseField, editor.CreateTypeField("int", "instanceId", 1, 4, 0, false)); type = editor.SaveType(); inst.file.typeTree.pTypes_Unity5 = inst.file.typeTree.pTypes_Unity5.Concat(new Type_0D[] { type }).ToArray(); inst.file.typeTree.fieldCount++; }
private static Type_0D CreateTk2dEmuTypeTree(ClassDatabaseFile cldb) { Type_0D type = C2T5.Cldb2TypeTree(cldb, 0x72); type.scriptIndex = 0x0001; type.scriptHash1 = Constants.tk2dEmuScriptNEHash[0]; type.scriptHash2 = Constants.tk2dEmuScriptNEHash[1]; type.scriptHash3 = Constants.tk2dEmuScriptNEHash[2]; type.scriptHash4 = Constants.tk2dEmuScriptNEHash[3]; TypeTreeEditor editor = new TypeTreeEditor(type); TypeField_0D baseField = type.typeFieldsEx[0]; uint vertices = editor.AddField(baseField, editor.CreateTypeField("vector", "vertices", 1, -1, 0, false, false, Flags.AnyChildUsesAlignBytesFlag)); uint Array = editor.AddField(editor.type.typeFieldsEx[vertices], editor.CreateTypeField("Array", "Array", 2, -1, 0, true, true)); editor.AddField(editor.type.typeFieldsEx[Array], editor.CreateTypeField("int", "size", 3, 4, 0, false)); uint data = editor.AddField(editor.type.typeFieldsEx[Array], editor.CreateTypeField("Vector3", "data", 3, -1, 0, false)); editor.AddField(editor.type.typeFieldsEx[data], editor.CreateTypeField("float", "x", 4, 4, 0, false)); editor.AddField(editor.type.typeFieldsEx[data], editor.CreateTypeField("float", "y", 4, 4, 0, false)); editor.AddField(editor.type.typeFieldsEx[data], editor.CreateTypeField("float", "z", 4, 4, 0, false)); uint uvs = editor.AddField(baseField, editor.CreateTypeField("vector", "uvs", 1, -1, 0, false, false, Flags.AnyChildUsesAlignBytesFlag)); Array = editor.AddField(editor.type.typeFieldsEx[uvs], editor.CreateTypeField("Array", "Array", 2, -1, 0, true, true)); editor.AddField(editor.type.typeFieldsEx[Array], editor.CreateTypeField("int", "size", 3, 4, 0, false)); data = editor.AddField(editor.type.typeFieldsEx[Array], editor.CreateTypeField("Vector2", "data", 3, -1, 0, false)); editor.AddField(editor.type.typeFieldsEx[data], editor.CreateTypeField("float", "x", 4, 4, 0, false)); editor.AddField(editor.type.typeFieldsEx[data], editor.CreateTypeField("float", "y", 4, 4, 0, false)); uint indices = editor.AddField(baseField, editor.CreateTypeField("vector", "indices", 1, -1, 0, false, false, Flags.AnyChildUsesAlignBytesFlag)); Array = editor.AddField(editor.type.typeFieldsEx[indices], editor.CreateTypeField("Array", "Array", 2, -1, 0, true, true)); editor.AddField(editor.type.typeFieldsEx[Array], editor.CreateTypeField("int", "size", 3, 4, 0, false)); editor.AddField(editor.type.typeFieldsEx[Array], editor.CreateTypeField("int", "data", 3, 4, 0, false)); type = editor.SaveType(); return(type); }