Decompiled source of GUI Scale Unlocked v1.0.0

GUI Scale Unlocked/plugins/GUIScaleUnlocked.dll

Decompiled 2 months ago
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 HarmonyLib;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("GUIScaleUnlocked")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GUIScaleUnlocked")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("45cdc1bb-7fb9-4a40-967a-4ef9c5218ef7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace GUIScaleUnlocked;

[BepInPlugin("professionalliar.GUIScaleUnlocked", "GUI Scale Unlocked", "1.0.0")]
[BepInProcess("valheim.exe")]
public class GUIScaleUnlocked : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Settings), "Awake")]
	private class GUISliderPatch
	{
		public static void Prefix(ref Slider ___m_guiScaleSlider)
		{
			___m_guiScaleSlider.maxValue = guiScaleMax.Value;
		}
	}

	private readonly Harmony harmony = new Harmony("professionalliar.GUIScaleUnlocked");

	public static ConfigEntry<float> guiScaleMax;

	private string section;

	private void Awake()
	{
		harmony.PatchAll();
		section = "User Interface Settings";
		guiScaleMax = ((BaseUnityPlugin)this).Config.Bind<float>(section, "guiScaleMax", 150f, "The maximum value of the GUI Scale slider found under the settings Misc tab. The vanilla game value is 115%.");
	}
}