From c84b347414bd5179d1b8972e1d928e064c33c238 Mon Sep 17 00:00:00 2001 From: Alexander Tkachov Date: Sat, 13 Apr 2024 13:47:57 +0200 Subject: [PATCH] fix AddNewArchive() default i20 impl and switch to using .suit-like impl for .stage (for performance) --- DAT1/TOC.cs | 8 ++++++++ Overstrike/Installers/StageInstaller.cs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/DAT1/TOC.cs b/DAT1/TOC.cs index 9b3d52f..8effec7 100644 --- a/DAT1/TOC.cs +++ b/DAT1/TOC.cs @@ -404,6 +404,14 @@ private uint AddNewArchive_Default(string filename) { Filename = bytes }); + // fix all assets entries that referenced archives prior to the one added + var offsets = OffsetsSection.Entries; + foreach (var offset in offsets) { + if (offset.ArchiveIndex >= index) { + ++offset.ArchiveIndex; + } + } + return (uint)index; } diff --git a/Overstrike/Installers/StageInstaller.cs b/Overstrike/Installers/StageInstaller.cs index 7f35e62..8a6f4d7 100644 --- a/Overstrike/Installers/StageInstaller.cs +++ b/Overstrike/Installers/StageInstaller.cs @@ -103,7 +103,7 @@ public Helper(StageInstaller_I20 outer) { _outer = outer; } - protected override uint CreateArchive(string filename) => _outer._toc.AddNewArchive(filename, TOCBase.ArchiveAddingImpl.DEFAULT); + protected override uint CreateArchive(string filename) => _outer._toc.AddNewArchive(filename, TOCBase.ArchiveAddingImpl.SUITTOOL); protected override ZipArchive ReadStageFile() => _outer.ReadModFile();