Decompiled source of CameriumCamera v1.9.5
Mods/Camerium.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.Json; using System.Text.Json.Serialization; using System.Threading; using BoneLib; using BoneLib.BoneMenu; using Camerium; using Camerium.Media; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Marrow; using Il2CppSLZ.VRMK; using Il2CppSystem; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Core), "Camerium", "1.9.5", "DuoLab", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: MelonAdditionalDependencies(new string[] { "BoneLib" })] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Camerium")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.9.5.0")] [assembly: AssemblyInformationalVersion("1.9.5")] [assembly: AssemblyProduct("Camerium")] [assembly: AssemblyTitle("Camerium")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.9.5.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Camerium { public static class Art { public static Texture2D Atlas; public static bool Ready; public const int CW = 40; public const int CH = 64; private static byte[] _gFill; private static byte[] _gAlpha; private static int _gw; private static int _gh; private static bool _tried; public const int Body = 0; public const int Rubber = 1; public const int Orange = 2; public const int Key = 3; public const int KeySide = 4; public const int Metal = 5; public const int Glass = 6; public const int Red = 7; public const int PanelDark = 8; public const int Black = 9; public const int White = 10; public const int DarkMetal = 11; public const int LedOn = 12; public const int LedOff = 13; public const int BlueGlass = 14; public const int Cream = 15; private static readonly Vector3 LightDir; public static bool Load() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) if (_tried) { return Ready; } _tried = true; try { Atlas = LoadPng("device_atlas.png", (FilterMode)1); Texture2D val = LoadPng("glyphs.png", (FilterMode)1); _gw = ((Texture)val).width; _gh = ((Texture)val).height; Il2CppStructArray<Color32> pixels = val.GetPixels32(); _gFill = new byte[_gw * _gh]; _gAlpha = new byte[_gw * _gh]; for (int i = 0; i < _gh; i++) { for (int j = 0; j < _gw; j++) { Color32 val2 = ((Il2CppArrayBase<Color32>)(object)pixels)[i * _gw + j]; int num = (_gh - 1 - i) * _gw + j; _gFill[num] = val2.r; _gAlpha[num] = val2.a; } } Object.Destroy((Object)(object)val); Ready = (Object)(object)Atlas != (Object)null; } catch (Exception ex) { Core.Log.Error("Art load failed: " + ex); Ready = false; } return Ready; } private static Texture2D LoadPng(string name, FilterMode filter) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = null; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text2 in manifestResourceNames) { if (text2.EndsWith(name, StringComparison.OrdinalIgnoreCase)) { text = text2; } } if (text == null) { throw new FileNotFoundException("embedded " + name); } byte[] array; using (Stream stream = executingAssembly.GetManifestResourceStream(text)) { using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); array = memoryStream.ToArray(); } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array), false); ((Texture)val).filterMode = filter; ((Texture)val).wrapMode = (TextureWrapMode)1; ((Object)val).hideFlags = (HideFlags)32; return val; } public static float Shade(Vector3 n) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (Gfx.IsLit) { return 0.9f + 0.06f * n.y; } float num = Mathf.Max(0f, Vector3.Dot(n, LightDir)); return Mathf.Clamp(0.4f + 0.62f * num + 0.1f * (n.y * 0.5f + 0.5f) + 0.08f * Mathf.Max(0f, 0f - n.z), 0.32f, 1.22f); } public static Vector2 Swatch(int col, float shade) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.InverseLerp(0.32f, 1.22f, shade); return new Vector2((float)(col * 128 + 64) / 2048f, (2f + num * 251f) / 1536f); } public static Vector2 Panel(float x, float y) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp((x + 0.163f) / 0.326f, 0.002f, 0.998f); float num2 = Mathf.Clamp01((y + 0.1019f) / 0.2038f); return new Vector2(num, (256f + num2 * 1279f) / 1536f); } public static MeshKit.UVFn Sw(int col) { return (Vector3 p, Vector3 n) => Swatch(col, Shade(n)); } public static MeshKit.UVFn Front(int sideCol) { return (Vector3 p, Vector3 n) => (!(n.z < -0.7f)) ? Swatch(sideCol, Shade(n)) : Panel(p.x, p.y); } public static Texture2D NewTextTexture(int w, int h) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown return new Texture2D(Mathf.Max(4, w), Mathf.Max(4, h), (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)32 }; } public static void Render(Texture2D tex, string s, Color ink, Color outline, Color bg, int align = 1, float pad = 0.08f) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) int width = ((Texture)tex).width; int height = ((Texture)tex).height; Color32[] array = (Color32[])(object)new Color32[width * height]; Color32 val = Color32.op_Implicit(bg); for (int i = 0; i < array.Length; i++) { array[i] = val; } if (Ready && !string.IsNullOrEmpty(s)) { string[] array2 = s.Split('\n'); int num = 1; string[] array3 = array2; foreach (string text in array3) { num = Math.Max(num, text.Length); } float num2 = (float)width * (1f - pad * 2f); float num3 = Mathf.Min((float)height * (1f - pad) / (float)(array2.Length * 64), num2 / ((float)num * 40f)); float num4 = 40f * num3; float num5 = 64f * num3; float num6 = ((float)height - (float)array2.Length * num5) / 2f; for (int k = 0; k < array2.Length; k++) { string text2 = array2[k]; float num7 = (float)text2.Length * num4; float num8 = align switch { 2 => (float)width - (float)width * pad - num7, 0 => (float)width * pad, _ => ((float)width - num7) / 2f, }; float dy = num6 + (float)k * num5; for (int l = 0; l < text2.Length; l++) { int num9 = text2[l]; if (num9 == 183) { num9 = 45; } if (num9 < 32 || num9 > 126) { num9 = 63; } if (num9 != 32) { int num10 = num9 - 32; int gx = num10 % 16 * 40; int gy = num10 / 16 * 64; DrawGlyph(array, width, height, gx, gy, num8 + (float)l * num4, dy, num3, ink, outline); } } } } tex.SetPixels32(new Il2CppStructArray<Color32>(array)); tex.Apply(false); } private static void DrawGlyph(Color32[] buf, int w, int h, int gx, int gy, float dx0, float dy0, float scale, Color ink, Color outline) { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) int val = Mathf.FloorToInt(dx0); int val2 = Mathf.FloorToInt(dy0); int val3 = Mathf.CeilToInt(dx0 + 40f * scale); int val4 = Mathf.CeilToInt(dy0 + 64f * scale); Color val7 = default(Color); for (int i = Math.Max(0, val2); i < Math.Min(h, val4); i++) { float sy = ((float)i + 0.5f - dy0) / scale - 0.5f; for (int j = Math.Max(0, val); j < Math.Min(w, val3); j++) { float sx = ((float)j + 0.5f - dx0) / scale - 0.5f; Sample(gx, gy, sx, sy, out var fill, out var alpha); if (!(alpha <= 0.004f)) { float num = Mathf.Clamp01(fill / Mathf.Max(alpha, 0.0001f)); Color val5 = Color.Lerp(outline, ink, num); float num2 = alpha * Mathf.Lerp(outline.a, ink.a, num); int num3 = (h - 1 - i) * w + j; Color val6 = Color32.op_Implicit(buf[num3]); ((Color)(ref val7))..ctor(val5.r * num2 + val6.r * (1f - num2), val5.g * num2 + val6.g * (1f - num2), val5.b * num2 + val6.b * (1f - num2), num2 + val6.a * (1f - num2)); buf[num3] = Color32.op_Implicit(val7); } } } } private static void Sample(int gx, int gy, float sx, float sy, out float fill, out float alpha) { int num = Mathf.FloorToInt(sx); int num2 = Mathf.FloorToInt(sy); float num3 = sx - (float)num; float num4 = sy - (float)num2; fill = 0f; alpha = 0f; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { int num5 = num + j; int num6 = num2 + i; if (num5 >= 0 && num6 >= 0 && num5 < 40 && num6 < 64) { float num7 = ((j == 0) ? (1f - num3) : num3) * ((i == 0) ? (1f - num4) : num4); int num8 = (gy + num6) * _gw + gx + num5; fill += (float)(int)_gFill[num8] / 255f * num7; alpha += (float)(int)_gAlpha[num8] / 255f * num7; } } } } static Art() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) Vector3 val = new Vector3(-0.4f, 0.75f, -0.55f); LightDir = ((Vector3)(ref val)).normalized; } } public static class CameraRig { public static Camera Cam; public static RenderTexture RT; public static EffectProfile Fx = EffectProfile.Get(CamEffect.Clean); public static bool Recording; public static float RecordTime; public static float FlashTimer; public static float ZoomHudTimer; public static float ModeStartTime; private static GameObject _root; private static GameObject _volumeGo; private static GameObject _wrist; private static GameObject _bodycamModel; private static UniversalAdditionalCameraData _camData; private static Volume _volume; private static VolumeProfile _profile; private static Bloom _bloom; private static Vignette _vignette; private static FilmGrain _grain; private static ChromaticAberration _chroma; private static LensDistortion _lens; private static ColorAdjustments _color; private static WhiteBalance _white; private static Tonemapping _tone; private static DepthOfField _dof; private static Material _wristMat; private static Light _light; private static Shader _unlit; private static int _fxLayer = -1; private static Camera _lastMainCam; private static Vector3 _pos; private static Quaternion _rot = Quaternion.identity; private static bool _snap = true; private static Quaternion _torsoRot = Quaternion.identity; private static Vector3 _tripodPos; private static Quaternion _tripodRot = Quaternion.identity; private static bool _tripodPlaced; private static float _orbitAngle; private static float _bodyYaw; private static Vector3 _lastHeadPos; private static Vector3 _lastBodyPos; private static float _bobPhase; private static float _focusDist = 3f; public static RenderTexture Display; private static float _lastPresent = -10f; private static bool _presentBroken; private static bool _mapFxBlocked; private static bool _safeFx; private static CamEffect _guardFx = (CamEffect)(-1); private static int _blackStrikes; private static float _nextProbe; private static RenderTexture _probeRT; private static Texture2D _probeTex; private static Transform _anchorT; private static Vector3 _anchorPos; private static Vector3 _anchorCamPos; private static Quaternion _anchorRot = Quaternion.identity; private static Quaternion _anchorCamRot = Quaternion.identity; private static bool _hooked; private static Animator _anim; private static float _animRefresh; private static Settings S => Core.S; public static bool Alive { get { if ((Object)(object)_root != (Object)null) { return (Object)(object)Cam != (Object)null; } return false; } } public static void Ensure() { if (Alive) { return; } try { Create(); } catch (Exception ex) { Core.Log.Error("Camera create failed: " + ex); } } private static void Create() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Expected O, but got Unknown _root = new GameObject("Camerium_Rig"); Object.DontDestroyOnLoad((Object)(object)_root); ((Object)_root).hideFlags = (HideFlags)32; GameObject val = new GameObject("Camerium_Camera"); val.transform.SetParent(_root.transform, false); Cam = val.AddComponent<Camera>(); Camera val2 = MainCam(); if ((Object)(object)val2 != (Object)null) { try { Cam.CopyFrom(val2); } catch { } } Cam.stereoTargetEye = (StereoTargetEyeMask)0; Cam.depth = 50f; Cam.nearClipPlane = 0.05f; Cam.farClipPlane = (((Object)(object)val2 != (Object)null) ? Mathf.Max(val2.farClipPlane, 500f) : 1000f); Cam.allowHDR = true; Cam.allowMSAA = true; _camData = val.GetComponent<UniversalAdditionalCameraData>(); if ((Object)(object)_camData == (Object)null) { _camData = val.AddComponent<UniversalAdditionalCameraData>(); } _camData.renderPostProcessing = true; try { _camData.stopNaN = true; } catch { } try { _camData.requiresDepthTexture = true; } catch { } try { _camData.dithering = true; } catch { } try { _camData.volumeFrameworkUpdateMode = (VolumeFrameworkUpdateMode)0; } catch { } _camData.volumeTrigger = val.transform; GameObject val3 = new GameObject("Camerium_Light"); val3.transform.SetParent(val.transform, false); _light = val3.AddComponent<Light>(); _light.type = (LightType)0; _light.spotAngle = 70f; _light.range = 18f; _light.color = new Color(1f, 0.96f, 0.88f); _light.shadows = (LightShadows)0; ((Behaviour)_light).enabled = false; _fxLayer = FindFreeLayer(); _volumeGo = new GameObject("Camerium_Volume"); _volumeGo.transform.SetParent(_root.transform, false); _volumeGo.layer = _fxLayer; _volume = _volumeGo.AddComponent<Volume>(); _volume.isGlobal = true; _volume.priority = 999f; _volume.weight = 1f; _profile = ((Il2CppObjectBase)ScriptableObject.CreateInstance(Il2CppType.Of<VolumeProfile>())).Cast<VolumeProfile>(); ((Object)_profile).hideFlags = (HideFlags)32; _bloom = Add<Bloom>(); _vignette = Add<Vignette>(); _grain = Add<FilmGrain>(); _chroma = Add<ChromaticAberration>(); _lens = Add<LensDistortion>(); _color = Add<ColorAdjustments>(); _white = Add<WhiteBalance>(); _tone = Add<Tonemapping>(); _dof = Add<DepthOfField>(); _volume.sharedProfile = _profile; Gfx.Init(); _unlit = Gfx.Opaque; BuildModel(val.transform); BuildWrist(); try { Device.Build(_root.transform); } catch (Exception ex) { Core.Log.Error("Device build failed: " + ex); } Overlay.Build(val.transform, _fxLayer); _snap = true; ApplyEffect(); Core.Log.Msg($"Camera created (fx layer {_fxLayer}, opaque {(((Object)(object)Gfx.Opaque != (Object)null) ? ((Object)Gfx.Opaque).name : "none")}, blend {(((Object)(object)Gfx.Blend != (Object)null) ? ((Object)Gfx.Blend).name : "none")}, overlay {Overlay.Ready})."); } private static T Add<T>() where T : VolumeComponent { try { T val = ((Il2CppObjectBase)_profile.Add(Il2CppType.Of<T>(), true)).Cast<T>(); ((VolumeComponent)val).active = true; return val; } catch (Exception ex) { Core.Log.Warning("Volume component " + typeof(T).Name + " unavailable: " + ex.Message); return default(T); } } public static void Destroy() { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } _root = null; Cam = null; if ((Object)(object)RT != (Object)null) { RT.Release(); Object.Destroy((Object)(object)RT); RT = null; } } public static void OnLevelLoaded() { _tripodPlaced = false; _mapFxBlocked = false; _safeFx = false; _blackStrikes = 0; _snap = true; _lastMainCam = null; Device.OnLevelLoaded(); HeadMirror.Clear(); } public static Camera MainCam() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 Camera main = Camera.main; if ((Object)(object)main != (Object)null && (Object)(object)main != (Object)(object)Cam) { return main; } try { foreach (Camera item in (Il2CppArrayBase<Camera>)(object)Camera.allCameras) { if ((Object)(object)item != (Object)(object)Cam && (int)item.stereoTargetEye == 3 && ((Behaviour)item).isActiveAndEnabled) { return item; } } } catch { } return null; } private static int FindFreeLayer() { for (int num = 31; num >= 8; num--) { if (string.IsNullOrEmpty(LayerMask.LayerToName(num))) { return num; } } return 31; } private static void BuildModel(Transform cam) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0050: 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) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) Color color = default(Color); ((Color)(ref color))..ctor(0.1f, 0.1f, 0.11f); _bodycamModel = new GameObject("Camerium_BodycamModel"); _bodycamModel.transform.SetParent(cam, false); Gfx.Prim((PrimitiveType)3, _bodycamModel.transform, new Vector3(0f, -0.01f, -0.03f), new Vector3(0.055f, 0.085f, 0.03f), color); Gfx.Prim((PrimitiveType)2, _bodycamModel.transform, new Vector3(0f, 0.012f, -0.012f), new Vector3(0.022f, 0.006f, 0.022f), new Color(0.02f, 0.03f, 0.06f), new Vector3(90f, 0f, 0f)); Gfx.Prim((PrimitiveType)0, _bodycamModel.transform, new Vector3(0.018f, 0.028f, -0.014f), Vector3.one * 0.006f, new Color(1f, 0.15f, 0.1f)); } private static void BuildWrist() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0022: Unknown result type (might be due to invalid IL or missing references) _wrist = Gfx.Prim((PrimitiveType)5, _root.transform, Vector3.zero, Vector3.one, Color.white); ((Object)_wrist).name = "Camerium_WristMonitor"; _wristMat = Gfx.Emissive((Texture)(object)Gfx.White); if ((Object)(object)_wristMat != (Object)null) { ((Renderer)_wrist.GetComponent<MeshRenderer>()).sharedMaterial = _wristMat; } _wrist.SetActive(false); } public static float EffectFov() { float num = Fx.FovOverride; if (S.Mode == CamMode.Bodycam) { num = Mathf.Max(num, 105f); } else if (S.Mode == CamMode.Headcam) { num = Mathf.Max(num, (S.HeadMount == HeadMount.Chin) ? 95f : ((S.HeadMount == HeadMount.Forehead || S.HeadMount == HeadMount.Eyes) ? 100f : 110f)); } return num; } public static void ApplyEffect() { //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) if (S.Effect != _guardFx) { _guardFx = S.Effect; _safeFx = false; _mapFxBlocked = false; _blackStrikes = 0; } Fx = EffectProfile.Get(S.Effect); if ((Object)(object)_profile == (Object)null) { return; } float effectStrength = S.EffectStrength; try { if ((Object)(object)_bloom != (Object)null) { ((VolumeParameter<float>)(object)_bloom.intensity).Override(Fx.BloomIntensity * effectStrength * S.BloomBoost * (_safeFx ? 0.35f : 1f)); ((VolumeParameter<float>)(object)_bloom.threshold).Override(Fx.BloomThreshold); ((VolumeParameter<float>)(object)_bloom.scatter).Override(Fx.BloomScatter); ((VolumeParameter<Color>)(object)_bloom.tint).Override(Fx.BloomTint); ((VolumeParameter<bool>)(object)_bloom.highQualityFiltering).Override(true); } if ((Object)(object)_vignette != (Object)null) { ((VolumeParameter<float>)(object)_vignette.intensity).Override(Mathf.Clamp01(Fx.Vignette * effectStrength * S.VignetteBoost)); ((VolumeParameter<float>)(object)_vignette.smoothness).Override(Fx.VignetteSmooth); ((VolumeParameter<Color>)(object)_vignette.color).Override(Fx.VignetteColor); } if ((Object)(object)_grain != (Object)null) { ((VolumeParameter<float>)(object)_grain.intensity).Override(Mathf.Clamp01(Fx.Grain * effectStrength * S.GrainBoost)); ((VolumeParameter<FilmGrainLookup>)(object)_grain.type).Override((FilmGrainLookup)Mathf.Clamp(Fx.GrainType, 0, 9)); ((VolumeParameter<float>)(object)_grain.response).Override(0.8f); } if ((Object)(object)_chroma != (Object)null) { ((VolumeParameter<float>)(object)_chroma.intensity).Override(Mathf.Clamp01(Fx.Chroma * effectStrength)); } if ((Object)(object)_lens != (Object)null) { float num = Fx.Lens * effectStrength; float num2 = Mathf.Lerp(1f, Fx.LensScale, Mathf.Clamp01(effectStrength)); if (S.UseEffectFov && S.Mode == CamMode.Bodycam) { num = Mathf.Max(num, 0.4f); num2 = Mathf.Min(num2, 0.93f); } if (S.UseEffectFov && S.Mode == CamMode.Headcam) { num = Mathf.Max(num, 0.35f); num2 = Mathf.Min(num2, 0.94f); } ((VolumeParameter<float>)(object)_lens.intensity).Override(Mathf.Clamp(num, -1f, 1f)); ((VolumeParameter<float>)(object)_lens.scale).Override(num2); } if ((Object)(object)_color != (Object)null) { ((VolumeParameter<float>)(object)_color.saturation).Override(Mathf.Clamp(Fx.Saturation * Mathf.Min(effectStrength, 1f) + S.Saturation, -100f, 100f)); ((VolumeParameter<float>)(object)_color.contrast).Override(Mathf.Clamp(Fx.Contrast * effectStrength, -100f, 100f)); ((VolumeParameter<float>)(object)_color.postExposure).Override(Fx.Exposure * effectStrength + S.Exposure); ((VolumeParameter<float>)(object)_color.hueShift).Override(Fx.HueShift); ((VolumeParameter<Color>)(object)_color.colorFilter).Override(Fx.ColorFilter); } if ((Object)(object)_white != (Object)null) { ((VolumeParameter<float>)(object)_white.temperature).Override(Fx.Temperature * effectStrength); ((VolumeParameter<float>)(object)_white.tint).Override(Fx.Tint * effectStrength); } if ((Object)(object)_tone != (Object)null) { bool flag = Fx.ACES && !_safeFx; ((VolumeParameter<TonemappingMode>)(object)_tone.mode).Override((TonemappingMode)(flag ? 2 : 0)); ((VolumeComponent)_tone).active = flag; } if ((Object)(object)_dof != (Object)null) { bool flag2 = S.AutoFocus && !_safeFx; ((VolumeComponent)_dof).active = flag2; ((VolumeParameter<DepthOfFieldMode>)(object)_dof.mode).Override((DepthOfFieldMode)(flag2 ? 2 : 0)); ((VolumeParameter<float>)(object)_dof.aperture).Override(S.Aperture); } } catch (Exception ex) { Core.Log.Warning("ApplyEffect: " + ex.Message); } Hud.OnEffectChanged(); } private static void SyncVolumeMasks(Camera main) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (_fxLayer < 0 || (Object)(object)_camData == (Object)null) { return; } int num = 1 << _fxLayer; int num2 = -1; LayerMask volumeLayerMask; if ((Object)(object)main != (Object)null) { try { UniversalAdditionalCameraData component = ((Component)main).GetComponent<UniversalAdditionalCameraData>(); if ((Object)(object)component != (Object)null) { volumeLayerMask = component.volumeLayerMask; num2 = ((LayerMask)(ref volumeLayerMask)).value; if ((num2 & num) != 0) { volumeLayerMask = default(LayerMask); ((LayerMask)(ref volumeLayerMask)).value = num2 & ~num; component.volumeLayerMask = volumeLayerMask; num2 &= ~num; } } } catch { } } int num3 = ((S.UseMapPostFx && !_mapFxBlocked) ? (num2 | num) : num); volumeLayerMask = _camData.volumeLayerMask; if (((LayerMask)(ref volumeLayerMask)).value != num3) { UniversalAdditionalCameraData camData = _camData; volumeLayerMask = default(LayerMask); ((LayerMask)(ref volumeLayerMask)).value = num3; camData.volumeLayerMask = volumeLayerMask; } } public static Vector2Int TargetSize() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) int num = S.Quality switch { Quality.Low_480p => 480, Quality.High_1080p => 1080, Quality.Ultra_1440p => 1440, _ => 720, }; if (S.AuthenticResolution && Fx.ForcedHeight > 0) { num = Mathf.Min(num, Fx.ForcedHeight); } float num2 = Aspect(); int num3 = Mathf.RoundToInt((float)num * num2); if (num2 < 1f) { num3 = num; num = Mathf.RoundToInt((float)num3 / num2); } return new Vector2Int(Mathf.Max(16, num3), Mathf.Max(16, num)); } public static float Aspect() { return S.Aspect switch { AspectChoice.Wide_16x9 => 1.7777778f, AspectChoice.Classic_4x3 => 1.3333334f, AspectChoice.Ultrawide_21x9 => 2.3333333f, AspectChoice.Square_1x1 => 1f, AspectChoice.Vertical_9x16 => 0.5625f, _ => Fx.Aspect, }; } private static void EnsureRT() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown //IL_01aa: Unknown result type (might be due to invalid IL or missing references) Vector2Int val = TargetSize(); FilterMode val2 = (FilterMode)(!Fx.PointFilter); if ((Object)(object)RT != (Object)null && ((Texture)RT).width == ((Vector2Int)(ref val)).x && ((Texture)RT).height == ((Vector2Int)(ref val)).y && ((Object)(object)Display != (Object)null || _presentBroken)) { if ((Object)(object)Display != (Object)null && ((Texture)Display).filterMode != val2) { ((Texture)Display).filterMode = val2; } if (((Texture)RT).filterMode != val2) { ((Texture)RT).filterMode = val2; } return; } if ((Object)(object)RT != (Object)null) { Cam.targetTexture = null; RT.Release(); Object.Destroy((Object)(object)RT); } if ((Object)(object)Display != (Object)null) { Display.Release(); Object.Destroy((Object)(object)Display); } RT = new RenderTexture(((Vector2Int)(ref val)).x, ((Vector2Int)(ref val)).y, 24, (RenderTextureFormat)0); ((Object)RT).name = "Camerium_Render"; RT.antiAliasing = ((((Vector2Int)(ref val)).y < 720) ? 1 : 2); ((Texture)RT).filterMode = val2; ((Object)RT).hideFlags = (HideFlags)32; RT.Create(); Cam.targetTexture = RT; Display = null; if (!_presentBroken) { RenderTextureFormat val3 = (RenderTextureFormat)(SystemInfo.SupportsRenderTextureFormat((RenderTextureFormat)22) ? 22 : 0); Display = new RenderTexture(((Vector2Int)(ref val)).x, ((Vector2Int)(ref val)).y, 0, val3); ((Object)Display).name = "Camerium_Display"; ((Texture)Display).filterMode = val2; ((Object)Display).hideFlags = (HideFlags)32; Display.Create(); } _lastPresent = -10f; RenderTexture val4 = (((Object)(object)Display != (Object)null) ? Display : RT); Device.SetFeed((Texture)(object)val4); Gfx.SetTex(_wristMat, (Texture)(object)val4); Hud.OnEffectChanged(); } private static void Present() { if (_presentBroken || (Object)(object)Display == (Object)null) { return; } int num = S.FpsCap; if (S.AuthenticResolution && Fx.ForcedFps > 0) { num = ((num > 0) ? Mathf.Min(num, Fx.ForcedFps) : Fx.ForcedFps); } if (num > 0 && Time.unscaledTime - _lastPresent < 1f / (float)num - 0.002f) { return; } _lastPresent = Time.unscaledTime; try { Gfx.Blit((Texture)(object)RT, Display); } catch (Exception ex) { Core.Log.Warning("Present failed, showing the raw render instead: " + ex.Message); if ((Object)(object)Display != (Object)null) { Display.Release(); Object.Destroy((Object)(object)Display); Display = null; } Device.SetFeed((Texture)(object)RT); Gfx.SetTex(_wristMat, (Texture)(object)RT); _presentBroken = true; } } private static void BlackGuard() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) if (Time.unscaledTime < _nextProbe || (Object)(object)RT == (Object)null) { return; } _nextProbe = Time.unscaledTime + 1f; try { if ((Object)(object)_probeRT == (Object)null) { _probeRT = new RenderTexture(8, 8, 0, (RenderTextureFormat)0); ((Object)_probeRT).hideFlags = (HideFlags)32; _probeRT.Create(); } if ((Object)(object)_probeTex == (Object)null) { _probeTex = new Texture2D(8, 8, (TextureFormat)4, false); ((Object)_probeTex).hideFlags = (HideFlags)32; } Gfx.Blit((Texture)(object)RT, _probeRT); RenderTexture active = RenderTexture.active; RenderTexture.active = _probeRT; _probeTex.ReadPixels(new Rect(0f, 0f, 8f, 8f), 0, 0, false); RenderTexture.active = active; Il2CppStructArray<Color32> pixels = _probeTex.GetPixels32(); int num = 0; for (int i = 0; i < ((Il2CppArrayBase<Color32>)(object)pixels).Length; i++) { Color32 val = ((Il2CppArrayBase<Color32>)(object)pixels)[i]; num = Math.Max(num, Math.Max(val.r, Math.Max(val.g, val.b))); } if (num > 3) { _blackStrikes = 0; } else if (++_blackStrikes >= 2) { _blackStrikes = 0; if (!_safeFx) { _safeFx = true; Core.Log.Warning("Black image detected with effect " + S.Effect.ToString() + ": switching to safe post-processing values."); Core.Notify("Camerium", "Black image detected, using safe effect settings."); ApplyEffect(); } else if (!_mapFxBlocked && S.UseMapPostFx) { _mapFxBlocked = true; Core.Log.Warning("Still black with effect " + S.Effect.ToString() + ": ignoring the map's post-processing for the camera."); } } } catch (Exception ex) { Core.Log.Warning("Black guard: " + ex.Message); _nextProbe = Time.unscaledTime + 30f; } } public static void LateUpdate() { //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) if (!S.Enabled) { if (Recording) { Recording = false; Recorder.Stop(); } Recorder.Update(); try { HeadMirror.Update(-1); } catch { } if ((Object)(object)_root != (Object)null && _root.activeSelf) { _root.SetActive(false); } return; } Ensure(); if (!Alive) { return; } if (!_root.activeSelf) { _root.SetActive(true); _snap = true; } Camera val = MainCam(); if ((Object)(object)val == (Object)null) { ((Behaviour)Cam).enabled = false; return; } if ((Object)(object)val != (Object)(object)_lastMainCam) { _lastMainCam = val; _snap = true; } try { int num = ((_fxLayer >= 0) ? (1 << _fxLayer) : 0); if ((val.cullingMask & num) != 0) { val.cullingMask &= ~num; } int num2 = val.cullingMask | num; if (Cam.cullingMask != num2) { Cam.cullingMask = num2; } } catch { } SyncVolumeMasks(val); try { HeadMirror.Update(_fxLayer); } catch (Exception ex) { Core.Log.Warning("Head copy: " + ex.Message); } EnsureRT(); float deltaTime = Time.deltaTime; if (Recording) { RecordTime += deltaTime; } if (FlashTimer > 0f) { FlashTimer -= deltaTime; } if (ZoomHudTimer > 0f) { ZoomHudTimer -= deltaTime; } try { Device.Update(val); } catch (Exception ex2) { Core.Log.Warning("Device: " + ex2.Message); } ComputeTarget(val, out var pos, out var rot, out var smoothMul); if (_snap) { _pos = pos; _rot = rot; _snap = false; } else { float num3 = Mathf.Clamp(S.PositionSmoothing * smoothMul, 0f, 0.98f); float num4 = Mathf.Clamp(S.RotationSmoothing * smoothMul, 0f, 0.98f); _pos = ((S.Mode == CamMode.Headcam || S.Mode == CamMode.Bodycam || (Device.Held && (S.Mode == CamMode.Handheld || S.Mode == CamMode.Selfie))) ? pos : Vector3.Lerp(_pos, pos, (num3 <= 0f) ? 1f : (1f - Mathf.Exp((0f - deltaTime) * Mathf.Lerp(60f, 1.5f, num3))))); _rot = Quaternion.Slerp(_rot, rot, (num4 <= 0f) ? 1f : (1f - Mathf.Exp((0f - deltaTime) * Mathf.Lerp(60f, 1.5f, num4)))); } Quaternion val2 = _rot; float num5 = S.ShakeAmount * Fx.ShakeMul * ModeShake(); if (num5 > 0.001f) { float time = Time.time; float num6 = (Mathf.PerlinNoise(time * 0.9f, 1.3f) - 0.5f) * 2.2f * num5; float num7 = (Mathf.PerlinNoise(2.1f, time * 0.8f) - 0.5f) * 2.2f * num5; float num8 = (Mathf.PerlinNoise(time * 0.6f, 5.7f) - 0.5f) * 1.6f * num5; val2 *= Quaternion.Euler(num6, num7, num8); } if (S.HorizonLock) { Vector3 val3 = val2 * Vector3.forward; if (Mathf.Abs(Vector3.Dot(val3, Vector3.up)) < 0.98f) { val2 = Quaternion.LookRotation(val3, Vector3.up); } } if (Mathf.Abs(S.DutchTilt) > 0.01f) { val2 *= Quaternion.Euler(0f, 0f, S.DutchTilt); } Vector3 val4 = _pos; if (S.CameraCollision && UsesCollision()) { val4 = Collide(((Component)val).transform.position, val4); } ((Component)Cam).transform.SetPositionAndRotation(val4, val2); bool flag = Device.Held && !S.HandheldStabilizer && (S.Mode == CamMode.Handheld || S.Mode == CamMode.Selfie); _anchorT = ((S.Mode == CamMode.Headcam) ? ((Component)val).transform : (flag ? Device.LensTransform(S.Mode == CamMode.Selfie) : null)); if ((Object)(object)_anchorT != (Object)null) { _anchorPos = _anchorT.position; _anchorRot = _anchorT.rotation; } _anchorCamPos = val4; _anchorCamRot = val2; float num9 = EffectFov(); float num10 = ((num9 > 0f && S.UseEffectFov) ? num9 : S.Fov); Cam.fieldOfView = Mathf.Clamp(num10 / Mathf.Max(0.1f, S.Zoom), 5f, 150f); float num11 = Mathf.Max(0.01f, S.NearClip); if (S.Mode == CamMode.Headcam && S.HeadMount == HeadMount.Eyes) { num11 = Mathf.Max(num11, 0.07f); } Cam.nearClipPlane = num11; UpdateFocus(); UpdateVisuals(val); if (Overlay.Ready) { Overlay.I.Frame(Cam, Fx, RT); } if (!((Behaviour)Cam).enabled) { ((Behaviour)Cam).enabled = true; } Present(); BlackGuard(); Recorder.Update(); } private static float ModeShake() { switch (S.Mode) { case CamMode.Handheld: if (!Device.Held || !S.HandheldStabilizer) { return 0f; } return 0.5f; case CamMode.Selfie: if (!Device.Held || !S.HandheldStabilizer) { return 0f; } return 0.4f; case CamMode.Bodycam: return 0.5f; case CamMode.Headcam: if (S.HeadMount != HeadMount.Eyes) { return 0.4f; } return 0f; case CamMode.Drone: return 0.35f; case CamMode.ThirdPerson: return 0.25f; default: return 0f; } } private static bool UsesCollision() { if (S.Mode != CamMode.ThirdPerson && S.Mode != CamMode.Orbit) { return S.Mode == CamMode.Drone; } return true; } private static Transform HandT(bool camHand) { try { bool flag = S.Hand == CamHand.Right; if (!camHand) { flag = !flag; } Hand val = (flag ? Player.RightHand : Player.LeftHand); return ((Object)(object)val != (Object)null) ? ((Component)val).transform : null; } catch { return null; } } private static Transform ChestT() { try { return Player.Chest; } catch { return null; } } private static Vector3 Flat(Vector3 v) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) v.y = 0f; if (((Vector3)(ref v)).sqrMagnitude < 1E-05f) { return Vector3.forward; } return ((Vector3)(ref v)).normalized; } public static void HookBeforeRender() { if (_hooked) { return; } try { BeforeRenderHelper.RegisterCallback(DelegateSupport.ConvertDelegate<UnityAction>((Delegate)new Action(OnBeforeRender))); _hooked = true; } catch (Exception ex) { Core.Log.Warning("Before-render hook unavailable (headcam may lag 1 frame): " + ex.Message); } } private static void OnBeforeRender() { //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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_005e: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_007a: Unknown result type (might be due to invalid IL or missing references) try { if (S.Enabled && Alive) { Device.LateSnap(); HeadMirror.LateSync(); if (!((Object)(object)_anchorT == (Object)null)) { Transform anchorT = _anchorT; Quaternion val = anchorT.rotation * Quaternion.Inverse(_anchorRot); Vector3 val2 = anchorT.position + val * (_anchorCamPos - _anchorPos); ((Component)Cam).transform.SetPositionAndRotation(val2, val * _anchorCamRot); } } } catch { } } private static Animator Anim() { if (Time.unscaledTime > _animRefresh || (Object)(object)_anim == (Object)null) { _animRefresh = Time.unscaledTime + 2f; try { _anim = (((Object)(object)Player.Avatar != (Object)null) ? Player.Avatar.animator : null); } catch { _anim = null; } } return _anim; } private static bool TorsoFrame(Vector3 headFwd, out Vector3 chestPos, out Quaternion rot, out float depth) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) chestPos = default(Vector3); rot = Quaternion.identity; depth = 0.14f; try { Animator val = Anim(); if ((Object)(object)val == (Object)null) { return false; } Transform boneTransform = val.GetBoneTransform((HumanBodyBones)13); Transform boneTransform2 = val.GetBoneTransform((HumanBodyBones)14); Transform boneTransform3 = val.GetBoneTransform((HumanBodyBones)0); Transform val2 = val.GetBoneTransform((HumanBodyBones)9) ?? val.GetBoneTransform((HumanBodyBones)10); Transform val3 = val.GetBoneTransform((HumanBodyBones)54) ?? val.GetBoneTransform((HumanBodyBones)8); if ((Object)(object)boneTransform == (Object)null || (Object)(object)boneTransform2 == (Object)null || (Object)(object)boneTransform3 == (Object)null || (Object)(object)val2 == (Object)null) { return false; } Vector3 val4 = boneTransform2.position - boneTransform.position; float magnitude = ((Vector3)(ref val4)).magnitude; if (magnitude < 0.05f || magnitude > 2f) { return false; } val4 /= magnitude; Vector3 val5 = val2.position - boneTransform3.position; Vector3 normalized = ((Vector3)(ref val5)).normalized; val5 = Vector3.Cross(val4, normalized); Vector3 val6 = ((Vector3)(ref val5)).normalized; if (Vector3.Dot(val6, headFwd) < -0.2f) { val6 = -val6; } val5 = Vector3.Cross(val6, val4); normalized = ((Vector3)(ref val5)).normalized; rot = Quaternion.LookRotation(val6, normalized); Vector3 val7 = (boneTransform.position + boneTransform2.position) * 0.5f; chestPos = (((Object)(object)val3 != (Object)null) ? Vector3.Lerp(val3.position, val7 - normalized * magnitude * 0.35f, 0.5f) : (val7 - normalized * magnitude * 0.35f)); depth = Mathf.Clamp(magnitude * 0.45f, 0.09f, 0.3f); return true; } catch { return false; } } public static void PlaceTripod() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) Camera val = MainCam(); if (!((Object)(object)val == (Object)null)) { Transform val2 = HandT(camHand: true); _tripodPos = (((Object)(object)val2 != (Object)null) ? val2.position : (((Component)val).transform.position + ((Component)val).transform.forward * 0.5f)); _tripodRot = Quaternion.LookRotation(Flat(((Component)val).transform.forward), Vector3.up); _tripodPlaced = true; _snap = true; Core.Notify("Tripod placed", "Camera locked at your hand position."); } } public static void OnModeChanged() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) ModeStartTime = Time.time; _snap = true; ApplyEffect(); if ((S.Mode == CamMode.Tripod || S.Mode == CamMode.SecurityCam) && !_tripodPlaced) { PlaceTripod(); } if (S.Mode == CamMode.Orbit) { Camera val = MainCam(); if ((Object)(object)val != (Object)null) { _orbitAngle = Mathf.Atan2(0f - ((Component)val).transform.forward.z, 0f - ((Component)val).transform.forward.x) * 57.29578f; } } } private static void ComputeTarget(Camera main, out Vector3 pos, out Quaternion rot, out float smoothMul) { //IL_0008: 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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_072d: Unknown result type (might be due to invalid IL or missing references) //IL_0738: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_0756: Unknown result type (might be due to invalid IL or missing references) //IL_075b: Unknown result type (might be due to invalid IL or missing references) //IL_0766: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_0770: Unknown result type (might be due to invalid IL or missing references) //IL_0771: Unknown result type (might be due to invalid IL or missing references) //IL_0776: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Unknown result type (might be due to invalid IL or missing references) //IL_077d: Unknown result type (might be due to invalid IL or missing references) //IL_0782: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_078e: Unknown result type (might be due to invalid IL or missing references) //IL_0793: Unknown result type (might be due to invalid IL or missing references) //IL_0798: Unknown result type (might be due to invalid IL or missing references) //IL_07a3: Unknown result type (might be due to invalid IL or missing references) //IL_07ad: Unknown result type (might be due to invalid IL or missing references) //IL_07b2: Unknown result type (might be due to invalid IL or missing references) //IL_07b7: Unknown result type (might be due to invalid IL or missing references) //IL_07ba: Unknown result type (might be due to invalid IL or missing references) //IL_07bd: Unknown result type (might be due to invalid IL or missing references) //IL_07c2: Unknown result type (might be due to invalid IL or missing references) //IL_07c7: Unknown result type (might be due to invalid IL or missing references) //IL_07cc: Unknown result type (might be due to invalid IL or missing references) //IL_07d1: Unknown result type (might be due to invalid IL or missing references) //IL_07d3: Unknown result type (might be due to invalid IL or missing references) //IL_07d8: Unknown result type (might be due to invalid IL or missing references) //IL_0807: Unknown result type (might be due to invalid IL or missing references) //IL_081b: Unknown result type (might be due to invalid IL or missing references) //IL_082a: Unknown result type (might be due to invalid IL or missing references) //IL_082f: Unknown result type (might be due to invalid IL or missing references) //IL_0834: Unknown result type (might be due to invalid IL or missing references) //IL_0843: Unknown result type (might be due to invalid IL or missing references) //IL_0848: Unknown result type (might be due to invalid IL or missing references) //IL_084d: Unknown result type (might be due to invalid IL or missing references) //IL_084f: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) //IL_085a: Unknown result type (might be due to invalid IL or missing references) //IL_085b: Unknown result type (might be due to invalid IL or missing references) //IL_0865: Unknown result type (might be due to invalid IL or missing references) //IL_086a: Unknown result type (might be due to invalid IL or missing references) //IL_0870: Unknown result type (might be due to invalid IL or missing references) //IL_0875: Unknown result type (might be due to invalid IL or missing references) //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_087f: Unknown result type (might be due to invalid IL or missing references) //IL_0884: Unknown result type (might be due to invalid IL or missing references) //IL_0886: Unknown result type (might be due to invalid IL or missing references) //IL_088b: Unknown result type (might be due to invalid IL or missing references) //IL_08b1: Unknown result type (might be due to invalid IL or missing references) //IL_08b2: Unknown result type (might be due to invalid IL or missing references) //IL_08bd: Unknown result type (might be due to invalid IL or missing references) //IL_08c2: Unknown result type (might be due to invalid IL or missing references) //IL_08c7: Unknown result type (might be due to invalid IL or missing references) //IL_08d9: Unknown result type (might be due to invalid IL or missing references) //IL_08de: Unknown result type (might be due to invalid IL or missing references) //IL_08e3: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Unknown result type (might be due to invalid IL or missing references) //IL_08fe: Unknown result type (might be due to invalid IL or missing references) //IL_0903: Unknown result type (might be due to invalid IL or missing references) //IL_0908: Unknown result type (might be due to invalid IL or missing references) //IL_090a: Unknown result type (might be due to invalid IL or missing references) //IL_090f: Unknown result type (might be due to invalid IL or missing references) //IL_0915: Unknown result type (might be due to invalid IL or missing references) //IL_0917: Unknown result type (might be due to invalid IL or missing references) //IL_091c: Unknown result type (might be due to invalid IL or missing references) //IL_0921: Unknown result type (might be due to invalid IL or missing references) //IL_0926: Unknown result type (might be due to invalid IL or missing references) //IL_092b: Unknown result type (might be due to invalid IL or missing references) //IL_092d: Unknown result type (might be due to invalid IL or missing references) //IL_0932: Unknown result type (might be due to invalid IL or missing references) //IL_0941: Unknown result type (might be due to invalid IL or missing references) //IL_0946: Unknown result type (might be due to invalid IL or missing references) //IL_094c: Unknown result type (might be due to invalid IL or missing references) //IL_094e: Unknown result type (might be due to invalid IL or missing references) //IL_0958: Unknown result type (might be due to invalid IL or missing references) //IL_095d: Unknown result type (might be due to invalid IL or missing references) //IL_0962: Unknown result type (might be due to invalid IL or missing references) //IL_0691: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) //IL_0698: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06a8: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Unknown result type (might be due to invalid IL or missing references) //IL_06b4: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06cc: Unknown result type (might be due to invalid IL or missing references) //IL_06d1: Unknown result type (might be due to invalid IL or missing references) //IL_06d6: Unknown result type (might be due to invalid IL or missing references) //IL_06d8: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_06e7: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_06ee: Unknown result type (might be due to invalid IL or missing references) //IL_06f3: Unknown result type (might be due to invalid IL or missing references) //IL_070b: Unknown result type (might be due to invalid IL or missing references) //IL_070d: Unknown result type (might be due to invalid IL or missing references) //IL_0712: Unknown result type (might be due to invalid IL or missing references) //IL_0717: Unknown result type (might be due to invalid IL or missing references) //IL_0719: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_071e: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0641: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_0629: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)main).transform; Vector3 position = transform.position; Vector3 val = Flat(transform.forward); Vector3 val2 = Vector3.Cross(Vector3.up, val); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(S.OffsetSide, S.OffsetUp, S.OffsetForward); Quaternion val4 = Quaternion.Euler(S.PitchOffset, S.YawOffset, 0f); smoothMul = 1f; float num3; Quaternion val8; Vector3 val7; Vector3 val9; switch (S.Mode) { case CamMode.Handheld: case CamMode.Selfie: if (!((Object)(object)Device.Root == (Object)null)) { Device.LensPose(S.Mode == CamMode.Selfie, out pos, out rot); smoothMul = (S.HandheldStabilizer ? 1f : 0f); rot *= val4; pos += rot * val3; return; } break; case CamMode.Bodycam: { num3 = Mathf.Max(Time.deltaTime, 0.0001f); float num4 = Mathf.Atan2(val.x, val.z) * 57.29578f; if (_snap) { _bodyYaw = num4; } float num5 = Mathf.DeltaAngle(_bodyYaw, num4); float num6 = ((Mathf.Abs(num5) > 40f) ? (num5 - Mathf.Sign(num5) * 40f) : 0f); _bodyYaw += num6 * (1f - Mathf.Exp((0f - num3) * 6f)); Vector3 val10 = (position - _lastHeadPos) / num3; val10.y = 0f; _lastHeadPos = position; float num7 = ((_snap || ((Vector3)(ref val10)).magnitude > 20f) ? 0f : Mathf.Clamp01(((Vector3)(ref val10)).magnitude / 1.5f)); _bodyYaw += num5 * (1f - Mathf.Exp((0f - num3) * 2.5f * num7)); val8 = Quaternion.Euler(0f, _bodyYaw, 0f); if (TorsoFrame(transform.forward, out var chestPos, out var rot2, out var depth) && position.y - chestPos.y > 0.12f) { _torsoRot = (_snap ? rot2 : Quaternion.Slerp(_torsoRot, rot2, 1f - Mathf.Exp((0f - num3) * 12f))); val7 = chestPos; rot = _torsoRot * Quaternion.Euler(8f, 0f, 0f) * val4; val9 = val7 + _torsoRot * (new Vector3(0.05f, -0.02f, depth) + val3); goto IL_03d7; } Transform val11 = ChestT(); if ((Object)(object)val11 != (Object)null && position.y - val11.position.y > 0.15f) { Vector3 val12 = val11.position - position; if (((Vector3)(ref val12)).sqrMagnitude < 0.8f) { val7 = val11.position; goto IL_0365; } } val7 = position - Vector3.up * 0.38f; goto IL_0365; } case CamMode.Headcam: { Quaternion rotation = transform.rotation; float num10 = (S.HideOwnHead ? 0.03f : 0f); Vector3 zero = default(Vector3); Quaternion val14; switch (S.HeadMount) { case HeadMount.Side: ((Vector3)(ref zero))..ctor(0.095f, 0.05f, 0.06f + num10); val14 = Quaternion.Euler(4f, -2f, 0f); break; case HeadMount.Top: ((Vector3)(ref zero))..ctor(0f, 0.14f, 0.04f + num10); val14 = Quaternion.Euler(8f, 0f, 0f); break; case HeadMount.Chin: ((Vector3)(ref zero))..ctor(0f, -0.11f, 0.11f + num10); val14 = Quaternion.Euler(-4f, 0f, 0f); break; case HeadMount.Forehead: ((Vector3)(ref zero))..ctor(0f, 0.065f, 0.095f + num10); val14 = Quaternion.Euler(4f, 0f, 0f); break; default: zero = Vector3.zero; val14 = Quaternion.identity; break; } rot = rotation * val14 * val4; pos = position + rotation * (zero + val3); smoothMul = ((S.HeadMount == HeadMount.Eyes) ? 0f : 0.3f); return; } case CamMode.Tripod: if (!_tripodPlaced) { PlaceTripod(); } rot = _tripodRot * val4; pos = _tripodPos + _tripodRot * val3; return; case CamMode.SecurityCam: { if (!_tripodPlaced) { PlaceTripod(); } pos = _tripodPos + _tripodRot * val3; Vector3 val6 = position - pos; rot = ((((Vector3)(ref val6)).sqrMagnitude > 0.01f) ? (Quaternion.LookRotation(val6, Vector3.up) * val4) : _tripodRot); smoothMul = 1.6f; return; } case CamMode.ThirdPerson: { pos = position - val * S.ThirdPersonDistance + Vector3.up * S.ThirdPersonHeight + val2 * S.ThirdPersonSide + Quaternion.LookRotation(val) * val3; Vector3 val5 = position + val * 3f + val2 * S.ThirdPersonSide * 0.5f; rot = Quaternion.LookRotation(val5 - pos, Vector3.up) * val4; return; } case CamMode.Orbit: { _orbitAngle += S.OrbitSpeed * Time.deltaTime; float num2 = _orbitAngle * ((float)Math.PI / 180f); pos = position + new Vector3(Mathf.Cos(num2), 0f, Mathf.Sin(num2)) * S.OrbitRadius + Vector3.up * S.OrbitHeight + val3; rot = Quaternion.LookRotation(position - Vector3.up * 0.2f - pos, Vector3.up) * val4; smoothMul = 0.6f; return; } case CamMode.Drone: { float num = Mathf.Sin(Time.time * 1.3f) * 0.08f; pos = position - val * S.DroneDistance + Vector3.up * (S.DroneHeight + num) + val2 * Mathf.Sin(Time.time * 0.4f) * 0.4f + val3; rot = Quaternion.LookRotation(position - pos, Vector3.up) * val4; smoothMul = 2.2f; return; } IL_0365: val7.y = Mathf.Min(val7.y, position.y - 0.3f); rot = val8 * Quaternion.Euler(10f, 0f, 0f) * val4; val9 = val7 + val8 * (new Vector3(0.06f, 0f, 0.16f) + val3); goto IL_03d7; IL_03d7: if (S.BodyBob) { Vector3 val13 = (val7 - _lastBodyPos) / num3; val13.y = 0f; float num8 = Mathf.Min(((Vector3)(ref val13)).magnitude, 6f); if (_snap || ((Vector3)(ref val13)).magnitude > 20f) { num8 = 0f; } _bobPhase += num3 * (4f + num8 * 2.4f) * ((num8 > 0.3f) ? 1f : 0.15f); float num9 = Mathf.Clamp01(num8 / 2.5f); val9 += Vector3.up * Mathf.Abs(Mathf.Sin(_bobPhase)) * 0.025f * num9; rot *= Quaternion.Euler(Mathf.Sin(_bobPhase * 2f) * 2f * num9, Mathf.Sin(_bobPhase) * 1.2f * num9, Mathf.Sin(_bobPhase) * 3f * num9); } _lastBodyPos = val7; pos = val9; smoothMul = 0.25f; return; } rot = transform.rotation; pos = position + transform.forward * 0.1f; } private static Vector3 Collide(Vector3 from, Vector3 to) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0028: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) try { Vector3 val = to - from; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.05f) { return to; } val /= magnitude; Il2CppStructArray<RaycastHit> val2 = Physics.SphereCastAll(from, 0.12f, val, magnitude, -1, (QueryTriggerInteraction)1); float num = magnitude; Transform val3 = null; try { val3 = (((Object)(object)Player.RigManager != (Object)null) ? ((Component)Player.RigManager).transform : null); } catch { } foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)val2) { RaycastHit current = item; if (!((Object)(object)((RaycastHit)(ref current)).collider == (Object)null) && !(((RaycastHit)(ref current)).distance <= 0.001f) && (!((Object)(object)val3 != (Object)null) || !((Component)((RaycastHit)(ref current)).collider).transform.IsChildOf(val3)) && (!((Object)(object)((RaycastHit)(ref current)).collider.attachedRigidbody != (Object)null) || ((RaycastHit)(ref current)).collider.attachedRigidbody.isKinematic) && ((RaycastHit)(ref current)).distance < num) { num = ((RaycastHit)(ref current)).distance; } } return from + val * Mathf.Max(0.2f, num - 0.05f); } catch { return to; } } private static void UpdateFocus() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0058: Unknown result type (might be due to invalid IL or missing references) if (!S.AutoFocus || (Object)(object)_dof == (Object)null) { return; } try { float num = 10f; RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)Cam).transform.position + ((Component)Cam).transform.forward * 0.1f, ((Component)Cam).transform.forward, ref val, 100f, -1, (QueryTriggerInteraction)1)) { num = ((RaycastHit)(ref val)).distance + 0.1f; } _focusDist = Mathf.Lerp(_focusDist, num, 1f - Mathf.Exp((0f - Time.deltaTime) * 6f)); ((VolumeParameter<float>)(object)_dof.focusDistance).Override(_focusDist); float num2 = 24f * 0.5f / Mathf.Tan(Cam.fieldOfView * 0.5f * ((float)Math.PI / 180f)); ((VolumeParameter<float>)(object)_dof.focalLength).Override(Mathf.Clamp(num2, 1f, 300f)); } catch { } } private static void UpdateVisuals(Camera main) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) bool flag = S.ShowCameraModel && S.Mode == CamMode.Bodycam; if ((Object)(object)_bodycamModel != (Object)null && _bodycamModel.activeSelf != flag) { _bodycamModel.SetActive(flag); } if ((Object)(object)_light != (Object)null) { ((Behaviour)_light).enabled = S.CameraLight; _light.intensity = S.LightIntensity; } if (!((Object)(object)_wrist != (Object)null)) { return; } bool wristMonitor = S.WristMonitor; Transform val = HandT(camHand: false); if (wristMonitor && (Object)(object)val != (Object)null) { if (!_wrist.activeSelf) { _wrist.SetActive(true); } Vector3 position = ((Component)main).transform.position; Vector3 val2 = val.position + Vector3.up * 0.09f; Vector3 val3 = val2 - position; if (((Vector3)(ref val3)).sqrMagnitude > 0.0001f) { _wrist.transform.SetPositionAndRotation(val2, Quaternion.LookRotation(val3, Vector3.up)); } float num = (((Object)(object)RT != (Object)null) ? ((float)((Texture)RT).width / (float)((Texture)RT).height) : 1.7777778f); _wrist.transform.localScale = new Vector3(S.WristMonitorSize * num, S.WristMonitorSize, 1f); } else if (_wrist.activeSelf) { _wrist.SetActive(false); } } public static void TakePhoto() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00bc: Expected O, but got Unknown if (!S.Enabled || !Alive || (Object)(object)RT == (Object)null) { Core.Notify("Camera is off", "Turn the camera on first."); return; } try { ((Behaviour)Cam).enabled = true; Cam.Render(); } catch { } try { RenderTexture active = RenderTexture.active; RenderTexture.active = RT; Texture2D val = new Texture2D(((Texture)RT).width, ((Texture)RT).height, (TextureFormat)3, false); val.ReadPixels(new Rect(0f, 0f, (float)((Texture)RT).width, (float)((Texture)RT).height), 0, 0); val.Apply(); RenderTexture.active = active; Il2CppStructArray<byte> source = ImageConversion.EncodeToPNG(val); Object.Destroy((Object)val); byte[] bytes = ((IEnumerable<byte>)source).ToArray(); Directory.CreateDirectory(Settings.PhotoFolder); string text = "Camerium_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss-fff") + "_" + S.Effect.ToString() + ".png"; File.WriteAllBytes(Path.Combine(Settings.PhotoFolder, text), bytes); FlashTimer = 0.18f; Core.Notify("Photo saved", text); } catch (Exception ex) { Core.Log.Error("Photo failed: " + ex); Core.Notify("Photo failed", ex.Message); } } public static void ToggleRecording() { if (!Recording) { if (!S.Enabled || !Alive) { Core.Notify("Camera is off", "Turn the camera on first."); } else if (Recorder.Busy) { Core.Notify("Please wait", "Still saving the last video..."); } else if (!S.RecordVideo || Recorder.Start()) { Recording = true; RecordTime = 0f; Core.Notify("REC", S.RecordVideo ? "Recording to UserData/Camerium/Videos" : "Indicator only (video saving is off)"); } } else { Recording = false; if (Recorder.Active) { Recorder.Stop(); Core.Notify("STOP", "Saving video..."); } else { Core.Notify("STOP", "Recording stopped."); } } } public static void StopRecording() { if (Recording) { Recording = false; Recorder.Stop(); } } } public class Core : MelonMod { public static Instance Log; public static Settings S = new Settings(); private static float _saveTimer = -1f; private static float _bothSticksHeld; private static bool _bothSticksFired; private static bool _kbFailed; public override void OnInitializeMelon() { Log = ((MelonBase)this).LoggerInstance; S = Settings.Load() ?? new Settings(); if (S.ConfigVersion < 3) { S.HeadMount = HeadMount.Forehead; S.ConfigVersion = 3; } if (S.ConfigVersion < 4) { S.HeadMount = HeadMount.Eyes; S.ConfigVersion = 4; } S.Enabled = false; Hooking.OnLevelLoaded += delegate { CameraRig.OnLevelLoaded(); }; Hooking.OnLevelUnloaded += delegate { CameraRig.StopRecording(); CameraRig.OnLevelLoaded(); }; Menu.Build(); CameraRig.HookBeforeRender(); Log.Msg("Camerium loaded. Open BoneMenu > Camerium."); } public static void Changed() { _saveTimer = 1.5f; } public override void OnUpdate() { if (_saveTimer > 0f) { _saveTimer -= Time.unscaledDeltaTime; if (_saveTimer <= 0f) { S.Save(); } } try { Shortcuts(); } catch { } } public override void OnLateUpdate() { try { CameraRig.LateUpdate(); } catch (Exception ex) { Log.Error("Camera update: " + ex.Message); } } public override void OnGUI() { try { Hud.Draw(); } catch { } } public override void OnApplicationQuit() { Recorder.Shutdown(); S.Save(); } private static void Shortcuts() { if (S.KeyboardShortcuts && !_kbFailed) { try { Keyboard current = Keyboard.current; if (current != null) { if (((ButtonControl)current.f6Key).wasPressedThisFrame) { Actions.ToggleCamera(); } if (((ButtonControl)current.f7Key).wasPressedThisFrame) { Actions.NextMode(); } if (((ButtonControl)current.f8Key).wasPressedThisFrame) { Actions.NextEffect(); } if (((ButtonControl)current.f9Key).wasPressedThisFrame) { CameraRig.TakePhoto(); } if (((ButtonControl)current.f10Key).wasPressedThisFrame) { CameraRig.ToggleRecording(); } if (((ButtonControl)current.f5Key).wasPressedThisFrame) { Actions.CycleDesktop(); } if (((ButtonControl)current.pageUpKey).isPressed) { Actions.ZoomBy(1f + Time.unscaledDeltaTime * 1.5f); } if (((ButtonControl)current.pageDownKey).isPressed) { Actions.ZoomBy(1f / (1f + Time.unscaledDeltaTime * 1.5f)); } if (((ButtonControl)current.homeKey).wasPressedThisFrame) { Actions.SetZoom(1f); } if (((ButtonControl)current.endKey).wasPressedThisFrame) { CameraRig.PlaceTripod(); } if (((ButtonControl)current.f4Key).wasPressedThisFrame) { Device.Summon(); } } } catch (Exception ex) { _kbFailed = true; Log.Warning("Keyboard shortcuts disabled: " + ex.Message); } } if (!S.ControllerShortcuts || !Player.ControllersExist) { return; } BaseController leftController = Player.LeftController; BaseController rightController = Player.RightController; if ((Object)(object)leftController == (Object)null || (Object)(object)rightController == (Object)null) { return; } if (leftController.GetThumbStick() && rightController.GetThumbStick()) { _bothSticksHeld += Time.unscaledDeltaTime; if (_bothSticksHeld > 0.8f && !_bothSticksFired) { _bothSticksFired = true; CameraRig.ToggleRecording(); } return; } if (_bothSticksHeld > 0.02f && _bothSticksHeld <= 0.8f && !_bothSticksFired) { if (S.Enabled) { CameraRig.TakePhoto(); } else { Actions.ToggleCamera(); } } _bothSticksHeld = 0f; _bothSticksFired = false; } public static void Notify(string title, string msg) { Instance log = Log; if (log != null) { log.Msg(title + ": " + (msg ?? "").Replace('\n', ' ')); } } } public static class Actions { private static Settings S => Core.S; public static void ToggleCamera() { S.Enabled = !S.Enabled; OnEnabledChanged(); Menu.Sync(); } public static void OnEnabledChanged() { if (S.Enabled) { CameraRig.Ensure(); Device.Summon(); CameraRig.OnModeChanged(); } Core.Notify("Camerium", S.Enabled ? ("Camera ON · " + S.Mode.ToString() + " · " + EffectProfile.Get(S.Effect).Name) : "Camera OFF"); } public static void NextMode() { C