Decompiled source of WidescreenSupport v1.0.0

wideScreenSupport.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("wideScreenSupport")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bdd521c374dbc38e909954d9ca88f929d50a1aa8")]
[assembly: AssemblyProduct("wideScreenSupport")]
[assembly: AssemblyTitle("wideScreenSupport")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.yourdomain.wideScreenSupport", "wideScreenSupport", "1.0.5")]
public class Class1 : BaseUnityPlugin
{
	private const string modGUID = "x002.wideScreenSupport";

	private const string modName = "wideScreenSupport";

	private const string modVersion = "1.0.5";

	public static Class1 instance;

	private readonly Harmony harmony = new Harmony("x002.wideScreenSupport");

	private void Awake()
	{
		instance = this;
		harmony.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"wideScreenSupport is loaded!");
	}
}
[HarmonyPatch(typeof(GraphicsManager), "Update")]
public class AwakePatch
{
	public static GameObject val;

	public static GameObject val2;

	public static void Prefix()
	{
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: 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_0119: Unknown result type (might be due to invalid IL or missing references)
		float num = (float)AccessTools.Field(typeof(GraphicsManager), "fullscreenCheckTimer").GetValue(GraphicsManager.instance);
		if (num > 0f)
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2))
		{
			val = GameObject.Find("Render Texture Overlay");
			val2 = GameObject.Find("Render Texture Main");
		}
		if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
		{
			return;
		}
		RectTransform component = val.GetComponent<RectTransform>();
		RectTransform component2 = val2.GetComponent<RectTransform>();
		if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null)
		{
			float num2 = (float)Screen.width / (float)Screen.height;
			if (num2 > 1.7777778f)
			{
				component.sizeDelta = new Vector2(428f * num2, 428f);
				component2.sizeDelta = new Vector2(428f * num2, 428f);
			}
			else
			{
				component.sizeDelta = new Vector2(750f, 750f / num2);
				component2.sizeDelta = new Vector2(750f, 750f / num2);
			}
		}
	}
}