public TXV(TXM txm, Stream stream) { if (!LoadFile(txm, stream)) { throw new Exception("Loading TXV failed!"); } }
public static int Execute(List <string> args) { if (args.Count != 1 && args.Count != 2) { Console.WriteLine("Usage: texture.txm texture.txv"); Console.WriteLine(" or: texture.tex (FPS4 file containing TXM and TXV)"); return(-1); } String outdir = args[0] + ".ext"; if (args.Count == 1) { FPS4.FPS4 fps4 = new FPS4.FPS4(args[0]); if (fps4.Files.Count == 2 || (fps4.Files.Count == 3 && fps4.Files[2].FileSize == 0)) { TXM txm = new TXM(fps4.GetChildByIndex(0).AsFile.DataStream); var txvs = fps4.GetChildByIndex(1).AsFile.DataStream; TXV txv = new TXV(txm, txvs.Duplicate(), AutodetectVesperiaPC(txvs.Duplicate())); return(Extract(txv, outdir) ? 0 : -1); } Console.WriteLine(args[0] + " contains != 2 files, not a txm/txv pair"); return(-1); } return(Extract(args[0], args[1], outdir) ? 0 : -1); }
public TXV(TXM txm, Stream stream, bool vesperiaPcTextureFormat) { if (!LoadFile(txm, stream, vesperiaPcTextureFormat)) { throw new Exception("Loading TXV failed!"); } }
public TXV(TXM txm, String filename) { using (Stream stream = new System.IO.FileStream(filename, FileMode.Open)) { if (!LoadFile(txm, stream)) { throw new Exception("Loading TXV failed!"); } } }
public TXV(TXM txm, String filename, bool vesperiaPcTextureFormat) { using (Stream stream = new System.IO.FileStream(filename, FileMode.Open)) { if (!LoadFile(txm, stream, vesperiaPcTextureFormat)) { throw new Exception("Loading TXV failed!"); } } }
public static bool Extract(string txmpath, string txvpath, string outdir) { TXM txm = new TXM(txmpath); TXV txv; using (Stream stream = new System.IO.FileStream(txvpath, FileMode.Open)) { txv = new TXV(txm, stream, AutodetectVesperiaPC(stream)); } return(Extract(txv, outdir)); }
private bool LoadFile(TXM txm, Stream stream) { textures = new List <TXVSingle>(); foreach (TXMSingle ts in txm.TXMSingles) { textures.Add(new TXVSingle(stream, ts)); } return(true); }
private bool LoadFile(TXM txm, Stream stream, bool vesperiaPcTextureFormat) { textures = new List <TXVSingle>(); foreach (TXMSingle ts in txm.TXMSingles) { try { textures.Add(new TXVSingle(stream, ts, vesperiaPcTextureFormat)); } catch (Exception ex) { Console.WriteLine("Error loading " + ts.ToString() + ": " + ex.ToString()); } } return(true); }
public static bool Extract(string txmpath, string txvpath, string outdir) { TXM txm = new TXM(txmpath); TXV txv = new TXV(txm, txvpath); Directory.CreateDirectory(outdir); int counter = 0; foreach (TXVSingle ts in txv.textures) { foreach (var tex in ts.Decode()) { using (var fs = new FileStream(Path.Combine(outdir, counter.ToString("D4") + "_" + tex.name), FileMode.Create)) { tex.data.Position = 0; Util.CopyStream(tex.data, fs, tex.data.Length); } ++counter; } } return(true); }