using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("SoundApiRepoFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SoundApiRepoFix")] [assembly: AssemblyTitle("SoundApiRepoFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SoundApiRepoFix { [BepInPlugin("themorningstar.soundapirepofix", "SoundAPI REPO Fix", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string Guid = "themorningstar.soundapirepofix"; internal static ManualLogSource Log; private void Awake() { //IL_0037: 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_005f: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; try { MethodInfo methodInfo = AccessTools.Method("loaforcsSoundAPI.REPO.Patches.SoundPatch:ResetAudioInfoFetched", (Type[])null, (Type[])null); if (methodInfo == null) { Log.LogError((object)"SoundApiRepoFix: could not find SoundPatch.ResetAudioInfoFetched - target mod version changed? No patch applied."); return; } new Harmony("themorningstar.soundapirepofix").Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Patch).GetMethod("SafeReset")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"SoundApiRepoFix: null-guarded SoundPatch.ResetAudioInfoFetched (stops the deprecated SoundAPI_REPO NullRef storm)."); } catch (Exception ex) { Log.LogError((object)("SoundApiRepoFix: patch failed: " + ex)); } } } internal static class Patch { public static bool SafeReset(Sound __instance) { if (__instance != null && (Object)(object)__instance.Source != (Object)null && (Object)(object)__instance.Source.clip == (Object)null) { __instance.AudioInfoFetched = false; } return false; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { internal IgnoresAccessChecksToAttribute(string assemblyName) { } } }