using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using HD_Camera;
using Il2CppSLZ.Marrow;
using MelonLoader;
using UnityEngine;
using UnityEngine.EventSystems;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(HDCamera), "High Res camera", "1.0.0", "Man2787", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("High Res camera")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("High Res camera")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9a2c838b-57f6-4d1d-9d85-686a35dd8865")]
[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 HD_Camera;
public class HDCamera : MelonMod
{
public enum ImageSize
{
Potato = 128,
Small = 256,
Medium = 512,
Large = 1024,
Ultra = 2160,
Insane = 4320
}
private EnumElement m_size;
public override void OnInitializeMelon()
{
((MelonBase)this).OnInitializeMelon();
InitializeMenu();
((MelonBase)this).LoggerInstance.Msg("Initialized.");
}
private void InitializeMenu()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
Page obj = Page.Root.CreatePage("HDCamera", Color.green, 0, true);
m_size = new EnumElement("size", Color.white, (Enum)ImageSize.Large, (Action<Enum>)null);
obj.Add((Element)(object)m_size);
obj.CreateFunction("Apply to held camera", Color.white, (Action)ApplyToHeldCamera);
obj.CreateFunction("Spawn image board and camera", Color.white, (Action)SpawnBoardAndCamera);
}
private void ApplyToHeldCamera()
{
(Transform, Camera) tuple = FindHeldCamera(Player.PhysicsRig.leftHand);
Transform item = tuple.Item1;
Camera item2 = tuple.Item2;
(Transform, Camera) tuple2 = FindHeldCamera(Player.PhysicsRig.rightHand);
Transform item3 = tuple2.Item1;
Camera item4 = tuple2.Item2;
ImageSize resulution = (ImageSize)(object)m_size.Value;
if ((Object)(object)item2 != (Object)null)
{
SetResulution(item, item2, (int)resulution);
}
else if ((Object)(object)item4 != (Object)null)
{
SetResulution(item3, item4, (int)resulution);
}
else
{
((MelonBase)this).LoggerInstance.Msg("Didnt detect valid camera in either hand");
}
}
private void SetResulution(Transform parent, Camera camera, int resulution)
{
((Component)parent.Find("Variables/width")).GetComponent<EventSystem>().m_DragThreshold = resulution;
camera.targetTexture.Release();
((Texture)camera.targetTexture).width = resulution;
((Texture)camera.targetTexture).height = resulution;
camera.targetTexture.Create();
}
private (Transform, Camera) FindHeldCamera(Hand hand)
{
if ((Object)(object)hand.AttachedReceiver == (Object)null)
{
return (null, null);
}
InteractableHost componentInParent = ((Component)hand.AttachedReceiver).gameObject.GetComponentInParent<InteractableHost>(true);
if ((Object)(object)componentInParent == (Object)null)
{
return (null, null);
}
Transform transform = ((Component)componentInParent).transform;
if ((Object)(object)transform.Find("IS_CAMERA") == (Object)null)
{
return (transform, null);
}
Transform val = transform.Find("CameraTarget/rt");
if ((Object)(object)val == (Object)null)
{
return (transform, null);
}
return (transform, ((Component)val).GetComponent<Camera>());
}
private void SpawnBoardAndCamera()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
Transform head = Player.Head;
Vector3 val = head.position + head.forward - head.right * 0.2f;
Vector3 val2 = head.position + head.forward + head.right * 0.2f;
HelperMethods.SpawnCrate("Rexmeck.ImageBoard.Spawnable.ImageBoardBright", val, default(Quaternion), Vector3.one, false, (Action<GameObject>)null, (Action<GameObject>)null);
HelperMethods.SpawnCrate("Rexmeck.ImageBoard.Spawnable.CameraImageBoard", val2, default(Quaternion), Vector3.one, false, (Action<GameObject>)null, (Action<GameObject>)null);
}
}