Decompiled source of BaboonAPI v2.7.1

BepInEx/plugins/BaboonAPI.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using <StartupCode$BaboonAPI>;
using <StartupCode$BaboonAPI>.$BaboonAPI.Internal;
using <StartupCode$BaboonAPI>.$BaboonAPI.Utility;
using BaboonAPI;
using BaboonAPI.Event;
using BaboonAPI.Hooks.Entrypoints;
using BaboonAPI.Hooks.Initializer;
using BaboonAPI.Hooks.Saves;
using BaboonAPI.Hooks.Tracks;
using BaboonAPI.Internal;
using BaboonAPI.Internal.BaseGame;
using BaboonAPI.Patch;
using BaboonAPI.Utility;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.FSharp.Collections;
using Microsoft.FSharp.Control;
using Microsoft.FSharp.Core;
using Microsoft.FSharp.Core.CompilerServices;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Steamworks;
using UnityEngine;
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: FSharpInterfaceDataVersion(2, 0, 0)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("TromboneChamps")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Trombone Champ modding API")]
[assembly: AssemblyFileVersion("2.7.1.0")]
[assembly: AssemblyInformationalVersion("2.7.1+4a49125149f688c102e9ea80d10214e4444a96f0")]
[assembly: AssemblyProduct("BaboonAPI")]
[assembly: AssemblyTitle("BaboonAPI")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/tc-mods/BaboonAPI/")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default)]
[assembly: AssemblyVersion("2.7.1.0")]
namespace BaboonAPI.Event
{
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public interface Event<T>
	{
		T invoker { get; }

		virtual void Register(T P_0);

		virtual void Unregister(T P_0);
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class EventFactory<T> : Event<T>
	{
		internal FSharpFunc<FSharpList<T>, T> reducer;

		internal FSharpList<T> handlers;

		public EventFactory(FSharpFunc<FSharpList<T>, T> reducer)
		{
			this.reducer = reducer;
			handlers = FSharpList<T>.Empty;
		}

		public static Event<T> create(FSharpFunc<FSharpList<T>, T> reducer)
		{
			return new EventFactory<T>(reducer);
		}

		[SpecialName]
		virtual T Event<T>.get_invoker()
		{
			return ((FSharpFunc<FSharpList<FSharpList<T>>, FSharpList<T>>)(object)reducer).Invoke((FSharpList<FSharpList<T>>)(object)handlers);
		}

		virtual void Event<T>.Register(T handler)
		{
			handlers = FSharpList<T>.Cons(handler, handlers);
		}

		virtual void Event<T>.Unregister(T handler)
		{
			handlers = ListModule.Filter<T>((FSharpFunc<T, bool>)new $EventBus.BaboonAPI-Event-Event<'T>-Unregister@18<T>(handler), handlers);
		}
	}
}
namespace BaboonAPI.Hooks.Tracks
{
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public sealed class TrackAudio : IEquatable<TrackAudio>, IStructuralEquatable
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal AudioClip Clip@;

		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal float Volume@;

		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		public AudioClip Clip
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				return Clip@;
			}
		}

		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		public float Volume
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				return Volume@;
			}
		}

		[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(TrackAudio))]
		public TrackAudio(AudioClip clip, float volume)
		{
			Clip@ = clip;
			Volume@ = volume;
		}

		[CompilerGenerated]
		public override string ToString()
		{
			return ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<TrackAudio, string>>((PrintfFormat<FSharpFunc<TrackAudio, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<TrackAudio, string>, Unit, string, string, TrackAudio>("%+A")).Invoke(this);
		}

		[CompilerGenerated]
		public sealed int GetHashCode(IEqualityComparer comp)
		{
			if (this != null)
			{
				int num = 0;
				num = -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<float>(comp, Volume@) + ((num << 6) + (num >> 2)));
				return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<AudioClip>(comp, Clip@) + ((num << 6) + (num >> 2)));
			}
			return 0;
		}

		[CompilerGenerated]
		public sealed override int GetHashCode()
		{
			return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
		}

		[CompilerGenerated]
		public sealed bool Equals(object obj, IEqualityComparer comp)
		{
			if (this != null)
			{
				if (obj is TrackAudio trackAudio)
				{
					if (HashCompare.GenericEqualityWithComparerIntrinsic<AudioClip>(comp, Clip@, trackAudio.Clip@))
					{
						return Volume@ == trackAudio.Volume@;
					}
					return false;
				}
				return false;
			}
			return obj == null;
		}

		[CompilerGenerated]
		public sealed bool Equals(TrackAudio obj)
		{
			if (this != null)
			{
				if (obj != null)
				{
					if (HashCompare.GenericEqualityERIntrinsic<AudioClip>(Clip@, obj.Clip@))
					{
						float volume@ = Volume@;
						float volume@2 = obj.Volume@;
						if (volume@ == volume@2)
						{
							return true;
						}
						if (volume@ != volume@)
						{
							return volume@2 != volume@2;
						}
						return false;
					}
					return false;
				}
				return false;
			}
			return obj == null;
		}

		[CompilerGenerated]
		public sealed override bool Equals(object obj)
		{
			if (obj is TrackAudio obj2)
			{
				return Equals(obj2);
			}
			return false;
		}
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class BackgroundContext
	{
		internal GameController controller@23;

		public GameController controller => controller@23;

		public BackgroundContext(GameController controller)
		{
			controller@23 = controller;
		}
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public interface LoadedTromboneTrack : IDisposable
	{
		string trackref { get; }

		virtual TrackAudio LoadAudio();

		virtual GameObject LoadBackground(BackgroundContext ctx);

		[CompilationArgumentCounts(new int[] { 1, 1 })]
		virtual void SetUpBackgroundDelayed(BGController controller, GameObject bg);
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public interface TromboneTrack
	{
		string trackref { get; }

		string trackname_long { get; }

		string trackname_short { get; }

		string year { get; }

		string artist { get; }

		string desc { get; }

		string genre { get; }

		int difficulty { get; }

		int tempo { get; }

		int length { get; }

		virtual SavedLevel LoadChart();

		virtual LoadedTromboneTrack LoadTrack();

		virtual bool IsVisible();
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class PauseContext
	{
		internal PauseCanvasController controller;

		public GameController gameController => controller.gc;

		public BGController backgroundController => controller.gc.bgcontroller;

		public GameObject backgroundObj => controller.gc.bgcontroller.fullbgobject;

		public PauseContext(PauseCanvasController controller)
		{
			this.controller = controller;
		}
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public interface PauseAware
	{
		bool CanResume { get; }

		virtual void OnPause(PauseContext P_0);

		virtual void OnResume(PauseContext P_0);
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public interface Previewable
	{
		virtual BaboonAPI.Utility.Coroutines.YieldTask<FSharpResult<TrackAudio, string>> LoadClip();
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public interface Sortable
	{
		int sortOrder { get; }
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public sealed class SongGraph : IEquatable<SongGraph>, IStructuralEquatable, IComparable<SongGraph>, IComparable, IStructuralComparable
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal int fury@;

		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal int tears@;

		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal int spunk@;

		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal int doots@;

		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal int slides@;

		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		public int fury
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				return fury@;
			}
		}

		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		public int tears
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				return tears@;
			}
		}

		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		public int spunk
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				return spunk@;
			}
		}

		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		public int doots
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				return doots@;
			}
		}

		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		public int slides
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				return slides@;
			}
		}

		public int[] asArray => new int[5] { fury@, tears@, spunk@, doots@, slides@ };

		[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(SongGraph))]
		public SongGraph(int fury, int tears, int spunk, int doots, int slides)
		{
			fury@ = fury;
			tears@ = tears;
			spunk@ = spunk;
			doots@ = doots;
			slides@ = slides;
		}

		[CompilerGenerated]
		public override string ToString()
		{
			return ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<SongGraph, string>>((PrintfFormat<FSharpFunc<SongGraph, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<SongGraph, string>, Unit, string, string, SongGraph>("%+A")).Invoke(this);
		}

		[CompilerGenerated]
		public sealed int CompareTo(SongGraph obj)
		{
			if (this != null)
			{
				if (obj != null)
				{
					IComparer genericComparer = LanguagePrimitives.GenericComparer;
					int num = fury@;
					int num2 = obj.fury@;
					int num3 = ((num > num2) ? 1 : 0) - ((num < num2) ? 1 : 0);
					if (num3 < 0)
					{
						return num3;
					}
					if (num3 > 0)
					{
						return num3;
					}
					return $TrackRegistry.CompareTo$cont@107(this, obj, null);
				}
				return 1;
			}
			if (obj != null)
			{
				return -1;
			}
			return 0;
		}

		[CompilerGenerated]
		public sealed int CompareTo(object obj)
		{
			return CompareTo((SongGraph)obj);
		}

		[CompilerGenerated]
		public sealed int CompareTo(object obj, IComparer comp)
		{
			SongGraph songGraph = (SongGraph)obj;
			if (this != null)
			{
				if ((SongGraph)obj != null)
				{
					int num = fury@;
					int num2 = songGraph.fury@;
					int num3 = ((num > num2) ? 1 : 0) - ((num < num2) ? 1 : 0);
					if (num3 < 0)
					{
						return num3;
					}
					if (num3 > 0)
					{
						return num3;
					}
					return $TrackRegistry.CompareTo$cont@107-1(this, songGraph, null);
				}
				return 1;
			}
			if ((SongGraph)obj != null)
			{
				return -1;
			}
			return 0;
		}

		[CompilerGenerated]
		public sealed int GetHashCode(IEqualityComparer comp)
		{
			if (this != null)
			{
				int num = 0;
				num = -1640531527 + (slides@ + ((num << 6) + (num >> 2)));
				num = -1640531527 + (doots@ + ((num << 6) + (num >> 2)));
				num = -1640531527 + (spunk@ + ((num << 6) + (num >> 2)));
				num = -1640531527 + (tears@ + ((num << 6) + (num >> 2)));
				return -1640531527 + (fury@ + ((num << 6) + (num >> 2)));
			}
			return 0;
		}

		[CompilerGenerated]
		public sealed override int GetHashCode()
		{
			return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
		}

		[CompilerGenerated]
		public sealed bool Equals(object obj, IEqualityComparer comp)
		{
			if (this != null)
			{
				if (obj is SongGraph songGraph)
				{
					if (fury@ == songGraph.fury@)
					{
						if (tears@ == songGraph.tears@)
						{
							if (spunk@ == songGraph.spunk@)
							{
								if (doots@ == songGraph.doots@)
								{
									return slides@ == songGraph.slides@;
								}
								return false;
							}
							return false;
						}
						return false;
					}
					return false;
				}
				return false;
			}
			return obj == null;
		}

		public static SongGraph all(int value)
		{
			return new SongGraph(value, value, value, value, value);
		}

		[CompilerGenerated]
		public sealed bool Equals(SongGraph obj)
		{
			if (this != null)
			{
				if (obj != null)
				{
					if (fury@ == obj.fury@)
					{
						if (tears@ == obj.tears@)
						{
							if (spunk@ == obj.spunk@)
							{
								if (doots@ == obj.doots@)
								{
									return slides@ == obj.slides@;
								}
								return false;
							}
							return false;
						}
						return false;
					}
					return false;
				}
				return false;
			}
			return obj == null;
		}

		[CompilerGenerated]
		public sealed override bool Equals(object obj)
		{
			if (obj is SongGraph obj2)
			{
				return Equals(obj2);
			}
			return false;
		}
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public interface Graphable
	{
		virtual FSharpOption<SongGraph> CreateGraph();
	}
}
namespace BaboonAPI.Hooks.Saves
{
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public interface ICustomSaveData<a>
	{
		virtual a Save();

		virtual void Load(a data);

		virtual a Convert(JObject o);
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public interface SaverCapability
	{
		[CompilationArgumentCounts(new int[] { 1, 1 })]
		virtual void Attach<a>(string name, ICustomSaveData<a> target);
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	internal class PluginSaverLoader
	{
		internal string pluginGuid;

		internal FSharpFunc<SaverCapability, Unit> attacher;

		public PluginSaverLoader(string pluginGuid, FSharpFunc<SaverCapability, Unit> attacher)
		{
			this.pluginGuid = pluginGuid;
			this.attacher = attacher;
		}

		internal FSharpMap<string, object> Save(FSharpMap<string, object> pluginData)
		{
			FSharpRef<FSharpMap<string, object>> val = new FSharpRef<FSharpMap<string, object>>(pluginData);
			attacher.Invoke((SaverCapability)new $CustomSaveData.Save@49(this, val));
			return val.contents;
		}

		internal void Load(FSharpMap<string, JObject> pluginData)
		{
			attacher.Invoke((SaverCapability)new $CustomSaveData.Load@56(this, pluginData));
		}
	}
}
namespace BaboonAPI.Hooks.Initializer
{
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public sealed class LoadError : IEquatable<LoadError>, IStructuralEquatable
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal PluginInfo PluginInfo@;

		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal string Message@;

		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		public PluginInfo PluginInfo
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				return PluginInfo@;
			}
		}

		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		public string Message
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				return Message@;
			}
		}

		[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(LoadError))]
		public LoadError(PluginInfo pluginInfo, string message)
		{
			PluginInfo@ = pluginInfo;
			Message@ = message;
		}

		[CompilerGenerated]
		public override string ToString()
		{
			return ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<LoadError, string>>((PrintfFormat<FSharpFunc<LoadError, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<LoadError, string>, Unit, string, string, LoadError>("%+A")).Invoke(this);
		}

		[CompilerGenerated]
		public sealed int GetHashCode(IEqualityComparer comp)
		{
			if (this != null)
			{
				int num = 0;
				num = -1640531527 + ((Message@?.GetHashCode() ?? 0) + ((num << 6) + (num >> 2)));
				return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<PluginInfo>(comp, PluginInfo@) + ((num << 6) + (num >> 2)));
			}
			return 0;
		}

		[CompilerGenerated]
		public sealed override int GetHashCode()
		{
			return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
		}

		[CompilerGenerated]
		public sealed bool Equals(object obj, IEqualityComparer comp)
		{
			if (this != null)
			{
				if (obj is LoadError loadError)
				{
					if (HashCompare.GenericEqualityWithComparerIntrinsic<PluginInfo>(comp, PluginInfo@, loadError.PluginInfo@))
					{
						return string.Equals(Message@, loadError.Message@);
					}
					return false;
				}
				return false;
			}
			return obj == null;
		}

		[CompilerGenerated]
		public sealed bool Equals(LoadError obj)
		{
			if (this != null)
			{
				if (obj != null)
				{
					if (HashCompare.GenericEqualityERIntrinsic<PluginInfo>(PluginInfo@, obj.PluginInfo@))
					{
						return string.Equals(Message@, obj.Message@);
					}
					return false;
				}
				return false;
			}
			return obj == null;
		}

		[CompilerGenerated]
		public sealed override bool Equals(object obj)
		{
			if (obj is LoadError obj2)
			{
				return Equals(obj2);
			}
			return false;
		}
	}
}
namespace BaboonAPI.Hooks.Entrypoints
{
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class BaboonEntryPointAttribute : Attribute
	{
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public sealed class EntryPointContainer<t> : IEquatable<EntryPointContainer<t>>, IStructuralEquatable
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal PluginInfo Source@;

		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal t Instance@;

		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		public PluginInfo Source
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				return Source@;
			}
		}

		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		public t Instance
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				return Instance@;
			}
		}

		[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(EntryPointContainer<>))]
		public EntryPointContainer(PluginInfo source, t instance)
		{
			Source@ = source;
			Instance@ = instance;
		}

		[CompilerGenerated]
		public override string ToString()
		{
			return ((FSharpFunc<EntryPointContainer<EntryPointContainer<t>>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<EntryPointContainer<t>, string>>((PrintfFormat<FSharpFunc<EntryPointContainer<t>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<EntryPointContainer<FSharpFunc<EntryPointContainer<t>, string>>, string>, Unit, string, string, EntryPointContainer<FSharpFunc<EntryPointContainer<t>, string>>>("%+A"))).Invoke((EntryPointContainer<EntryPointContainer<t>>)(object)this);
		}

		[CompilerGenerated]
		public sealed int GetHashCode(IEqualityComparer comp)
		{
			if (this != null)
			{
				int num = 0;
				t instance@ = Instance@;
				num = -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<t>(comp, instance@) + ((num << 6) + (num >> 2)));
				return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<PluginInfo>(comp, Source@) + ((num << 6) + (num >> 2)));
			}
			return 0;
		}

		[CompilerGenerated]
		public sealed override int GetHashCode()
		{
			return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
		}

		[CompilerGenerated]
		public sealed bool Equals(object obj, IEqualityComparer comp)
		{
			if (this != null)
			{
				if (obj is EntryPointContainer<t> entryPointContainer)
				{
					if (HashCompare.GenericEqualityWithComparerIntrinsic<PluginInfo>(comp, Source@, entryPointContainer.Source@))
					{
						t instance@ = Instance@;
						t instance@2 = entryPointContainer.Instance@;
						return HashCompare.GenericEqualityWithComparerIntrinsic<t>(comp, instance@, instance@2);
					}
					return false;
				}
				return false;
			}
			return obj == null;
		}

		[CompilerGenerated]
		public sealed bool Equals(EntryPointContainer<t> obj)
		{
			if (this != null)
			{
				if (obj != null)
				{
					if (HashCompare.GenericEqualityERIntrinsic<PluginInfo>(Source@, obj.Source@))
					{
						t instance@ = Instance@;
						t instance@2 = obj.Instance@;
						return HashCompare.GenericEqualityERIntrinsic<t>(instance@, instance@2);
					}
					return false;
				}
				return false;
			}
			return obj == null;
		}

		[CompilerGenerated]
		public sealed override bool Equals(object obj)
		{
			if (obj is EntryPointContainer<t> obj2)
			{
				return Equals(obj2);
			}
			return false;
		}
	}
}
namespace BaboonAPI.Internal.BaseGame
{
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class BaseGameLoadedTrack : PauseAware, LoadedTromboneTrack
	{
		internal string trackref@13;

		internal AssetBundle bundle;

		internal BaseGameLoadedTrack(string trackref, AssetBundle bundle)
		{
			trackref@13 = trackref;
			this.bundle = bundle;
		}

		virtual TrackAudio LoadedTromboneTrack.LoadAudio()
		{
			GameObject val = bundle.LoadAsset<GameObject>(PrintfModule.PrintFormatToStringThen<string>((PrintfFormat<string, Unit, string, string>)(object)new PrintfFormat<string, Unit, string, string, string>("music_%P()", new object[1] { trackref@13 }, (Type[])null)));
			AudioSource component = val.GetComponent<AudioSource>();
			return new TrackAudio(component.clip, component.volume);
		}

		virtual GameObject LoadedTromboneTrack.LoadBackground(BackgroundContext _ctx)
		{
			return bundle.LoadAsset<GameObject>(PrintfModule.PrintFormatToStringThen<string>((PrintfFormat<string, Unit, string, string>)(object)new PrintfFormat<string, Unit, string, string, string>("BGCam_%P()", new object[1] { trackref@13 }, (Type[])null)));
		}

		virtual void IDisposable.Dispose()
		{
			bundle.Unload(true);
		}

		[CompilationArgumentCounts(new int[] { 1, 1 })]
		virtual void LoadedTromboneTrack.SetUpBackgroundDelayed(BGController _arg2, GameObject _arg1)
		{
		}

		[SpecialName]
		virtual string LoadedTromboneTrack.get_trackref()
		{
			return trackref@13;
		}

		[SpecialName]
		virtual bool PauseAware.get_CanResume()
		{
			return true;
		}

		virtual void PauseAware.OnPause(PauseContext _arg3)
		{
		}

		virtual void PauseAware.OnResume(PauseContext _arg4)
		{
		}
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class BaseGameTrack : Graphable, Previewable, Sortable, TromboneTrack
	{
		internal string trackref@39;

		internal SavedLevelMetadata data;

		internal string trackPath;

		internal BaseGameTrack(SavedLevelMetadata data, string trackref)
		{
			this.data = data;
			trackref@39 = trackref;
			trackPath = PrintfModule.PrintFormatToStringThen<string>((PrintfFormat<string, Unit, string, string>)(object)new PrintfFormat<string, Unit, string, string, Tuple<string, string>>("%P()/trackassets/%P()", new object[2]
			{
				Application.streamingAssetsPath,
				trackref@39
			}, (Type[])null));
		}

		[SpecialName]
		virtual string TromboneTrack.get_trackname_long()
		{
			return data.trackname_long;
		}

		[SpecialName]
		virtual string TromboneTrack.get_trackname_short()
		{
			return data.trackname_short;
		}

		[SpecialName]
		virtual string TromboneTrack.get_trackref()
		{
			return trackref@39;
		}

		[SpecialName]
		virtual string TromboneTrack.get_year()
		{
			return data.year;
		}

		[SpecialName]
		virtual string TromboneTrack.get_artist()
		{
			return data.artist;
		}

		[SpecialName]
		virtual string TromboneTrack.get_genre()
		{
			return data.genre;
		}

		[SpecialName]
		virtual string TromboneTrack.get_desc()
		{
			return data.description;
		}

		[SpecialName]
		virtual int TromboneTrack.get_difficulty()
		{
			return data.difficulty;
		}

		[SpecialName]
		virtual int TromboneTrack.get_length()
		{
			return data.length;
		}

		[SpecialName]
		virtual int TromboneTrack.get_tempo()
		{
			return data.tempo;
		}

		virtual LoadedTromboneTrack TromboneTrack.LoadTrack()
		{
			AssetBundle bundle = AssetBundle.LoadFromFile(PrintfModule.PrintFormatToStringThen<string>((PrintfFormat<string, Unit, string, string>)(object)new PrintfFormat<string, Unit, string, string, string>("%P()/contentbundle", new object[1] { trackPath }, (Type[])null)));
			return new BaseGameLoadedTrack(trackref@39, bundle);
		}

		virtual bool TromboneTrack.IsVisible()
		{
			string a = trackref@39;
			if (string.Equals(a, "einefinal"))
			{
				return GlobalVariables.localsave.progression_trombone_champ;
			}
			return true;
		}

		virtual SavedLevel TromboneTrack.LoadChart()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			string path = PrintfModule.PrintFormatToStringThen<string>((PrintfFormat<string, Unit, string, string>)(object)new PrintfFormat<string, Unit, string, string, string>("%P()/trackdata.tmb", new object[1] { trackPath }, (Type[])null));
			using FileStream serializationStream = File.Open(path, FileMode.Open);
			return (SavedLevel)new BinaryFormatter().Deserialize(serializationStream);
		}

		[SpecialName]
		virtual int Sortable.get_sortOrder()
		{
			return data.sort_order;
		}

		virtual BaboonAPI.Utility.Coroutines.YieldTask<FSharpResult<TrackAudio, string>> Previewable.LoadClip()
		{
			string path = PrintfModule.PrintFormatToStringThen<string>((PrintfFormat<string, Unit, string, string>)(object)new PrintfFormat<string, Unit, string, string, string>("%P()/sample.ogg", new object[1] { trackPath }, (Type[])null));
			BaboonAPI.Utility.Coroutines.YieldTask<FSharpResult<AudioClip, string>> task = BaboonAPI.Utility.Unity.loadAudioClip(path, (AudioType)14);
			FSharpFunc<AudioClip, TrackAudio> @_instance;
			@_instance = $BaseGame.BaboonAPI-Hooks-Tracks-Previewable-LoadClip@76-1.@_instance;
			return BaboonAPI.Utility.Coroutines.map<FSharpResult<AudioClip, string>, FSharpResult<TrackAudio, string>>($BaseGame.func1@1(@_instance), task);
		}

		virtual FSharpOption<SongGraph> Graphable.CreateGraph()
		{
			string a = trackref@39;
			if (!string.Equals(a, "warmup"))
			{
				if (string.Equals(a, "einefinal"))
				{
					return FSharpOption<SongGraph>.Some(new SongGraph(104, 104, 104, 104, 104));
				}
				return null;
			}
			return FSharpOption<SongGraph>.Some(new SongGraph(10, 10, 10, 10, 10));
		}
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	internal class BaseGameTrackRegistry : TrackRegistrationEvent.Listener
	{
		internal string path;

		public BaseGameTrackRegistry(string path)
		{
			this.path = path;
		}

		virtual IEnumerable<TromboneTrack> TrackRegistrationEvent.Listener.OnRegisterTracks()
		{
			return (IEnumerable<TromboneTrack>)(object)new $BaseGame.BaboonAPI-Hooks-Tracks-TrackRegistrationEvent-Listener-OnRegisterTracks@88(this, null, null, null, null, 0, null);
		}
	}
}
namespace BaboonAPI.Patch
{
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	internal class TrackCountAccessor
	{
		internal static int trackCount()
		{
			return BaboonAPI.Internal.TrackAccessor.trackLoader.tracks.Count;
		}

		internal static string trackrefByIndex(int i)
		{
			return BaboonAPI.Internal.TrackAccessor.trackLoader.tracksByIndex[i].track@.trackref;
		}
	}
	[Serializable]
	[HarmonyPatch]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class TrackCountPatches
	{
		internal static FieldInfo tracktitles_f;

		internal static int init@13;

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(SaveSlotController), "checkScores")]
		[HarmonyPatch(typeof(SaverLoader), "genBlankScores")]
		public static IEnumerable<CodeInstruction> PatchLength(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: 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)
			//IL_0022: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
			{
				new CodeMatch((Func<CodeInstruction, bool>)$TrackCountPatches.PatchLength@26.Invoke, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldlen, (object)null, (string)null)
			}).ThrowIfInvalid("Could not find data_tracktitles length lookup").Repeat((Action<CodeMatcher>)$TrackCountPatches.PatchLength@30-1.Invoke, (Action<string>)null)
				.InstructionEnumeration();
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(SaveSlotController), "checkScores")]
		[HarmonyPatch(typeof(SaverLoader), "genBlankScores")]
		public static IEnumerable<CodeInstruction> PatchAccess(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: 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)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[5]
			{
				new CodeMatch((Func<CodeInstruction, bool>)$TrackCountPatches.matcher@42.Invoke, (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)$TrackCountPatches.matcher@43-1.Invoke, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldelem_Ref, (object)null, (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)$TrackCountPatches.matcher@45-2.Invoke, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldelem_Ref, (object)null, (string)null)
			}).ThrowIfInvalid("Could not find data_tracktitles lookup");
			return val.Repeat((Action<CodeMatcher>)$TrackCountPatches.PatchAccess@49.Invoke, (Action<string>)null).InstructionEnumeration();
		}

		static TrackCountPatches()
		{
			$TrackCountPatches.init@ = 0;
			_ = $TrackCountPatches.init@;
		}
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	internal sealed class LevelSelectContext : IEquatable<LevelSelectContext>, IStructuralEquatable
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal LevelSelectController controller@;

		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal List<SingleTrackData> allTracksList@;

		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		internal LevelSelectController controller
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				return controller@;
			}
		}

		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		internal List<SingleTrackData> allTracksList
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				return allTracksList@;
			}
		}

		[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(LevelSelectContext))]
		internal LevelSelectContext(LevelSelectController controller, List<SingleTrackData> allTracksList)
		{
			controller@ = controller;
			allTracksList@ = allTracksList;
		}

		[CompilerGenerated]
		public override string ToString()
		{
			return ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<LevelSelectContext, string>>((PrintfFormat<FSharpFunc<LevelSelectContext, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<LevelSelectContext, string>, Unit, string, string, LevelSelectContext>("%+A")).Invoke(this);
		}

		[CompilerGenerated]
		public sealed int GetHashCode(IEqualityComparer comp)
		{
			if (this != null)
			{
				int num = 0;
				num = -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<List<SingleTrackData>>(comp, allTracksList@) + ((num << 6) + (num >> 2)));
				return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<LevelSelectController>(comp, controller@) + ((num << 6) + (num >> 2)));
			}
			return 0;
		}

		[CompilerGenerated]
		public sealed override int GetHashCode()
		{
			return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
		}

		[CompilerGenerated]
		public sealed bool Equals(object obj, IEqualityComparer comp)
		{
			if (this != null)
			{
				if (obj is LevelSelectContext levelSelectContext)
				{
					if (HashCompare.GenericEqualityWithComparerIntrinsic<LevelSelectController>(comp, controller@, levelSelectContext.controller@))
					{
						return HashCompare.GenericEqualityWithComparerIntrinsic<List<SingleTrackData>>(comp, allTracksList@, levelSelectContext.allTracksList@);
					}
					return false;
				}
				return false;
			}
			return obj == null;
		}

		[CompilerGenerated]
		public sealed bool Equals(LevelSelectContext obj)
		{
			if (this != null)
			{
				if (obj != null)
				{
					if (HashCompare.GenericEqualityERIntrinsic<LevelSelectController>(controller@, obj.controller@))
					{
						return HashCompare.GenericEqualityERIntrinsic<List<SingleTrackData>>(allTracksList@, obj.allTracksList@);
					}
					return false;
				}
				return false;
			}
			return obj == null;
		}

		[CompilerGenerated]
		public sealed override bool Equals(object obj)
		{
			if (obj is LevelSelectContext obj2)
			{
				return Equals(obj2);
			}
			return false;
		}
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	internal class LevelSelectReloadBehaviour : MonoBehaviour, TracksLoadedEvent.Listener
	{
		internal static FieldInfo songindex_f;

		internal static MethodInfo populate_names_m;

		internal FSharpOption<LevelSelectContext> context;

		internal static int init@15;

		public LevelSelectReloadBehaviour()
		{
			context = null;
		}

		internal void Init(LevelSelectController controller, List<SingleTrackData> alltrackslist)
		{
			context = FSharpOption<LevelSelectContext>.Some(new LevelSelectContext(controller, alltrackslist));
		}

		internal void Start()
		{
			TracksLoadedEvent.EVENT.Register(this);
		}

		internal void OnDestroy()
		{
			TracksLoadedEvent.EVENT.Unregister(this);
		}

		virtual void TracksLoadedEvent.Listener.OnTracksLoaded(FSharpList<TromboneTrack> _arg1)
		{
			FSharpOption<LevelSelectContext> val = context;
			if (val != null)
			{
				FSharpOption<LevelSelectContext> val2 = val;
				LevelSelectContext value = val2.Value;
				value.allTracksList@.Clear();
				value.allTracksList@.AddRange(SeqModule.Map<BaboonAPI.Internal.TrackAccessor.RegisteredTrack, SingleTrackData>((FSharpFunc<BaboonAPI.Internal.TrackAccessor.RegisteredTrack, SingleTrackData>)$TrackrefPatches.BaboonAPI-Hooks-Tracks-TracksLoadedEvent-Listener-OnTracksLoaded@43.@_instance, SeqModule.Filter<BaboonAPI.Internal.TrackAccessor.RegisteredTrack>((FSharpFunc<BaboonAPI.Internal.TrackAccessor.RegisteredTrack, bool>)$TrackrefPatches.BaboonAPI-Hooks-Tracks-TracksLoadedEvent-Listener-OnTracksLoaded@42-1.@_instance, SeqModule.OfArray<BaboonAPI.Internal.TrackAccessor.RegisteredTrack>(BaboonAPI.Internal.TrackAccessor.trackLoader.tracksByIndex))));
				if (init@15 < 1)
				{
					IntrinsicFunctions.FailStaticInit();
				}
				songindex_f.SetValue(value.controller@, 0);
				if (init@15 < 2)
				{
					IntrinsicFunctions.FailStaticInit();
				}
				object obj = populate_names_m.Invoke(value.controller@, new object[1] { false });
			}
		}

		static LevelSelectReloadBehaviour()
		{
			$TrackrefPatches.init@ = 0;
			_ = $TrackrefPatches.init@;
		}
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	internal class TrackrefAccessor
	{
		internal static int init@51-1;

		internal static int finalLevelIndex()
		{
			return BaboonAPI.Internal.TrackAccessor.trackLoader.tracks["einefinal"].trackIndex@;
		}

		internal static string trackrefForIndex(int i)
		{
			return BaboonAPI.Internal.TrackAccessor.trackLoader.tracksByIndex[i].track@.trackref;
		}

		internal static string trackTitleForIndex(int i)
		{
			return BaboonAPI.Internal.TrackAccessor.trackLoader.tracksByIndex[i].track@.trackname_long;
		}

		internal static int trackDifficultyForIndex(int i)
		{
			return BaboonAPI.Internal.TrackAccessor.trackLoader.tracksByIndex[i].track@.difficulty;
		}

		internal static int trackLengthForIndex(int i)
		{
			return BaboonAPI.Internal.TrackAccessor.trackLoader.tracksByIndex[i].track@.length;
		}

		internal static int trackCount()
		{
			return BaboonAPI.Internal.TrackAccessor.trackLoader.tracks.Count;
		}

		internal static SingleTrackData fetchChosenTrack(string trackref)
		{
			BaboonAPI.Internal.TrackAccessor.RegisteredTrack registeredTrack = BaboonAPI.Internal.TrackAccessor.trackLoader.tracks[trackref];
			return BaboonAPI.Internal.TrackAccessor.makeTrackData(registeredTrack.track@, registeredTrack.trackIndex@);
		}

		internal static void doLevelSelectStart(LevelSelectController instance, List<SingleTrackData> alltrackslist)
		{
			((Component)instance).gameObject.AddComponent<LevelSelectReloadBehaviour>().context = FSharpOption<LevelSelectContext>.Some(new LevelSelectContext(instance, alltrackslist));
			alltrackslist.AddRange(SeqModule.Map<BaboonAPI.Internal.TrackAccessor.RegisteredTrack, SingleTrackData>((FSharpFunc<BaboonAPI.Internal.TrackAccessor.RegisteredTrack, SingleTrackData>)$TrackrefPatches.doLevelSelectStart@86.@_instance, SeqModule.Filter<BaboonAPI.Internal.TrackAccessor.RegisteredTrack>((FSharpFunc<BaboonAPI.Internal.TrackAccessor.RegisteredTrack, bool>)$TrackrefPatches.doLevelSelectStart@85-1.@_instance, SeqModule.OfArray<BaboonAPI.Internal.TrackAccessor.RegisteredTrack>(BaboonAPI.Internal.TrackAccessor.trackLoader.tracksByIndex))));
		}

		internal static int[][] populateSongGraphs()
		{
			return ArrayModule.OfSeq<int[]>(SeqModule.Map<BaboonAPI.Internal.TrackAccessor.RegisteredTrack, int[]>((FSharpFunc<BaboonAPI.Internal.TrackAccessor.RegisteredTrack, int[]>)$TrackrefPatches.populateSongGraphs@91.@_instance, SeqModule.OfArray<BaboonAPI.Internal.TrackAccessor.RegisteredTrack>(BaboonAPI.Internal.TrackAccessor.trackLoader.tracksByIndex)));
		}

		[CompilerGenerated]
		internal static int[] makeSongGraph(BaboonAPI.Internal.TrackAccessor.RegisteredTrack rt)
		{
			FSharpTypeFunc val = (FSharpTypeFunc)(object)new $TrackrefPatches.generate@55(rt);
			TromboneTrack track@ = rt.track@;
			object obj;
			if (track@ is Graphable graphable)
			{
				Graphable graphable2 = graphable;
				obj = graphable2.CreateGraph();
			}
			else
			{
				obj = null;
			}
			FSharpOption<SongGraph> val2 = (FSharpOption<SongGraph>)obj;
			if (val2 != null)
			{
				FSharpOption<SongGraph> val3 = val2;
				return val3.Value.asArray;
			}
			FSharpFunc<int, int> val4 = (FSharpFunc<int, int>)val.Specialize<int>();
			int[] array = new int[5];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = Mathf.Clamp(rt.track@.difficulty * 10 + Random.Range(-25, 5), 10, 104);
			}
			return array;
		}

		static TrackrefAccessor()
		{
			$TrackrefPatches.init@ = 0;
			_ = $TrackrefPatches.init@;
		}
	}
	[Serializable]
	[HarmonyPatch(typeof(SaverLoader), "loadTrackData")]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class TrackLoaderPatch
	{
		public static bool Prefix(string trackref)
		{
			GlobalVariables.chosen_track = trackref;
			GlobalVariables.chosen_track_data = TrackrefAccessor.fetchChosenTrack(trackref);
			return false;
		}
	}
	[Serializable]
	[HarmonyPatch]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class TrackTitlePatches
	{
		internal static FieldInfo tracktitles_f;

		internal static int init@103-2;

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(LevelSelectController), "Start")]
		public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: 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)
			//IL_0022: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: 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_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[4]
			{
				new CodeMatch((Func<CodeInstruction, bool>)$TrackrefPatches.matcher@112-3.Invoke, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldlen, (object)null, (string)null),
				new CodeMatch((OpCode?)null, (object)null, (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)$TrackrefPatches.matcher@115-4.Invoke, (string)null)
			}).ThrowIfInvalid("Could not find end of injection point in LevelSelectController#Start");
			int pos = val.Pos;
			Label? label = null;
			if (!CodeInstructionExtensions.Branches(val.Instruction, ref label))
			{
				throw new InvalidOperationException("Could not find branching instruction of for loop in LevelSelectController#Start");
			}
			Label value = label.Value;
			int num = val.SearchBack((Func<CodeInstruction, bool>)new $TrackrefPatches.startPos@127(value).Invoke).ThrowIfInvalid("Could not find start of injection point in LevelSelectController#Start").Pos - 3;
			return val.RemoveInstructionsInRange(num, pos).Start().Advance(num)
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[7]
				{
					new CodeInstruction(OpCodes.Ldarg_0, (object)null),
					new CodeInstruction(OpCodes.Ldarg_0, (object)null),
					CodeInstruction.LoadField(typeof(LevelSelectController), "alltrackslist", false),
					CodeInstruction.Call(typeof(TrackrefAccessor), "doLevelSelectStart", new Type[2]
					{
						typeof(LevelSelectController),
						typeof(List<SingleTrackData>)
					}, (Type[])null),
					new CodeInstruction(OpCodes.Ldarg_0, (object)null),
					CodeInstruction.Call(typeof(TrackrefAccessor), "populateSongGraphs", (Type[])null, (Type[])null),
					CodeInstruction.StoreField(typeof(LevelSelectController), "songgraphs")
				})
				.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
				{
					new CodeMatch((Func<CodeInstruction, bool>)$TrackrefPatches.Transpiler@148.Invoke, (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldlen, (object)null, (string)null)
				})
				.ThrowIfInvalid("Could not find data_tracktitles length lookup in LevelSelectController#Start")
				.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Ldc_I4_0, (object)null))
				.RemoveInstruction()
				.InstructionEnumeration();
		}

		static TrackTitlePatches()
		{
			$TrackrefPatches.init@ = 0;
			_ = $TrackrefPatches.init@;
		}
	}
	[Serializable]
	[HarmonyPatch(typeof(SaverLoader), "loadAllTrackMetadata")]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class LoaderPatch
	{
		public static bool Prefix()
		{
			string path = PrintfModule.PrintFormatToStringThen<string>((PrintfFormat<string, Unit, string, string>)(object)new PrintfFormat<string, Unit, string, string, string>("%P()/trackassets", new object[1] { Application.streamingAssetsPath }, (Type[])null));
			TrackRegistrationEvent.EVENT.Register(new BaseGameTrackRegistry(path));
			return false;
		}
	}
	[Serializable]
	[HarmonyPatch(typeof(LanguageChanger), "loadMetadata")]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class LanguageChangerPatch
	{
		public static bool Prefix()
		{
			BaboonAPI.Internal.TrackAccessor.trackLoader.onTracksLoaded(BaboonAPI.Internal.TrackAccessor.trackLoader.makeTrackLoader());
			return false;
		}
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	internal class FreePlayLoader : LoadedTromboneTrack
	{
		internal AssetBundle bundle;

		public FreePlayLoader()
		{
			bundle = AssetBundle.LoadFromFile(PrintfModule.PrintFormatToStringThen<string>((PrintfFormat<string, Unit, string, string>)(object)new PrintfFormat<string, Unit, string, string, string>("%P()/trackassets/freeplay/contentbundle", new object[1] { Application.streamingAssetsPath }, (Type[])null)));
		}

		[SpecialName]
		virtual string LoadedTromboneTrack.get_trackref()
		{
			return "freeplay";
		}

		virtual TrackAudio LoadedTromboneTrack.LoadAudio()
		{
			return new TrackAudio(null, 1f);
		}

		virtual GameObject LoadedTromboneTrack.LoadBackground(BackgroundContext _ctx)
		{
			return bundle.LoadAsset<GameObject>("BGCam_freeplay");
		}

		[CompilationArgumentCounts(new int[] { 1, 1 })]
		virtual void LoadedTromboneTrack.SetUpBackgroundDelayed(BGController _arg2, GameObject _arg1)
		{
		}

		virtual void IDisposable.Dispose()
		{
			bundle.Unload(true);
		}
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	internal class GameControllerExtension
	{
		internal static FSharpOption<LoadedTromboneTrack> loadedTrack;

		internal static ManualLogSource logger;

		internal static int init@27;

		internal static string fetchTrackTitle(int i)
		{
			return BaboonAPI.Internal.TrackAccessor.trackLoader.tracksByIndex[i].track@.trackname_long;
		}

		internal static float Infix(GameController instance)
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			object obj;
			if (instance.freeplay)
			{
				obj = new FreePlayLoader();
			}
			else
			{
				string chosen_track = GlobalVariables.chosen_track;
				obj = BaboonAPI.Internal.TrackAccessor.trackLoader.tracks[chosen_track].track@.LoadTrack();
			}
			LoadedTromboneTrack loadedTromboneTrack = (LoadedTromboneTrack)obj;
			if (!instance.freeplay)
			{
				TrackAudio trackAudio = loadedTromboneTrack.LoadAudio();
				instance.musictrack.clip = trackAudio.Clip@;
				instance.musictrack.volume = trackAudio.Volume@ * GlobalVariables.localsettings.maxvolume_music;
				if (GlobalVariables.turbomode)
				{
					instance.musictrack.pitch = 2f;
				}
			}
			BackgroundContext ctx = new BackgroundContext(instance);
			GameObject val = Object.Instantiate<GameObject>(loadedTromboneTrack.LoadBackground(ctx), Vector3.zero, Quaternion.identity, instance.bgholder.transform);
			val.transform.localPosition = Vector3.zero;
			instance.bgcontroller.fullbgobject = val;
			instance.bgcontroller.songname = loadedTromboneTrack.trackref;
			loadedTromboneTrack.SetUpBackgroundDelayed(instance.bgcontroller, val);
			Coroutine val2 = ((MonoBehaviour)instance).StartCoroutine("loadAssetBundleResources");
			int track_is_pausable;
			if (loadedTromboneTrack is PauseAware pauseAware)
			{
				PauseAware pauseAware2 = pauseAware;
				track_is_pausable = (pauseAware2.CanResume ? 1 : 0);
			}
			else
			{
				track_is_pausable = 0;
			}
			instance.track_is_pausable = (byte)track_is_pausable != 0;
			if (init@27 < 1)
			{
				IntrinsicFunctions.FailStaticInit();
			}
			FSharpOption<LoadedTromboneTrack> val3 = loadedTrack;
			if (val3 != null)
			{
				FSharpOption<LoadedTromboneTrack> val4 = val3;
				LoadedTromboneTrack value = val4.Value;
				if (init@27 < 2)
				{
					IntrinsicFunctions.FailStaticInit();
				}
				logger.LogWarning((object)PrintfModule.PrintFormatToStringThen<string>((PrintfFormat<string, Unit, string, string>)(object)new PrintfFormat<string, Unit, string, string, string>("Loaded track %P() wasn't cleaned up properly", new object[1] { value.trackref }, (Type[])null)));
				value.Dispose();
			}
			if (init@27 < 1)
			{
				IntrinsicFunctions.FailStaticInit();
			}
			loadedTrack = FSharpOption<LoadedTromboneTrack>.Some(loadedTromboneTrack);
			if (GlobalVariables.turbomode)
			{
				return 2f;
			}
			return GlobalVariables.practicemode;
		}

		internal static SavedLevel LoadChart(string trackref)
		{
			return BaboonAPI.Internal.TrackAccessor.trackLoader.tracks[trackref].track@.LoadChart();
		}

		internal static void PauseTrack(PauseCanvasController controller)
		{
			if (init@27 < 1)
			{
				IntrinsicFunctions.FailStaticInit();
			}
			FSharpOption<LoadedTromboneTrack> val = loadedTrack;
			if (val != null)
			{
				FSharpOption<LoadedTromboneTrack> val2 = val;
				if (val2.Value is PauseAware pauseAware)
				{
					PauseAware pauseAware2 = pauseAware;
					pauseAware2.OnPause(new PauseContext(controller));
				}
			}
		}

		internal static void ResumeTrack(PauseCanvasController controller)
		{
			if (init@27 < 1)
			{
				IntrinsicFunctions.FailStaticInit();
			}
			FSharpOption<LoadedTromboneTrack> val = loadedTrack;
			if (val != null)
			{
				FSharpOption<LoadedTromboneTrack> val2 = val;
				if (val2.Value is PauseAware pauseAware)
				{
					PauseAware pauseAware2 = pauseAware;
					pauseAware2.OnResume(new PauseContext(controller));
				}
			}
		}

		internal static void Unload()
		{
			if (init@27 < 1)
			{
				IntrinsicFunctions.FailStaticInit();
			}
			FSharpOption<LoadedTromboneTrack> val = loadedTrack;
			if (val != null)
			{
				FSharpOption<LoadedTromboneTrack> val2 = val;
				LoadedTromboneTrack value = val2.Value;
				value.Dispose();
				if (init@27 < 1)
				{
					IntrinsicFunctions.FailStaticInit();
				}
				loadedTrack = null;
			}
		}

		static GameControllerExtension()
		{
			$GameControllerPatch.init@ = 0;
			_ = $GameControllerPatch.init@;
		}
	}
	[Serializable]
	[HarmonyPatch]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class GameControllerPatch
	{
		internal static FieldInfo freeplay_f;

		internal static int init@107-1;

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(GameController), "Start")]
		public static IEnumerable<CodeInstruction> TranspileStart(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0027: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
			int pos = val.Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[5]
			{
				new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"", (string)null),
				new CodeMatch((OpCode?)OpCodes.Stloc_1, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)$GameControllerPatch.startIndex@123.Invoke, (string)null),
				new CodeMatch((OpCode?)OpCodes.Brtrue, (object)null, (string)null)
			}).ThrowIfInvalid("Could not find start of injection point in GameController#Start")
				.Pos;
			List<Label> labels = val.Labels;
			int num = val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[3]
			{
				new CodeMatch((OpCode?)OpCodes.Ldnull, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Stloc_2, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_I4_6, (object)null, (string)null)
			}).ThrowIfInvalid("Could not find end of injection point in GameController#Start").Pos - 1;
			return val.RemoveInstructionsInRange(pos, num).Start().Advance(pos)
				.Insert((CodeInstruction[])(object)new CodeInstruction[4]
				{
					new CodeInstruction(OpCodes.Ldarg_0, (object)null),
					new CodeInstruction(OpCodes.Ldarg_0, (object)null),
					CodeInstruction.Call(typeof(GameControllerExtension), "Infix", (Type[])null, (Type[])null),
					CodeInstruction.StoreField(typeof(GameController), "smooth_scrolling_move_mult")
				})
				.AddLabels((IEnumerable<Label>)labels)
				.InstructionEnumeration();
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(GameController), "tryToLoadLevel")]
		public static IEnumerable<CodeInstruction> LoadChartTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[2]
			{
				new CodeMatch((OpCode?)OpCodes.Ldnull, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Stloc_2, (object)null, (string)null)
			}).ThrowIfInvalid("Could not find injection point in GameController#tryToLoadLevel");
			int pos = val.Pos;
			return val.RemoveInstructionsInRange(0, pos).Start().Insert((CodeInstruction[])(object)new CodeInstruction[3]
			{
				new CodeInstruction(OpCodes.Ldarg_1, (object)null),
				CodeInstruction.Call(typeof(GameControllerExtension), "LoadChart", new Type[1] { typeof(string) }, (Type[])null),
				new CodeInstruction(OpCodes.Stloc_3, (object)null)
			})
				.InstructionEnumeration();
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(GameController), "unloadBundles")]
		public static bool UnloadPrefix(GameController __instance, ref AssetBundle ___mySoundAssetBundle)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			GameControllerExtension.Unload();
			___mySoundAssetBundle.Unload(true);
			___mySoundAssetBundle = null;
			return false;
		}

		static GameControllerPatch()
		{
			$GameControllerPatch.init@ = 0;
			_ = $GameControllerPatch.init@;
		}
	}
	[Serializable]
	[HarmonyPatch]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class PausePatches
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(PauseCanvasController), "showPausePanel")]
		public static void PausePostfix(PauseCanvasController __instance)
		{
			GameControllerExtension.PauseTrack(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PauseCanvasController), "resumeFromPause")]
		public static void ResumePostfix(PauseCanvasController __instance)
		{
			GameControllerExtension.ResumeTrack(__instance);
		}
	}
	[Serializable]
	[HarmonyPatch(typeof(SaverLoader))]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class SaverLoaderPatch
	{
		internal static ManualLogSource logger;

		internal static int init@61;

		[HarmonyPostfix]
		[HarmonyPatch("loadSavedGame")]
		public static void LoadPostfix()
		{
			try
			{
				CustomSaveController.LoadPluginData(SaverLoader.global_saveindex);
			}
			catch (object obj)
			{
				Exception ex = (Exception)obj;
				if (!(ex is FileNotFoundException))
				{
					if (!(ex is CustomSaveController.IncompatibleVersion))
					{
						throw;
					}
					int data = ((CustomSaveController.IncompatibleVersion)ex).Data0;
					int data2 = ((CustomSaveController.IncompatibleVersion)ex).Data1;
					if (init@61 < 1)
					{
						IntrinsicFunctions.FailStaticInit();
					}
					logger.LogError((object)PrintfModule.PrintFormatToStringThen<string>((PrintfFormat<string, Unit, string, string>)(object)new PrintfFormat<string, Unit, string, string, Tuple<int, int>>("The plugin save data is version %P(), but this BaboonAPI version expects %P().", new object[2] { data2, data }, (Type[])null)));
				}
				else
				{
					if (init@61 < 1)
					{
						IntrinsicFunctions.FailStaticInit();
					}
					logger.LogInfo((object)"No custom save file yet, continuing");
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("updateSavedGame")]
		public static void SavePostfix()
		{
			CustomSaveController.SavePluginData(SaverLoader.global_saveindex);
		}

		[HarmonyPostfix]
		[HarmonyPatch("deleteSavedGame")]
		public static void DeletePostfix(int whichindex)
		{
			File.Delete(CustomSaveController.dataPath(whichindex));
			File.Delete(CustomSaveController.oldDataPath(whichindex));
		}

		static SaverLoaderPatch()
		{
			$SaverLoaderPatch.init@ = 0;
			_ = $SaverLoaderPatch.init@;
		}
	}
	[Serializable]
	[HarmonyPatch(typeof(BrandingController))]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class BrandingPatch
	{
		internal static MethodInfo loadlevel_m;

		internal static int init@90;

		public static void RunInitialize()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			ModInitializer.initResult = FSharpOption<FSharpResult<Unit, LoadError>>.Some(GameInitializationEvent.EVENT.invoker.Initialize());
		}

		[HarmonyPatch("Start")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> PatchStart(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: 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)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((Func<CodeInstruction, bool>)$InitializerPatch.PatchStart@102.Invoke, (string)null)
			}).Set(OpCodes.Call, (object)AccessTools.Method(typeof(BrandingPatch), "RunInitialize", (Type[])null, (Type[])null)).InstructionEnumeration();
		}

		[HarmonyPatch("doHolyWowAnim")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> PatchSequence(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[4]
			{
				new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"killandload", (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)$InitializerPatch.PatchSequence@115.Invoke, (string)null),
				new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null)
			}).RemoveInstructions(4).InstructionEnumeration();
		}

		[HarmonyPatch("epwarning")]
		[HarmonyPostfix]
		public static void WarningPostfix(BrandingController __instance)
		{
			IEnumerator<YieldInstruction> enumerator = ModInitializer.ShowResult(__instance);
			Coroutine val = ((MonoBehaviour)__instance).StartCoroutine((IEnumerator)enumerator);
		}

		[HarmonyPatch("killandload")]
		[HarmonyPrefix]
		public static bool KillPrefix()
		{
			return ModInitializer.IsInitialized();
		}

		static BrandingPatch()
		{
			$InitializerPatch.init@ = 0;
			_ = $InitializerPatch.init@;
		}
	}
	[Serializable]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	internal class TrackScoresAccessor
	{
		internal static int countSRanks()
		{
			return SeqModule.Length<BaboonAPI.Internal.ScoreStorage.Rank>(SeqModule.Filter<BaboonAPI.Internal.ScoreStorage.Rank>((FSharpFunc<BaboonAPI.Internal.ScoreStorage.Rank, bool>)$TrackScorePatch.countSRanks@28.@_instance, SeqModule.Choose<BaboonAPI.Internal.ScoreStorage.TrackScores, BaboonAPI.Internal.ScoreStorage.Rank>((FSharpFunc<BaboonAPI.Internal.ScoreStorage.TrackScores, FSharpOption<BaboonAPI.Internal.ScoreStorage.Rank>>)$TrackScorePatch.countSRanks@27-1.@_instance, BaboonAPI.Internal.ScoreStorage.allTrackScores())));
		}

		internal static List<string> fetchHighScoresFormatted(string trackref)
		{
			FSharpList<string> collection = ListModule.Map<int, string>((FSharpFunc<int, string>)$TrackScorePatch.fetchHighScoresFormatted@33.@_instance, BaboonAPI.Internal.ScoreStorage.getStorageFor(trackref).Load(trackref).highScores@);
			return new List<string>((IEnumerable<string>)collection);
		}

		internal static int fetchHighestScore(string trackref)
		{
			return BaboonAPI.Internal.ScoreStorage.getStorageFor(trackref).Load(trackref).highScores@.Head;
		}
	}
	[Serializable]
	[HarmonyPatch]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class TrackScorePatches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(LevelSelectController), "checkForS")]
		public static bool CheckForS(string tag, out bool __result)
		{
			__result = TrackScoresUtility.checkForS(tag);
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(LevelSelectController), "pullLetterScore")]
		public static bool PullLetterScore(string tag, out string __result)
		{
			__result = BaboonAPI.Internal.ScoreStorage.rankString(BaboonAPI.Internal.ScoreStorage.getStorageFor(tag).Load(tag).highestRank@);
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SaveSlotController), "checkScores")]
		public static bool SkipCheckingScores()
		{
			FSharpOption<BaboonAPI.Internal.ScoreStorage.BaseTrackScoreStorage> baseGameStorage = BaboonAPI.Internal.ScoreStorage.baseGameStorage;
			if (baseGameStorage != null)
			{
				FSharpOption<BaboonAPI.Internal.ScoreStorage.BaseTrackScoreStorage> val = baseGameStorage;
				if (val.Value.migrateScores())
				{
					SaverLoader.updateSavedGame();
				}
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SaverLoader), "grabHighestScore")]
		public static bool GrabHighestScore(string songtag, out int __result)
		{
			__result = BaboonAPI.Internal.ScoreStorage.getStorageFor(songtag).Load(songtag).highScores@.Head;
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SaverLoader), "checkForUpdatedScore")]
		public static bool UpdateScore(string songtag, int newscore, string newletterscore)
		{
			FSharpOption<BaboonAPI.Internal.ScoreStorage.Rank> val = BaboonAPI.Internal.ScoreStorage.Rank.from(newletterscore);
			BaboonAPI.Internal.ScoreStorage.AchievedScore score = new BaboonAPI.Internal.ScoreStorage.AchievedScore(songtag, val.Value, newscore);
			BaboonAPI.Internal.ScoreStorage.getStorageFor(songtag).Save(score);
			return false;
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(LevelSelectController), "populateScores")]
		public static IEnumerable<CodeInstruction> PatchPopulateScores(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
			int pos = val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
			{
				new CodeMatch((Func<CodeInstruction, bool>)$TrackScorePatch.startIndex@97-1.Invoke, (string)null),
				new CodeMatch((OpCode?)OpCodes.Stloc_2, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Br, (object)null, (string)null)
			}).ThrowIfInvalid("Could not find start of for loop in LevelSelectController#populateScores").Pos;
			int pos2 = val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[3]
			{
				new CodeMatch((OpCode?)OpCodes.Ldloc_3, (object)null, (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)$TrackScorePatch.endIndex@105.Invoke, (string)null),
				new CodeMatch((OpCode?)OpCodes.Blt, (object)null, (string)null)
			}).ThrowIfInvalid("Could not find end of 2nd for loop in LevelSelectController#populateScores").Pos;
			CodeMatcher obj = val.RemoveInstructionsInRange(pos, pos2).Start().Advance(pos);
			CodeInstruction[] obj2 = new CodeInstruction[12]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				CodeInstruction.LoadField(typeof(LevelSelectController), "alltrackslist", false),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				CodeInstruction.LoadField(typeof(LevelSelectController), "songindex", false),
				default(CodeInstruction),
				default(CodeInstruction),
				default(CodeInstruction),
				default(CodeInstruction),
				default(CodeInstruction),
				default(CodeInstruction),
				default(CodeInstruction)
			};
			CodeInstruction val2 = CodeInstruction.Call(typeof(List<SingleTrackData>), "get_Item", new Type[1] { typeof(int) }, (Type[])null);
			val2.opcode = OpCodes.Callvirt;
			obj2[5] = val2;
			obj2[6] = CodeInstruction.LoadField(typeof(SingleTrackData), "trackref", false);
			obj2[7] = new CodeInstruction(OpCodes.Dup, (object)null);
			obj2[8] = CodeInstruction.Call(typeof(TrackScoresAccessor), "fetchHighScoresFormatted", (Type[])null, (Type[])null);
			obj2[9] = new CodeInstruction(OpCodes.Stloc_1, (object)null);
			obj2[10] = CodeInstruction.Call(typeof(TrackScoresAccessor), "fetchHighestScore", (Type[])null, (Type[])null);
			obj2[11] = CodeInstruction.StoreField(typeof(LevelSelectController), "highestscore");
			return obj.InsertAndAdvance((CodeInstruction[])(object)obj2).InstructionEnumeration();
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(LatchController), "getNumberOfSScores")]
		public static bool PatchLatchCheck(out int ___num_s)
		{
			if (GlobalVariables.localsettings.acc_unlockhatches)
			{
				___num_s = Mathf.FloorToInt((float)GlobalVariables.localsave.tracks_played * 0.25f);
			}
			else
			{
				___num_s = TrackScoresAccessor.countSRanks();
			}
			return false;
		}
	}
	[Serializable]
	[HarmonyPatch]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class PreviewPatch
	{
		internal static ManualLogSource logger;

		internal static FieldInfo clip_volume_f;

		internal static FieldInfo clip_player_f;

		internal static MethodInfo start_fade_m;

		internal static int init@11;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(LevelSelectClipPlayer), "beginClipSearch")]
		public static bool ClipSearchPrefix(LevelSelectClipPlayer __instance, in string ___current_trackref)
		{
			FSharpOption<BaboonAPI.Internal.TrackAccessor.RegisteredTrack> val = MapModule.TryFind<string, BaboonAPI.Internal.TrackAccessor.RegisteredTrack>(___current_trackref, BaboonAPI.Internal.TrackAccessor.trackLoader.tracks);
			object obj;
			if (val == null)
			{
				obj = null;
			}
			else
			{
				FSharpOption<BaboonAPI.Internal.TrackAccessor.RegisteredTrack> val2 = val;
				BaboonAPI.Internal.TrackAccessor.RegisteredTrack value = val2.Value;
				obj = FSharpOption<TromboneTrack>.Some(value.track@);
			}
			FSharpOption<TromboneTrack> val3 = (FSharpOption<TromboneTrack>)obj;
			if (val3 != null)
			{
				FSharpOption<TromboneTrack> val4 = val3;
				if (val4.Value is Previewable previewable)
				{
					Previewable preview = previewable;
					IEnumerator<YieldInstruction> enumerator = SeqModule.Delay<YieldInstruction>((FSharpFunc<Unit, IEnumerable<YieldInstruction>>)new $PreviewPatch.ClipSearchPrefix@42(__instance, preview)).GetEnumerator();
					Coroutine val5 = ((MonoBehaviour)__instance).StartCoroutine((IEnumerator)enumerator);
					goto IL_007b;
				}
			}
			doClipNotFound(__instance);
			goto IL_007b;
			IL_007b:
			return false;
		}

		[CompilationArgumentCounts(new int[] { 1, 1 })]
		[CompilerGenerated]
		internal static void setClipAndFade(TrackAudio clip, LevelSelectClipPlayer player)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			if (init@11 < 2)
			{
				IntrinsicFunctions.FailStaticInit();
			}
			clip_volume_f.SetValue(player, clip.Volume@);
			if (init@11 < 3)
			{
				IntrinsicFunctions.FailStaticInit();
			}
			AudioSource val = (AudioSource)clip_player_f.GetValue(player);
			val.clip = clip.Clip@;
			val.volume = 0f;
			val.Play();
			if (init@11 < 4)
			{
				IntrinsicFunctions.FailStaticInit();
			}
			object obj = start_fade_m.Invoke(player, new object[1] { 1f });
		}

		[CompilerGenerated]
		internal static void doClipNotFound(LevelSelectClipPlayer player)
		{
			((MonoBehaviour)player).Invoke("doDefaultClipNotFoundEvent", 0f);
		}

		static PreviewPatch()
		{
			$PreviewPatch.init@ = 0;
			_ = $PreviewPatch.init@;
		}
	}
}
namespace BaboonAPI
{
	[Serializable]
	[BepInPlugin("ch.offbeatwit.baboonapi.plugin", "BaboonAPI", "2.7.1.0")]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class BaboonPlugin : BaseUnityPlugin, GameInitializationEvent.Listener
	{
		internal Harmony harmony;

		public BaboonPlugin()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			harmony = new Harmony("ch.offbeatwit.baboonapi.plugin");
		}

