Skip to content

Commit

Permalink
Fix issue when opening soundbanks with prefetch streamed sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
segabl committed Sep 13, 2023
1 parent b66b2e9 commit c380dd0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion PD2SoundBankEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<UseWPF>true</UseWPF>
<StartupObject></StartupObject>
<AssemblyName>PD2SoundBankEditor</AssemblyName>
<Version>1.3.0</Version>
<Version>1.3.1</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<NeutralLanguage>en</NeutralLanguage>
Expand Down
14 changes: 9 additions & 5 deletions SoundBank/Sections/HircObjects/Sound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit c380dd0

Please sign in to comment.