The BepInEx console will not appear when launching like it does for other games on Thunderstore. This is normal (and helps prevent crashes during startup). You can turn it back on in your BepInEx.cfg file.
Decompiled source of PeakCinema v0.3.0
plugins/com.github.megalon.peakcinema.dll
Decompiled 5 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.megalon.peakcinema")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.3.0.0")] [assembly: AssemblyInformationalVersion("0.3.0+2fe04741bbbb9d4f0ade03258aaf50095fdfcb38")] [assembly: AssemblyProduct("com.github.megalon.peakcinema")] [assembly: AssemblyTitle("PeakCinema")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.3.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PeakCinema { [BepInPlugin("com.github.megalon.peakcinema", "PeakCinema", "0.3.0")] public class Plugin : BaseUnityPlugin { public class PluginModConfig { public readonly ConfigEntry<KeyCode> toggleCinemaCamControlKey; public readonly ConfigEntry<KeyCode> exitCinemaCamKey; public readonly ConfigEntry<KeyCode> keyMoveForward; public readonly ConfigEntry<KeyCode> keyMoveBackward; public readonly ConfigEntry<KeyCode> keyMoveLeft; public readonly ConfigEntry<KeyCode> keyMoveRight; public readonly ConfigEntry<KeyCode> keyMoveUp; public readonly ConfigEntry<KeyCode> keyMoveDown; public readonly ConfigEntry<KeyCode> keyMoveFaster; public readonly ConfigEntry<KeyCode> keySmoothToggle; public PluginModConfig(ConfigFile config) { toggleCinemaCamControlKey = config.Bind<KeyCode>("Keybinds", "Toggle Cinema Cam Control", (KeyCode)284, ""); exitCinemaCamKey = config.Bind<KeyCode>("Keybinds", "Exit Cinema Cam", (KeyCode)27, ""); keyMoveForward = config.Bind<KeyCode>("Keybinds", "Move Forward", (KeyCode)119, ""); keyMoveBackward = config.Bind<KeyCode>("Keybinds", "Move Backward", (KeyCode)115, ""); keyMoveLeft = config.Bind<KeyCode>("Keybinds", "Move Left", (KeyCode)97, ""); keyMoveRight = config.Bind<KeyCode>("Keybinds", "Move Right", (KeyCode)100, ""); keyMoveUp = config.Bind<KeyCode>("Keybinds", "Move Up", (KeyCode)32, ""); keyMoveDown = config.Bind<KeyCode>("Keybinds", "Move Down", (KeyCode)306, ""); keyMoveFaster = config.Bind<KeyCode>("Keybinds", "Move Faster", (KeyCode)304, ""); keySmoothToggle = config.Bind<KeyCode>("Keybinds", "Toggle Camera Smoothing", (KeyCode)301, ""); } } internal static GameObject HUD = null; internal static List<VoiceObscuranceFilter> VoiceFilters = new List<VoiceObscuranceFilter>(); public const string Id = "com.github.megalon.peakcinema"; internal static ManualLogSource Log { get; private set; } = null; internal static PluginModConfig ModConfig { get; private set; } = null; internal static bool CinemaCamActive { get; private set; } internal static Transform? CamTransform { get; private set; } internal static bool CameraWasSpawned { get; private set; } internal static bool Smoothing { get; private set; } = true; internal static float HoldTimer { get; private set; } internal static float InitHoldTimer { get; private set; } = 3f; public static string Name => "PeakCinema"; public static string Version => "0.3.0"; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)("Plugin " + Name + " is loaded!")); Harmony.CreateAndPatchAll(typeof(Plugin), (string)null); ModConfig = new PluginModConfig(((BaseUnityPlugin)this).Config); HoldTimer = InitHoldTimer; } [HarmonyPatch(typeof(VoiceObscuranceFilter), "Start")] [HarmonyPostfix] private static void VoiceObscuranceFilter_Start(VoiceObscuranceFilter __instance) { if (CinemaCamActive) { SetVoiceFilterToCinemaCam(__instance); } VoiceFilters.Add(__instance); } [HarmonyPatch(typeof(CinemaCamera), "Start")] [HarmonyPostfix] private static void CinemaCamera_Start(CinemaCamera __instance) { CamTransform = __instance.cam; CameraWasSpawned = false; HoldTimer = InitHoldTimer; } [HarmonyPatch(typeof(CinemaCamera), "Update")] [HarmonyPrefix] private static bool CinemaCameraFix(CinemaCamera __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_040f: 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_0480: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0534: 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_0559: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)HUD == (Object)null) { HUD = GameObject.Find("Canvas_HUD"); } if (Input.GetKeyDown(ModConfig.exitCinemaCamKey.Value)) { CinemaCamActive = false; __instance.on = false; GameObject hUD = HUD; if (hUD != null) { hUD.SetActive(true); } ((Component)__instance.cam).gameObject.SetActive(false); if ((Object)(object)__instance.fog != (Object)null) { ((Component)__instance.fog).gameObject.SetActive(true); } if ((Object)(object)__instance.oldCam != (Object)null) { ((Component)__instance.oldCam).gameObject.SetActive(true); } foreach (VoiceObscuranceFilter voiceFilter in VoiceFilters) { if (!((Object)(object)voiceFilter == (Object)null)) { voiceFilter.head = ((Component)MainCamera.instance).transform; } } } else if (Input.GetKey(ModConfig.toggleCinemaCamControlKey.Value)) { HoldTimer -= Time.deltaTime; if (HoldTimer <= 0f) { MoveCameraToPlayerPosition(__instance); if (!__instance.on) { __instance.on = true; } HoldTimer = -1f; } } else if (Input.GetKeyUp(ModConfig.toggleCinemaCamControlKey.Value)) { if (!CinemaCamActive) { CinemaCamActive = true; HandleVoiceFilters(); } if (HoldTimer > -1f) { __instance.on = !__instance.on; } HoldTimer = InitHoldTimer; } if (__instance.on) { InputSystem.actions.Disable(); GameObject hUD2 = HUD; if (hUD2 != null) { hUD2.SetActive(false); } __instance.ambience.parent = ((Component)__instance).transform; if (Object.op_Implicit((Object)(object)__instance.fog)) { ((Component)__instance.fog).gameObject.SetActive(false); } if (Object.op_Implicit((Object)(object)__instance.oldCam)) { ((Component)__instance.oldCam).gameObject.SetActive(false); } ((Component)__instance).transform.parent = null; __instance.cam.parent = null; if (!CameraWasSpawned) { MoveCameraToPlayerPosition(__instance); } ((Component)__instance.cam).gameObject.SetActive(true); if (Input.GetKeyDown(ModConfig.keySmoothToggle.Value)) { Smoothing = !Smoothing; } float num = 0f; if (Smoothing) { __instance.vel = Vector3.Lerp(__instance.vel, Vector3.zero, 1f * Time.deltaTime); __instance.rot = Vector3.Lerp(__instance.rot, Vector3.zero, 2.5f * Time.deltaTime); num = (Input.GetKey(ModConfig.keyMoveFaster.Value) ? 0.2f : 0.05f); __instance.rot.y += Input.GetAxis("Mouse X") * num * 0.05f; __instance.rot.x += Input.GetAxis("Mouse Y") * num * 0.05f; } else { __instance.vel = Vector3.zero; __instance.rot = Vector3.zero; num = (Input.GetKey(ModConfig.keyMoveFaster.Value) ? 10f : 5f); __instance.rot.y += Input.GetAxis("Mouse X") * num * 0.1f; __instance.rot.x += Input.GetAxis("Mouse Y") * num * 0.1f; } float num2 = num * Time.deltaTime; if (Input.GetKey(ModConfig.keyMoveRight.Value)) { __instance.vel.x = (Smoothing ? (__instance.vel.x + num2) : num2); } if (Input.GetKey(ModConfig.keyMoveLeft.Value)) { __instance.vel.x = (Smoothing ? (__instance.vel.x - num2) : (0f - num2)); } if (Input.GetKey(ModConfig.keyMoveForward.Value)) { __instance.vel.z = (Smoothing ? (__instance.vel.z + num2) : num2); } if (Input.GetKey(ModConfig.keyMoveBackward.Value)) { __instance.vel.z = (Smoothing ? (__instance.vel.z - num2) : (0f - num2)); } if (Input.GetKey(ModConfig.keyMoveUp.Value)) { __instance.vel.y = (Smoothing ? (__instance.vel.y + num2) : num2); } if (Input.GetKey(ModConfig.keyMoveDown.Value)) { __instance.vel.y = (Smoothing ? (__instance.vel.y - num2) : (0f - num2)); } ((Component)__instance.cam).transform.Rotate(Vector3.up * __instance.rot.y, (Space)0); ((Component)__instance.cam).transform.Rotate(((Component)__instance).transform.right * (0f - __instance.rot.x)); ((Component)__instance.cam).transform.Translate(Vector3.right * __instance.vel.x, (Space)1); ((Component)__instance.cam).transform.Translate(Vector3.forward * __instance.vel.z, (Space)1); ((Component)__instance.cam).transform.Translate(Vector3.up * __instance.vel.y, (Space)0); __instance.t = true; CameraWasSpawned = true; } else { InputSystem.actions.Enable(); } return false; } private static void MoveCameraToPlayerPosition(CinemaCamera __instance) { //IL_0049: 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) Character val = Character.AllCharacters.First((Character c) => c.IsLocal); if ((Object)(object)val != (Object)null) { ((Component)__instance.cam).transform.position = val.refs.animationPositionTransform.position + new Vector3(0f, 0f, 1f); } } private static void HandleVoiceFilters() { for (int num = VoiceFilters.Count - 1; num >= 0; num--) { VoiceObscuranceFilter val = VoiceFilters[num]; if ((Object)(object)val == (Object)null) { VoiceFilters.RemoveAt(num); } } foreach (VoiceObscuranceFilter voiceFilter in VoiceFilters) { if (!((Object)(object)voiceFilter == (Object)null)) { SetVoiceFilterToCinemaCam(voiceFilter); } } Log.LogInfo((object)$"Adjusted {VoiceFilters.Count} voice filters!"); } private static void SetVoiceFilterToCinemaCam(VoiceObscuranceFilter filter) { if (!((Object)(object)CamTransform == (Object)null) && !((Object)(object)filter == (Object)null)) { filter.head = CamTransform; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }