private static void TryAddFullBodyObjectProperties(UserPropertyDictionary dictionary, string name) { TryAddProperty(dictionary, new UserIntProperty($"{name}.CatherineData.xrd649_envelope_tone", 100)); TryAddProperty(dictionary, new UserIntProperty($"{name}.CatherineData.xrd649_envelope_edge", 100)); TryAddProperty(dictionary, new UserIntProperty($"{name}.CatherineData.xrd649_envelope", 0)); TryAddProperty(dictionary, new UserIntProperty($"{name}.CatherineData.xrd649_outline", 0)); TryAddProperty(dictionary, new UserIntProperty($"{name}.CatherineData.xrd649_shadow_reciever", 0)); TryAddProperty(dictionary, new UserIntProperty($"{name}.CatherineData.xrd649_shadow_caster", 0)); TryAddProperty(dictionary, new UserIntProperty($"{name}.CatherineData.xrd649_fog_disable", 0)); TryAddProperty(dictionary, new UserIntProperty($"{name}.CatherineData.xrd649_pos_resid", 0)); TryAddProperty(dictionary, new UserIntProperty($"{name}.CatherineData.xrd649_pos_minor", 0)); TryAddProperty(dictionary, new UserIntProperty($"{name}.CatherineData.xrd649_pos_major", 0)); TryAddProperty(dictionary, new UserIntProperty($"{name}.CatherineData.xrd649_pos_type", 1)); TryAddProperty(dictionary, new UserIntProperty($"{name}.CatherineData.xrd649_ca_type", 3)); }
private static Resource Load(Stream stream, bool leaveOpen, Type type) { if (stream.Length < ResourceFileHeader.SIZE) { throw new InvalidDataException("Stream is too small to be a valid resource file."); } using (var reader = new ResourceReader(stream, leaveOpen)) { var header = reader.ReadFileHeader(); Resource res; switch (header.Type) { case ResourceType.ModelPack: res = new ModelPack(header.Version); break; case ResourceType.ShaderCachePS3: if (type == typeof(Epl)) { res = new Epl(header.Version); } else { res = new ShaderCachePS3(header.Version); } break; case ResourceType.ShaderCachePSP2: res = new ShaderCachePSP2(header.Version); break; case ResourceType.ShaderCachePS4: res = new ShaderCachePS4(header.Version); break; // Custom case ResourceType.TextureMap: res = new TextureMap(header.Version); break; case ResourceType.TextureDictionary: res = new TextureDictionary(header.Version); break; case ResourceType.Texture: res = new Texture(header.Version); break; case ResourceType.ShaderPS3: res = new ShaderPS3(header.Version); break; case ResourceType.ShaderPSP2: res = new ShaderPSP2(header.Version); break; case ResourceType.ShaderPS4: res = new ShaderPS4(header.Version); break; case ResourceType.Model: res = new Model(header.Version); break; case ResourceType.Node: return(Node.ReadRecursive(reader, header.Version)); case ResourceType.UserPropertyDictionary: res = new UserPropertyDictionary(header.Version); break; case ResourceType.Morph: res = new Morph(header.Version); break; case ResourceType.MorphTarget: res = new MorphTarget(header.Version); break; case ResourceType.MorphTargetList: res = new MorphTargetList(header.Version); break; case ResourceType.MaterialDictionary: res = new MaterialDictionary(header.Version); break; case ResourceType.ChunkType000100F9: res = new ChunkType000100F9(header.Version); break; case ResourceType.ChunkType000100F8: return(new ChunkType000100F8(header.Version) { Data = reader.ReadBytes(reader.ReadInt32()) }); case ResourceType.AnimationPack: res = new AnimationPack(header.Version); break; case ResourceType.MaterialAttribute: return(MaterialAttribute.Read(reader, header.Version)); case ResourceType.Material: res = new Material(header.Version); break; case ResourceType.Light: res = new Light(header.Version); break; case ResourceType.Mesh: res = new Mesh(header.Version); break; case ResourceType.Camera: res = new Camera(header.Version); break; case ResourceType.Epl: { res = new Epl(header.Version); break; } case ResourceType.EplLeaf: res = new EplLeaf(header.Version); break; case ResourceType.Animation: res = new Animation(header.Version); break; case ResourceType.AnimationBit29Data: res = new AnimationBit29Data(header.Version); break; case ResourceType.AnimationLayer: res = new AnimationLayer(header.Version); break; case ResourceType.AnimationController: res = new AnimationController(header.Version); break; default: throw new InvalidDataException("Unknown/Invalid resource type"); } res.ReadCore(reader); if (res.ResourceType == ResourceType.ModelPack && type == typeof(AnimationPack)) { // Identify AnimationPack from a file with a model resource header var model = ( ModelPack )res; if (model.AnimationPack != null && model.ChunkType000100F8 == null && model.ChunkType000100F9 == null && model.Materials == null && model.Model == null && model.Textures == null) { res = model.AnimationPack; } } return(res); } }