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 DysonSphereMods.Shared;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[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("Valoneu")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyDescription("Allows zooming further away from the mech.")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+aeaf3be073c3baa0546c330d4ba232f1f6633ec0")]
[assembly: AssemblyProduct("DysonSphereMods")]
[assembly: AssemblyTitle("FarZoom")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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;
}
}
}
namespace FarZoom
{
[BepInPlugin("com.Valoneu.FarZoom", "FarZoom", "1.0.1")]
[BepInProcess("DSPGAME.exe")]
public class FarZoomPlugin : BaseUnityPlugin
{
public static class FarZoomPatch
{
[HarmonyPatch(typeof(GameCamera), "Logic")]
[HarmonyPrefix]
public static void GameCamera_Logic_Prefix()
{
if (VFInput.shift && Mathf.Abs(VFInput.mouseWheel) > 0.0001f)
{
float num = ((VFInput.mouseWheel > 0f) ? 1.1f : 0.90909f);
CurrentFovMultiplier *= num;
CurrentFovMultiplier = Mathf.Clamp(CurrentFovMultiplier, 0.1f, 5f);
AccessTools.PropertySetter(typeof(VFInput), "mouseWheel").Invoke(null, new object[1] { 0f });
}
}
[HarmonyPatch(typeof(RTSPoser), "Calculate")]
[HarmonyPrefix]
public static void RTSPoser_Calculate_Prefix(RTSPoser __instance)
{
__instance.normalFov = 60f * CurrentFovMultiplier;
__instance.distMax = 57f * ZoomMultiplier.Value;
}
[HarmonyPatch(typeof(PlanetPoser), "Calculate")]
[HarmonyPrefix]
public static void PlanetPoser_Calculate_Prefix(PlanetPoser __instance)
{
__instance.normalFov = 60f * CurrentFovMultiplier;
}
[HarmonyPatch(typeof(GraticulePoser), "Calculate")]
[HarmonyPrefix]
public static void GraticulePoser_Calculate_Prefix(GraticulePoser __instance)
{
__instance.normalFov = 40f * CurrentFovMultiplier;
}
[HarmonyPatch(typeof(RTSPoser), "Calculate")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> RTSPoser_Calculate_Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
bool flag = false;
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Call && list[i].operand.ToString().Contains("Clamp01"))
{
list.Insert(i + 1, new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(FarZoomPlugin), "ZoomSpeedMultiplier")));
list.Insert(i + 2, new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.PropertyGetter(typeof(ConfigEntry<float>), "Value")));
list.Insert(i + 3, new CodeInstruction(OpCodes.Mul, (object)null));
flag = true;
break;
}
}
if (!flag)
{
Log.Warning((object)"RTSPoser_Calculate_Transpiler failed to find Clamp01");
}
return list;
}
[HarmonyPatch(typeof(GameCamera), "Logic")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> GameCamera_Logic_Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
bool flag = false;
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 58f)
{
list.Insert(i + 1, new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(FarZoomPlugin), "ZoomMultiplier")));
list.Insert(i + 2, new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.PropertyGetter(typeof(ConfigEntry<float>), "Value")));
list.Insert(i + 3, new CodeInstruction(OpCodes.Mul, (object)null));
i += 3;
flag = true;
}
}
if (!flag)
{
Log.Warning((object)"GameCamera_Logic_Transpiler failed to find 58f");
}
return list;
}
}
public const string MOD_GUID = "com.Valoneu.FarZoom";
public const string MOD_NAME = "FarZoom";
public const string MOD_VERSION = "1.0.1";
public static ConfigEntry<float> ZoomMultiplier;
public static ConfigEntry<float> ZoomSpeedMultiplier;
public static float CurrentFovMultiplier = 1f;
private void Awake()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
ZoomMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ZoomMultiplier", 2f, "Multiplier for the maximum zoom distance in Mech/Build mode. Default is 2.0 (2x vanilla).");
ZoomSpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ZoomSpeedMultiplier", 1f, "Multiplier for the zoom speed in Mech/Build mode. Default is 1.0 (vanilla speed).");
Log.Init(((BaseUnityPlugin)this).Logger);
new Harmony("com.Valoneu.FarZoom").PatchAll(typeof(FarZoomPatch));
((BaseUnityPlugin)this).Logger.LogInfo((object)"FarZoom v1.0.1 loaded!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.Valoneu.FarZoom";
public const string PLUGIN_NAME = "FarZoom";
public const string PLUGIN_VERSION = "1.0.1";
}
}