Decompiled source of REPOTrueUltrawide v1.0.0

REPOTrueUltrawide.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
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: AssemblyTitle("REPOTrueUltrawide")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("REPOTrueUltrawide")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3f5fd507-336d-42d3-a6f5-e6583a230cfc")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace REPOTrueUltrawide;

[BepInPlugin("REPOTrueUltrawide", "REPO True Ultrawide", "1.0.0")]
public class REPOTrueUltrawidePlugin : BaseUnityPlugin
{
	public static ConfigEntry<float> BaseFov;

	private void Awake()
	{
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Expected O, but got Unknown
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"REPO True Ultrawide v1.0.0 loaded!");
		((BaseUnityPlugin)this).Logger.LogInfo((object)$"Aspect ratio: {(float)Screen.width / (float)Screen.height}");
		BaseFov = ((BaseUnityPlugin)this).Config.Bind<float>("FOV", "FOV", 70f, new ConfigDescription("The FOV, 90 is good for 32:9.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(50f, 110f), Array.Empty<object>()));
		Harmony val = new Harmony("REPOTrueUltrawide");
		val.PatchAll();
	}
}
[HarmonyPatch(typeof(GraphicsManager), "Update")]
public class StretchingPatch
{
	public static void Postfix()
	{
		//IL_00ae: 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_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		float num = (float)Screen.width / (float)Screen.height;
		GameObject val = GameObject.Find("Render Texture Overlay");
		GameObject val2 = GameObject.Find("Render Texture Main");
		if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2))
		{
			RectTransform component = val.GetComponent<RectTransform>();
			RectTransform component2 = val2.GetComponent<RectTransform>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2))
			{
				component.sizeDelta = new Vector2(428f * num, 428f);
				component2.sizeDelta = new Vector2(428f * num, 428f);
			}
			else
			{
				component.sizeDelta = new Vector2(750f, 750f / num);
				component2.sizeDelta = new Vector2(750f, 750f / num);
			}
		}
		Camera mainCamera = GameDirector.instance.MainCamera;
		float value = REPOTrueUltrawidePlugin.BaseFov.Value;
		float fieldOfView = 2f * Mathf.Atan(Mathf.Tan(value * ((float)Math.PI / 180f) / 2f) * 1.7777778f / num) * 57.29578f;
		mainCamera.aspect = num;
		mainCamera.fieldOfView = fieldOfView;
		GameObject val3 = GameObject.Find("Post Processing Overlay");
		if (Object.op_Implicit((Object)(object)val3))
		{
			val3.SetActive(false);
		}
	}
}