Decompiled source of Rumble LIV Camera Enabler v1.0.7

Mods/LIVCameraEnabler.dll

Decompiled 4 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using LIV_Camera_Enabler;
using MelonLoader;
using RUMBLE.Utilities;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(LIVCameraStart), "LIV Camera Enabler", "1.0.6", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[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 LIV_Camera_Enabler;

public class LIVCameraStart : MelonMod
{
	private string currentScene = "";

	private bool sceneChanged = false;

	private RecordingCamera playerLIV;

	public override void OnInitializeMelon()
	{
		((MelonBase)this).OnInitializeMelon();
	}

	public override void OnLateInitializeMelon()
	{
		((MelonBase)this).OnLateInitializeMelon();
	}

	public override void OnFixedUpdate()
	{
		((MelonBase)this).OnFixedUpdate();
		if (!sceneChanged || !(currentScene != "") || !(currentScene != "Loader"))
		{
			return;
		}
		if (IsProcessRunning("capture"))
		{
			try
			{
				playerLIV = GameObject.Find("Game Instance/Initializable/RecordingCamera").GetComponent<RecordingCamera>();
				playerLIV.OnModernRecordingCameraEnabledChanged(true);
				playerLIV.SaveConfiguration();
				sceneChanged = false;
				MelonLogger.Msg("F10 Camera Enabled");
				return;
			}
			catch
			{
				return;
			}
		}
		sceneChanged = false;
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName);
		currentScene = sceneName;
		sceneChanged = true;
	}

	private static bool IsProcessRunning(string processName)
	{
		return Process.GetProcessesByName(processName).Length != 0;
	}
}