using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using Bounce.Singletons;
using Bounce.TaleSpire.AssetManagement;
using Bounce.Unmanaged;
using Bounce.UnsafeViews;
using DataModel;
using HarmonyLib;
using TMPro;
using TaleSpire.Atmosphere;
using TaleSpire.ContentManagement;
using Unity.Collections;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AudioPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AudioPlugin")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("AudioPlugin")]
[assembly: ComVisible(false)]
[assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")]
[assembly: AssemblyFileVersion("4.1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("4.1.0.0")]
namespace LordAshes;
[BepInPlugin("org.pluginmasters.plugins.audio", "Audio Plug-In", "4.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class AudioPlugin : BaseUnityPlugin
{
public class MyCustomMusicContentProvider : IContentProvider, IProvidesMusicDataContent, IProvidesAudioClipContent
{
public static NativeHashMap<ContentGuid, (InternedContentAddress address, UnsafeView<MusicDataV0> data, string name)> Music;
public MyCustomMusicContentProvider()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
Music = new NativeHashMap<ContentGuid, (InternedContentAddress, UnsafeView<MusicDataV0>, string)>(128, (Allocator)4);
NGuid val = default(NGuid);
NGuid.TryParse(Utility.GuidFromString("org.pluginmasters.plugins.audio").ToString(), ref val);
SemiInternedPackId val2 = default(SemiInternedPackId);
((SemiInternedPackId)(ref val2))..ctor(new SourceLocalPackId(val.Data));
InternedPackSource val3 = (InternedPackSource)typeof(InternedPackSource).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[1] { typeof(PackSourceKind) }, null).Invoke(new object[1] { (object)(PackSourceKind)3 });
InternedPackId val4 = default(InternedPackId);
((InternedPackId)(ref val4))..ctor(val3, val2.SourceLocalPackId, default(MD5));
using MD5 mD = MD5.Create();
NGuid val6 = default(NGuid);
Builder<MusicDataV0> val7 = default(Builder<MusicDataV0>);
ContentGuid val8 = default(ContentGuid);
foreach (MusicKind value in Enum.GetValues(typeof(MusicKind)))
{
for (int i = 0; i < customAudioSources[value].Count(); i++)
{
((NGuid)(ref val6))..ctor(mD.ComputeHash(Encoding.Default.GetBytes(customAudioSources[value][i])));
ref MusicDataV0 reference = ref Builder<MusicDataV0>.Create((Allocator)4, ref val7);
((ContentGuid)(ref val8))..ctor(val6);
ContentAddress val9 = ContentAddress.CreateFromParts((PackSourceKind)3, MemoryExtensions.AsSpan(""), val2.SourceLocalPackId, val8);
MusicDataV0.Construct<MusicDataV0>(val8, ref val7, ref reference, val9, customAudioSources[value][i], "", Array.Empty<string>(), value);
Root<MusicDataV0> val10 = val7.Complete((Allocator)4);
UnsafeView<MusicDataV0> item = UnsafeViewExtensions.TakeView<MusicDataV0>(ref val10);
Music.TryAdd(item.Value.Id, (new InternedContentAddress(val4, item.Value.Address.ContentRef), item, customAudioSources[value][i]));
}
}
}
public void FetchAudioClip(Destination contentDestination, in InternedContentAddress contentAddress)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
ProcessAudioClipLoad(Music, contentDestination, in contentAddress);
}
public void FetchMusicData(Destination contentDestination, in InternedContentAddress contentAddress)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
(InternedContentAddress, UnsafeView<MusicDataV0>, string) tuple = default((InternedContentAddress, UnsafeView<MusicDataV0>, string));
if (Music.TryGetValue(((ContentRef)(ref contentAddress.ContentRef)).AsContentId, ref tuple))
{
ContentManager.TryDeliverContent(contentDestination, ref tuple.Item2);
}
else
{
ContentManager.TryDeliverFailure(contentDestination, (ContentLoadFailureReason)5);
}
}
void IProvidesMusicDataContent.FetchMusicData(Destination contentDestination, in InternedContentAddress contentAddress)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
FetchMusicData(contentDestination, in contentAddress);
}
void IProvidesAudioClipContent.FetchAudioClip(Destination contentDestination, in InternedContentAddress contentAddress)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
FetchAudioClip(contentDestination, in contentAddress);
}
}
[HarmonyPatch(typeof(InternalPackManager), "OnInstanceSetup")]
public class OnSetupPatches
{
private static void Postfix()
{
ContentManager.RegisterContentProvider((ContentProviderKind)100, (IContentProvider)(object)new MyCustomMusicContentProvider());
}
}
[HarmonyPatch(typeof(ContentManager), "ProviderKindToPackSourceKind")]
public class PatchProviderLookup
{
private static bool Prefix(ref PackSourceKind __result, ContentProviderKind providerKind)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected I4, but got Unknown
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Invalid comparison between Unknown and I4
switch ((int)providerKind)
{
case 0:
__result = (PackSourceKind)1;
break;
case 1:
__result = (PackSourceKind)2;
break;
case 2:
__result = (PackSourceKind)5;
break;
case 3:
__result = (PackSourceKind)6;
break;
case 4:
__result = (PackSourceKind)4;
break;
case 5:
__result = (PackSourceKind)7;
break;
default:
if ((int)providerKind == 100)
{
__result = (PackSourceKind)3;
}
break;
}
return false;
}
}
[HarmonyPatch(typeof(UI_MusicSelectionDropdown), "OnEnable")]
public class OnEnablePatches
{
private static void Postfix(ref TMP_Dropdown ____dropdown, MusicKind ____type, ref List<InternedContentAddress> ____trackList)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
ProcessDropdownCreation(ref ____dropdown, ____type, ref ____trackList);
}
}
[HarmonyPatch(typeof(UI_MusicSelectionDropdown), "SelectIndex")]
public class OnSelectIndex
{
private static bool Prefix(int index, ref TMP_Dropdown ____dropdown, MusicKind ____type, ref List<InternedContentAddress> ____trackList)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
return ProcessDropdownSelection(index, ref ____dropdown, ____type, ref ____trackList);
}
}
[HarmonyPatch(typeof(AtmosphereReferenceData), "SetAtmosphereData")]
public class PatchReferenceData
{
private static void Postfix(AtmosphereReferenceData __instance, in AtmosphereData data)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
(InternedContentAddress, UnsafeView<MusicDataV0>, string) tuple = default((InternedContentAddress, UnsafeView<MusicDataV0>, string));
if (MyCustomMusicContentProvider.Music.TryGetValue(data.music, ref tuple))
{
__instance.Music = tuple.Item1;
}
(InternedContentAddress, UnsafeView<MusicDataV0>, string) tuple2 = default((InternedContentAddress, UnsafeView<MusicDataV0>, string));
if (MyCustomMusicContentProvider.Music.TryGetValue(data.ambientMusic, ref tuple2))
{
__instance.AmbientMusic = tuple2.Item1;
}
}
}
public static class Utility
{
public static bool isBoardLoaded()
{
return SimpleSingletonBehaviour<CameraController>.HasInstance && SingletonStateMBehaviour<BoardSessionManager, State<BoardSessionManager>>.HasInstance && !BoardSessionManager.IsLoading;
}
public static Guid GuidFromString(string input)
{
using MD5 mD = MD5.Create();
byte[] b = mD.ComputeHash(Encoding.Default.GetBytes(input));
return new Guid(b);
}
public static GameObject GetBaseLoader(CreatureGuid cid)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
try
{
CreatureBoardAsset val = null;
CreaturePresenter.TryGetAsset(cid, ref val);
if ((Object)(object)val != (Object)null)
{
Transform match = null;
Traverse(((Component)val).transform, "BaseLoader", 0, 10, ref match);
if ((Object)(object)match != (Object)null)
{
Debug.Log((object)("Audio Plug-In: Base Loader '" + ((Object)match.GetChild(0)).name + "' Found"));
return ((Component)match.GetChild(0)).gameObject;
}
Debug.LogWarning((object)"Audio Plug-In: Could Not Find Base Loader");
return null;
}
return null;
}
catch
{
return null;
}
}
public static GameObject GetAssetLoader(CreatureGuid cid)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
try
{
CreatureBoardAsset val = null;
CreaturePresenter.TryGetAsset(cid, ref val);
if ((Object)(object)val != (Object)null)
{
Transform match = null;
Traverse(((Component)val).transform, "AssetLoader", 0, 10, ref match);
if ((Object)(object)match != (Object)null)
{
Debug.Log((object)("Audio Plug-In: Asset Loader '" + ((Object)match.GetChild(0)).name + "' Found"));
return ((Component)match.GetChild(0)).gameObject;
}
Debug.LogWarning((object)"Audio Plug-In: Could Not Find Asset Loader");
return null;
}
return null;
}
catch
{
return null;
}
}
public static void Traverse(Transform root, string seek, int depth, int depthMax, ref Transform match)
{
try
{
if ((Object)(object)match != (Object)null)
{
return;
}
if (((Object)root).name == seek)
{
match = root;
return;
}
foreach (Transform item in ExtensionMethods.Children(root))
{
if (depth < depthMax)
{
Traverse(item, seek, depth + 1, depthMax, ref match);
}
}
}
catch
{
}
}
public static float ParseFloat(string value)
{
return float.Parse(value, CultureInfo.InvariantCulture);
}
public static string GetCreatureName(string nameBlock)
{
if (nameBlock == null)
{
return "(Unknown)";
}
if (!nameBlock.Contains("<size=0>"))
{
return nameBlock;
}
return nameBlock.Substring(0, nameBlock.IndexOf("<size=0>")).Trim();
}
public static void PostOnMainPage(MemberInfo plugin)
{
SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode)
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
try
{
if (((Scene)(ref scene)).name == "UI")
{
TextMeshProUGUI uITextByName = GetUITextByName("BETA");
if (Object.op_Implicit((Object)(object)uITextByName))
{
((TMP_Text)uITextByName).text = "INJECTED BUILD - unstable mods";
}
}
else
{
TextMeshProUGUI uITextByName2 = GetUITextByName("TextMeshPro Text");
if (Object.op_Implicit((Object)(object)uITextByName2))
{
BepInPlugin val = (BepInPlugin)Attribute.GetCustomAttribute(plugin, typeof(BepInPlugin));
if (((TMP_Text)uITextByName2).text.EndsWith("</size>"))
{
((TMP_Text)uITextByName2).text = ((TMP_Text)uITextByName2).text + "\n\nMods Currently Installed:\n";
}
TextMeshProUGUI val2 = uITextByName2;
((TMP_Text)val2).text = ((TMP_Text)val2).text + "\nPlugin Masters' " + val.Name + " - " + val.Version;
}
}
}
catch (Exception ex)
{
Debug.Log((object)ex);
}
};
}
private static TextMeshProUGUI GetUITextByName(string name)
{
TextMeshProUGUI[] array = Object.FindObjectsOfType<TextMeshProUGUI>();
for (int i = 0; i < array.Length; i++)
{
if (((Object)array[i]).name == name)
{
return array[i];
}
}
return null;
}
}
public enum DiagnosticLevel
{
none,
error,
warning,
info,
debug,
ultra
}
public enum CoreAudioInclusionSettings
{
first,
alphabetical,
last
}
public const string Name = "Audio Plug-In";
public const string Guid = "org.pluginmasters.plugins.audio";
public const string Version = "4.1.0";
public const string Author = "Plugin Masters";
private static Dictionary<MusicKind, string> virtualCoreFolders = new Dictionary<MusicKind, string>();
private static Dictionary<MusicKind, string> currentFolder = new Dictionary<MusicKind, string>();
private static Dictionary<MusicKind, List<string>> customAudioSources = new Dictionary<MusicKind, List<string>>();
private static Dictionary<MusicKind, SortedDictionary<string, InternedContentAddress>> coreAudioSources = new Dictionary<MusicKind, SortedDictionary<string, InternedContentAddress>>();
private static AudioPlugin _self = null;
public static ConfigEntry<DiagnosticLevel> diagnostics { get; set; }
public static ConfigEntry<CoreAudioInclusionSettings> coreInclusionSettings { get; set; }
private void Awake()
{
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Expected O, but got Unknown
_self = this;
diagnostics = ((BaseUnityPlugin)this).Config.Bind<DiagnosticLevel>("Settings", "Diagnostic Level", DiagnosticLevel.info, (ConfigDescription)null);
coreInclusionSettings = ((BaseUnityPlugin)this).Config.Bind<CoreAudioInclusionSettings>("Settings", "Core Audio Placement", CoreAudioInclusionSettings.alphabetical, (ConfigDescription)null);
virtualCoreFolders[(MusicKind)1] = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "Virtual Core Ambient Files Location", "Ambient/Core", (ConfigDescription)null).Value.ToString();
virtualCoreFolders[(MusicKind)0] = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "Virtual Core Music Files Location", "Music/Core", (ConfigDescription)null).Value.ToString();
Debug.Log((object)("Audio Plug-In: Active. (Diagnostic Mode = " + diagnostics.Value.ToString() + ")"));
Harmony val = new Harmony("org.pluginmasters.plugins.audio");
val.PatchAll();
currentFolder.Add((MusicKind)1, "Ambient");
currentFolder.Add((MusicKind)0, "Music");
coreAudioSources.Add((MusicKind)1, new SortedDictionary<string, InternedContentAddress>());
coreAudioSources.Add((MusicKind)0, new SortedDictionary<string, InternedContentAddress>());
GetAllCustomSongs(ref customAudioSources);
Utility.PostOnMainPage(((object)this).GetType());
}
public void GetAllCustomSongs(ref Dictionary<MusicKind, List<string>> customAudioSources)
{
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_032b: Unknown result type (might be due to invalid IL or missing references)
//IL_0389: Unknown result type (might be due to invalid IL or missing references)
//IL_035e: Unknown result type (might be due to invalid IL or missing references)
//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
//IL_0469: Unknown result type (might be due to invalid IL or missing references)
//IL_046e: Unknown result type (might be due to invalid IL or missing references)
//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
customAudioSources.Add((MusicKind)1, (from a in File.Find("/Audio/Ambient/", (CacheType)999)
where ".ACC|.MP3|.OGG|.WAV|.WWW".Contains(Path.GetExtension(a).ToUpper())
select a).ToList());
customAudioSources.Add((MusicKind)0, (from a in File.Find("/Audio/Music/", (CacheType)999)
where ".ACC|.MP3|.OGG|.WAV|.WWW".Contains(Path.GetExtension(a).ToUpper())
select a).ToList());
foreach (MusicKind value in Enum.GetValues(typeof(MusicKind)))
{
int num = customAudioSources[value].Count();
for (int i = 0; i < num; i++)
{
customAudioSources[value][i] = customAudioSources[value][i].Replace("\\", "/").Substring(customAudioSources[value][i].IndexOf("/Audio/") + "/Audio/".Length);
customAudioSources[value][i] = customAudioSources[value][i].Substring(0, customAudioSources[value][i].Replace("\\", "/").LastIndexOf("/")) + "/" + Path.GetFileNameWithoutExtension(customAudioSources[value][i]) + "♫";
string[] array = customAudioSources[value][i].Substring(0, customAudioSources[value][i].Replace("\\", "/").LastIndexOf("/")).Split('/');
string text = array[0];
for (int j = 1; j < array.Length; j++)
{
if (!customAudioSources[value].Contains(text + "/[" + array[j] + "]►"))
{
customAudioSources[value].Add(text + "/[" + array[j] + "]►");
}
if (!customAudioSources[value].Contains(text + "/" + array[j] + "/[Back]►"))
{
customAudioSources[value].Add(text + "/" + array[j] + "/[Back]►");
}
text = text + "/" + array[j];
}
}
}
foreach (KeyValuePair<MusicKind, string> virtualCoreFolder in virtualCoreFolders)
{
string[] array2 = virtualCoreFolder.Value.Replace("\\", "/").Split("/");
string text2 = array2[0];
for (int k = 1; k < array2.Length; k++)
{
if (!customAudioSources[virtualCoreFolder.Key].Contains(text2 + "/[" + array2[k] + "]►"))
{
customAudioSources[virtualCoreFolder.Key].Add(text2 + "/[" + array2[k] + "]►");
}
if (!customAudioSources[virtualCoreFolder.Key].Contains(text2 + "/" + array2[k] + "/[Back]►"))
{
customAudioSources[virtualCoreFolder.Key].Add(text2 + "/" + array2[k] + "/[Back]►");
}
text2 = text2 + "/" + array2[k];
}
}
if (diagnostics.Value < DiagnosticLevel.debug)
{
return;
}
foreach (MusicKind value2 in Enum.GetValues(typeof(MusicKind)))
{
MusicKind key2 = value2;
for (int l = 0; l < customAudioSources[key2].Count(); l++)
{
Debug.Log((object)("Audio Plug-In: Adding Audio File. Type '" + ((object)(MusicKind)(ref key2)).ToString() + "', Location '" + customAudioSources[key2][l] + "'"));
}
}
}
public static void ProcessDropdownCreation(ref TMP_Dropdown ____dropdown, MusicKind ____type, ref List<InternedContentAddress> ____trackList)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Invalid comparison between Unknown and I4
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0383: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
//IL_033a: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0673: Unknown result type (might be due to invalid IL or missing references)
//IL_0675: Invalid comparison between Unknown and I4
//IL_045e: Unknown result type (might be due to invalid IL or missing references)
//IL_047a: Unknown result type (might be due to invalid IL or missing references)
//IL_0487: Unknown result type (might be due to invalid IL or missing references)
//IL_0427: Unknown result type (might be due to invalid IL or missing references)
//IL_0443: Unknown result type (might be due to invalid IL or missing references)
//IL_068e: Unknown result type (might be due to invalid IL or missing references)
//IL_0693: Unknown result type (might be due to invalid IL or missing references)
//IL_069c: Unknown result type (might be due to invalid IL or missing references)
//IL_0678: Unknown result type (might be due to invalid IL or missing references)
//IL_067d: Unknown result type (might be due to invalid IL or missing references)
//IL_0686: Unknown result type (might be due to invalid IL or missing references)
//IL_06a1: Unknown result type (might be due to invalid IL or missing references)
//IL_06bf: Unknown result type (might be due to invalid IL or missing references)
//IL_054b: Unknown result type (might be due to invalid IL or missing references)
//IL_0550: Unknown result type (might be due to invalid IL or missing references)
//IL_0585: Unknown result type (might be due to invalid IL or missing references)
//IL_0711: Unknown result type (might be due to invalid IL or missing references)
//IL_0716: Unknown result type (might be due to invalid IL or missing references)
//IL_0628: Unknown result type (might be due to invalid IL or missing references)
//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
if (diagnostics.Value >= DiagnosticLevel.info)
{
Debug.Log((object)"Audio Plug-In: Building Audio Options");
}
AtmosphereReferenceData currentReferenceData = AtmosphereManager.GetCurrentReferenceData();
NativeKeyValueArrays<ContentGuid, (InternedContentAddress, UnsafeView<MusicDataV0>, string)> keyValueArrays = MyCustomMusicContentProvider.Music.GetKeyValueArrays((Allocator)3);
try
{
List<string> list = new List<string>();
NativeArray<ContentGuid> val = default(NativeArray<ContentGuid>);
NativeArray<(InternedContentAddress, UnsafeView<MusicDataV0>, string)> val2 = default(NativeArray<(InternedContentAddress, UnsafeView<MusicDataV0>, string)>);
NativeCollectionExtensionMethods.Deconstruct<ContentGuid, (InternedContentAddress, UnsafeView<MusicDataV0>, string)>(keyValueArrays, ref val, ref val2);
SortedDictionary<string, InternedContentAddress> sortedDictionary = new SortedDictionary<string, InternedContentAddress>();
SortedDictionary<string, ContentGuid> source = new SortedDictionary<string, ContentGuid>();
if (coreAudioSources[____type].Count() == 0)
{
if (diagnostics.Value >= DiagnosticLevel.debug)
{
Debug.Log((object)("Audio Plug-In: Storing " + (____dropdown.options.Count() - 1) + " Core " + ((object)(MusicKind)(ref ____type)).ToString() + " Audio Options"));
}
for (int i = 1; i < ____dropdown.options.Count(); i++)
{
if (diagnostics.Value >= DiagnosticLevel.ultra)
{
Debug.Log((object)("Audio Plug-In: Storing Item '" + ____dropdown.options[i].text + "'"));
}
coreAudioSources[____type].Add(____dropdown.options[i].text, ____trackList[i - 1]);
}
}
if (diagnostics.Value >= DiagnosticLevel.debug)
{
Debug.Log((object)"Audio Plug-In: Clear Audio Options");
}
____trackList.Clear();
____dropdown.ClearOptions();
if ((int)____type == 1)
{
____dropdown.AddOptions(new List<string> { "Default" });
}
else
{
____dropdown.AddOptions(new List<string> { "Silence" });
}
if (diagnostics.Value >= DiagnosticLevel.debug)
{
Debug.Log((object)("Audio Plug-In: Adding Custom Links (" + (val.Length > 0) + ") For " + currentFolder[____type]));
}
if (val.Length > 0)
{
for (int j = 0; j < val.Length; j++)
{
(InternedContentAddress, UnsafeView<MusicDataV0>, string) tuple = val2[j];
if (tuple.Item2.Value.Kind == ____type && tuple.Item3.Substring(0, tuple.Item3.Replace("\\", "/").LastIndexOf("/")) == currentFolder[____type] && tuple.Item3.EndsWith("►"))
{
if (diagnostics.Value >= DiagnosticLevel.ultra)
{
Debug.Log((object)("Audio Plug-In: Adding Link '" + tuple.Item3 + "' For " + currentFolder[____type]));
}
sortedDictionary.Add(tuple.Item3.Substring(tuple.Item3.Replace("\\", "/").LastIndexOf("/") + 1), tuple.Item1);
}
}
}
if (diagnostics.Value >= DiagnosticLevel.debug)
{
Debug.Log((object)("Audio Plug-In: Adding Core Audio Options (" + (currentFolder[____type] == virtualCoreFolders[____type]) + ") For " + currentFolder[____type]));
}
string text = ((coreInclusionSettings.Value == CoreAudioInclusionSettings.first) ? "♪" : "");
if (currentFolder[____type] == virtualCoreFolders[____type])
{
for (int k = 0; k < coreAudioSources[____type].Keys.Count(); k++)
{
if (diagnostics.Value >= DiagnosticLevel.ultra)
{
Debug.Log((object)("Audio Plug-In: Adding Core Item '" + coreAudioSources[____type].Keys.ElementAt(k) + "' For " + currentFolder[____type]));
}
sortedDictionary.Add(text + coreAudioSources[____type].Keys.ElementAt(k), coreAudioSources[____type].Values.ElementAt(k));
}
}
if (diagnostics.Value >= DiagnosticLevel.debug)
{
Debug.Log((object)("Audio Plug-In: Adding Custom Audio Options (" + (val.Length > 0) + ")"));
}
if (val.Length > 0)
{
text = ((coreInclusionSettings.Value == CoreAudioInclusionSettings.last) ? "♪" : "");
for (int l = 0; l < val.Length; l++)
{
(InternedContentAddress, UnsafeView<MusicDataV0>, string) tuple2 = val2[l];
if (tuple2.Item2.Value.Kind == ____type && tuple2.Item3.Substring(0, tuple2.Item3.Replace("\\", "/").LastIndexOf("/")) == currentFolder[____type] && tuple2.Item3.EndsWith("♫"))
{
if (diagnostics.Value >= DiagnosticLevel.ultra)
{
Debug.Log((object)("Audio Plug-In: Adding Custom Item '" + tuple2.Item3 + "' For " + currentFolder[____type]));
}
sortedDictionary.Add(text + tuple2.Item3.Substring(tuple2.Item3.Replace("\\", "/").LastIndexOf("/") + 1), tuple2.Item1);
}
}
}
if (diagnostics.Value >= DiagnosticLevel.ultra)
{
Debug.Log((object)"Audio Plug-In: Getting Atmosphere Selection");
}
InternedContentAddress val3;
ContentGuid asContentId;
if ((int)____type != 1)
{
val3 = currentReferenceData.Music;
asContentId = ((ContentRef)(ref val3.ContentRef)).AsContentId;
}
else
{
val3 = currentReferenceData.AmbientMusic;
asContentId = ((ContentRef)(ref val3.ContentRef)).AsContentId;
}
ContentGuid val4 = asContentId;
if (diagnostics.Value >= DiagnosticLevel.ultra)
{
Debug.Log((object)("Audio Plug-In: Atmosphere Selection Is " + Convert.ToString(val4)));
}
int valueWithoutNotify = 0;
try
{
if (diagnostics.Value >= DiagnosticLevel.ultra)
{
Debug.Log((object)"Audio Plug-In: Seeking Dropdown Selected Item");
}
for (int m = 0; m < sortedDictionary.Count(); m++)
{
if (source.ElementAt(m).Value == val4)
{
valueWithoutNotify = m;
if (diagnostics.Value >= DiagnosticLevel.ultra)
{
Debug.Log((object)("Audio Plug-In: Current Dropdown Selection Is " + valueWithoutNotify));
}
}
}
}
catch (Exception)
{
}
____trackList.AddRange(sortedDictionary.Values.ToList());
____dropdown.AddOptions(sortedDictionary.Keys.ToList());
if (diagnostics.Value >= DiagnosticLevel.ultra)
{
Debug.Log((object)("Audio Plug-In: Applying Current Dropdown Selection Of " + valueWithoutNotify));
}
____dropdown.SetValueWithoutNotify(valueWithoutNotify);
}
finally
{
((IDisposable)keyValueArrays).Dispose();
}
}
public static bool ProcessDropdownSelection(int index, ref TMP_Dropdown ____dropdown, MusicKind ____type, ref List<InternedContentAddress> ____trackList)
{
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
if (diagnostics.Value >= DiagnosticLevel.info)
{
Debug.Log((object)("Audio Plug-In: Selected '" + ____dropdown.options[index].text + "'"));
}
if (!____dropdown.options[index].text.EndsWith("►"))
{
return true;
}
if (____dropdown.options[index].text == "[Back]►")
{
currentFolder[____type] = currentFolder[____type].Substring(0, currentFolder[____type].LastIndexOf("/"));
}
else
{
currentFolder[____type] = currentFolder[____type] + "/" + ____dropdown.options[index].text.Substring(1, ____dropdown.options[index].text.Length - 3);
}
currentFolder[____type] = currentFolder[____type].Replace("\\", "/");
if (diagnostics.Value >= DiagnosticLevel.debug)
{
Debug.Log((object)("Audio Plug-In: Current Folder Is '" + currentFolder[____type] + "'"));
}
ProcessDropdownCreation(ref ____dropdown, ____type, ref ____trackList);
return false;
}
public static void ProcessAudioClipLoad(NativeHashMap<ContentGuid, (InternedContentAddress address, UnsafeView<MusicDataV0> data, string name)> Music, Destination contentDestination, in InternedContentAddress contentAddress)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Invalid comparison between Unknown and I4
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
(InternedContentAddress, UnsafeView<MusicDataV0>, string) tuple = default((InternedContentAddress, UnsafeView<MusicDataV0>, string));
if (Music.TryGetValue(((ContentRef)(ref contentAddress.ContentRef)).AsContentId, ref tuple))
{
if (diagnostics.Value >= DiagnosticLevel.ultra)
{
Debug.Log((object)(((object)(MusicKind)(ref tuple.Item2.Value.Kind)).ToString() + ": " + ((String)(ref tuple.Item2.Value.Name)).GetString() + ": " + ((String)(ref tuple.Item2.Value.Description)).GetString() + ": " + ((Packed)(ref tuple.Item2.Value.Address)).ToUri()));
}
string text = File.Find("/Audio/" + ((String)(ref tuple.Item2.Value.Name)).GetString().Replace("♫", "").Replace("♪", ""), (CacheType)999).ElementAt(0);
if (Path.GetExtension(text).ToUpper() == ".WWW")
{
text = File.ReadAllText(text, (CacheType)999);
}
if (!text.ToUpper().StartsWith("HTTP"))
{
text = "file:/" + text;
}
UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(text, (AudioType)0);
try
{
audioClip.SendWebRequest();
while (!audioClip.isDone)
{
}
if ((int)audioClip.result == 2)
{
Debug.LogWarning((object)("Audio Plug-In: Failure To Load Clip '" + text + "'"));
Debug.LogWarning((object)("Audio Plug-In: " + audioClip.error));
}
else
{
AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip);
ContentManager.TryDeliverContent(contentDestination, content);
}
return;
}
finally
{
((IDisposable)audioClip)?.Dispose();
}
}
ContentGuid asContentId = ((ContentRef)(ref contentAddress.ContentRef)).AsContentId;
Debug.LogWarning((object)("Audio Plug-In: Requested Item Address " + ((object)(ContentGuid)(ref asContentId)).ToString() + " Not Registered."));
ContentManager.TryDeliverFailure(contentDestination, (ContentLoadFailureReason)5);
}
}