Decompiled source of LessShadows MONO v1.0.1

LessShadows-MONO.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using LessShadows;
using MelonLoader;
using ScheduleOne.DevUtilities;
using ScheduleOne.Persistence;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::LessShadows.LessShadows), "LessShadows", "1.0", "XOWithSauce", null)]
[assembly: MelonColor]
[assembly: MelonOptionalDependencies(new string[] { "FishNet.Runtime" })]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("LessShadows")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LessShadows")]
[assembly: AssemblyTitle("LessShadows")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LessShadows;

public static class BuildInfo
{
	public const string Name = "LessShadows";

	public const string Description = "LessShadowss";

	public const string Author = "XOWithSauce";

	public const string Company = null;

	public const string Version = "1.0";

	public const string DownloadLink = null;
}
public class LessShadows : MelonMod
{
	[CompilerGenerated]
	private sealed class <Setup>d__4 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		private Light[] <lights>5__1;

		private Light[] <>s__2;

		private int <>s__3;

		private Light <light>5__4;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <Setup>d__4(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<lights>5__1 = null;
			<>s__2 = null;
			<light>5__4 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(10f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<lights>5__1 = Object.FindObjectsOfType<Light>(true);
				MelonLogger.Msg("DISABLING SHADOWS FOR " + <lights>5__1.Length + " LIGHTS!");
				MelonLogger.Msg("YOU MIGHT EXPERIENCE SLIGHT LAG DURING THIS OPERATION!");
				<>s__2 = <lights>5__1;
				<>s__3 = 0;
				goto IL_0124;
			case 2:
				<>1__state = -1;
				<>2__current = (object)new WaitForEndOfFrame();
				<>1__state = 3;
				return true;
			case 3:
				<>1__state = -1;
				<light>5__4.shadows = (LightShadows)0;
				<light>5__4 = null;
				<>s__3++;
				goto IL_0124;
			case 4:
				{
					<>1__state = -1;
					return false;
				}
				IL_0124:
				if (<>s__3 < <>s__2.Length)
				{
					<light>5__4 = <>s__2[<>s__3];
					<>2__current = (object)new WaitForSeconds(0.001f);
					<>1__state = 2;
					return true;
				}
				<>s__2 = null;
				MelonLogger.Msg("LIGHT SHADOWS HAVE BEEN DISABLED. ENJOY YOUR FPS!");
				<>2__current = null;
				<>1__state = 4;
				return true;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	public static List<object> coros = new List<object>();

	private bool registered = false;

	private void OnLoadCompleteCb()
	{
		if (!registered)
		{
			coros.Add(MelonCoroutines.Start(Setup()));
			registered = true;
		}
	}

	public override void OnSceneWasInitialized(int buildIndex, string sceneName)
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		if (buildIndex == 1)
		{
			if ((Object)(object)Singleton<LoadManager>.Instance != (Object)null && !registered)
			{
				Singleton<LoadManager>.Instance.onLoadComplete.AddListener(new UnityAction(OnLoadCompleteCb));
			}
			return;
		}
		registered = false;
		foreach (object coro in coros)
		{
			MelonCoroutines.Stop(coro);
		}
		coros.Clear();
	}

	[IteratorStateMachine(typeof(<Setup>d__4))]
	public static IEnumerator Setup()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <Setup>d__4(0);
	}
}