		public void Awake()
		{
			GameInitializationEvent.EVENT.Register(this);
			CustomSaveRegistry.Register(((BaseUnityPlugin)this).Info, $Library.Awake@18.@_instance);
			harmony.PatchAll(typeof(BrandingPatch));
		}

		public Coroutine TestReload()
		{
			IEnumerator<YieldInstruction> enumerator = BaboonAPI.Internal.TrackAccessor.trackLoader.LoadTracksAsync();
			return ((MonoBehaviour)this).StartCoroutine((IEnumerator)enumerator);
		}

		public FSharpResult<Unit, LoadError> TryLoadTracks()
		{
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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)
			try
			{
				BaboonAPI.Internal.TrackAccessor.trackLoader.onTracksLoaded(BaboonAPI.Internal.TrackAccessor.trackLoader.makeTrackLoader());
				FSharpOption<BaboonAPI.Internal.ScoreStorage.BaseTrackScoreStorage> baseGameStorage = BaboonAPI.Internal.ScoreStorage.baseGameStorage;
				if (baseGameStorage != null)
				{
					FSharpOption<BaboonAPI.Internal.ScoreStorage.BaseTrackScoreStorage> val = baseGameStorage;
					val.Value.firstTimeBackup();
				}
				return FSharpResult<Unit, LoadError>.NewOk((Unit)null);
			}
			catch (object obj) when (((Func<bool>)delegate
			{
				// Could not convert BlockContainer to single expression
				Exception ex = (Exception)obj;
				System.Runtime.CompilerServices.Unsafe.SkipInit(out int result);
				if (ex is BaboonAPI.Internal.TrackAccessor.DuplicateTrackrefException)
				{
					string data = ((BaboonAPI.Internal.TrackAccessor.DuplicateTrackrefException)ex).Data0;
					result = 1;
				}
				else
				{
					result = 0;
				}
				return (byte)result != 0;
			}).Invoke())
			{
				Exception ex3 = (Exception)obj;
				if (ex3 is BaboonAPI.Internal.TrackAccessor.DuplicateTrackrefException)
				{
					string data = ((BaboonAPI.Internal.TrackAccessor.DuplicateTrackrefException)ex3).Data0;
					string message = StringModule.Concat("\n", (IEnumerable<string>)FSharpList<string>.Cons(PrintfModule.PrintFormatToStringThen<string>((PrintfFormat<string, Unit, string, string>)(object)new PrintfFormat<string, Unit, string, string, string>("Duplicate tracks found with track ID '%P()'", new object[1] { data }, (Type[])null)), FSharpList<string>.Cons("Please check your songs folder for duplicates!", FSharpList<string>.Empty)));
					return FSharpResult<Unit, LoadError>.NewError(new LoadError(((BaseUnityPlugin)this).Info, message));
				}
				throw;
			}
		}

		virtual FSharpResult<Unit, LoadError> GameInitializationEvent.Listener.Initialize()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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)
			ManualLogSource logger = ((BaseUnityPlugin)this).Logger;
			logger.LogInfo((object)"Unlocking the secrets of the baboon...");
			FSharpResult<Unit, LoadError> val = GameInitializationEvent.attempt(((BaseUnityPlugin)this).Info, new $Library.BaboonAPI-Hooks-Initializer-GameInitializationEvent-Listener-Initialize@48(this, logger));
			if (val.Tag != 0)
			{
				return FSharpResult<Unit, LoadError>.NewError(val.ErrorValue);
			}
			return TryLoadTracks();
		}
	}
}
namespace <StartupCode$BaboonAPI>
{
	internal static class $Library
	{
		[Serializable]
		internal sealed class Awake@18 : FSharpFunc<SaverCapability, Unit>
		{
			internal static readonly Awake@18 @_instance = new Awake@18();

