using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using ComputerysModdingUtilities;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: StraftatMod(false)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Koki")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+445113a778a965e85d9148a65305acd1866447f3")]
[assembly: AssemblyProduct("CameraTweaks")]
[assembly: AssemblyTitle("CameraTweaks")]
[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;
}
}
}
[HarmonyPatch(typeof(FirstPersonController), "ApplyFinalMovements")]
internal class RemoveCameraShake
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Expected O, but got Unknown
FieldInfo fieldInfo = AccessTools.Field(typeof(FirstPersonController), "highFallShakeHeight");
MethodInfo methodInfo = AccessTools.Method(typeof(RemoveCameraShake), "FallSound", (Type[])null, (Type[])null);
CodeMatcher obj = new CodeMatcher(instructions, generator).MatchForward(true, (CodeMatch[])(object)new CodeMatch[2]
{
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo, (string)null),
new CodeMatch((OpCode?)OpCodes.Ble_Un, (object)null, (string)null)
});
Label label = (Label)obj.Operand;
return obj.Advance(1).Insert((CodeInstruction[])(object)new CodeInstruction[3]
{
new CodeInstruction(OpCodes.Ldarg_0, (object)null),
new CodeInstruction(OpCodes.Call, (object)methodInfo),
new CodeInstruction(OpCodes.Br, (object)label)
}).InstructionEnumeration();
}
private static void FallSound(FirstPersonController fpc)
{
fpc.PlaySoundServer(21);
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.koki.cameratweaks", "Camera Tweaks", "1.0.0")]
public class CTPlugin : BaseUnityPlugin
{
private Harmony _harmony = new Harmony("com.koki.cameratweaks");
private ConfigEntry<bool> _enableMod;
private void Awake()
{
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
_enableMod = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Mod", true, (ConfigDescription)null);
((BaseUnityPlugin)this).Config.SettingChanged += ApplyConfig;
if (_enableMod.Value)
{
_harmony.PatchAll();
}
}
private void ApplyConfig(object sender, EventArgs e)
{
_harmony.UnpatchSelf();
if (_enableMod.Value)
{
_harmony.PatchAll();
}
}
private void OnDestroy()
{
_harmony.UnpatchSelf();
}
}
namespace CameraTweaks
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.koki.cameratweaks";
public const string PLUGIN_NAME = "Camera Tweaks";
public const string PLUGIN_VERSION = "1.0.0";
}
}