Decompiled source of QuickLoad v0.1.0

QuickLoad.dll

Decompiled 3 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.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("QuickLoad")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QuickLoad")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5963B14D-78EF-42C8-AF2D-00169547F284")]
[assembly: AssemblyFileVersion("0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
namespace QuickLoad;

[HarmonyPatch]
public static class Patches
{
	private static bool firstLoad = true;

	[HarmonyPatch(typeof(MainMenu), "Start")]
	[HarmonyPostfix]
	private static void MainMenu_Awake_Postfix(MainMenu __instance)
	{
		if (firstLoad)
		{
			firstLoad = false;
			int @int = PlayerPrefs.GetInt("MS_QuickLoad_LastProfile", -1);
			if (@int >= 0 && @int < __instance.profileSlots.Length && __instance.profileSlots[@int].profile != null)
			{
				__instance.profileSlots[@int].OnPlayConfirm();
			}
		}
	}

	[HarmonyPatch(typeof(ProfileSlot), "OnPlayConfirm")]
	[HarmonyPostfix]
	private static void ProfileSlot_OnPlayConfirm_Postfix(ProfileSlot __instance)
	{
		PlayerPrefs.SetInt("MS_QuickLoad_LastProfile", __instance.slot);
		Plugin.Log.LogInfo((object)$"Set last profile to {__instance.slot}");
	}
}
[BepInPlugin("com.maxsch.BelowTheStone.QuickLoad", "QuickLoad", "0.1.0")]
public class Plugin : BaseUnityPlugin
{
	public const string PluginGUID = "com.maxsch.BelowTheStone.QuickLoad";

	public const string PluginName = "QuickLoad";

	public const string PluginVersion = "0.1.0";

	public static ManualLogSource Log { get; private set; }

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("com.maxsch.BelowTheStone.QuickLoad");
		val.PatchAll();
		Log = ((BaseUnityPlugin)this).Logger;
	}
}