			[CompilerGenerated]
			[DebuggerNonUserCode]
			internal Awake@18()
			{
			}

			public override Unit Invoke(SaverCapability cap)
			{
				cap.Attach("scores", BaboonAPI.Internal.ScoreStorage.customStorage);
				return null;
			}
		}

		[Serializable]
		internal sealed class BaboonAPI-Hooks-Initializer-GameInitializationEvent-Listener-Initialize@63-1 : FSharpFunc<Type, Unit>
		{
			[DebuggerBrowsable(DebuggerBrowsableState.Never)]
			[CompilerGenerated]
			[DebuggerNonUserCode]
			public Harmony objectArg;

			[CompilerGenerated]
			[DebuggerNonUserCode]
			internal BaboonAPI-Hooks-Initializer-GameInitializationEvent-Listener-Initialize@63-1(Harmony objectArg)
			{
				this.objectArg = objectArg;
			}

			public override Unit Invoke(Type assembly)
			{
				objectArg.PatchAll(assembly);
				return null;
			}
		}

		[Serializable]
		internal sealed class BaboonAPI-Hooks-Initializer-GameInitializationEvent-Listener-Initialize@48 : FSharpFunc<Unit, Unit>
		{
			public BaboonPlugin @this;

			public ManualLogSource logger;

