diff --git a/AshDumpLib/ExtendedBinaryReader.cs b/AshDumpLib/ExtendedBinaryReader.cs index 093d048..648c749 100644 --- a/AshDumpLib/ExtendedBinaryReader.cs +++ b/AshDumpLib/ExtendedBinaryReader.cs @@ -45,10 +45,10 @@ public virtual void Jump(long offset, SeekOrigin origin) Seek(offset + genericOffset, origin); } - public virtual string ReadStringTableEntry(bool useGenOffset = false) + public virtual string ReadStringTableEntry(bool useGenOffset = false, bool dontCheckForZeroes = false) { long pointer = Read(); - if (pointer > 0) + if (pointer > 0 || dontCheckForZeroes) { if (useGenOffset) pointer += genericOffset; diff --git a/AshDumpLib/HedgehogEngine/Archives/PAC.cs b/AshDumpLib/HedgehogEngine/Archives/PAC.cs index 006fa2c..a1b665d 100644 --- a/AshDumpLib/HedgehogEngine/Archives/PAC.cs +++ b/AshDumpLib/HedgehogEngine/Archives/PAC.cs @@ -944,7 +944,7 @@ void ReadV3(ExtendedBinaryReader reader) rootChunk.uncompressedData = uncompressedRootData.ToArray(); } reader.Seek(prePos1, SeekOrigin.Begin); - File.WriteAllBytes(FilePath + "_og.root", rootChunk.uncompressedData); + //File.WriteAllBytes(FilePath + "_og.root", rootChunk.uncompressedData); PAC rootPac = new(); rootPac.Open(FileName + ".root", rootChunk.uncompressedData, parseFiles); foreach (var x in rootPac.Files) @@ -968,7 +968,7 @@ void ReadV3(ExtendedBinaryReader reader) } rootPac.dependencies[i].main.uncompressedData = uncompressedData.ToArray(); } - File.WriteAllBytes(FilePath + "_og." + i, rootPac.dependencies[i].main.uncompressedData); + //File.WriteAllBytes(FilePath + "_og." + i, rootPac.dependencies[i].main.uncompressedData); PAC tempPac = new(); tempPac.Open(rootPac.dependencies[i].name, rootPac.dependencies[i].main.uncompressedData, parseFiles); foreach (var x in tempPac.Files) @@ -1025,7 +1025,7 @@ void WriteV3(ExtendedBinaryWriter writer) dep.chunks = ddChunks; deps.Add(dep); depPacs.Add(depPac); - File.WriteAllBytes($"{FilePath}.{index}", dmemStream.ToArray()); + //File.WriteAllBytes($"{FilePath}.{index}", dmemStream.ToArray()); index++; } PAC rootPac = new(); @@ -1190,7 +1190,7 @@ void WriteV3(ExtendedBinaryWriter writer) writer.Align(16); - File.WriteAllBytes(FilePath + ".root", rootChunk.uncompressedData); + //File.WriteAllBytes(FilePath + ".root", rootChunk.uncompressedData); } public struct PACVersion diff --git a/AshDumpLib/HedgehogEngine/BINA/BINAReader.cs b/AshDumpLib/HedgehogEngine/BINA/BINAReader.cs index 1b146c3..aa0249c 100644 --- a/AshDumpLib/HedgehogEngine/BINA/BINAReader.cs +++ b/AshDumpLib/HedgehogEngine/BINA/BINAReader.cs @@ -77,7 +77,7 @@ public void ReadHeader() this.Skip(RelativeDataOffset); } - public override string ReadStringTableEntry(bool useGenOffset = false) + public override string ReadStringTableEntry(bool useGenOffset = false, bool dontCheckForZeroes = false) { //Reads the string table pointer long pointer = Read(); diff --git a/AshDumpLib/HedgehogEngine/Mirage/Anim/CameraAnimation.cs b/AshDumpLib/HedgehogEngine/Mirage/Anim/CameraAnimation.cs index bc5cd42..f5f6201 100644 --- a/AshDumpLib/HedgehogEngine/Mirage/Anim/CameraAnimation.cs +++ b/AshDumpLib/HedgehogEngine/Mirage/Anim/CameraAnimation.cs @@ -122,7 +122,7 @@ public void Read(ExtendedBinaryReader reader, List keyframes) var prePos = reader.Position; reader.Jump(pointer, SeekOrigin.Begin); - Name = reader.ReadStringTableEntry(); + Name = reader.ReadStringTableEntry(dontCheckForZeroes: true); RotationOrAim = reader.Read() == 1; reader.Skip(3); FPS = reader.Read(); diff --git a/AshDumpLib/HedgehogEngine/Mirage/Anim/MaterialAnimation.cs b/AshDumpLib/HedgehogEngine/Mirage/Anim/MaterialAnimation.cs index 870cc4b..cc867c2 100644 --- a/AshDumpLib/HedgehogEngine/Mirage/Anim/MaterialAnimation.cs +++ b/AshDumpLib/HedgehogEngine/Mirage/Anim/MaterialAnimation.cs @@ -113,7 +113,7 @@ public void Read(ExtendedBinaryReader reader, List keyframes) var pointer = reader.Read(); var prePos = reader.Position; reader.Jump(pointer, SeekOrigin.Begin); - Name = reader.ReadStringTableEntry(); + Name = reader.ReadStringTableEntry(dontCheckForZeroes: true); FPS = reader.Read(); FrameStart = reader.Read(); FrameEnd = reader.Read(); diff --git a/AshDumpLib/HedgehogEngine/Mirage/Anim/UVAnimation.cs b/AshDumpLib/HedgehogEngine/Mirage/Anim/UVAnimation.cs index 801f1eb..c7887d4 100644 --- a/AshDumpLib/HedgehogEngine/Mirage/Anim/UVAnimation.cs +++ b/AshDumpLib/HedgehogEngine/Mirage/Anim/UVAnimation.cs @@ -43,8 +43,8 @@ public override void Read(ExtendedBinaryReader reader) } reader.Jump(uvsPointer, SeekOrigin.Begin); - MaterialName = reader.ReadStringTableEntry(); - TextureName = reader.ReadStringTableEntry(); + MaterialName = reader.ReadStringTableEntry(dontCheckForZeroes: true); + TextureName = reader.ReadStringTableEntry(dontCheckForZeroes: true); var uvCount = reader.Read(); for (int i = 0; i < uvCount; i++) { @@ -120,7 +120,7 @@ public void Read(ExtendedBinaryReader reader, List keyframes) var pointer = reader.Read(); var prePos = reader.Position; reader.Jump(pointer, SeekOrigin.Begin); - Name = reader.ReadStringTableEntry(); + Name = reader.ReadStringTableEntry(dontCheckForZeroes: true); FPS = reader.Read(); FrameStart = reader.Read(); FrameEnd = reader.Read(); diff --git a/AshDumpLib/HedgehogEngine/Mirage/Anim/VisibilityAnimation.cs b/AshDumpLib/HedgehogEngine/Mirage/Anim/VisibilityAnimation.cs index 96f6593..32e948e 100644 --- a/AshDumpLib/HedgehogEngine/Mirage/Anim/VisibilityAnimation.cs +++ b/AshDumpLib/HedgehogEngine/Mirage/Anim/VisibilityAnimation.cs @@ -40,8 +40,8 @@ public override void Read(ExtendedBinaryReader reader) } reader.Jump(vissPointer, SeekOrigin.Begin); - SkeletonName = reader.ReadStringTableEntry(); - InputName = reader.ReadStringTableEntry(); + SkeletonName = reader.ReadStringTableEntry(dontCheckForZeroes: true); + InputName = reader.ReadStringTableEntry(dontCheckForZeroes: true); var visCount = reader.Read(); for (int i = 0; i < visCount; i++) { @@ -117,7 +117,7 @@ public void Read(ExtendedBinaryReader reader, List keyframes) var pointer = reader.Read(); var prePos = reader.Position; reader.Jump(pointer, SeekOrigin.Begin); - Name = reader.ReadStringTableEntry(); + Name = reader.ReadStringTableEntry(dontCheckForZeroes: true); FPS = reader.Read(); FrameStart = reader.Read(); FrameEnd = reader.Read(); diff --git a/AshDumpLibTest/Program.cs b/AshDumpLibTest/Program.cs index 9a4147d..932824a 100644 --- a/AshDumpLibTest/Program.cs +++ b/AshDumpLibTest/Program.cs @@ -53,10 +53,22 @@ //NeedleShader needleShader = new(filepath); //Animator asm = new(filepath); //asm.SaveToFile(filepath + "1"); -PAC pAC = new(); -pAC.parseFiles = false; -pAC.Open(filepath); -pAC.SaveToFile(filepath+".pac"); +foreach(var i in Directory.GetFiles(filepath)) +{ + PAC pAC = new(); + pAC.parseFiles = false; + pAC.Open(i); + if(pAC.Files.Where(x => x.Extension == "cam-anim").Count() > 0) + foreach(var l in pAC.Files.Where(x => x.Extension == "cam-anim")) + { + CameraAnimation camanim = new(); + camanim.Open(l.FileName, l.Data); + foreach(var m in camanim.Cameras) + if(m.AspectRatio > 1.79 || m.AspectRatio < 1.76) + Console.WriteLine($"{i}\\{l.FileName}: {m.Name} - bad aspect ratio"); + } +} + //pAC.parseFiles = false; //pAC.SaveToFile(filepath + "test.pac"); //PointCloud pcmodel = new(filepath);