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 BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("REPOUltrawide")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("REPOUltrawide")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bbcd3dc5-e600-4064-b035-f046acd8cfcc")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace REPOUltrawide
{
[BepInPlugin("REPOUltrawide", "REPOUltrawide", "1.0.0")]
public class REPOUltrawidePlugin : BaseUnityPlugin
{
private const string MyGUID = "REPOUltrawide";
private const string PluginName = "REPOUltrawide";
private const string VersionString = "1.0.0";
public static string disableUIPPString = "Disable UI Post Processing";
public static string aspectEnableString = "Enable Aspect Ratio Changes";
public static string aspectString = "Aspect Ratio";
public static ConfigEntry<bool> postProcessing;
public static ConfigEntry<bool> enableAspect;
public static ConfigEntry<int> aspectMode;
public static ConfigEntry<bool> enableFov;
public static ConfigEntry<float> fovValue;
private static readonly Harmony Harmony = new Harmony("REPOUltrawide");
public static ManualLogSource Log = new ManualLogSource("REPOUltrawide");
private void Awake()
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
postProcessing = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", disableUIPPString, false, (ConfigDescription)null);
enableAspect = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", aspectEnableString, false, (ConfigDescription)null);
aspectMode = ((BaseUnityPlugin)this).Config.Bind<int>("Gameplay", aspectString, 1, new ConfigDescription("1 = 16:9, 2 = 21:9, 3 = 32:9", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 3), Array.Empty<object>()));
enableFov = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Enable FOV Changer", false, (ConfigDescription)null);
fovValue = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "FOV Value", 70f, new ConfigDescription("FOV Value", (AcceptableValueBase)(object)new AcceptableValueRange<float>(70f, 130f), Array.Empty<object>()));
postProcessing.SettingChanged += ConfigSettingChanged;
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: REPOUltrawide, VersionString: 1.0.0 is loading...");
Harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: REPOUltrawide, VersionString: 1.0.0 is loaded.");
Log = ((BaseUnityPlugin)this).Logger;
}
private void Update()
{
}
private void ConfigSettingChanged(object sender, EventArgs e)
{
_ = e is SettingChangedEventArgs;
}
}
}
namespace REPOUltrawide.Patches
{
[HarmonyPatch(typeof(GraphicsManager), "Update")]
public class AwakePatch
{
private static GameObject postprocessing;
public static void Prefix()
{
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: 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_0097: Unknown result type (might be due to invalid IL or missing references)
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.gameObject.GetComponent<RectTransform>();
RectTransform component2 = val2.gameObject.GetComponent<RectTransform>();
if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2))
{
float num = (float)Screen.width / (float)Screen.height;
if (num > 1.7777778f)
{
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);
}
}
}
if (REPOUltrawidePlugin.enableAspect.Value)
{
if (REPOUltrawidePlugin.aspectMode.Value == 1)
{
GameDirector.instance.MainCamera.aspect = 1.7777778f;
}
else if (REPOUltrawidePlugin.aspectMode.Value == 2)
{
GameDirector.instance.MainCamera.aspect = 2.3333333f;
}
else if (REPOUltrawidePlugin.aspectMode.Value == 3)
{
GameDirector.instance.MainCamera.aspect = 3.5555556f;
}
}
else
{
GameDirector.instance.MainCamera.aspect = 1.7777778f;
}
if (REPOUltrawidePlugin.enableFov.Value)
{
GameDirector.instance.MainCamera.fieldOfView = REPOUltrawidePlugin.fovValue.Value;
}
if ((Object)(object)postprocessing == (Object)null)
{
postprocessing = GameObject.Find("Post Processing Overlay");
}
if (Object.op_Implicit((Object)(object)postprocessing))
{
postprocessing.active = !REPOUltrawidePlugin.postProcessing.Value;
postprocessing.SetActive(!REPOUltrawidePlugin.postProcessing.Value);
}
}
}
}