1
0
mirror of synced 2025-01-31 12:23:52 +01:00

Fix BARS that have null audio entries for certain slots

This commit is contained in:
KillzXGaming 2019-07-02 20:01:10 -04:00
parent aede3839dc
commit 7a396e2095
10 changed files with 13 additions and 13 deletions

Binary file not shown.

View File

@ -9,7 +9,7 @@ using Switch_Toolbox.Library;
using Switch_Toolbox.Library.IO; using Switch_Toolbox.Library.IO;
using Switch_Toolbox.Library.Forms; using Switch_Toolbox.Library.Forms;
namespace FirstPlugin.New namespace FirstPlugin
{ {
public class SARC : IArchiveFile, IFileFormat public class SARC : IArchiveFile, IFileFormat
{ {

View File

@ -9,7 +9,7 @@ using Switch_Toolbox.Library;
using Switch_Toolbox.Library.IO; using Switch_Toolbox.Library.IO;
using Switch_Toolbox.Library.Forms; using Switch_Toolbox.Library.Forms;
namespace FirstPlugin namespace FirstPlugin.Old
{ {
public class SARC : TreeNodeFile, IFileFormat public class SARC : TreeNodeFile, IFileFormat
{ {

View File

@ -66,7 +66,7 @@ namespace FirstPlugin
public BarsProperty(BarsLib.BARS bars) public BarsProperty(BarsLib.BARS bars)
{ {
AudioCount = bars.AmtaList.Count; AudioCount = bars.AudioEntries.Count;
} }
} }
@ -226,23 +226,23 @@ namespace FirstPlugin
bars = new BarsLib.BARS(stream); bars = new BarsLib.BARS(stream);
if (bars.AmtaList.Count > 0) if (bars.HasMetaData)
Nodes.Add("Meta Data"); Nodes.Add("Meta Data");
if (bars.audioList.Count > 0) if (bars.HasAudioFiles)
Nodes.Add("Audio"); Nodes.Add("Audio");
for (int i = 0; i < bars.AmtaList.Count; i++) for (int i = 0; i < bars.AudioEntries.Count; i++)
{ {
var amtaWrapper = new MetaDataNodeWrapper(bars.AmtaList[i]); var amtaWrapper = new MetaDataNodeWrapper(bars.AudioEntries[i].MetaData);
string audioName = bars.AmtaList[i].Name; string audioName = bars.AudioEntries[i].MetaData.Name;
amtaWrapper.Text = $"{audioName}.amta"; amtaWrapper.Text = $"{audioName}.amta";
Nodes[0].Nodes.Add(amtaWrapper); Nodes[0].Nodes.Add(amtaWrapper);
if (bars.audioList.Count > 0) if (bars.AudioEntries[i].AudioFile != null)
{ {
BARSAudioFile audio = bars.audioList[i]; BARSAudioFile audio = bars.AudioEntries[i].AudioFile;
AudioEntry node = new AudioEntry(); AudioEntry node = new AudioEntry();
node.Type = audio.AudioType; node.Type = audio.AudioType;
@ -288,14 +288,14 @@ namespace FirstPlugin
foreach (TreeNode node in Nodes[1].Nodes) foreach (TreeNode node in Nodes[1].Nodes)
{ {
for (int i = 0; i < bars.AmtaList.Count; i++) for (int i = 0; i < bars.AudioEntries.Count; i++)
{ {
string audioName = bars.AmtaList[i].Name; string audioName = bars.AudioEntries[i].MetaData.Name;
if (Path.GetFileNameWithoutExtension(node.Text) == audioName) if (Path.GetFileNameWithoutExtension(node.Text) == audioName)
{ {
Console.WriteLine(audioName); Console.WriteLine(audioName);
bars.audioList[i].data = ((AudioEntry)node).Data; bars.AudioEntries[i].AudioFile.data = ((AudioEntry)node).Data;
} }
} }
} }

Binary file not shown.

Binary file not shown.