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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("UltrawideOrLongFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("UltrawideOrLongFix")]
[assembly: AssemblyTitle("UltrawideOrLongFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 UltrawideOrLongFix
{
[BepInPlugin("Oksamies.UltrawideOrLongFix", "UltrawideOrLongFix", "0.1.4")]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(GraphicsManager), "Update")]
public class GraphicsManagerUpdatePatch
{
public static void Prefix()
{
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
if (!(GraphicsManager.instance.fullscreenCheckTimer <= 0f))
{
return;
}
currentAspectRatio = (float)Screen.width / (float)Screen.height;
if (!configAspectRatioFix.Value)
{
return;
}
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))
{
if (currentAspectRatio > defaultAspectRatio)
{
component.sizeDelta = new Vector2(428f * currentAspectRatio, 428f);
component2.sizeDelta = new Vector2(428f * currentAspectRatio, 428f);
}
else
{
component.sizeDelta = new Vector2(750f, 750f / currentAspectRatio);
component2.sizeDelta = new Vector2(750f, 750f / currentAspectRatio);
}
previousAspectRatio = currentAspectRatio;
if (!configFieldOfViewFix.Value)
{
}
}
}
previousAspectRatio = currentAspectRatio;
}
}
[HarmonyPatch(typeof(CameraZoom), "Update")]
public class CameraZoomAwakePatch
{
public static void Prefix(CameraZoom __instance)
{
if (SemiFunc.MenuLevel())
{
sceneFoV = 33f;
}
else
{
sceneFoV = 70f;
menuFoVSet = false;
}
if ((!configFieldOfViewFix.Value || fovSetOnce) && (!configFieldOfViewFix.Value || currentAspectRatio == defaultAspectRatio) && (!SemiFunc.MenuLevel() || menuFoVSet))
{
return;
}
if (configAutoFieldOfView.Value)
{
if (currentAspectRatio != defaultAspectRatio && (previousAspectRatio != currentAspectRatio || !fovSetOnce))
{
if (SemiFunc.MenuLevel())
{
CameraNoPlayerTarget.instance.cam.fieldOfView = 33f / (defaultAspectRatio / currentAspectRatio);
}
else
{
__instance.playerZoomDefault = 70f / (defaultAspectRatio / currentAspectRatio);
__instance.zoomPrev = 70f / (defaultAspectRatio / currentAspectRatio);
__instance.zoomCurrent = __instance.zoomPrev;
}
}
}
else if (SemiFunc.MenuLevel())
{
CameraNoPlayerTarget.instance.cam.fieldOfView = 33f / (33f / configFieldOfView.Value);
menuFoVSet = true;
}
else
{
__instance.playerZoomDefault = configFieldOfView.Value;
__instance.zoomPrev = configFieldOfView.Value;
__instance.zoomCurrent = __instance.zoomPrev;
}
previousAspectRatio = currentAspectRatio;
}
}
public const string modGUID = "Oksamies.UltrawideOrLongFix";
public const string modName = "UltrawideOrLongFix";
public const string modVersion = "0.1.4";
public static ConfigEntry<bool> configAspectRatioFix;
public static ConfigEntry<bool> configFieldOfViewFix;
public static ConfigEntry<float> configFieldOfView;
public static ConfigEntry<bool> configAutoFieldOfView;
public static float previousAspectRatio;
public static float currentAspectRatio;
public static readonly float defaultAspectRatio = 1.7777778f;
public static bool fovSetOnce = false;
public static float sceneFoV = 33f;
public static bool menuFoVSet = false;
private readonly Harmony harmony = new Harmony("Oksamies.UltrawideOrLongFix");
public static ManualLogSource mls;
private void Awake()
{
mls = Logger.CreateLogSource("Oksamies.UltrawideOrLongFix");
configAspectRatioFix = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Aspect-ratio fix on/off", true, "In case aspect-ratio fix is broken or you want to disable aspect-ratio fixing, turn this to false");
configFieldOfViewFix = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Field of View Fix on/off", true, "In case field of view fix is broken or you want to disable FOV fixing, turn this to false");
configFieldOfView = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "Field of View", 70f, "Set this and turn Auto Field of View off to control it manually.");
configAutoFieldOfView = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Auto Field of View", true, "Automatically try to figure out a proper field of view for the window");
mls.LogInfo((object)"Oksamies.UltrawideOrLongFix is now awake!");
harmony.PatchAll();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "UltrawideOrLongFix";
public const string PLUGIN_NAME = "UltrawideOrLongFix";
public const string PLUGIN_VERSION = "0.1.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}