From a1ba24bc871fdb7d7f39a023963d5ebcc1549ac1 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Tue, 23 Jun 2020 14:32:00 +0200 Subject: [PATCH] xact3::xwb: Number sounds when no names are found This is a workaround as in the long run names should be read from the corresponding sound bank. --- src/xact3/xwb.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/xact3/xwb.rs b/src/xact3/xwb.rs index 7a75dc4..fadc1c2 100644 --- a/src/xact3/xwb.rs +++ b/src/xact3/xwb.rs @@ -196,8 +196,12 @@ impl WaveBank<'_> { debug!("Parsing entries (length {})", segments[1].len()); let entries = exec_nom_parser(count(Entry::parse, info.entry_count as usize), segments[1])?; debug!("Parsing entry names (length {})", segments[3].len()); - let entry_names = - exec_nom_parser(count(take_str64, info.entry_count as usize), segments[3])?; + let entry_names = if segments[3].len() == info.entry_count as usize * 64 { + exec_nom_parser(count(take_str64, info.entry_count as usize), segments[3])? + } else { + warn!("File does not have name entries"); + (0..info.entry_count).map(|x| x.to_string()).collect() + }; let mut wave_bank = WaveBank { name: info.name,