Decompiled source of LegacyCameraEnabler v2.1.2

Mods/LegacyCameraEnabler.dll

Decompiled 2 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Il2CppRUMBLE.Utilities;
using Legacy_Camera_Enabler;
using MelonLoader;
using RumbleModUI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(LegacyCameraStart), "LegacyCameraEnabler", "2.1.2", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 6, 6, true)]
[assembly: AssemblyTitle("LIV Camera Enabler")]
[assembly: AssemblyDescription("Start playing Rumble with the F10 Camera Active")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LIV Camera Enabler")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ce5c6056-f5fe-45d6-92f5-42037a30db8f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Legacy_Camera_Enabler;

public static class ModBuildInfo
{
	public const string Name = "LegacyCameraEnabler";

	public const string Version = "2.1.2";
}
public class LegacyCameraStart : MelonMod
{
	private string currentScene = "Loader";

	private RecordingCamera recordingCamera;

	public static Mod LegacyCameraEnabler = new Mod();

	private bool enabled = false;

	public override void OnLateInitializeMelon()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Expected O, but got Unknown
		LegacyCameraEnabler.ModName = "LegacyCameraEnabler";
		LegacyCameraEnabler.ModVersion = "2.1.2";
		LegacyCameraEnabler.SetFolder("LegacyCameraEnabler");
		LegacyCameraEnabler.AddToList("Enabled", true, 0, "Enable/Disable Mod", new Tags());
		LegacyCameraEnabler.GetFromFile();
		UI.instance.UI_Initialized += UIInit;
		LegacyCameraEnabler.ModSaved += Save;
		Save();
	}

	private void Save()
	{
		enabled = (bool)LegacyCameraEnabler.Settings[0].SavedValue;
		if (currentScene != "Loader")
		{
			if (enabled)
			{
				recordingCamera.OnLegacyRecordingCameraEnabledChanged(true);
				recordingCamera.SaveConfiguration();
			}
			else
			{
				recordingCamera.OnLegacyRecordingCameraEnabledChanged(false);
				recordingCamera.SaveConfiguration();
			}
		}
	}

	private void UIInit()
	{
		UI.instance.AddMod(LegacyCameraEnabler);
	}

	public void UpdateCamera()
	{
		try
		{
			if (enabled)
			{
				recordingCamera.OnLegacyRecordingCameraEnabledChanged(true);
				recordingCamera.SaveConfiguration();
			}
		}
		catch
		{
		}
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		currentScene = sceneName;
		if (currentScene == "Loader")
		{
			recordingCamera = Singleton<RecordingCamera>.instance;
		}
		else
		{
			UpdateCamera();
		}
	}
}