RUMBLE does not support other mod managers. If you want to use a manager, you must use the RUMBLE Mod Manager, a manager specifically designed for this game.
Decompiled source of HeinhouserHoloLens v1.1.8
Mods/HeinhouserHoloLens.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using HarmonyLib; using HeinhouserHoloLens; using Il2CppLiv.Lck; using Il2CppRUMBLE.Managers; using Il2CppRUMBLE.Players; using Il2CppRUMBLE.Players.Subsystems; using Il2CppRUMBLE.Recording.LCK; using Il2CppRUMBLE.Recording.LCK.Extensions; using Il2CppRUMBLE.Utilities; using MelonLoader; using MelonLoader.Preferences; using RumbleModdingAPI.RMAPI; using UIFramework; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Core), "HeinhouserHoloLens", "1.1.8", "UlvakSkillz", null)] [assembly: MelonGame("Buckethead Entertainment", "RUMBLE")] [assembly: MelonColor(255, 195, 0, 255)] [assembly: MelonAuthorColor(255, 195, 0, 255)] [assembly: VerifyLoaderVersion(0, 7, 2, true)] [assembly: MelonAdditionalDependencies(new string[] { "UIFramework" })] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("HeinhouserHoloLens")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9df6b49d10c993516150a2d37cabc4f2f510a48e")] [assembly: AssemblyProduct("HeinhouserHoloLens")] [assembly: AssemblyTitle("HeinhouserHoloLens")] [assembly: AssemblyVersion("1.0.0.0")] namespace HeinhouserHoloLens; internal static class CameraSettings { internal static string SettingsToString() { return $"{(Core.isMatchmaking ? "player1 = 0, player2 = 1, " : ((Core.currentScene == "Park") ? $"parkPlayer1 = {Preferences.PrefCamPlayer1.Value}, parkPlayer2 = {Preferences.PrefCamPlayer2.Value}, " : ""))}cameraMoveSpeed = {Preferences.PrefCameraMoveSpeed.Value}, cameraOrbitSpeed = {Preferences.PrefCameraOrbitSpeed.Value}, cameraPositionCorrectionScaler = {Preferences.PrefCamPosCorrection.Value}, CameraDistanceFromMapCenterAllowed = {Preferences.PrefMaxCenterDist.Value}, playerCenterSmoothing = {Preferences.PrefPlayerCenterSmoothing.Value}, cameraPositionIncrease = {Preferences.PrefCamPosIncrease.Value}, cameraPositionFalloff = {Preferences.PrefCamPosFalloff.Value}, cameraPositionBuffer = {Preferences.PrefCamPosBuffer.Value}, allowedHeightScaler = {Preferences.PrefAllowedHeightScaler.Value}"; } } internal class CameraControl { [HarmonyPatch(typeof(LCKTabletUtility), "OnRecordingStarted", new Type[] { typeof(LckResult) })] public static class LCKTabletUtilityOnRecordingStartedPatch { private static void Postfix(LckResult result) { IsRecording = true; UpdateRecordingLens(); } } [HarmonyPatch(typeof(LCKTabletUtility), "OnRecordingStopped", new Type[] { typeof(LckResult) })] public static class LCKTabletUtilityOnRecordingStoppedPatch { private static void Postfix(LckResult result) { IsRecording = false; UpdateRecordingLens(); } } [CompilerGenerated] private sealed class <RunSpectateCamera>d__17 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int player1; public int player2; private Transform <selectedPlayer1>5__1; private Transform <selectedPlayer2>5__2; private Transform <cameraRotationControl>5__3; private Transform <originalParent>5__4; private Vector3 <originalLocalPos>5__5; private Quaternion <originalLocalRot>5__6; private float <localDistance>5__7; private float <remoteDistance>5__8; private float <playerCenterLerpSpot>5__9; private Vector3 <smoothedPlayersCenter>5__10; private bool <isOrbitingRight>5__11; private Vector3 <rawPlayersCenter>5__12; private float <distanceToPlayersCenter>5__13; private float <distanceToCenter>5__14; private float <baseDistance>5__15; private float <scaledIncrease>5__16; private float <idealCameraDistance>5__17; private float <allowedHeight>5__18; private float <clampedY>5__19; private Vector3 <clampedYVector>5__20; private Vector3 <dirFromCenter>5__21; private Vector3 <movementAmount>5__22; private Vector3 <desiredOrbitPos>5__23; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RunSpectateCamera>d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <selectedPlayer1>5__1 = null; <selectedPlayer2>5__2 = null; <cameraRotationControl>5__3 = null; <originalParent>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0343: 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_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_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0380: 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_038c: 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_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_019f: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_022c: 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_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0472: 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_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0491: 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_049d: 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_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_079f: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_07cb: Unknown result type (might be due to invalid IL or missing references) //IL_07d7: Unknown result type (might be due to invalid IL or missing references) //IL_07e1: Expected O, but got Unknown //IL_0629: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_06dc: Unknown result type (might be due to invalid IL or missing references) //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: 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_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_0709: Unknown result type (might be due to invalid IL or missing references) //IL_0724: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: 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_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_08d3: Unknown result type (might be due to invalid IL or missing references) //IL_08e4: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) //IL_0753: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; Melon<Core>.Logger.Msg("Playing Spectate Mode: " + CameraSettings.SettingsToString()); if (cameraIsBeingControlled) { cameraIsBeingControlled = false; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; } goto IL_0095; case 1: <>1__state = -1; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 2; return true; case 2: <>1__state = -1; goto IL_0095; case 3: { <>1__state = -1; break; } IL_0095: cameraIsBeingControlled = true; <selectedPlayer1>5__1 = ((Singleton<PlayerManager>.instance.AllPlayers.Count > player1) ? ((Component)Singleton<PlayerManager>.instance.AllPlayers[player1].Controller).transform.FindChild("Visuals/Skelington/Bone_Pelvis/Bone_Spine_A/Bone_Chest") : ((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).transform.FindChild("Visuals/Skelington/Bone_Pelvis/Bone_Spine_A/Bone_Chest")); <selectedPlayer2>5__2 = ((Singleton<PlayerManager>.instance.AllPlayers.Count > player2) ? ((Component)Singleton<PlayerManager>.instance.AllPlayers[player2].Controller).transform.FindChild("Visuals/Skelington/Bone_Pelvis/Bone_Spine_A/Bone_Chest") : ((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).transform.FindChild("Visuals/Skelington/Bone_Pelvis/Bone_Spine_A/Bone_Chest")); camera = ((Component)Singleton<PlayerManager>.instance.localPlayer.Controller.PlayerLIV.LckTablet.selfieCamera).gameObject.transform.parent; <cameraRotationControl>5__3 = new GameObject("SmoothCameraControl").transform; <originalParent>5__4 = ((Component)Singleton<PlayerManager>.instance.localPlayer.Controller.PlayerLIV.LckTablet.selfieCamera).gameObject.transform.parent.parent; <originalLocalPos>5__5 = camera.localPosition; <originalLocalRot>5__6 = camera.localRotation; <localDistance>5__7 = Vector3.Distance(camera.position, <selectedPlayer1>5__1.position); <remoteDistance>5__8 = Vector3.Distance(camera.position, <selectedPlayer2>5__2.position); <playerCenterLerpSpot>5__9 = <remoteDistance>5__8 / (<localDistance>5__7 + <remoteDistance>5__8); <smoothedPlayersCenter>5__10 = Vector3.Lerp(<selectedPlayer2>5__2.position, <selectedPlayer1>5__1.position, <playerCenterLerpSpot>5__9); camera.SetParent((Transform)null); <isOrbitingRight>5__11 = true; if (Preferences.PrefShowInGame.Value) { CreateHoloLens(); } <cameraRotationControl>5__3.position = camera.position; <cameraRotationControl>5__3.rotation = camera.rotation; break; } if (cameraIsBeingControlled && (Object)(object)<selectedPlayer1>5__1 != (Object)null && (Object)(object)<selectedPlayer2>5__2 != (Object)null && (Object)(object)camera != (Object)null && (Object)(object)<cameraRotationControl>5__3 != (Object)null) { <localDistance>5__7 = Vector3.Distance(camera.position, <selectedPlayer1>5__1.position); <remoteDistance>5__8 = Vector3.Distance(camera.position, <selectedPlayer2>5__2.position); <playerCenterLerpSpot>5__9 = <remoteDistance>5__8 / (<localDistance>5__7 + <remoteDistance>5__8); <rawPlayersCenter>5__12 = Vector3.Lerp(<selectedPlayer2>5__2.position, <selectedPlayer1>5__1.position, <playerCenterLerpSpot>5__9); <smoothedPlayersCenter>5__10 = Vector3.Lerp(<smoothedPlayersCenter>5__10, <rawPlayersCenter>5__12, Preferences.PrefPlayerCenterSmoothing.Value * Time.fixedDeltaTime); <distanceToPlayersCenter>5__13 = Vector3.Distance(<smoothedPlayersCenter>5__10, camera.position); <baseDistance>5__15 = Vector3.Distance(<selectedPlayer1>5__1.position, <selectedPlayer2>5__2.position) / 2f; <scaledIncrease>5__16 = Preferences.PrefCamPosIncrease.Value / (1f + <baseDistance>5__15 * Preferences.PrefCamPosFalloff.Value); <idealCameraDistance>5__17 = <baseDistance>5__15 + <scaledIncrease>5__16; <allowedHeight>5__18 = Math.Min(10f, Vector3.Distance(<selectedPlayer1>5__1.position, <selectedPlayer2>5__2.position) / Preferences.PrefAllowedHeightScaler.Value); if (Mathf.Abs(<distanceToPlayersCenter>5__13 - <idealCameraDistance>5__17) > Preferences.PrefCamPosBuffer.Value) { Vector3 val = <cameraRotationControl>5__3.position - <smoothedPlayersCenter>5__10; <dirFromCenter>5__21 = ((Vector3)(ref val)).normalized; <cameraRotationControl>5__3.position = Vector3.Lerp(<cameraRotationControl>5__3.position, <smoothedPlayersCenter>5__10 + <dirFromCenter>5__21 * <idealCameraDistance>5__17, Time.fixedDeltaTime * Preferences.PrefCameraMoveSpeed.Value); } <clampedY>5__19 = Mathf.Clamp(<cameraRotationControl>5__3.position.y, <smoothedPlayersCenter>5__10.y, <smoothedPlayersCenter>5__10.y + <allowedHeight>5__18); <clampedYVector>5__20 = new Vector3(<cameraRotationControl>5__3.position.x, <clampedY>5__19, <cameraRotationControl>5__3.position.z); <cameraRotationControl>5__3.position = Vector3.Lerp(<cameraRotationControl>5__3.position, <clampedYVector>5__20, Time.fixedDeltaTime * Preferences.PrefCameraMoveSpeed.Value); if (Core.isMatchmaking) { <distanceToCenter>5__14 = Vector2.Distance(Vector2.zero, new Vector2(<cameraRotationControl>5__3.position.x, <cameraRotationControl>5__3.position.z)); while (Vector2.Distance(Vector2.zero, new Vector2(<smoothedPlayersCenter>5__10.x, <smoothedPlayersCenter>5__10.z)) < Preferences.PrefMaxCenterDist.Value && <distanceToCenter>5__14 > Preferences.PrefMaxCenterDist.Value) { Transform obj = <cameraRotationControl>5__3; obj.position += <cameraRotationControl>5__3.forward * Preferences.PrefCamPosCorrection.Value; <cameraRotationControl>5__3.LookAt(<smoothedPlayersCenter>5__10); <distanceToCenter>5__14 = Vector2.Distance(Vector2.zero, new Vector2(<cameraRotationControl>5__3.position.x, <cameraRotationControl>5__3.position.z)); } } if (Vector3.Distance(camera.position, <cameraRotationControl>5__3.position) < Preferences.PrefCamPosBuffer.Value / Preferences.PrefMaxCenterDist.Value) { <movementAmount>5__22 = (float)(<isOrbitingRight>5__11 ? 1 : (-1)) * <cameraRotationControl>5__3.right * Preferences.PrefCamPosCorrection.Value; <desiredOrbitPos>5__23 = <cameraRotationControl>5__3.position - <movementAmount>5__22; if (!Core.isMatchmaking || Vector2.Distance(Vector2.zero, new Vector2(<desiredOrbitPos>5__23.x, <desiredOrbitPos>5__23.z)) <= Preferences.PrefMaxCenterDist.Value) { <cameraRotationControl>5__3.RotateAround(<smoothedPlayersCenter>5__10, Vector3.up, (<isOrbitingRight>5__11 ? 1f : (-1f)) * Preferences.PrefCameraOrbitSpeed.Value * Time.fixedDeltaTime); } else { <isOrbitingRight>5__11 = !<isOrbitingRight>5__11; } } <cameraRotationControl>5__3.LookAt(<smoothedPlayersCenter>5__10); camera.position = <cameraRotationControl>5__3.position; camera.rotation = <cameraRotationControl>5__3.rotation; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 3; return true; } IsActiveHoloLensNormal = true; if ((Object)(object)activeHoloLens != (Object)null) { Object.Destroy((Object)(object)activeHoloLens); } if ((Object)(object)<cameraRotationControl>5__3 != (Object)null && (Object)(object)((Component)<cameraRotationControl>5__3).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)<cameraRotationControl>5__3).gameObject); } if ((Object)(object)camera != (Object)null && (Object)(object)<originalParent>5__4 != (Object)null) { camera.SetParent(<originalParent>5__4); camera.localPosition = <originalLocalPos>5__5; camera.localRotation = <originalLocalRot>5__6; } if (Preferences.PrefRevertToFps.Value) { Player localPlayer = Singleton<PlayerManager>.instance.localPlayer; object obj2; if (localPlayer == null) { obj2 = null; } else { PlayerController controller = localPlayer.Controller; if (controller == null) { obj2 = null; } else { PlayerLIV playerLIV = controller.PlayerLIV; if (playerLIV == null) { obj2 = null; } else { LCKTabletUtility lckTablet = playerLIV.LckTablet; obj2 = ((lckTablet != null) ? lckTablet.lckCameraController : null); } } } if ((Object)obj2 != (Object)null) { Singleton<PlayerManager>.instance.localPlayer.Controller.PlayerLIV.LckTablet.lckCameraController.CameraModeChanged((CameraMode)1); } } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <StartSpectateCoroutine>d__16 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int player1; public int player2; private LCKCameraController <lckCameraController>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StartSpectateCoroutine>d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <lckCameraController>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_0109: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; Singleton<PlayerManager>.instance.localPlayer.Controller.PlayerLIV.ShowTablet(); <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 1; return true; case 1: <>1__state = -1; MelonCoroutines.Start(RunSpectateCamera(player1, player2)); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; case 2: <>1__state = -1; <lckCameraController>5__1 = Singleton<PlayerManager>.instance.localPlayer.Controller.PlayerLIV.LckTablet.lckCameraController; <lckCameraController>5__1.CameraModeChanged((CameraMode)0); <lckCameraController>5__1.SelfieFOVDoubleButton.ApplySavedData(Preferences.PrefCamFOV.Value); <lckCameraController>5__1.SelfieSmoothingDoubleButton.ApplySavedData(0); if (<lckCameraController>5__1.CurrentCameraOrientation != Preferences.PrefCamMode.Value) { <lckCameraController>5__1._orientationButton.RPC_OnPressed(); } <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 3; return true; case 3: <>1__state = -1; Singleton<PlayerManager>.instance.localPlayer.Controller.PlayerLIV.HideTablet(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static bool cameraIsBeingControlled = false; private static GameObject ddolHoloLens = null; private static GameObject activeHoloLens = null; private static Transform camera = null; private static bool IsRecording = false; private static bool grabbedMaterial = false; private static bool IsActiveHoloLensNormal = true; internal static void OnLateInitializeMelon() { ddolHoloLens = Object.Instantiate<GameObject>(AssetBundles.LoadAssetFromStream<GameObject>(Core.instance, "HeinhouserHoloLens.hololens", "HoloLens")); ((Object)ddolHoloLens).name = "HoloLens"; ddolHoloLens.SetActive(false); Object.DontDestroyOnLoad((Object)(object)ddolHoloLens); } internal static void OnSceneWasLoaded() { cameraIsBeingControlled = false; } internal static void MapLoaded(string map) { if (!grabbedMaterial && Core.currentScene == "Gym") { ((Renderer)((Component)ddolHoloLens.transform.GetChild(0).GetChild(3)).GetComponent<MeshRenderer>()).material = ((Renderer)TposePlayer.GetGameObject().GetComponent<MeshRenderer>()).material; grabbedMaterial = true; } if (Preferences.PrefEnable.Value && Core.isMatchmaking) { StartSpectate(); } else if (Preferences.PrefEnable.Value && Preferences.PrefRevertToFps.Value && Core.currentScene == "Gym") { Singleton<PlayerManager>.instance.localPlayer.Controller.PlayerLIV.LckTablet.lckCameraController.CameraModeChanged((CameraMode)1); } } internal static void Save(bool holoLensEnabledChanged, bool showCameraInGameChanged, bool spectateActiveChanged) { //IL_00fd: 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) bool flag = Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefCamPlayer1) || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefCamPlayer2); bool flag2 = Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefCameraMoveSpeed) || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefCameraOrbitSpeed) || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefCamPosCorrection) || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefMaxCenterDist) || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefPlayerCenterSmoothing) || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefCamPosIncrease) || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefCamPosFalloff) || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefCamPosBuffer) || Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefAllowedHeightScaler); if (Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefCamFOV)) { Singleton<PlayerManager>.instance.localPlayer.Controller.PlayerLIV.LckTablet.lckCameraController.SelfieFOVDoubleButton.ApplySavedData(Preferences.PrefCamFOV.Value); } if (Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefCamMode)) { LCKCameraController lckCameraController = Singleton<PlayerManager>.instance.localPlayer.Controller.PlayerLIV.LckTablet.lckCameraController; if (lckCameraController.CurrentCameraOrientation != Preferences.PrefCamMode.Value) { lckCameraController._orientationButton.RPC_OnPressed(); } } if (flag2) { if (Preferences.PrefEnable.Value && Core.isMatchmaking && cameraIsBeingControlled) { StartSpectate(); } else if (Preferences.PrefEnable.Value && cameraIsBeingControlled && Core.currentScene.Contains("Park")) { StartSpectate(Preferences.PrefCamPlayer1.Value, Preferences.PrefCamPlayer2.Value); } return; } if (Core.isMatchmaking) { if (Preferences.PrefEnable.Value && showCameraInGameChanged) { if (Preferences.PrefShowInGame.Value && (Object)(object)activeHoloLens == (Object)null) { CreateHoloLens(); } else if (!Preferences.PrefShowInGame.Value && (Object)(object)activeHoloLens != (Object)null) { Object.Destroy((Object)(object)activeHoloLens); activeHoloLens = null; } } if (holoLensEnabledChanged) { if (Preferences.PrefEnable.Value) { StartSpectate(); } else { cameraIsBeingControlled = false; } } return; } if (flag && Preferences.PrefCamSpectate.Value && Preferences.PrefEnable.Value) { StartSpectate(Preferences.PrefCamPlayer1.Value, Preferences.PrefCamPlayer2.Value); } if (spectateActiveChanged) { if (Preferences.PrefCamSpectate.Value) { StartSpectate(Preferences.PrefCamPlayer1.Value, Preferences.PrefCamPlayer2.Value); } else { cameraIsBeingControlled = false; } } } private static void UpdateRecordingLens() { if (IsActiveHoloLensNormal && (Object)(object)activeHoloLens != (Object)null) { ((Component)activeHoloLens.transform.GetChild(0).GetChild(0)).gameObject.SetActive(!IsRecording); ((Component)activeHoloLens.transform.GetChild(0).GetChild(1)).gameObject.SetActive(IsRecording); } } private static void CreateHoloLens() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)activeHoloLens == (Object)null) { activeHoloLens = Object.Instantiate<GameObject>(ddolHoloLens); ((Object)activeHoloLens).name = "HoloLens"; activeHoloLens.SetActive(true); activeHoloLens.transform.SetParent(camera.GetChild(0)); activeHoloLens.transform.localPosition = Vector3.zero; activeHoloLens.transform.localRotation = Quaternion.identity; if (Core.random.Next(0, 100) < Preferences.PrefHeadChance.Value) { IsActiveHoloLensNormal = false; ((Component)activeHoloLens.transform.GetChild(0).GetChild(0)).gameObject.SetActive(false); ((Component)activeHoloLens.transform.GetChild(0).GetChild(1)).gameObject.SetActive(false); ((Component)activeHoloLens.transform.GetChild(0).GetChild(2)).gameObject.SetActive(false); ((Component)activeHoloLens.transform.GetChild(0).GetChild(3)).gameObject.SetActive(true); } else { UpdateRecordingLens(); } } } private static void StartSpectate(int player1 = 0, int player2 = 1) { MelonCoroutines.Start(StartSpectateCoroutine(player1, player2)); } [IteratorStateMachine(typeof(<StartSpectateCoroutine>d__16))] private static IEnumerator StartSpectateCoroutine(int player1 = 0, int player2 = 1) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StartSpectateCoroutine>d__16(0) { player1 = player1, player2 = player2 }; } [IteratorStateMachine(typeof(<RunSpectateCamera>d__17))] private static IEnumerator RunSpectateCamera(int player1 = 0, int player2 = 1) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RunSpectateCamera>d__17(0) { player1 = player1, player2 = player2 }; } } public static class BuildInfo { public const string ModName = "HeinhouserHoloLens"; public const string ModVersion = "1.1.8"; public const string Author = "UlvakSkillz"; } public class Core : MelonMod { internal static MelonMod instance; internal static string currentScene = "Loader"; internal static bool isMatchmaking = false; internal static Random random = new Random(); public override void OnInitializeMelon() { Preferences.InitPrefs(); ((ModelModItem)UI.Register((MelonBase)(object)this, (MelonPreferences_Category[])(object)new MelonPreferences_Category[4] { Preferences.HoloLensCategory, Preferences.CameraSpectateCategory, Preferences.CameraMovementCategory, Preferences.CameraPositionCategory })).OnModSaved += Save; } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { currentScene = sceneName; string text = currentScene; bool flag = ((text == "Map0" || text == "Map1") ? true : false); isMatchmaking = flag; Preferences.PrefCamSpectate.Value = false; CameraControl.OnSceneWasLoaded(); } public override void OnLateInitializeMelon() { instance = (MelonMod)(object)this; CameraControl.OnLateInitializeMelon(); Actions.onMapInitialized += CameraControl.MapLoaded; } private void Save() { CameraControl.Save(Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefEnable), Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefShowInGame), Preferences.IsPrefChanged((MelonPreferences_Entry)(object)Preferences.PrefCamSpectate)); Preferences.StoreLastSavedPrefs(); } } public class Preferences { private const string CONFIG_FILE = "config.cfg"; private const string USER_DATA = "UserData/HeinhouserHoloLens/"; internal static Dictionary<MelonPreferences_Entry, object> LastSavedValues = new Dictionary<MelonPreferences_Entry, object>(); internal static MelonPreferences_Category HoloLensCategory; internal static MelonPreferences_Entry<bool> PrefEnable; internal static MelonPreferences_Entry<bool> PrefShowInGame; internal static MelonPreferences_Entry<bool> PrefRevertToFps; internal static MelonPreferences_Entry<int> PrefHeadChance; internal static MelonPreferences_Category CameraSpectateCategory; internal static MelonPreferences_Entry<int> PrefCamFOV; internal static MelonPreferences_Entry<LckCameraOrientation> PrefCamMode; internal static MelonPreferences_Entry<bool> PrefCamSpectate; internal static MelonPreferences_Entry<int> PrefCamPlayer1; internal static MelonPreferences_Entry<int> PrefCamPlayer2; internal static MelonPreferences_Category CameraMovementCategory; internal static MelonPreferences_Entry<float> PrefCameraMoveSpeed; internal static MelonPreferences_Entry<float> PrefCameraOrbitSpeed; internal static MelonPreferences_Entry<float> PrefCamPosCorrection; internal static MelonPreferences_Entry<float> PrefMaxCenterDist; internal static MelonPreferences_Category CameraPositionCategory; internal static MelonPreferences_Entry<float> PrefPlayerCenterSmoothing; internal static MelonPreferences_Entry<float> PrefCamPosIncrease; internal static MelonPreferences_Entry<float> PrefCamPosFalloff; internal static MelonPreferences_Entry<float> PrefCamPosBuffer; internal static MelonPreferences_Entry<float> PrefAllowedHeightScaler; internal static void InitPrefs() { if (!Directory.Exists("UserData/HeinhouserHoloLens/")) { Directory.CreateDirectory("UserData/HeinhouserHoloLens/"); } HoloLensCategory = MelonPreferences.CreateCategory("HoloLens", "Settings"); HoloLensCategory.SetFilePath(Path.Combine("UserData/HeinhouserHoloLens/", "config.cfg")); PrefEnable = HoloLensCategory.CreateEntry<bool>("EnableHoloLens", true, "Enable Holo Lens", "Toggles HoloLens Camera On/Off", false, false, (ValueValidator)null, (string)null); PrefShowInGame = HoloLensCategory.CreateEntry<bool>("ShowInGame", true, "Show HoloLens in Game", "Toggles Camera Visuals On/Off", false, false, (ValueValidator)null, (string)null); PrefRevertToFps = HoloLensCategory.CreateEntry<bool>("RevertToFps", true, "Revert To 1st Person", "Reverts to 1st Person View whenever Entering the Gym or Spectating Stops", false, false, (ValueValidator)null, (string)null); PrefHeadChance = HoloLensCategory.CreateEntry<int>("Head Camera Chance", 1, "Head Camera Chance Percent", "Changes the % chance to replace the HoloLens with a Player Head", false, false, (ValueValidator)(object)new ValueRange<int>(0, int.MaxValue), (string)null); CameraSpectateCategory = MelonPreferences.CreateCategory("HoloLensCamera", "Camera Settings"); CameraSpectateCategory.SetFilePath(Path.Combine("UserData/HeinhouserHoloLens/", "config.cfg")); PrefCamFOV = CameraSpectateCategory.CreateEntry<int>("CamFOV", 90, "Camera FOV", "Sets the Camera FOV for HoloLens", false, false, (ValueValidator)(object)new ValueRange<int>(0, 360), (string)null); PrefCamMode = CameraSpectateCategory.CreateEntry<LckCameraOrientation>("CamMode", (LckCameraOrientation)1, "Camera Mode", "Sets the Camera Mode for HoloLens", false, false, (ValueValidator)(object)new ValueRange<LckCameraOrientation>((LckCameraOrientation)0, (LckCameraOrientation)1), (string)null); PrefCamSpectate = CameraSpectateCategory.CreateEntry<bool>("CamSpectate", false, "Camera Spectate Activate", "Toggles On/Off Spectating in non-Matchmaking Maps", false, false, (ValueValidator)null, (string)null); PrefCamPlayer1 = CameraSpectateCategory.CreateEntry<int>("CamPlayer1", 0, "Camera Player 1", "Selects what Player to Spectate as Player 1 (0 = You, 1 = Oldest Remote Player, 2 = 2nd Oldest Remote Player, etc)" + Environment.NewLine + "Defaults to Local Player if invalid", false, false, (ValueValidator)(object)new ValueRange<int>(0, int.MaxValue), (string)null); PrefCamPlayer2 = CameraSpectateCategory.CreateEntry<int>("CamPlayer2", 1, "Camera Player 2", "Selects what Player to Spectate as Player 2 (0 = You, 1 = Oldest Remote Player, 2 = 2nd Oldest Remote Player, etc)" + Environment.NewLine + "Defaults to Local Player if invalid", false, false, (ValueValidator)(object)new ValueRange<int>(0, int.MaxValue), (string)null); CameraMovementCategory = MelonPreferences.CreateCategory("HoloLensCameraMovement", "Camera Movement"); CameraMovementCategory.SetFilePath(Path.Combine("UserData/HeinhouserHoloLens/", "config.cfg")); PrefCameraMoveSpeed = CameraMovementCategory.CreateEntry<float>("CameraMoveSpeed", 6.5f, "Move Speed", "Controls how fast the Camera moves Forwards/Backwards and Up/Down" + Environment.NewLine + "Default: 6.5", false, false, (ValueValidator)(object)new ValueRange<float>(0f, float.MaxValue), (string)null); PrefCameraOrbitSpeed = CameraMovementCategory.CreateEntry<float>("CameraOrbitSpeed", 6f, "Orbit Speed", "Controls how fast the Camera Orbits around the Viewing Point" + Environment.NewLine + "Default: 6", false, false, (ValueValidator)(object)new ValueRange<float>(0f, float.MaxValue), (string)null); PrefCamPosCorrection = CameraMovementCategory.CreateEntry<float>("CamPosCorrection", 0.01f, "Position Correction Scaler", "Controls how fast the Camera moves when Orbiting and getting away from Walls" + Environment.NewLine + "Default: 0.01", false, false, (ValueValidator)(object)new ValueRange<float>(0f, float.MaxValue), (string)null); PrefMaxCenterDist = CameraMovementCategory.CreateEntry<float>("MaxCenterDist", 10.25f, "Max Center Distance", "Controls how far the Camera can move from the Center of the Matchmaking Map" + Environment.NewLine + "Default: 10.25", false, false, (ValueValidator)(object)new ValueRange<float>(0f, float.MaxValue), (string)null); CameraPositionCategory = MelonPreferences.CreateCategory("HoloLensCameraPosition", "Camera Position"); CameraPositionCategory.SetFilePath(Path.Combine("UserData/HeinhouserHoloLens/", "config.cfg")); PrefPlayerCenterSmoothing = CameraPositionCategory.CreateEntry<float>("PlayerCenterSmoothing", 6f, "Player Center Smoothing", "Controls how Smooth the Look at Center of the Players moves" + Environment.NewLine + "Default: 6", false, false, (ValueValidator)(object)new ValueRange<float>(0f, float.MaxValue), (string)null); PrefCamPosIncrease = CameraPositionCategory.CreateEntry<float>("CamPosIncrease", 2f, "Camera Position Increase", "Controls how far away the Camera is from the Player's Center Point" + Environment.NewLine + "Default: 2", false, false, (ValueValidator)(object)new ValueRange<float>(0f, float.MaxValue), (string)null); PrefCamPosFalloff = CameraPositionCategory.CreateEntry<float>("CamPosFalloff", 0.25f, "Camera Position Falloff", "Controls how fast the Camera Position Increase amount falls off" + Environment.NewLine + "Default: 0.25", false, false, (ValueValidator)(object)new ValueRange<float>(0f, float.MaxValue), (string)null); PrefCamPosBuffer = CameraPositionCategory.CreateEntry<float>("CamPosBuffer", 0.1f, "Camera Position Buffer", "Determines if the Camera needs to move (small but not 0 is best)" + Environment.NewLine + "Default: 0.1", false, false, (ValueValidator)(object)new ValueRange<float>(0f, float.MaxValue), (string)null); PrefAllowedHeightScaler = CameraPositionCategory.CreateEntry<float>("AllowedHeightScaler", 1.5f, "Allowed Height Scaler", "Scaled the Allowed Height of the Camera in comparison to the Player's Center Point Height (smaller = higher, bigger = lower)" + Environment.NewLine + "Default: 1.5", false, false, (ValueValidator)(object)new ValueRange<float>(0f, float.MaxValue), (string)null); ((MelonPreferences_Entry)PrefCamSpectate).ResetToDefault(); StoreLastSavedPrefs(); } internal static void StoreLastSavedPrefs() { List<MelonPreferences_Entry> list = new List<MelonPreferences_Entry>(); list.AddRange(HoloLensCategory.Entries); list.AddRange(CameraSpectateCategory.Entries); list.AddRange(CameraMovementCategory.Entries); list.AddRange(CameraPositionCategory.Entries); foreach (MelonPreferences_Entry item in list) { LastSavedValues[item] = item.BoxedValue; } } public static bool AnyPrefsChanged() { foreach (KeyValuePair<MelonPreferences_Entry, object> lastSavedValue in LastSavedValues) { if (!lastSavedValue.Key.BoxedValue.Equals(lastSavedValue.Value)) { return true; } } return false; } public static bool IsPrefChanged(MelonPreferences_Entry entry) { if (LastSavedValues.TryGetValue(entry, out var value)) { return !entry.BoxedValue.Equals(value); } return false; } }