using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("PEAKInvertY")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PEAKInvertY")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ef60b004-c2f4-467e-8167-32f628fe0b4b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("kaosz.PEAKInvertY", "PEAK Force Invert Pitch", "1.0.0")]
[BepInProcess("PEAK.exe")]
public class PEAKForceInvertPitch : BaseUnityPlugin
{
private static PEAKForceInvertPitch Instance;
private static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger;
private void Awake()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected O, but got Unknown
Instance = this;
Log.LogInfo((object)"PEAKForceInvertPitch Awake()");
Harmony val = new Harmony("kaosz.PEAKInvertY");
Type type = AccessTools.TypeByName("MainCameraMovement");
if (type == null)
{
Log.LogError((object)"MainCameraMovement not found!");
return;
}
MethodInfo methodInfo = AccessTools.Method(type, "LateUpdate", Array.Empty<Type>(), (Type[])null);
if (methodInfo == null)
{
Log.LogError((object)"MainCameraMovement.LateUpdate() not found!");
return;
}
val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(PEAKForceInvertPitch), "LateUpdate_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
Log.LogInfo((object)"Patched MainCameraMovement.LateUpdate");
}
private static void LateUpdate_Postfix(object __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
try
{
Transform transform = ((Component)(MonoBehaviour)__instance).transform;
Vector3 localEulerAngles = transform.localEulerAngles;
localEulerAngles.x = 0f - NormalizeAngle(localEulerAngles.x);
transform.localEulerAngles = localEulerAngles;
}
catch (Exception ex)
{
Log.LogError((object)("ForceInvertPitch failed: " + ex));
}
}
private static float NormalizeAngle(float a)
{
a %= 360f;
if (a > 180f)
{
a -= 360f;
}
if (a < -180f)
{
a += 360f;
}
return a;
}
}