			[CompilerGenerated]
			[DebuggerNonUserCode]
			internal BaboonAPI-Hooks-Initializer-GameInitializationEvent-Listener-Initialize@48(BaboonPlugin @this, ManualLogSource logger)
			{
				this.@this = @this;
				this.logger = logger;
			}

			public override Unit Invoke(Unit unitVar0)
			{
				BaboonAPI.Internal.Debug.printDebug(logger);
				FSharpList<Type> val = FSharpList<Type>.Cons(typeof(TrackCountPatches), FSharpList<Type>.Cons(typeof(TrackLoaderPatch), FSharpList<Type>.Cons(typeof(TrackTitlePatches), FSharpList<Type>.Cons(typeof(LoaderPatch), FSharpList<Type>.Cons(typeof(LanguageChangerPatch), FSharpList<Type>.Cons(typeof(GameControllerPatch), FSharpList<Type>.Cons(typeof(PausePatches), FSharpList<Type>.Cons(typeof(PreviewPatch), FSharpList<Type>.Cons(typeof(SaverLoaderPatch), FSharpList<Type>.Cons(typeof(TrackScorePatches), FSharpList<Type>.Empty))))))))));
				Harmony harmony = this.@this.harmony;
				FSharpFunc<Type, Unit> val2 = new BaboonAPI-Hooks-Initializer-GameInitializationEvent-Listener-Initialize@63-1(harmony);
				FSharpList<Type> val3 = val;
				for (FSharpList<Type> tailOrNull = val3.TailOrNull; tailOrNull != null; tailOrNull = val3.TailOrNull)
				{
					Type headOrDefault = val3.HeadOrDefault;
					val2.Invoke(headOrDefault);
					val3 = tailOrNull;
				}
				SaverLoader.loadAllTrackMetadata();
				return null;
			}
		}
	}
}
namespace BaboonAPI.Hooks.Entrypoints
{
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public static class Entrypoints
	{
		[Serializable]
		internal sealed class get@29<t> : FSharpFunc<EntryPointContainer<t>, t>
		{
			internal static readonly get@29<t> @_instance = new get@29<t>();

			[CompilerGenerated]
			[DebuggerNonUserCode]
			internal get@29()
			{
				((FSharpFunc<EntryPointContainer<EntryPointContainer<t>>, EntryPointContainer<t>>)(object)this)..ctor();
			}

			public override t Invoke(EntryPointContainer<t> c)
			{
				return c.Instance@;
			}
		}

		public static IReadOnlyList<EntryPointContainer<t>> getEntrypointContainers<t>()
		{
			return (IReadOnlyList<EntryPointContainer<t>>)BaboonAPI.Internal.EntryPointScanner.scanAll<t>();
		}

		public static IReadOnlyList<t> get<t>()
		{
			return (IReadOnlyList<t>)ListModule.Map<EntryPointContainer<t>, t>((FSharpFunc<EntryPointContainer<t>, t>)get@29<t>.@_instance, BaboonAPI.Internal.EntryPointScanner.scanAll<t>());
		}
	}
}
namespace <StartupCode$BaboonAPI>.$BaboonAPI.Hooks.Entrypoints
{
	internal static class Entrypoints
	{
	}
}
namespace BaboonAPI.Hooks.Initializer
{
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public static class BaboonInitializer
	{
		public static bool IsInitialized()
		{
			return ModInitializer.IsInitialized();
		}
	}
}
namespace <StartupCode$BaboonAPI>
{
	internal static class $Initializer___2
	{
	}
}
namespace BaboonAPI.Hooks.Tracks
{
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public static class TrackLookup
	{
		[Serializable]
		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		public sealed class SavedTrackScore : IEquatable<SavedTrackScore>, IStructuralEquatable, IComparable<SavedTrackScore>, IComparable, IStructuralComparable
		{
			[CompilerGenerated]
			[DebuggerBrowsable(DebuggerBrowsableState.Never)]
			internal string highestRank@;

			[CompilerGenerated]
			[DebuggerBrowsable(DebuggerBrowsableState.Never)]
			internal FSharpList<int> highScores@;

			[CompilationMapping(/*Could not decode attribute arguments.*/)]
			public string highestRank
			{
				[CompilerGenerated]
				[DebuggerNonUserCode]
				get
				{
					return highestRank@;
				}
			}

			[CompilationMapping(/*Could not decode attribute arguments.*/)]
			public FSharpList<int> highScores
			{
				[CompilerGenerated]
				[DebuggerNonUserCode]
				get
				{
					return highScores@;
				}
			}

			[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(SavedTrackScore))]
			public SavedTrackScore(string highestRank, FSharpList<int> highScores)
			{
				highestRank@ = highestRank;
				highScores@ = highScores;
			}

			[CompilerGenerated]
			public override string ToString()
			{
				return ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<SavedTrackScore, string>>((PrintfFormat<FSharpFunc<SavedTrackScore, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<SavedTrackScore, string>, Unit, string, string, SavedTrackScore>("%+A")).Invoke(this);
			}

			[CompilerGenerated]
			public sealed int CompareTo(SavedTrackScore obj)
			{
				if (this != null)
				{
					if (obj != null)
					{
						IComparer genericComparer = LanguagePrimitives.GenericComparer;
						int num = string.CompareOrdinal(highestRank@, obj.highestRank@);
						if (num < 0)
						{
							return num;
						}
						if (num > 0)
						{
							return num;
						}
						genericComparer = LanguagePrimitives.GenericComparer;
						FSharpList<int> val = highScores@;
						FSharpList<int> val2 = obj.highScores@;
						return val.CompareTo((object)val2, genericComparer);
					}
					return 1;
				}
				if (obj != null)
				{
					return -1;
				}
				return 0;
			}

			[CompilerGenerated]
			public sealed int CompareTo(object obj)
			{
				return CompareTo((SavedTrackScore)obj);
			}

			[CompilerGenerated]
			public sealed int CompareTo(object obj, IComparer comp)
			{
				SavedTrackScore savedTrackScore = (SavedTrackScore)obj;
				if (this != null)
				{
					if ((SavedTrackScore)obj != null)
					{
						int num = string.CompareOrdinal(highestRank@, savedTrackScore.highestRank@);
						if (num < 0)
						{
							return num;
						}
						if (num > 0)
						{
							return num;
						}
						FSharpList<int> val = highScores@;
						FSharpList<int> val2 = savedTrackScore.highScores@;
						return val.CompareTo((object)val2, comp);
					}
					return 1;
				}
				if ((SavedTrackScore)obj != null)
				{
					return -1;
				}
				return 0;
			}

			[CompilerGenerated]
			public sealed int GetHashCode(IEqualityComparer comp)
			{
				if (this != null)
				{
					int num = 0;
					num = -1640531527 + (highScores@.GetHashCode(comp) + ((num << 6) + (num >> 2)));
					return -1640531527 + ((highestRank@?.GetHashCode() ?? 0) + ((num << 6) + (num >> 2)));
				}
				return 0;
			}

			[CompilerGenerated]
			public sealed override int GetHashCode()
			{
				return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
			}

			[CompilerGenerated]
			public sealed bool Equals(object obj, IEqualityComparer comp)
			{
				if (this != null)
				{
					if (obj is SavedTrackScore savedTrackScore)
					{
						if (string.Equals(highestRank@, savedTrackScore.highestRank@))
						{
							FSharpList<int> val = highScores@;
							FSharpList<int> val2 = savedTrackScore.highScores@;
							return val.Equals((object)val2, comp);
						}
						return false;
					}
					return false;
				}
				return obj == null;
			}

			[CompilerGenerated]
			public sealed bool Equals(SavedTrackScore obj)
			{
				if (this != null)
				{
					if (obj != null)
					{
						if (string.Equals(highestRank@, obj.highestRank@))
						{
							return HashCompare.GenericEqualityERIntrinsic<FSharpList<int>>(highScores@, obj.highScores@);
						}
						return false;
					}
					return false;
				}
				return obj == null;
			}

			[CompilerGenerated]
			public sealed override bool Equals(object obj)
			{
				if (obj is SavedTrackScore obj2)
				{
					return Equals(obj2);
				}
				return false;
			}
		}

		public static TromboneTrack lookup(string trackref)
		{
			return BaboonAPI.Internal.TrackAccessor.trackLoader.tracks[trackref].track@;
		}

		public static FSharpOption<TromboneTrack> tryLookup(string trackref)
		{
			FSharpOption<BaboonAPI.Internal.TrackAccessor.RegisteredTrack> val = MapModule.TryFind<string, BaboonAPI.Internal.TrackAccessor.RegisteredTrack>(trackref, BaboonAPI.Internal.TrackAccessor.trackLoader.tracks);
			if (val == null)
			{
				return null;
			}
			FSharpOption<BaboonAPI.Internal.TrackAccessor.RegisteredTrack> val2 = val;
			BaboonAPI.Internal.TrackAccessor.RegisteredTrack value = val2.Value;
			return FSharpOption<TromboneTrack>.Some(value.track@);
		}

		public static SingleTrackData toTrackData(TromboneTrack track)
		{
			return BaboonAPI.Internal.TrackAccessor.toTrackData(track);
		}

		public static FSharpList<TromboneTrack> allTracks()
		{
			ListCollector<TromboneTrack> val = default(ListCollector<TromboneTrack>);
			using (IEnumerator<BaboonAPI.Internal.TrackAccessor.RegisteredTrack> enumerator = SeqModule.OfArray<BaboonAPI.Internal.TrackAccessor.RegisteredTrack>(BaboonAPI.Internal.TrackAccessor.trackLoader.tracksByIndex).GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					BaboonAPI.Internal.TrackAccessor.RegisteredTrack current = enumerator.Current;
					val.Add(current.track@);
				}
				IEnumerable<TromboneTrack> enumerable = null;
			}
			return val.Close();
		}

