public void RemoveEntry(uint assetID, AssetType assetType) { List <EntrySoundInfo_GCN_V1> entries; if (assetType == AssetType.SND) { entries = Entries_SND.ToList(); } else { entries = Entries_SNDS.ToList(); } for (int i = 0; i < entries.Count; i++) { if (entries[i].SoundAssetID == assetID) { entries.Remove(entries[i--]); } } if (assetType == AssetType.SND) { Entries_SND = entries.ToArray(); } else { Entries_SNDS = entries.ToArray(); } }
public byte[] GetHeader(uint assetID, AssetType assetType) { List <EntrySoundInfo_GCN_V1> entries; if (assetType == AssetType.SND) { entries = Entries_SND.ToList(); } else { entries = Entries_SNDS.ToList(); } for (int i = 0; i < entries.Count; i++) { if (entries[i].SoundAssetID == assetID) { return(entries[i].SoundHeader); } } entries = Entries_Sound_CIN.ToList(); for (int i = 0; i < entries.Count; i++) { if (entries[i].SoundAssetID == assetID) { return(entries[i].SoundHeader); } } throw new Exception($"Error: SNDI asset does not contain {assetType} sound header for asset [{assetID:X8}]"); }
public void AddEntry(byte[] soundData, uint assetID, AssetType assetType, out byte[] finalData) { List <EntrySoundInfo_GCN_V1> entries; if (assetType == AssetType.SND) { entries = Entries_SND.ToList(); } else { entries = Entries_SNDS.ToList(); } for (int i = 0; i < entries.Count; i++) { if (entries[i].SoundAssetID == assetID) { entries.Remove(entries[i--]); } } entries.Add(new EntrySoundInfo_GCN_V1(soundData.Take(0x60).ToArray(), assetID)); finalData = soundData.Skip(0x60).ToArray(); if (assetType == AssetType.SND) { Entries_SND = entries.ToArray(); } else { Entries_SNDS = entries.ToArray(); } }
public void Merge(AssetSNDI_GCN_V1 assetSNDI) { { // SND var entries = Entries_SND.ToList(); var assetIDsAlreadyPresent = (from entry in entries select(uint) entry.SoundAssetID).ToList(); foreach (var entry in assetSNDI.Entries_SND) { if (!assetIDsAlreadyPresent.Contains(entry.SoundAssetID)) { entries.Add(entry); } } Entries_SND = entries.ToArray(); } { // SNDS var entries = Entries_SNDS.ToList(); var assetIDsAlreadyPresent = (from entry in entries select(uint) entry.SoundAssetID).ToList(); foreach (var entry in assetSNDI.Entries_SNDS) { if (!assetIDsAlreadyPresent.Contains(entry.SoundAssetID)) { entries.Add(entry); } } Entries_SNDS = entries.ToArray(); } { // Sound_CIN var entries = Entries_Sound_CIN.ToList(); var assetIDsAlreadyPresent = (from entry in entries select(uint) entry.SoundAssetID).ToList(); foreach (var entry in assetSNDI.Entries_Sound_CIN) { if (!assetIDsAlreadyPresent.Contains(entry.SoundAssetID)) { entries.Add(entry); } } Entries_Sound_CIN = entries.ToArray(); } }
public void Clean(IEnumerable <uint> assetIDs) { { // SND var entries = Entries_SND.ToList(); for (int i = 0; i < entries.Count; i++) { if (!assetIDs.Contains(entries[i].SoundAssetID)) { entries.RemoveAt(i--); } } Entries_SND = entries.ToArray(); } { // SNDS var entries = Entries_SNDS.ToList(); for (int i = 0; i < entries.Count; i++) { if (!assetIDs.Contains(entries[i].SoundAssetID)) { entries.RemoveAt(i--); } } Entries_SNDS = entries.ToArray(); } { // Sound_CIN var entries = Entries_Sound_CIN.ToList(); for (int i = 0; i < entries.Count; i++) { if (!assetIDs.Contains(entries[i].SoundAssetID)) { entries.RemoveAt(i--); } } Entries_Sound_CIN = entries.ToArray(); } }