using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("LODSettings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7e9b9e4aed71e757c8a24233600db23db9640841")]
[assembly: AssemblyProduct("LODSettings")]
[assembly: AssemblyTitle("LODSettings")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LODSettings
{
[BepInPlugin("com.cabeca143.LODSettings", "LODSettings", "1.0.0")]
public class LODSettingsPlugin : BasePlugin
{
private const string MyGUID = "com.cabeca143.LODSettings";
private const string PluginName = "LODSettings";
private const string VersionString = "1.0.0";
internal static ManualLogSource Logger;
internal static ConfigEntry<float> LodBiasConfig;
public override void Load()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Expected O, but got Unknown
Logger = ((BasePlugin)this).Log;
LodBiasConfig = ((BasePlugin)this).Config.Bind<float>("General", "LOD Bias", 7.5f, new ConfigDescription("Adjust the Level of Detail (LOD) bias to fix asset pop-in. Higher values render high-quality objects further away.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>()));
LodBiasConfig.SettingChanged += delegate
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
float num = (float)Math.Round(LodBiasConfig.Value, 2);
if (LodBiasConfig.Value != num)
{
LodBiasConfig.Value = num;
}
else
{
QualitySettings.lodBias = num;
ManualLogSource logger3 = Logger;
bool flag2 = default(bool);
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(25, 1, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("LOD Bias updated live to ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(num);
}
logger3.LogInfo(val2);
}
};
ManualLogSource logger = Logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Patching Camera...");
}
logger.LogInfo(val);
Harmony.CreateAndPatchAll(typeof(LODSettingsPlugin), (string)null);
ManualLogSource logger2 = Logger;
val = new BepInExInfoLogInterpolatedStringHandler(5, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Done!");
}
logger2.LogInfo(val);
}
[HarmonyPatch(typeof(CameraManager), "Awake")]
[HarmonyPostfix]
private static void RenderDistance_BruteForce_Patch()
{
QualitySettings.lodBias = LodBiasConfig.Value;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}