private void MergeSNDI(Section_AHDR AHDR, Game game, Platform platform) { foreach (Asset a in assetDictionary.Values) { if (a is AssetSNDI_GCN_V1 SNDI_G1) { SNDI_G1.Merge(new AssetSNDI_GCN_V1(AHDR, game, platform)); return; } else if (a is AssetSNDI_GCN_V2 SNDI_G2) { SNDI_G2.Merge(new AssetSNDI_GCN_V2(AHDR, game, platform)); return; } else if (a is AssetSNDI_XBOX SNDI_X) { SNDI_X.Merge(new AssetSNDI_XBOX(AHDR, game, platform)); return; } else if (a is AssetSNDI_PS2 SNDI_P) { SNDI_P.Merge(new AssetSNDI_PS2(AHDR, game, platform)); return; } } }
public void AddSoundToSNDI(byte[] soundData, uint assetID, AssetType assetType, out byte[] finalData) { foreach (Asset a in assetDictionary.Values) { if (a is AssetSNDI_GCN_V1 SNDI_G1) { SNDI_G1.AddEntry(soundData, assetID, assetType, out finalData); return; } else if (a is AssetSNDI_GCN_V2 SNDI_G2) { SNDI_G2.AddEntry(soundData, assetID); finalData = new byte[0]; return; } else if (a is AssetSNDI_XBOX SNDI_X) { SNDI_X.AddEntry(soundData, assetID, assetType, out finalData); return; } else if (a is AssetSNDI_PS2 SNDI_P) { SNDI_P.AddEntry(soundData, assetID, assetType, out finalData); return; } } throw new Exception("Unable to add sound: SNDI asset not found"); }
public void RemoveSoundFromSNDI(uint assetID) { foreach (Asset a in assetDictionary.Values) { if (a is AssetSNDI_GCN_V1 SNDI_G1) { if (SNDI_G1.HasReference(assetID)) { SNDI_G1.RemoveEntry(assetID, GetFromAssetID(assetID).AHDR.assetType); } } else if (a is AssetSNDI_GCN_V2 SNDI_G2) { if (SNDI_G2.HasReference(assetID)) { SNDI_G2.RemoveEntry(assetID); } } else if (a is AssetSNDI_XBOX SNDI_X) { if (SNDI_X.HasReference(assetID)) { SNDI_X.RemoveEntry(assetID, GetFromAssetID(assetID).AHDR.assetType); } } else if (a is AssetSNDI_PS2 SNDI_P) { if (SNDI_P.HasReference(assetID)) { SNDI_P.RemoveEntry(assetID, GetFromAssetID(assetID).AHDR.assetType); } } } }
public void AddSoundToSNDI(byte[] soundData, uint assetID, AssetType assetType, out byte[] finalData) { if (!ContainsAssetWithType(AssetType.SNDI)) { int layerType = (int)LayerType_BFBB.SNDTOC; if (game == Game.Incredibles) { layerType = (int)LayerType_TSSM.SNDTOC; } var list = new List <uint>(); PlaceTemplate(new SharpDX.Vector3(), IndexOfLayerOfType(layerType), ref list, "sound_info", AssetTemplate.SoundInfo); } foreach (Asset a in assetDictionary.Values) { if (a is AssetSNDI_GCN_V1 SNDI_G1) { SNDI_G1.AddEntry(soundData, assetID, assetType, out finalData); return; } else if (a is AssetSNDI_GCN_V2 SNDI_G2) { SNDI_G2.AddEntry(soundData, assetID); finalData = new byte[0]; return; } else if (a is AssetSNDI_XBOX SNDI_X) { SNDI_X.AddEntry(soundData, assetID, assetType, out finalData); return; } else if (a is AssetSNDI_PS2 SNDI_P) { SNDI_P.AddEntry(soundData, assetID, assetType, out finalData); return; } } throw new Exception("Unable to add sound: SNDI asset not found"); }
private void CleanSNDI() { foreach (Asset a in assetDictionary.Values) { if (a is AssetSNDI_GCN_V1 SNDI_G1) { SNDI_G1.Clean(from Asset a1 in assetDictionary.Values select a1.AHDR.assetID); } else if (a is AssetSNDI_GCN_V2 SNDI_G2) { SNDI_G2.Clean(from Asset a2 in assetDictionary.Values select a2.AHDR.assetID); } else if (a is AssetSNDI_XBOX SNDI_X) { SNDI_X.Clean(from Asset a3 in assetDictionary.Values select a3.AHDR.assetID); } else if (a is AssetSNDI_PS2 SNDI_P) { SNDI_P.Clean(from Asset a4 in assetDictionary.Values select a4.AHDR.assetID); } } }
public byte[] GetHeaderFromSNDI(uint assetID) { foreach (Asset a in assetDictionary.Values) { if (a is AssetSNDI_GCN_V1 SNDI_G1) { if (SNDI_G1.HasReference(assetID)) { return(SNDI_G1.GetHeader(assetID, GetFromAssetID(assetID).AHDR.assetType)); } } else if (a is AssetSNDI_GCN_V2 SNDI_G2) { if (SNDI_G2.HasReference(assetID)) { return(SNDI_G2.GetHeader(assetID)); } } else if (a is AssetSNDI_XBOX SNDI_X) { if (SNDI_X.HasReference(assetID)) { return(SNDI_X.GetHeader(assetID, GetFromAssetID(assetID).AHDR.assetType)); } } else if (a is AssetSNDI_PS2 SNDI_P) { if (SNDI_P.HasReference(assetID)) { return(SNDI_P.GetHeader(assetID, GetFromAssetID(assetID).AHDR.assetType)); } } } throw new Exception("Error: could not find SNDI asset which contains this sound in this archive."); }