		public static void reload()
		{
			BaboonAPI.Internal.TrackAccessor.trackLoader.onTracksLoaded(BaboonAPI.Internal.TrackAccessor.trackLoader.makeTrackLoader());
		}

		public static IEnumerator<YieldInstruction> reloadAsync()
		{
			return BaboonAPI.Internal.TrackAccessor.trackLoader.LoadTracksAsync();
		}

		public static FSharpOption<SavedTrackScore> lookupScore(string trackref)
		{
			BaboonAPI.Internal.ScoreStorage.IScoreStorage storageFor = BaboonAPI.Internal.ScoreStorage.getStorageFor(trackref);
			if (storageFor.IsSaved(trackref))
			{
				BaboonAPI.Internal.ScoreStorage.TrackScores trackScores = storageFor.Load(trackref);
				return FSharpOption<SavedTrackScore>.Some(new SavedTrackScore(BaboonAPI.Internal.ScoreStorage.rankString(trackScores.highestRank@), trackScores.highScores@));
			}
			return null;
		}
	}
}
namespace <StartupCode$BaboonAPI>.$BaboonAPI.Hooks.Tracks
{
	internal static class TrackLookup
	{
	}
}
namespace <StartupCode$BaboonAPI>
{
	internal static class $PreviewPatch
	{
		[Serializable]
		internal sealed class ClipSearchPrefix@44-1 : FSharpFunc<FSharpResult<TrackAudio, string>, IEnumerable<YieldInstruction>>
		{
			public LevelSelectClipPlayer __instance;

