Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MiniMapHeeler v1.1.0
MiniMapHeeler.dll
Decompiled a week agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using MiniMapHeeler.Configuration; using MiniMapHeeler.Layout; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MiniMapHeeler")] [assembly: AssemblyDescription("Client-side HUD minimap resizer with 1:1 terrain scaling, expanded zoom range, and clean HUD alignment for Valheim.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("dreamwraith (https://github.com/dreamwraith)")] [assembly: AssemblyProduct("MiniMapHeeler")] [assembly: AssemblyCopyright("Copyright © 2026 dreamwraith")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("cb624f27-7f85-4532-9c46-a57ddd01ea0b")] [assembly: AssemblyFileVersion("1.1.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.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.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] [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; } } [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 MiniMapHeeler { [BepInPlugin("dreamwraith.MiniMapHeeler", "MiniMapHeeler", "1.1.0")] public class Plugin : BaseUnityPlugin { public const string ModGUID = "dreamwraith.MiniMapHeeler"; public const string ModName = "MiniMapHeeler"; public const string ModVersion = "1.1.0"; internal static ManualLogSource Log; private Harmony? _harmony; internal static Plugin? Instance { get; private set; } private void Awake() { Instance = this; Log = ((BaseUnityPlugin)this).Logger; ModConfig.Initialize(((BaseUnityPlugin)this).Config); _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "dreamwraith.MiniMapHeeler"); Log.LogInfo((object)"MiniMapHeeler v1.1.0 loaded successfully."); } private void OnDestroy() { Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } internal static void LogDebug(string message) { if (ModConfig.EnableDebugLogs != null && ModConfig.EnableDebugLogs.Value) { Log.LogInfo((object)("[DEBUG] " + message)); } } } internal static class VersionInfo { public const string Version = "1.1.0"; } } namespace MiniMapHeeler.Patches { [HarmonyPatch(typeof(Hud))] internal static class HudPatches { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void AwakePostfix(Hud __instance) { MinimapManager.InitializeHud(__instance); } } [HarmonyPatch(typeof(Minimap))] internal static class MinimapPatches { public const float HardcodedDefaultZoom = 0.015f; public const float HardcodedMinZoom = 0.002f; public const float HardcodedMaxZoom = 1f; [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] private static bool SetSmallZoomPrefix(Minimap __instance, ref float value) { if (!ModConfig.EnableMod.Value) { return true; } float smallZoom = __instance.SmallZoom; bool num = Mathf.Approximately(value, smallZoom * 0.5f); bool flag = Mathf.Approximately(value, smallZoom * 1.5f); if (num) { Plugin.LogDebug(string.Format(arg1: __instance.m_smallZoom = Mathf.Clamp(smallZoom / 1.5f, 0.002f, 1f), format: "Zoom in: {0:F4} -> {1:F4}", arg0: smallZoom)); return false; } if (flag) { Plugin.LogDebug(string.Format(arg1: __instance.m_smallZoom = Mathf.Clamp(smallZoom * 1.5f, 0.002f, 1f), format: "Zoom out: {0:F4} -> {1:F4}", arg0: smallZoom)); return false; } __instance.m_smallZoom = Mathf.Clamp(value, 0.002f, 1f); return false; } [HarmonyPostfix] [HarmonyPatch("Start")] private static void StartPostfix(Minimap __instance) { MinimapManager.InitializeMinimap(__instance); } [HarmonyPostfix] [HarmonyPatch("SetMapMode")] private static void SetMapModePostfix(MapMode mode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)mode == 1) { MinimapManager.ApplyLayout(); } } [HarmonyPostfix] [HarmonyPatch("CenterMap", new Type[] { typeof(Vector3) })] private static void CenterMapPostfix(Minimap __instance, Vector3 centerPoint) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (ModConfig.EnableMod.Value && (int)__instance.m_mode == 1 && Object.op_Implicit((Object)(object)__instance.m_mapImageSmall)) { float num = Mathf.Max(50f, ModConfig.MinimapWidth.Value); float num2 = Mathf.Max(50f, ModConfig.MinimapHeight.Value); float innerWidth = num - 12f; float innerHeight = num2 - 12f; MinimapManager.UpdateViewportUv(__instance, innerWidth, innerHeight, centerPoint); } } } } namespace MiniMapHeeler.Layout { internal static class MinimapManager { public static Vector2 BaseRootSize = new Vector2(200f, 200f); public static Vector2 BaseRootPosition = new Vector2(-40f, -40f); public static Vector2 BaseStatusPosition = new Vector2(-271f, -45f); public static Vector2 BaseWindPosition = new Vector2(-78f, -78f); public const float HardcodedStatusEffectsClearance = 220f; public const float NativeMapPadding = 12f; public const float NativeMapInnerSize = 188f; public const float NativeStatusGap = 31f; public static bool MinimapInitialized; public static bool HudInitialized; private static bool s_capturedMinimapDefaults; private static bool s_capturedHudDefaults; public static void InitializeMinimap(Minimap minimapInstance) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (!s_capturedMinimapDefaults) { if ((Object)(object)minimapInstance.m_smallRoot != (Object)null) { RectTransform component = minimapInstance.m_smallRoot.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { BaseRootPosition = component.anchoredPosition; BaseRootSize = component.sizeDelta; } } if ((Object)(object)minimapInstance.m_windMarker != (Object)null) { BaseWindPosition = minimapInstance.m_windMarker.anchoredPosition; } s_capturedMinimapDefaults = true; Plugin.LogDebug($"Minimap defaults captured: BaseRootSize={BaseRootSize}, BaseRootPosition={BaseRootPosition}, BaseWindPosition={BaseWindPosition}"); } MinimapInitialized = true; if (ModConfig.EnableMod.Value) { minimapInstance.SmallZoom = 0.015f; } ApplyLayout(); } public static void InitializeHud(Hud hudInstance) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (!s_capturedHudDefaults) { if ((Object)(object)hudInstance.m_statusEffectListRoot != (Object)null) { BaseStatusPosition = hudInstance.m_statusEffectListRoot.anchoredPosition; } s_capturedHudDefaults = true; Plugin.LogDebug($"HUD defaults captured: BaseStatusPosition={BaseStatusPosition}"); } HudInitialized = true; ApplyLayout(); } public static void UpdateViewportUv(Minimap minimapInstance, float innerWidth, float innerHeight, Vector3? centerWorldPosition = null) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) //IL_0096: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)minimapInstance == (Object)null) && !((Object)(object)minimapInstance.m_mapImageSmall == (Object)null)) { Vector3 val = (Vector3)(((??)centerWorldPosition) ?? (((Object)(object)Player.m_localPlayer != (Object)null) ? ((Component)Player.m_localPlayer).transform.position : Vector3.zero)); float num = default(float); float num2 = default(float); minimapInstance.WorldToMapPoint(val, ref num, ref num2); Rect uvRect = minimapInstance.m_mapImageSmall.uvRect; ((Rect)(ref uvRect)).width = minimapInstance.SmallZoom * (innerWidth / 188f); ((Rect)(ref uvRect)).height = minimapInstance.SmallZoom * (innerHeight / 188f); ((Rect)(ref uvRect)).center = new Vector2(num, num2); minimapInstance.m_mapImageSmall.uvRect = uvRect; } } public static void ApplyLayout() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) if (!MinimapInitialized || (Object)(object)Minimap.instance == (Object)null || (Object)(object)Minimap.instance.m_smallRoot == (Object)null) { return; } if (!ModConfig.EnableMod.Value) { RestoreDefaults(); return; } float num = Mathf.Max(50f, ModConfig.MinimapWidth.Value); float num2 = Mathf.Max(50f, ModConfig.MinimapHeight.Value); RectTransform val = default(RectTransform); if (!Minimap.instance.m_smallRoot.TryGetComponent<RectTransform>(ref val)) { return; } val.sizeDelta = new Vector2(num, num2); if (ModConfig.ShiftBelowStatusEffects.Value && HudInitialized) { float num3 = BaseStatusPosition.y - 220f + ModConfig.PositionOffsetY.Value; val.anchoredPosition = new Vector2(BaseRootPosition.x + ModConfig.PositionOffsetX.Value, num3); } else { val.anchoredPosition = new Vector2(BaseRootPosition.x + ModConfig.PositionOffsetX.Value, BaseRootPosition.y + ModConfig.PositionOffsetY.Value); } if (HudInitialized && Object.op_Implicit((Object)(object)Hud.instance) && Object.op_Implicit((Object)(object)Hud.instance.m_statusEffectListRoot)) { if (ModConfig.ShiftBelowStatusEffects.Value) { Hud.instance.m_statusEffectListRoot.anchoredPosition = new Vector2(BaseRootPosition.x, BaseStatusPosition.y); } else { float num4 = BaseRootPosition.x + ModConfig.PositionOffsetX.Value - num - 31f; Hud.instance.m_statusEffectListRoot.anchoredPosition = new Vector2(num4, BaseStatusPosition.y); } } if (Object.op_Implicit((Object)(object)Minimap.instance.m_windMarker)) { float num5 = (num - 12f) / 2f; float num6 = (num2 - 12f) / 2f; Minimap.instance.m_windMarker.anchoredPosition = new Vector2(0f - num5 + 16f, 0f - num6 + 16f); } float innerWidth = num - 12f; float innerHeight = num2 - 12f; UpdateViewportUv(Minimap.instance, innerWidth, innerHeight); Minimap.instance.m_pinUpdateRequired = true; RefreshPins(); Plugin.LogDebug($"Layout applied: size=({num:F0}x{num2:F0}), pos={val.anchoredPosition}, " + "statusPos=" + ((Object.op_Implicit((Object)(object)Hud.instance) && Object.op_Implicit((Object)(object)Hud.instance.m_statusEffectListRoot)) ? ((object)Hud.instance.m_statusEffectListRoot.anchoredPosition/*cast due to .constrained prefix*/).ToString() : "N/A") + ", " + $"shiftBelow={ModConfig.ShiftBelowStatusEffects.Value}"); } public static void RefreshPins() { if (!MinimapInitialized || !Object.op_Implicit((Object)(object)Minimap.instance)) { return; } try { Minimap.instance.UpdatePins(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Failed to update minimap pins: " + ex.Message)); Plugin.LogDebug($"UpdatePins exception details: {ex}"); } } public static void RestoreDefaults() { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (MinimapInitialized && Object.op_Implicit((Object)(object)Minimap.instance) && Object.op_Implicit((Object)(object)Minimap.instance.m_smallRoot)) { RectTransform val = default(RectTransform); if (Minimap.instance.m_smallRoot.TryGetComponent<RectTransform>(ref val)) { val.sizeDelta = BaseRootSize; val.anchoredPosition = BaseRootPosition; } if (Object.op_Implicit((Object)(object)Minimap.instance.m_windMarker)) { Minimap.instance.m_windMarker.anchoredPosition = BaseWindPosition; } Minimap.instance.SmallZoom = 0.01f; UpdateViewportUv(Minimap.instance, 188f, 188f); Minimap.instance.m_pinUpdateRequired = true; RefreshPins(); } if (HudInitialized && Object.op_Implicit((Object)(object)Hud.instance) && Object.op_Implicit((Object)(object)Hud.instance.m_statusEffectListRoot)) { Hud.instance.m_statusEffectListRoot.anchoredPosition = BaseStatusPosition; } Plugin.LogDebug("Restored native minimap and HUD layout defaults."); } } } namespace MiniMapHeeler.Configuration { internal class ConfigurationManagerAttributes { public bool? IsAdvanced { get; set; } public int? Order { get; set; } public bool? Browsable { get; set; } public Action<ConfigEntryBase>? CustomDrawer { get; set; } } internal static class ModConfig { public static ConfigEntry<bool> EnableMod; public static ConfigEntry<float> MinimapWidth; public static ConfigEntry<float> MinimapHeight; public static ConfigEntry<bool> ShiftBelowStatusEffects; public static ConfigEntry<float> PositionOffsetX; public static ConfigEntry<float> PositionOffsetY; public static ConfigEntry<bool> EnableDebugLogs; public static void Initialize(ConfigFile config) { EnableMod = Bind(config, "1 - General", "EnableMod", defaultValue: true, "Master switch to enable or disable the functionality of this mod."); MinimapWidth = Bind(config, "2 - Dimensions", "MinimapWidth", 200f, "Width of the top-corner HUD minimap in canvas UI units (native default is 200; scales with UI scale).", (AcceptableValueBase?)(object)new AcceptableValueRange<float>(100f, 1920f)); MinimapHeight = Bind(config, "2 - Dimensions", "MinimapHeight", 200f, "Height of the top-corner HUD minimap in canvas UI units (native default is 200; scales with UI scale).", (AcceptableValueBase?)(object)new AcceptableValueRange<float>(100f, 1080f)); ShiftBelowStatusEffects = Bind(config, "3 - HUD Placement", "ShiftBelowStatusEffects", defaultValue: false, "When true, shifts status effect icons to the right screen edge without raising them, and places the minimap below them."); PositionOffsetX = Bind(config, "3 - HUD Placement", "PositionOffsetX", 0f, "Horizontal offset in canvas UI units from default position.", (AcceptableValueBase?)(object)new AcceptableValueRange<float>(-1920f, 1920f)); PositionOffsetY = Bind(config, "3 - HUD Placement", "PositionOffsetY", 0f, "Vertical offset in canvas UI units from default position.", (AcceptableValueBase?)(object)new AcceptableValueRange<float>(-1080f, 1080f)); EnableDebugLogs = Bind(config, "9 - Debug", "EnableDebugLogs", defaultValue: false, "Enables verbose diagnostic logging in the console and Player.log.", null, new ConfigurationManagerAttributes { IsAdvanced = true }); EnableMod.SettingChanged += delegate { MinimapManager.ApplyLayout(); }; MinimapWidth.SettingChanged += delegate { MinimapManager.ApplyLayout(); }; MinimapHeight.SettingChanged += delegate { MinimapManager.ApplyLayout(); }; ShiftBelowStatusEffects.SettingChanged += delegate { MinimapManager.ApplyLayout(); }; PositionOffsetX.SettingChanged += delegate { MinimapManager.ApplyLayout(); }; PositionOffsetY.SettingChanged += delegate { MinimapManager.ApplyLayout(); }; } private static ConfigEntry<T> Bind<T>(ConfigFile configFile, string section, string key, T defaultValue, string description, AcceptableValueBase? acceptableValues = null, ConfigurationManagerAttributes? customAttributes = null) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown return configFile.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, new object[1] { customAttributes })); } } }