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.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
[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: AssemblyCompany("CustomZoom")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CustomZoom")]
[assembly: AssemblyTitle("CustomZoom")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 CustomZoom
{
[BepInPlugin("com.fizzy.customzoom", "CustomZoom", "1.0.0")]
public class CustomZoom : BaseUnityPlugin
{
public static ConfigEntry<float> ZoomChange;
private void Awake()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
((ConfigEntry<bool>)AccessTools.Field(typeof(Chainloader), "ConfigHideBepInExGOs").GetValue(null)).Value = true;
ZoomChange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ChangeZoomLevel", 0f, new ConfigDescription("Add a negative or positive zoom offset", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-4f, 6f), Array.Empty<object>()));
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"CustomZoom has been loaded");
}
}
[HarmonyPatch]
public static class PatchCam
{
[HarmonyPrefix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
private static bool OverrideZoom(ref float __result)
{
CamController inst = CamController.Inst;
float value = Traverse.Create((object)inst).Field("focusOriginalSize").GetValue<float>();
__result = value + CustomZoom.ZoomChange.Value;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
private static bool OverrideX(ref float __result)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
CamController inst = CamController.Inst;
float num = inst.followThemeLimitX[LevelMgr.Inst.CurrentRoomCfg.themeType] + LevelMgr.Inst.CurrentRoomCfg.camExtraLimitX;
num += CustomZoom.ZoomChange.Value;
num += inst.specificBorderConstraint;
if (GameMgr.IsMobile_Static)
{
num -= 1.55f;
}
__result = num;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
private static bool OverrideYUp(ref float __result)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
CamController inst = CamController.Inst;
float num = inst.followThemeLimitYUp[LevelMgr.Inst.CurrentRoomCfg.themeType] + LevelMgr.Inst.CurrentRoomCfg.camExtraLimitYUp;
num += CustomZoom.ZoomChange.Value;
num += inst.specificBorderConstraint;
if (GameMgr.IsMobile_Static)
{
num -= 1.55f;
}
__result = num;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
private static bool OverrideUDown(ref float __result)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
CamController inst = CamController.Inst;
float num = inst.followThemeLimitYDown[LevelMgr.Inst.CurrentRoomCfg.themeType] + LevelMgr.Inst.CurrentRoomCfg.camExtraLimitYDown;
num += CustomZoom.ZoomChange.Value;
num += inst.specificBorderConstraint;
if (GameMgr.IsMobile_Static)
{
num -= 1.55f;
}
__result = num;
return false;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "CustomZoom";
public const string PLUGIN_NAME = "CustomZoom";
public const string PLUGIN_VERSION = "1.0.0";
}
}