			[CompilerGenerated]
			[DebuggerNonUserCode]
			internal ClipSearchPrefix@44-1(LevelSelectClipPlayer __instance)
			{
				this.__instance = __instance;
			}

			public override IEnumerable<YieldInstruction> Invoke(FSharpResult<TrackAudio, string> clip)
			{
				if (clip.Tag != 1)
				{
					TrackAudio resultValue = clip.ResultValue;
					PreviewPatch.setClipAndFade(resultValue, __instance);
					return SeqModule.Empty<YieldInstruction>();
				}
				string errorValue = clip.ErrorValue;
				if (PreviewPatch.init@11 < 1)
				{
					IntrinsicFunctions.FailStaticInit();
				}
				PreviewPatch.logger.LogError((object)PrintfModule.PrintFormatToStringThen<string>((PrintfFormat<string, Unit, string, string>)(object)new PrintfFormat<string, Unit, string, string, string>("Failed to load song preview clip: %P()", new object[1] { errorValue }, (Type[])null)));
				PreviewPatch.doClipNotFound(__instance);
				return SeqModule.Empty<YieldInstruction>();
			}
		}

		[Serializable]
		internal sealed class ClipSearchPrefix@42 : FSharpFunc<Unit, IEnumerable<YieldInstruction>>
		{
			public LevelSelectClipPlayer __instance;

