Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
        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}]");
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        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();
            }
        }
Ejemplo n.º 5
0
 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();
     }
 }