Decompiled source of RecursiveRockCam v1.0.1

Mods/RecursiveRockCam.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppRUMBLE.Players;
using MelonLoader;
using RecursiveRockCam;
using RumbleModUI;
using RumbleModdingAPI;
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(MainClass), "RecursiveRockCam", "1.0.1", "Kalamart", null)]
[assembly: VerifyLoaderVersion(0, 6, 5, true)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 255, 31, 90)]
[assembly: MelonAuthorColor(255, 255, 31, 90)]
[assembly: AssemblyDescription("Makes the Rock Cam screen visible in Rock Cam")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("621d30a5-8fa1-4d87-9826-92c0149b033e")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("RecursiveRockCam")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0d5afca1c3cb53820d38a37d528c34f4ec926318")]
[assembly: AssemblyProduct("RecursiveRockCam")]
[assembly: AssemblyTitle("RecursiveRockCam")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RecursiveRockCam;

public static class BuildInfo
{
	public const string ModName = "RecursiveRockCam";

	public const string ModVersion = "1.0.1";

	public const string Description = "Makes the Rock Cam screen visible in Rock Cam";

	public const string Author = "Kalamart";

	public const string Company = "";
}
public class MainClass : MelonMod
{
	[HarmonyPatch(typeof(PlayerController), "Initialize", new Type[] { typeof(Player) })]
	public static class playerspawn
	{
		private static void Postfix(ref PlayerController __instance, ref Player player)
		{
			if (Players.GetLocalPlayer() == player)
			{
				updateRockCamScreen();
			}
		}
	}

	public static Mod Mod = new Mod();

	public static bool screenVisible = true;

	public static GameObject screen = null;

	private static void Log(string msg)
	{
		MelonLogger.Msg(msg);
	}

	private static void LogWarn(string msg)
	{
		MelonLogger.Warning(msg);
	}

	private static void LogError(string msg)
	{
		MelonLogger.Error(msg);
	}

	private void InitModUI()
	{
		UI.instance.UI_Initialized += OnUIInit;
		SetUIOptions();
	}

	private void SetUIOptions()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Expected O, but got Unknown
		Mod.ModName = "RecursiveRockCam";
		Mod.ModVersion = "1.0.1";
		Mod.SetFolder("RecursiveRockCam");
		Mod.AddToList("Screen visible", true, 0, "Make Rock Cam screen visible in Rock Cam recordings.", new Tags());
		Mod.GetFromFile();
	}

	private void OnUIInit()
	{
		Mod.ModSaved += OnUISaved;
		UI.instance.AddMod(Mod);
	}

	private void OnUISaved()
	{
		updateRockCamScreen();
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		if (sceneName == "Loader")
		{
			InitModUI();
			return;
		}
		screen = null;
		updateRockCamScreen();
	}

	private static void updateRockCamScreen()
	{
		try
		{
			screenVisible = (bool)Mod.Settings[0].SavedValue;
			PlayerController playerController = Players.GetPlayerController();
			if (playerController != null)
			{
				if (screen == null)
				{
					screen = ((Component)((Component)playerController).gameObject.transform.GetChild(10).GetChild(2).GetChild(2)
						.GetChild(0)
						.GetChild(3)
						.GetChild(0)).gameObject;
				}
				if (screenVisible)
				{
					screen.layer = LayerMask.NameToLayer("UI");
				}
				else
				{
					screen.layer = LayerMask.NameToLayer("RecordingCamera");
				}
			}
		}
		catch (Exception)
		{
		}
	}
}