			public Previewable preview;

			[CompilerGenerated]
			[DebuggerNonUserCode]
			internal ClipSearchPrefix@42(LevelSelectClipPlayer __instance, Previewable preview)
			{
				this.__instance = __instance;
				this.preview = preview;
			}

			public override IEnumerable<YieldInstruction> Invoke(Unit unitVar)
			{
				return BaboonAPI.Utility.Coroutines.coroutine.Bind(preview.LoadClip(), new ClipSearchPrefix@44-1(__instance));
			}
		}

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		[CompilerGenerated]
		[DebuggerNonUserCode]
		internal static int init@;

		static $PreviewPatch()
		{
			PreviewPatch.logger = Logger.CreateLogSource("BaboonAPI.PreviewPatch");
			PreviewPatch.init@11 = 1;
			PreviewPatch.clip_volume_f = AccessTools.Field(typeof(LevelSelectClipPlayer), "clip_volume");
			PreviewPatch.init@11 = 2;
			PreviewPatch.clip_player_f = AccessTools.Field(typeof(LevelSelectClipPlayer), "clipPlayer");
			PreviewPatch.init@11 = 3;
			PreviewPatch.start_fade_m = AccessTools.Method(typeof(LevelSelectClipPlayer), "startCrossFade", (Type[])null, (Type[])null);
			PreviewPatch.init@11 = 4;
		}
	}
}
namespace BaboonAPI.Patch
{
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	internal static class TrackScoresUtility
	{
		internal static BaboonAPI.Internal.ScoreStorage.TrackScores get(string trackref)
		{
			return BaboonAPI.Internal.ScoreStorage.getStorageFor(trackref).Load(trackref);
		}

		[CompilationArgumentCounts(new int[] { 1, 1 })]
		internal static void put(string trackref, BaboonAPI.Internal.ScoreStorage.AchievedScore score)
		{
			BaboonAPI.Internal.ScoreStorage.getStorageFor(trackref).Save(score);
		}

		internal static bool checkForS(string trackref)
		{
			FSharpOption<BaboonAPI.Internal.ScoreStorage.Rank> highestRank@ = BaboonAPI.Internal.ScoreStorage.getStorageFor(trackref).Load(trackref).highestRank@;
			if (highestRank@ != null)
			{
				FSharpOption<BaboonAPI.Internal.ScoreStorage.Rank> val = highestRank@;
				return HashCompare.GenericGreaterOrEqualIntrinsic<BaboonAPI.Internal.ScoreStorage.Rank>(val.Value, BaboonAPI.Internal.ScoreStorage.Rank.S);
			}
			return false;
		}

		internal static string pullLetterScore(string trackref)
		{
			return BaboonAPI.Internal.ScoreStorage.rankString(BaboonAPI.Internal.ScoreStorage.getStorageFor(trackref).Load(trackref).highestRank@);
		}
	}
}
namespace <StartupCode$BaboonAPI>
{
	internal static class $TrackScorePatch
	{
		[Serializable]
		internal sealed class countSRanks@28 : FSharpFunc<BaboonAPI.Internal.ScoreStorage.Rank, bool>
		{
			internal static readonly countSRanks@28 @_instance = new countSRanks@28();

