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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SoDSteadyTurning")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("SoDSteadyTurning")]
[assembly: AssemblyTitle("SoDSteadyTurning")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 SoDSteadyTurning
{
[BepInPlugin("sm3gm.sod.steadyturning", "Turn Speed Fix", "1.0.0")]
public sealed class Plugin : BasePlugin
{
public const string VER = "1.0.0";
internal static ManualLogSource L;
internal static ConfigEntry<bool> Enabled;
internal static ConfigEntry<float> ReferenceFps;
public override void Load()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
L = ((BasePlugin)this).Log;
Enabled = ((BasePlugin)this).Config.Bind<bool>("Turning", "Enabled", true, "Make controller turning speed the same at any frame rate.");
ReferenceFps = ((BasePlugin)this).Config.Bind<float>("Turning", "ReferenceFps", 60f, "Frame rate whose turning speed is kept. 60 = the speed you get at 60 fps now. Raise it to turn faster everywhere.");
new Harmony("sm3gm.sod.steadyturning").PatchAll(typeof(Look));
ManualLogSource l = L;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Turn Speed Fix ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded");
}
l.LogInfo(val);
}
}
[HarmonyPatch(typeof(MouseLook), "LookRotation")]
internal static class Look
{
private static int logged;
private static void Prefix(out Vector2 __state)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Expected O, but got Unknown
__state = new Vector2(-1f, -1f);
try
{
if (!Plugin.Enabled.Value)
{
return;
}
InputController instance = InputController.Instance;
Game instance2 = Game.Instance;
if ((Object)(object)instance == (Object)null || (Object)(object)instance2 == (Object)null || instance.mouseInputMode)
{
return;
}
float deltaTime = Time.deltaTime;
if (deltaTime <= 0f)
{
return;
}
float num = Mathf.Clamp(deltaTime * Plugin.ReferenceFps.Value, 0.25f, 4f);
if (Mathf.Abs(num - 1f) < 0.02f)
{
return;
}
__state = instance2.controllerSensitivity;
instance2.controllerSensitivity = __state * num;
if (logged < 3 && num > 1.5f)
{
logged++;
ManualLogSource l = Plugin.L;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(38, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[TURN] frame ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(deltaTime * 1000f, "0");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ms: stick input scaled x");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num, "0.0");
}
l.LogInfo(val);
}
}
catch
{
}
}
private static void Postfix(Vector2 __state)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (__state.x < 0f)
{
return;
}
try
{
Game.Instance.controllerSensitivity = __state;
}
catch
{
}
}
}
}