diff --git a/GPK_RePack/Editors/TextureTools.cs b/GPK_RePack/Editors/TextureTools.cs index 99333b3..a7aed37 100644 --- a/GPK_RePack/Editors/TextureTools.cs +++ b/GPK_RePack/Editors/TextureTools.cs @@ -30,7 +30,7 @@ public static void exportTexture(GpkExport export, string file) if (image == null || ddsFile == null) return; - image.SaveObject(file, new DdsSaveConfig(image.GetFormat(), 0, 0, false, false)); + image.SaveObject(file, new DdsSaveConfig(image.parsedImageFormat, 0, 0, false, false)); } catch (Exception ex) { @@ -47,7 +47,7 @@ public static void importTexture(GpkExport export, string file) var texture2d = export.Payload as Texture2D; var image = new DdsFile(); - var config = new DdsSaveConfig(texture2d.GetFormat(), 0, 0, false, false); + var config = new DdsSaveConfig(texture2d.parsedImageFormat, 0, 0, false, false); image.Load(file); if (image.MipMaps.Count == 0 || Settings.Default.GenerateMipMaps) diff --git a/GPK_RePack/Forms/GUI.cs b/GPK_RePack/Forms/GUI.cs index 0e2872f..2293a06 100644 --- a/GPK_RePack/Forms/GUI.cs +++ b/GPK_RePack/Forms/GUI.cs @@ -1505,6 +1505,7 @@ private Dictionary> filterCompositeList(string t } catch (Exception ex) { + logger.Error(ex, "filter fail"); return gpkStore.CompositeMap; } } diff --git a/GPK_RePack/IO/MassDumper.cs b/GPK_RePack/IO/MassDumper.cs index 27c1318..2d9d142 100644 --- a/GPK_RePack/IO/MassDumper.cs +++ b/GPK_RePack/IO/MassDumper.cs @@ -161,7 +161,10 @@ public static void DumpMassTextures(GpkStore store, String outdir, Dictionary ((GpkBaseProperty)t).name == "Format"); String format = ((GpkByteProperty)formatProp).nameValue; + SaveFormat(export); startUnk = reader.ReadBytes(12); int mipMapCountOffset = reader.ReadInt32(); @@ -308,14 +307,18 @@ public override string ToString() } - public FileFormat GetFormat() + public void SaveFormat(GpkExport export) { - GpkByteProperty formatProp = objectExport.GetProperty("Format") as GpkByteProperty; - if (formatProp == null) return FileFormat.Unknown; - - string format = formatProp.nameValue; - - return DdsPixelFormat.ParseFileFormat(format); + GpkByteProperty formatProp = export.GetProperty("Format") as GpkByteProperty; + if (formatProp == null) + { + parsedImageFormat = FileFormat.Unknown; + } + else + { + string format = formatProp.nameValue; + parsedImageFormat = DdsPixelFormat.ParseFileFormat(format); + } } public Stream GetObjectStream() @@ -332,7 +335,7 @@ public Stream GetObjectStream() private Stream buildDdsImage(int mipMapIndex) { MipMap mipMap = maps[mipMapIndex]; - DdsHeader ddsHeader = new DdsHeader(new DdsSaveConfig(GetFormat(), 0, 0, false, false), mipMap.sizeX, mipMap.sizeY); + DdsHeader ddsHeader = new DdsHeader(new DdsSaveConfig(parsedImageFormat, 0, 0, false, false), mipMap.sizeX, mipMap.sizeY); MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream); @@ -353,7 +356,7 @@ public void SaveObject(string filename, object configuration) if (maps == null || !maps.Any()) return; DdsSaveConfig config = configuration as DdsSaveConfig ?? new DdsSaveConfig(FileFormat.Unknown, 0, 0, false, false); - config.FileFormat = GetFormat(); + config.FileFormat = parsedImageFormat; //parse uncompressed image DdsFile ddsImage = new DdsFile(GetObjectStream()); diff --git a/GPK_RePack/Model/Prop/GpkBaseProperty.cs b/GPK_RePack/Model/Prop/GpkBaseProperty.cs index 9789406..720eef5 100644 --- a/GPK_RePack/Model/Prop/GpkBaseProperty.cs +++ b/GPK_RePack/Model/Prop/GpkBaseProperty.cs @@ -9,7 +9,6 @@ class GpkBaseProperty public string type; //long index public int size; public int arrayIndex; - public object value; public GpkBaseProperty() {