Decompiled source of Fast Load v1.0.1

LoadToSave.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne.Persistence;
using LoadToSave;
using MelonLoader;
using Microsoft.CodeAnalysis;
using ModManagerPhoneApp;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(EntryPoint), "LoadToSave", "1.0.0", "_peron", null)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("LoadToSave")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LoadToSave")]
[assembly: AssemblyTitle("LoadToSave")]
[assembly: AssemblyVersion("1.0.0.0")]
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 LoadToSave
{
	public class EntryPoint : MelonMod
	{
		[HarmonyPatch(typeof(LoadManager))]
		public class PlayerConfig
		{
			[HarmonyPatch("RefreshSaveInfo")]
			[HarmonyPostfix]
			public static void Selected(LoadManager __instance)
			{
				if (!ModExecuted)
				{
					__instance.StartGame(((Il2CppArrayBase<SaveInfo>)(object)LoadManager.SaveGames)[(int)_entry.BoxedValue - 1], false);
					ModExecuted = true;
				}
			}
		}

		private static MelonPreferences_Category? _cat;

		private static MelonPreferences_Entry? _entry;

		public static bool ModExecuted;

		public override void OnInitializeMelon()
		{
			_cat = MelonPreferences.CreateCategory("LoadToSave_LoadToSaveCategory", "LoadToSave - Config");
			_entry = _cat.CreateEntry<int>("LoadToSave_SaveToLoad", 1, "SaveToLoad", false);
			_cat.SetFilePath("UserData/LoadToSave.cfg");
			_cat.SaveToFile(true);
			try
			{
				ModSettingsEvents.OnPreferencesSaved += LoadAllCategories;
				((MelonBase)this).LoggerInstance.Msg("Successfully subscribed to Mod Manager save event.");
			}
			catch (Exception ex)
			{
				((MelonBase)this).LoggerInstance.Warning("Could not subscribe to Mod Manager event (Mod Manager may not be installed/compatible): " + ex.Message);
			}
		}

		public static void LoadAllCategories()
		{
			foreach (MelonPreferences_Category category in MelonPreferences.Categories)
			{
				category.LoadFromFile(true);
			}
		}
	}
}