From ba0ac85543249cfdb630c781a3469bc3f72b4b14 Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Sat, 12 Sep 2020 15:33:28 -0400 Subject: [PATCH] Store original usd1 section for saving back unless edited to prevent v9 bflyt glitches. --- .../FileFormats/Layout/CAFE/Header.cs | 12 ++++++++---- File_Format_Library/FileFormats/Layout/CAFE/USD1.cs | 5 +++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/File_Format_Library/FileFormats/Layout/CAFE/Header.cs b/File_Format_Library/FileFormats/Layout/CAFE/Header.cs index 3a94d2c8..b5c3ee5d 100644 --- a/File_Format_Library/FileFormats/Layout/CAFE/Header.cs +++ b/File_Format_Library/FileFormats/Layout/CAFE/Header.cs @@ -411,16 +411,20 @@ namespace LayoutBXLYT.Cafe long dataPos = reader.Position; if (currentPane != null) + { ((PAN1)currentPane).UserData = new USD1(reader, this); + + reader.SeekBegin(dataPos); + ((PAN1)currentPane).UserData.Data = reader.ReadBytes((int)SectionSize - 8); + } else { - //User data before panes UserData = new USD1(reader, this); - } - reader.SeekBegin(dataPos); - UserData.Data = reader.ReadBytes((int)SectionSize - 8); + reader.SeekBegin(dataPos); + UserData.Data = reader.ReadBytes((int)SectionSize - 8); + } break; //If the section is not supported store the raw bytes default: diff --git a/File_Format_Library/FileFormats/Layout/CAFE/USD1.cs b/File_Format_Library/FileFormats/Layout/CAFE/USD1.cs index a091dd01..4220b980 100644 --- a/File_Format_Library/FileFormats/Layout/CAFE/USD1.cs +++ b/File_Format_Library/FileFormats/Layout/CAFE/USD1.cs @@ -33,6 +33,11 @@ namespace LayoutBXLYT.Cafe { long startPos = writer.Position - 8; + if (!Edited) { + writer.Write(this.Data); + return; + } + writer.Write((ushort)Entries.Count); writer.Write((ushort)0);