using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using API;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using ChainedPuzzles;
using DebugScanLines.BepInEx;
using FluffyUnderware.Curvy;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Analytics;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DebugScanLines")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6a095134fc7cfc1d00183f8303fb74a344b6a103")]
[assembly: AssemblyProduct("DebugScanLines")]
[assembly: AssemblyTitle("DebugScanLines")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
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;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[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;
}
}
}
namespace DebugScanLines
{
[HarmonyPatch]
internal static class Fix
{
public class DebugHolopath : MonoBehaviour
{
public CP_Holopath_Spline? spline;
public float totalDistance;
public void Update()
{
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)spline == (Object)null || !spline.m_isVisible)
{
return;
}
List<CurvySplineSegment> controlPoints = spline.CurvySpline.controlPoints;
if (controlPoints.Count == 0)
{
return;
}
float num = 0f;
float num2 = spline.CurvyExtrusion.To * totalDistance;
for (int i = 1; i < controlPoints.Count; i++)
{
if (!(num <= num2))
{
break;
}
Vector3 val = ((Component)controlPoints[i]).transform.position - ((Component)controlPoints[i - 1]).transform.position;
float magnitude = ((Vector3)(ref val)).magnitude;
float num3 = 1f;
float num4 = num2 - num;
if (num4 < magnitude)
{
num3 = num4 / magnitude;
}
float num5 = Mathf.Min(Vector3.Distance(((Component)Camera.main).transform.position, ((Component)controlPoints[i]).transform.position), Vector3.Distance(((Component)Camera.main).transform.position, ((Component)controlPoints[i - 1]).transform.position));
float num6 = 1f / num5;
Fig.DrawLine(((Component)controlPoints[i - 1]).transform.position, ((Component)controlPoints[i - 1]).transform.position + val * num3, new Color(ConfigManager.R, ConfigManager.G, ConfigManager.B, ConfigManager.A), num6 * ConfigManager.Thickness);
num += magnitude;
}
}
}
[HarmonyPatch(typeof(CP_Holopath_Spline), "GeneratePath")]
[HarmonyPostfix]
private static void Postfix_CP_Holopath_GeneratePath(CP_Holopath_Spline __instance)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
DebugHolopath debugHolopath = ((Component)__instance).gameObject.AddComponent<DebugHolopath>();
debugHolopath.spline = __instance;
debugHolopath.totalDistance = 0f;
List<CurvySplineSegment> controlPoints = __instance.CurvySpline.controlPoints;
if (controlPoints.Count != 0)
{
for (int i = 1; i < controlPoints.Count; i++)
{
float totalDistance = debugHolopath.totalDistance;
Vector3 val = ((Component)controlPoints[i]).transform.position - ((Component)controlPoints[i - 1]).transform.position;
debugHolopath.totalDistance = totalDistance + ((Vector3)(ref val)).magnitude;
}
}
}
}
}
namespace DebugScanLines.BepInEx
{
public static class Module
{
public const string GUID = "randomuserhi.AMDScanLineFix";
public const string Name = "AMDScanLineFix";
public const string Version = "0.0.2";
}
public static class ConfigManager
{
public static ConfigFile configFile;
private static ConfigEntry<bool> debug;
private static ConfigEntry<float> thickness;
private static ConfigEntry<float> r;
private static ConfigEntry<float> g;
private static ConfigEntry<float> b;
private static ConfigEntry<float> a;
public static bool Debug
{
get
{
return debug.Value;
}
set
{
debug.Value = value;
}
}
public static float Thickness
{
get
{
return thickness.Value;
}
set
{
thickness.Value = value;
}
}
public static float R
{
get
{
return r.Value;
}
set
{
r.Value = value;
}
}
public static float G
{
get
{
return g.Value;
}
set
{
g.Value = value;
}
}
public static float B
{
get
{
return b.Value;
}
set
{
b.Value = value;
}
}
public static float A
{
get
{
return a.Value;
}
set
{
a.Value = value;
}
}
static ConfigManager()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
configFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "AMDScanLineFix.cfg"), true);
debug = configFile.Bind<bool>("Debug", "enable", false, "Enables debug messages when true.");
thickness = configFile.Bind<float>("Settings", "Thickness", 8f, "Thickness of holopath.");
r = configFile.Bind<float>("Settings", "Red", 1f, "Red channel.");
g = configFile.Bind<float>("Settings", "Green", 1f, "Green channel.");
b = configFile.Bind<float>("Settings", "Blue", 1f, "Blue channel.");
a = configFile.Bind<float>("Settings", "Alpha", 1f, "Alpha channel.");
}
}
[BepInPlugin("randomuserhi.AMDScanLineFix", "AMDScanLineFix", "0.0.2")]
public class Plugin : BasePlugin
{
private static Harmony? harmony;
public override void Load()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
APILogger.Log("Plugin is loaded!");
harmony = new Harmony("randomuserhi.AMDScanLineFix");
harmony.PatchAll();
ClassInjector.RegisterTypeInIl2Cpp<Fix.DebugHolopath>();
APILogger.Log("Debug is " + (ConfigManager.Debug ? "Enabled" : "Disabled"));
}
}
}
namespace API
{
[HarmonyPatch(typeof(GameDataInit))]
internal class GameDataInit_Patches
{
[HarmonyPatch("Initialize")]
[HarmonyWrapSafe]
[HarmonyPostfix]
public static void Initialize_Postfix()
{
Analytics.enabled = false;
}
}
internal static class APILogger
{
private static readonly ManualLogSource logger;
static APILogger()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
logger = new ManualLogSource("Rand-API");
Logger.Sources.Add((ILogSource)(object)logger);
}
private static string Format(string module, object msg)
{
return $"[{module}]: {msg}";
}
public static void Info(string module, object data)
{
logger.LogMessage((object)Format(module, data));
}
public static void Verbose(string module, object data)
{
}
public static void Log(object data)
{
logger.LogDebug((object)Format("AMDScanLineFix", data));
}
public static void Debug(object data)
{
if (ConfigManager.Debug)
{
Log(data);
}
}
public static void Warn(object data)
{
logger.LogWarning((object)Format("AMDScanLineFix", data));
}
public static void Error(object data)
{
logger.LogError((object)Format("AMDScanLineFix", data));
}
}
}