public void UnpackVifPacketToVu1() => File.OpenRead(Vu1FileName).Using(stream => { Helpers.AssertStream(stream, _ => { var vifContent = File.ReadAllBytes(VifFileName); var vifEmulator = new VifUnpacker(vifContent); vifEmulator.Run(); return(new MemoryStream(vifEmulator.Memory)); }); });
/// <summary> /// Build immutable parts from a submodel. /// </summary> /// <param name="submodel"></param> public Kkdf2MdlxParser(Mdlx.SubModel submodel) { immultableMeshList = new List <ImmutableMesh>(); foreach (Mdlx.DmaVif dmaVif in submodel.DmaChains.SelectMany(dmaChain => dmaChain.DmaVifs)) { const int tops = 0x40, top2 = 0x220; var unpacker = new VifUnpacker(dmaVif.VifPacket) { Vif1_Tops = tops }; unpacker.Run(); var mesh = VU1Simulation.Run(unpacker.Memory, tops, top2, dmaVif.TextureIndex, dmaVif.Alaxi); immultableMeshList.Add(mesh); } }
/// <summary> /// Build immutable parts from a submodel. /// </summary> /// <param name="submodel"></param> public Kkdf2MdlxParser(Mdlx.SubModel submodel) { immultableMeshList = new List <ImmutableMesh>(); foreach (Mdlx.DmaChain dmaChain in submodel.DmaChains) { foreach (Mdlx.DmaVif dmaVif in dmaChain.DmaVifs) { const int tops = 0x40; var unpacker = new VifUnpacker(dmaVif.VifPacket) { Vif1_Tops = tops }; unpacker.Run(); var mesh = VU1Simulation.Run(unpacker.Memory, tops, dmaVif.TextureIndex, dmaVif.Alaxi); mesh.isOpaque = (dmaChain.Unk00 & 1) == 0; immultableMeshList.Add(mesh); } } }