Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MotionSicknessFix v1.0.2
BepInEx/plugins/MotionSicknessFix/REPO.MotionSicknessFix.dll
Decompiled 2 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering.PostProcessing; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("REPO.MotionSicknessFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("REPO.MotionSicknessFix")] [assembly: AssemblyTitle("REPO.MotionSicknessFix")] [assembly: AssemblyVersion("1.0.2.0")] [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 REPOMotionSicknessFix { [BepInPlugin("rei.repo.motionsicknessfix", "R.E.P.O Motion Sickness Fix", "1.0.2")] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "rei.repo.motionsicknessfix"; public const string Name = "R.E.P.O Motion Sickness Fix"; public const string Version = "1.0.2"; internal static ConfigEntry<bool> RemoveHeadBob; internal static ConfigEntry<float> CameraShakeStrength; internal static ConfigEntry<float> CameraNoiseStrength; internal static ConfigEntry<bool> RemoveCameraTilt; internal static ConfigEntry<bool> StabilizeDynamicFieldOfView; internal static ConfigEntry<bool> DisableGrain; internal static ConfigEntry<bool> DisableMotionBlur; internal static ConfigEntry<bool> DisableLensDistortion; internal static ConfigEntry<bool> DisableChromaticAberration; internal static ConfigEntry<bool> DisableVignette; internal static ConfigEntry<bool> DisableBloom; internal static ConfigEntry<float> Brightness; internal static ConfigEntry<bool> ShowCenterDot; internal static ConfigEntry<int> CenterDotSize; private static readonly FieldInfo GrainField = AccessTools.Field(typeof(PostProcessing), "grain"); private static readonly FieldInfo MotionBlurField = AccessTools.Field(typeof(PostProcessing), "motionBlur"); private static readonly FieldInfo LensDistortionField = AccessTools.Field(typeof(PostProcessing), "lensDistortion"); private static readonly FieldInfo ChromaticAberrationField = AccessTools.Field(typeof(PostProcessing), "chromaticAberration"); private static readonly FieldInfo VignetteField = AccessTools.Field(typeof(PostProcessing), "vignette"); private static readonly FieldInfo BloomField = AccessTools.Field(typeof(PostProcessing), "bloom"); private static readonly FieldInfo ColorGradingField = AccessTools.Field(typeof(PostProcessing), "colorGrading"); private Texture2D dotTexture; private void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Expected O, but got Unknown //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Expected O, but got Unknown //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) RemoveHeadBob = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera", "RemoveHeadBob", true, "歩行・走行時の上下左右の揺れを無効化します。"); CameraShakeStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "CameraShakeStrength", 0f, new ConfigDescription("衝突・爆発・ダメージ等の画面揺れ倍率。初期値0で完全停止します。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); CameraNoiseStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "CameraNoiseStrength", 0f, new ConfigDescription("ランダムなカメラノイズ倍率。初期値0で完全停止します。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); RemoveCameraTilt = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera", "RemoveCameraTilt", true, "旋回・横移動時の視点傾きを無効化します。"); StabilizeDynamicFieldOfView = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera", "StabilizeDynamicFieldOfView", true, "走行・転倒によるFOV変化だけを除去し、イベントやアイテムのズームは維持します。"); DisableGrain = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "DisableGrain", true, "フィルムグレイン(粒状のザラつき)を無効化します。"); DisableMotionBlur = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "DisableMotionBlur", true, "モーションブラーを無効化します。"); DisableLensDistortion = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "DisableLensDistortion", false, "レンズ歪みを無効化します。状態表現を失う可能性があるため初期値はOFFです。"); DisableChromaticAberration = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "DisableChromaticAberration", true, "色収差を無効化します。"); DisableVignette = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "DisableVignette", false, "画面端のビネットを無効化します。状態表現を失う可能性があるため初期値はOFFです。"); DisableBloom = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "DisableBloom", false, "ブルーム(強い光のにじみ)を無効化します。"); Brightness = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "Brightness", 0.15f, new ConfigDescription("明るさの露出補正(EV)。0が標準、正数で明るく、負数で暗くなります。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-3f, 5f), Array.Empty<object>())); ShowCenterDot = ((BaseUnityPlugin)this).Config.Bind<bool>("Reticle", "ShowCenterDot", true, "視線の基準になる中央ドットを表示します。"); CenterDotSize = ((BaseUnityPlugin)this).Config.Bind<int>("Reticle", "CenterDotSize", 4, new ConfigDescription("中央ドットの大きさ(px)。", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 12), Array.Empty<object>())); dotTexture = new Texture2D(1, 1); dotTexture.SetPixel(0, 0, new Color(1f, 1f, 1f, 0.8f)); dotTexture.Apply(); new Harmony("rei.repo.motionsicknessfix").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"R.E.P.O Motion Sickness Fix 1.0.2 loaded"); } private void OnGUI() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (ShowCenterDot.Value && !((Object)(object)dotTexture == (Object)null)) { int value = CenterDotSize.Value; GUI.DrawTexture(new Rect((float)(Screen.width - value) * 0.5f, (float)(Screen.height - value) * 0.5f, (float)value, (float)value), (Texture)(object)dotTexture); } } internal static void ApplyPostProcessing(PostProcessing instance) { if (!((Object)(object)instance == (Object)null)) { object? value = GrainField.GetValue(instance); Grain val = (Grain)((value is Grain) ? value : null); if (DisableGrain.Value && (Object)(object)val != (Object)null) { ((PostProcessEffectSettings)val).active = false; ((ParameterOverride<float>)(object)val.intensity).value = 0f; } object? value2 = MotionBlurField.GetValue(instance); MotionBlur val2 = (MotionBlur)((value2 is MotionBlur) ? value2 : null); if (DisableMotionBlur.Value && (Object)(object)val2 != (Object)null) { ((PostProcessEffectSettings)val2).active = false; ((ParameterOverride<float>)(object)val2.shutterAngle).value = 0f; } object? value3 = LensDistortionField.GetValue(instance); LensDistortion val3 = (LensDistortion)((value3 is LensDistortion) ? value3 : null); if (DisableLensDistortion.Value && (Object)(object)val3 != (Object)null) { ((PostProcessEffectSettings)val3).active = false; ((ParameterOverride<float>)(object)val3.intensity).value = 0f; } object? value4 = ChromaticAberrationField.GetValue(instance); ChromaticAberration val4 = (ChromaticAberration)((value4 is ChromaticAberration) ? value4 : null); if (DisableChromaticAberration.Value && (Object)(object)val4 != (Object)null) { ((PostProcessEffectSettings)val4).active = false; ((ParameterOverride<float>)(object)val4.intensity).value = 0f; } object? value5 = VignetteField.GetValue(instance); Vignette val5 = (Vignette)((value5 is Vignette) ? value5 : null); if (DisableVignette.Value && (Object)(object)val5 != (Object)null) { ((PostProcessEffectSettings)val5).active = false; ((ParameterOverride<float>)(object)val5.intensity).value = 0f; } object? value6 = BloomField.GetValue(instance); Bloom val6 = (Bloom)((value6 is Bloom) ? value6 : null); if (DisableBloom.Value && (Object)(object)val6 != (Object)null) { ((PostProcessEffectSettings)val6).active = false; ((ParameterOverride<float>)(object)val6.intensity).value = 0f; } object? value7 = ColorGradingField.GetValue(instance); ColorGrading val7 = (ColorGrading)((value7 is ColorGrading) ? value7 : null); if ((Object)(object)val7 != (Object)null) { ((ParameterOverride<float>)(object)val7.postExposure).value = Brightness.Value; } } } } [HarmonyPatch(typeof(CameraBob), "Update")] internal static class CameraBobPatch { private static void Postfix(CameraBob __instance) { //IL_0013: 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) if (Plugin.RemoveHeadBob.Value) { ((Component)__instance).transform.localPosition = Vector3.zero; ((Component)__instance).transform.localRotation = Quaternion.identity; } } } [HarmonyPatch(typeof(CameraShake), "Update")] internal static class CameraShakePatch { private static void Postfix(CameraShake __instance) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) float value = Plugin.CameraShakeStrength.Value; Transform transform = ((Component)__instance).transform; transform.localPosition *= value; ((Component)__instance).transform.localRotation = Quaternion.Slerp(Quaternion.identity, ((Component)__instance).transform.localRotation, value); } } [HarmonyPatch(typeof(CameraNoise), "Update")] internal static class CameraNoisePatch { private static void Postfix(CameraNoise __instance) { if (!((Object)(object)__instance.AnimNoise == (Object)null)) { AnimNoise animNoise = __instance.AnimNoise; animNoise.noiseStrengthDefault *= Plugin.CameraNoiseStrength.Value; } } } [HarmonyPatch(typeof(CameraTilt), "Update")] internal static class CameraTiltPatch { private static void Postfix(CameraTilt __instance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (Plugin.RemoveCameraTilt.Value) { __instance.tiltXresult = 0f; __instance.tiltZresult = 0f; ((Component)__instance).transform.localRotation = Quaternion.identity; } } } [HarmonyPatch(typeof(CameraZoom), "Update")] internal static class CameraZoomPatch { private static readonly FieldInfo SprintField = AccessTools.Field(typeof(CameraZoom), "SprintZoomCurrent"); private static readonly FieldInfo TumbleField = AccessTools.Field(typeof(CameraZoom), "TumbleVelocityZoom"); private static readonly FieldInfo FinalField = AccessTools.Field(typeof(CameraZoom), "zoomFinal"); private static void Postfix(CameraZoom __instance) { if (!Plugin.StabilizeDynamicFieldOfView.Value) { return; } float num = (float)SprintField.GetValue(__instance); float num2 = (float)TumbleField.GetValue(__instance); float fieldOfView = Mathf.Clamp((float)FinalField.GetValue(__instance) - num - num2, __instance.MinimumZoom, __instance.MaximumZoom); foreach (Camera cam in __instance.cams) { if ((Object)(object)cam != (Object)null) { cam.fieldOfView = fieldOfView; } } } } [HarmonyPatch(typeof(PostProcessing), "Update")] internal static class PostProcessingUpdatePatch { private static void Postfix(PostProcessing __instance) { Plugin.ApplyPostProcessing(__instance); } } [HarmonyPatch(typeof(PostProcessing), "Setup")] internal static class PostProcessingSetupPatch { private static void Postfix(PostProcessing __instance) { Plugin.ApplyPostProcessing(__instance); } } }