			[CompilerGenerated]
			[DebuggerNonUserCode]
			internal countSRanks@28()
			{
			}

			public override bool Invoke(BaboonAPI.Internal.ScoreStorage.Rank r)
			{
				return HashCompare.GenericGreaterOrEqualIntrinsic<BaboonAPI.Internal.ScoreStorage.Rank>(r, BaboonAPI.Internal.ScoreStorage.Rank.S);
			}
		}

		[Serializable]
		internal sealed class countSRanks@27-1 : FSharpFunc<BaboonAPI.Internal.ScoreStorage.TrackScores, FSharpOption<BaboonAPI.Internal.ScoreStorage.Rank>>
		{
			internal static readonly countSRanks@27-1 @_instance = new countSRanks@27-1();

			[CompilerGenerated]
			[DebuggerNonUserCode]
			internal countSRanks@27-1()
			{
			}

			public override FSharpOption<BaboonAPI.Internal.ScoreStorage.Rank> Invoke(BaboonAPI.Internal.ScoreStorage.TrackScores s)
			{
				return s.highestRank@;
			}
		}

		[Serializable]
		internal sealed class fetchHighScoresFormatted@33 : FSharpFunc<int, string>
		{
			internal static readonly fetchHighScoresFormatted@33 @_instance = new fetchHighScoresFormatted@33();

			[CompilerGenerated]
			[DebuggerNonUserCode]
			internal fetchHighScoresFormatted@33()
			{
			}

			public override string Invoke(int i)
			{
				if (i > 0)
				{
					return i.ToString("n0");
				}
				return "-";
			}
		}

		[Serializable]
		[SpecialName]
		[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		internal static class startIndex@97-1
		{
			internal static bool Invoke(CodeInstruction ins)
			{
				return CodeInstructionExtensions.LoadsConstant(ins, 0L);
			}
		}

		[Serializable]
		[SpecialName]
		[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		internal static class endIndex@105
		{
			internal static bool Invoke(CodeInstruction ins)
			{
				return CodeInstructionExtensions.LoadsConstant(ins, 7L);
			}
		}
	}
}
namespace BaboonAPI.Patch
{
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	internal static class ModInitializer
	{
		[Serializable]
		[SpecialName]
		[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		internal sealed class ShowResult@38-1
		{
			public RectTransform rect;

			public ShowResult@38-1(RectTransform rect)
			{
				this.rect = rect;
				base..ctor();
			}

			internal void Invoke(float value)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				rect.offsetMin = new Vector2(10f, value);
			}
		}

		[Serializable]
		[SpecialName]
		[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
		[CompilationMapping(/*Could not decode attribute arguments.*/)]
		internal sealed class ShowResult@45-2
		{
			public RectTransform rect;

			public ShowResult@45-2(RectTransform rect)
			{
				this.rect = rect;
				base..ctor();
			}

			internal void Invoke(float value)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				rect.offsetMin = new Vector2(value, 30f);
			}
		}

		[Serializable]
		internal sealed class ShowResult@83-3 : FSharpFunc<Unit, IEnumerable<YieldInstruction>>
		{
			internal static readonly ShowResult@83-3 @_instance = new ShowResult@83-3();

			[CompilerGenerated]
			[DebuggerNonUserCode]
			internal ShowResult@83-3()
			{
			}

			public override IEnumerable<YieldInstruction> Invoke(Unit unitVar)
			{
				return SeqModule.Empty<YieldInstruction>();
			}
		}

		[Serializable]
		internal sealed class ShowResult@17 : FSharpFunc<Unit, IEnumerable<YieldInstruction>>
		{
			public BrandingController bc;

			[CompilerGenerated]
			[DebuggerNonUserCode]
			internal ShowResult@17(BrandingController bc)
			{
				this.bc = bc;
			}

			public override IEnumerable<YieldInstruction> Invoke(Unit unitVar)
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Expected O, but got Unknown
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0109: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
				Text component = ((Component)bc.failed_to_load_error.transform.Find("full_text")).GetComponent<Text>();
				FSharpOption<FSharpResult<Unit, LoadError>> initResult = ModInitializer.initResult;
				IEnumerable<YieldInstruction> enumerable;
				if (initResult != null)
				{
					FSharpOption<FSharpResult<Unit, LoadError>> val = initResult;
					FSharpResult<Unit, LoadError> value = val.Value;
					if (value.Tag != 1)
					{
						GameObject val2 = new GameObject("BaboonApiModsText");
						Text val3 = val2.AddComponent<Text>();
						RectTransform component2 = val2.GetComponent<RectTransform>();
						val3.font = component.font;
						val3.fontSize = 20;
						val3.alignment = (TextAnchor)6;
						val3.text = "<color=#90EE90>All your mods loaded successfully!\nHappy tooting!</color>";
						((Transform)component2).SetParent(((Component)bc.epwarningcg).transform);
						component2.pivot = new Vector2(0f, 0f);
						component2.anchorMin = new Vector2(0f, 0f);
						component2.anchorMax = new Vector2(1f, 1f);
						component2.offsetMin = new Vector2(10f, -50f);
						component2.offsetMax = new Vector2(250f, 30f);
						LTDescr val4 = LeanTween.value(-50f, 30f, 0.5f).setEaseInOutQuad().setOnUpdate((Action<float>)new ShowResult@38-1(component2).Invoke);
						val4 = LeanTween.value(10f, -500f, 0.5f).setEaseOutQuad().setDelay(5.5f)
							.setOnUpdate((Action<float>)new ShowResult@45-2(component2).Invoke);
						((MonoBehaviour)bc).Invoke("killandload", 6.45f);
						enumerable = SeqModule.E