From c380dd008da4c946075d065f6d0eaa025225dad2 Mon Sep 17 00:00:00 2001 From: Sebastian Gabl Date: Wed, 13 Sep 2023 14:13:33 +0200 Subject: [PATCH] Fix issue when opening soundbanks with prefetch streamed sounds --- PD2SoundBankEditor.csproj | 2 +- SoundBank/Sections/HircObjects/Sound.cs | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/PD2SoundBankEditor.csproj b/PD2SoundBankEditor.csproj index 57b9b39..882f96a 100644 --- a/PD2SoundBankEditor.csproj +++ b/PD2SoundBankEditor.csproj @@ -6,7 +6,7 @@ true PD2SoundBankEditor - 1.3.0 + 1.3.1 1.0.0.0 1.0.0.0 en diff --git a/SoundBank/Sections/HircObjects/Sound.cs b/SoundBank/Sections/HircObjects/Sound.cs index 9572233..d8d215f 100644 --- a/SoundBank/Sections/HircObjects/Sound.cs +++ b/SoundBank/Sections/HircObjects/Sound.cs @@ -27,18 +27,22 @@ public override void Read(BinaryReader reader, int amount) { SourceId = reader.ReadUInt32(); FileId = reader.ReadUInt32(); - if (StreamType == 0) { + //Trace.WriteLine(ObjectId); + + if (StreamType != 1) { FileOffset = reader.ReadUInt32(); FileSize = reader.ReadUInt32(); - var streamInfo = Section.SoundBank.StreamInfos.Find(x => x.Id == SourceId); - if (streamInfo != null) { - streamInfo.HasReferences = true; + if (StreamType == 0) { + var streamInfo = Section.SoundBank.StreamInfos.Find(x => x.Id == SourceId); + if (streamInfo != null) { + streamInfo.HasReferences = true; + } } } SourceBits = reader.ReadByte(); // 0 = sfx, 1 = voice if ((PluginId & 0xF) > 1) { - Trace.WriteLine($"Plugin 0x{PluginId & 0xF:X1} 0x{(PluginId & 0xFFF0) >> 4:X3}"); + //Trace.WriteLine($"Plugin 0x{PluginId & 0xF:X1} 0x{(PluginId & 0xFFF0) >> 4:X3}"); UnknownSize = reader.ReadUInt32(); // Unknown size field }