using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using PurrLobby; using PurrNet; using PurrNet.Packing; using PurrNet.Transports; using PurrNet.Utils; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: InternalsVisibleTo("ShaderPlayground.Tests")] [assembly: AssemblyCompany("ShaderPlayground")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.5.2.0")] [assembly: AssemblyInformationalVersion("0.5.2")] [assembly: AssemblyProduct("ShaderPlayground")] [assembly: AssemblyTitle("ShaderPlayground")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.5.2.0")] [module: UnverifiableCode] 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; } } } namespace ShaderPlayground { internal static class HostClientSyncPolicy { internal enum ClientHandshakeState { Disconnected, AwaitHelloAck, AwaitSnapshot, Synced, Stale } internal enum SnapshotValidationResult { Apply, Duplicate, Stale, Gap, SessionMismatch, Invalid } internal const float HostKeepaliveIntervalSeconds = 7f; internal const float HostQuietPeriodAfterCommitSeconds = 3f; internal const float HostRequestMinIntervalSeconds = 0.75f; internal const float ClientHelloRetryInitialSeconds = 0.9f; internal const float ClientHelloRetryMaxSeconds = 6f; internal const float ClientStateRequestIntervalSeconds = 2.25f; internal const float ClientStaleAfterSeconds = 12f; internal static bool ShouldHostSendKeepalive(bool isHost, float now, float nextKeepaliveAt, float lastCommitAt, out float nextAt) { nextAt = nextKeepaliveAt; if (!isHost || now < nextKeepaliveAt) { return false; } nextAt = now + 7f; if (lastCommitAt > 0f) { return !(now - lastCommitAt < 3f); } return true; } internal static bool ShouldClientSendHello(ClientHandshakeState state, float now, float nextHelloAt) { if (state == ClientHandshakeState.AwaitHelloAck) { return now >= nextHelloAt; } return false; } internal static bool ShouldClientSendStateRequest(ClientHandshakeState state, float now, float nextRequestAt) { if (state == ClientHandshakeState.AwaitSnapshot || state == ClientHandshakeState.Stale) { return now >= nextRequestAt; } return false; } internal static bool ShouldMarkClientStale(ClientHandshakeState state, float now, float lastSnapshotAcceptedAt) { if (state == ClientHandshakeState.Synced && lastSnapshotAcceptedAt > 0f) { return now - lastSnapshotAcceptedAt >= 12f; } return false; } internal static float NextHelloRetryInterval(float current) { if (current <= 0f) { return 0.9f; } return Math.Min(6f, Math.Max(0.9f, current * 1.7f)); } internal static bool ShouldAllowHostRequestResponse(ref float lastHandledAt, float now) { if (lastHandledAt > 0f && now - lastHandledAt < 0.75f) { return false; } lastHandledAt = now; return true; } internal static SnapshotValidationResult ClassifySnapshot(string sessionEpoch, long revision, string stateHash, string acceptedSessionEpoch, long acceptedRevision, string acceptedStateHash) { if (string.IsNullOrWhiteSpace(sessionEpoch) || string.IsNullOrWhiteSpace(stateHash) || revision < 0) { return SnapshotValidationResult.Invalid; } if (!string.IsNullOrEmpty(acceptedSessionEpoch) && !string.Equals(sessionEpoch, acceptedSessionEpoch, StringComparison.Ordinal)) { return SnapshotValidationResult.SessionMismatch; } if (acceptedRevision >= 0) { if (revision == acceptedRevision && string.Equals(stateHash, acceptedStateHash, StringComparison.Ordinal)) { return SnapshotValidationResult.Duplicate; } if (revision <= acceptedRevision) { return SnapshotValidationResult.Stale; } if (revision > acceptedRevision + 1) { return SnapshotValidationResult.Gap; } } return SnapshotValidationResult.Apply; } } [BepInPlugin("io.damon.ontogether.shaderplayground", "ShaderPlayground", "0.5.2")] [BepInProcess("OnTogether.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { private enum UiTab { Core, Effects, Experimental, World, AdvancedColor, Quality, Presets, Tools } private enum PresetKind { Clean, Noir, Stormfront, NightTime, DreamyStyle, PitchBlack } private enum WeatherMood { Clear, Golden, Overcast, Storm, Dream } private enum Msg : byte { Hello = 1, HelloAck, StateRequest, StateSnapshot } [Serializable] private sealed class NetworkPayloadV1 { public byte[] Data = Array.Empty(); } [Serializable] private sealed class HelloV2 { public int ProtocolVersion; public ulong ClientPlayerId; public string ClientNonce = string.Empty; public int CapabilityMask; public string PluginVersion = string.Empty; public string Reason = string.Empty; } [Serializable] private sealed class HelloAckV2 { public int ProtocolVersion; public string ClientNonce = string.Empty; public string SessionEpoch = string.Empty; public ulong HostPlayerId; public int HostCapabilityMask; public long CurrentRevision; public string StateHash = string.Empty; public string SentAtUtc = string.Empty; } [Serializable] private sealed class StateRequestV2 { public int ProtocolVersion; public string SessionEpoch = string.Empty; public long WantRevision; public string Reason = string.Empty; } [Serializable] private sealed class StateSnapshotV2 { public int ProtocolVersion; public string SessionEpoch = string.Empty; public long Revision; public string StateHash = string.Empty; public ProfileStateV1? State; public ProfileStateV1? Profile; public ProfileStateV1? ProfileState; public string StateJson = string.Empty; public string ProfileJson = string.Empty; public string Reason = string.Empty; public string SentAtUtc = string.Empty; } [Serializable] private sealed class StateSnapshotCompatV1 { public int ProtocolVersion; public string SessionEpoch = string.Empty; public long Revision; public string StateHash = string.Empty; public ProfileStateV1? State; public ProfileStateV1? Profile; public ProfileStateV1? ProfileState; public string StateJson = string.Empty; public string ProfileJson = string.Empty; public string Reason = string.Empty; public string SentAtUtc = string.Empty; } [Serializable] private sealed class ProfileStateV1 { public int ProtocolVersion; public long Revision; public bool MasterEnabled; public bool EnableShaderPass; public int QualityTier; public bool C; public float Ci; public bool D; public float Di; public bool K; public float Ki; public bool H; public float Hi; public float Hs; public bool S; public float Si; public bool V; public float Vi; public bool Pr; public float Pri; public bool Px; public float Pxi; public bool Cs; public float Csi; public bool Dt; public float Dti; public float LensCx; public float LensCy; public bool Mb; public float Mbi; public bool Df; public float Dfi; public bool Ab; public float Abi; public bool Hf; public float Hfi; public float Hfs; public float Hfa; public bool Kw; public float Kwi; public float Kwr; public bool Sc; public float Sci; public float Sch; public float Scr; public float Scs; public bool Rb; public float Rbi; public bool Ld; public float Ldi; public bool Rn; public float Rni; public bool Ca; public float Cai; public bool Gd; public float Gdi; public bool Fg; public float Fgi; public bool Gl; public float Gli; public bool Vf; public float Vfi; public float Vfd; public float Vfh; public bool Lb; public float Lbi; public bool HypnosisEnabled; public int HypnosisPreset; public float HypnosisIntensity; public float HypnosisSpeed; public float HypnosisWarpAmount; public float HypnosisSpiralAmount; public float HypnosisColorBlend; public bool Sky; public float SkyI; public float SkyExposure; public float SkyHue; public float SkyColorBlend; public int SkyboxIndex; public float SunIntensity; public float SunTemp; public float SunR; public float SunG; public float SunB; public float SunBlend; public int Tm; public bool Wb; public float WbTemp; public float WbTint; public bool Lgg; public float Lift; public float Gamma; public float Gain; public bool St; public float StSr; public float StSg; public float StSb; public float StHr; public float StHg; public float StHb; public float StBal; public bool Clouds; public float CloudD; public bool Weather; public int WeatherMode; public float WeatherStrength; public bool Water; public float WaterClarity; public float WaterWave; public int AaPreset; public float CasSharp; public string Reason = string.Empty; public string SentAtUtc = string.Empty; } [Serializable] private sealed class SessionVisualProfileV1 { public string Label = "Balanced"; public long Revision; public string LastUpdatedUtc = string.Empty; public bool SessionColorLabEnabled = true; public float SessionColorStrength = 0.08f; public bool BloomEnabled = true; public float BloomIntensity = 0.25f; public float BloomScatter = 0.6f; public bool ColorGradingEnabled = true; public float Contrast = 6f; public float Saturation = 5f; public float HueShift; public bool VignetteEnabled = true; public float VignetteIntensity = 0.08f; public bool ChromaticAberrationEnabled; public float ChromaticAberrationIntensity = 0.03f; public bool LensDistortionEnabled; public float LensDistortionIntensity; public bool DepthOfFieldEnabled; public bool MotionBlurEnabled; public float MotionBlurIntensity = 0.07f; public static SessionVisualProfileV1 CreateBalancedPreset() { return new SessionVisualProfileV1 { Label = "Balanced", Revision = 1L, LastUpdatedUtc = DateTime.UtcNow.ToString("O"), SessionColorLabEnabled = true, SessionColorStrength = 0.08f, BloomEnabled = true, BloomIntensity = 0.25f, BloomScatter = 0.6f, ColorGradingEnabled = true, Contrast = 6f, Saturation = 5f, HueShift = 0f, VignetteEnabled = true, VignetteIntensity = 0.08f, ChromaticAberrationEnabled = false, ChromaticAberrationIntensity = 0.03f, LensDistortionEnabled = false, LensDistortionIntensity = 0f, DepthOfFieldEnabled = false, MotionBlurEnabled = false, MotionBlurIntensity = 0.07f }; } } private readonly struct Env { public byte MessageType { get; } public ulong SenderPlayerId { get; } public string Json { get; } public Env(byte t, ulong s, string j) { MessageType = t; SenderPlayerId = s; Json = j; } } private readonly struct EffectSlot { public string Name { get; } public Func GetEnabled { get; } public Func GetIntensity { get; } public EffectSlot(string name, Func getEnabled, Func getIntensity) { Name = name; GetEnabled = getEnabled; GetIntensity = getIntensity; } } private static class Codec { public static byte[] Encode(byte t, ulong s, string j) { byte[] bytes = Encoding.UTF8.GetBytes(j ?? string.Empty); if (bytes.Length > 65536) { throw new InvalidOperationException("payload too large"); } using MemoryStream memoryStream = new MemoryStream(); using BinaryWriter binaryWriter = new BinaryWriter(memoryStream, Encoding.UTF8, leaveOpen: true); binaryWriter.Write((byte)1); binaryWriter.Write(t); binaryWriter.Write(s); binaryWriter.Write(bytes.Length); binaryWriter.Write(bytes); binaryWriter.Flush(); return memoryStream.ToArray(); } public static bool TryDecode(byte[] d, out Env e) { e = default(Env); if (d == null || d.Length < 14) { return false; } try { using MemoryStream memoryStream = new MemoryStream(d, writable: false); using BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8, leaveOpen: true); if (binaryReader.ReadByte() != 1) { return false; } byte t = binaryReader.ReadByte(); ulong s = binaryReader.ReadUInt64(); int num = binaryReader.ReadInt32(); if (num < 0 || num > 65536) { return false; } if (num > memoryStream.Length - memoryStream.Position) { return false; } byte[] array = binaryReader.ReadBytes(num); if (array.Length != num) { return false; } e = new Env(t, s, Encoding.UTF8.GetString(array)); return true; } catch { return false; } } } private const string PluginGuid = "io.damon.ontogether.shaderplayground"; private const string PluginName = "ShaderPlayground"; private const string PluginVersion = "0.5.2"; private const int ProtocolVersion = 4; private const int SessionVisualProtocolVersion = 1; private const int MaxPayloadBytes = 65536; private const float RuntimeVolumePriority = 12000f; private const int CapabilityHypnosisPack = 1; private const int CapabilitySyncHandshakeV2 = 2; private const float FisheyeIntensityMax = 0.1f; private const float GlitchIntensityMax = 0.1f; private const float BreathingIntensityMax = 0.05f; private static readonly string[] SkyboxStyleLabels = new string[2] { "Original", "Black" }; private static readonly Color UiCream = new Color(0.99f, 0.96f, 0.89f, 1f); private static readonly Color UiInk = new Color(0.13f, 0.13f, 0.13f, 1f); private static readonly Color UiSubtleInk = new Color(0.24f, 0.24f, 0.24f, 1f); private static readonly Color UiSectionFill = new Color(1f, 0.98f, 0.92f, 1f); private static readonly Color UiTabInactive = new Color(0.92f, 0.84f, 0.73f, 0.96f); private static readonly Color UiTabActiveLighten = new Color(1f, 1f, 1f, 0.22f); private static readonly Color UiButtonPrimary = new Color(0.66f, 0.9f, 0.81f, 0.98f); private static readonly Color UiButtonSecondary = new Color(1f, 0.83f, 0.71f, 0.98f); private static readonly Color UiButtonPressed = new Color(0.93f, 0.76f, 0.65f, 0.98f); private static readonly Color[] UiTabAccents = (Color[])(object)new Color[8] { new Color(0.95f, 0.87f, 0.73f, 0.98f), new Color(1f, 0.83f, 0.71f, 0.98f), new Color(0.66f, 0.9f, 0.81f, 0.98f), new Color(0.75f, 0.88f, 0.9f, 0.98f), new Color(0.8f, 0.89f, 0.95f, 0.98f), new Color(0.84f, 0.89f, 0.99f, 0.98f), new Color(0.95f, 0.88f, 0.75f, 0.98f), new Color(0.92f, 0.82f, 0.88f, 0.98f) }; private static readonly int ShaderTempRtId = Shader.PropertyToID("_ShaderPlaygroundTemp"); private static readonly int ShaderPixelRtId = Shader.PropertyToID("_ShaderPlaygroundPixel"); private static readonly string[] WaterKeywords = new string[5] { "water", "ocean", "river", "lake", "sea" }; private static readonly string[] SkyKeywords = new string[3] { "sky", "atmo", "horizon" }; private static readonly string[] CloudKeywords = new string[3] { "cloud", "mist", "fog" }; private static readonly string[] SurfaceKeywords = new string[21] { "terrain", "ground", "rock", "stone", "sand", "soil", "dirt", "floor", "wall", "road", "wood", "concrete", "cliff", "mountain", "bark", "grass", "leaf", "foliage", "nature", "prop", "mesh" }; private static readonly string[] CharacterKeywords = new string[12] { "player", "avatar", "character", "npc", "head", "body", "arm", "leg", "shirt", "pants", "shoe", "hair" }; private static readonly string[] WaterSignatureProperties = new string[11] { "_WaterColor", "_ShallowColor", "_DeepColor", "_WaveStrength", "_WaveScale", "_WaveSpeed", "_FoamAmount", "_FoamIntensity", "_RefractionStrength", "_GerstnerStrength", "_ShoreFoam" }; private static readonly string[] CloudSignatureProperties = new string[8] { "_CloudDensity", "_CloudOpacity", "_CloudCoverage", "_Cloudiness", "_CloudColor", "_CloudShadowColor", "_CloudSoftness", "_CloudDetail" }; private static readonly string[] WaterSurfaceColorProperties = new string[7] { "_BaseColor", "_Color", "_WaterColor", "_ShallowColor", "_MainColor", "_TintColor", "_SurfaceColor" }; private static readonly string[] WaterDeepColorProperties = new string[4] { "_DeepColor", "_DepthColor", "_AbsorptionColor", "_UnderwaterColor" }; private static readonly string[] WaterFoamColorProperties = new string[3] { "_FoamColor", "_EdgeColor", "_FoamTint" }; private static readonly string[] WaterWaveStrengthProperties = new string[6] { "_WaveStrength", "_WaveAmount", "_WaveAmplitude", "_GerstnerStrength", "_DistortionStrength", "_FlowStrength" }; private static readonly string[] WaterWaveScaleProperties = new string[5] { "_WaveScale", "_WaveLength", "_RippleScale", "_DetailScale", "_Tiling" }; private static readonly string[] WaterWaveSpeedProperties = new string[4] { "_WaveSpeed", "_FlowSpeed", "_DistortionSpeed", "_GerstnerSpeed" }; private static readonly string[] WaterNormalStrengthProperties = new string[4] { "_NormalScale", "_BumpScale", "_NormalStrength", "_DetailNormalScale" }; private static readonly string[] WaterSmoothnessProperties = new string[2] { "_Smoothness", "_Glossiness" }; private static readonly string[] WaterRefractionProperties = new string[4] { "_RefractionStrength", "_Distortion", "_RefractionAmount", "_GrabPassDistortion" }; private static readonly string[] WaterFoamAmountProperties = new string[5] { "_FoamAmount", "_FoamIntensity", "_FoamStrength", "_ShoreFoam", "_EdgeFoam" }; private static readonly string[] WaterEmissionColorProperties = new string[3] { "_EmissionColor", "_SpecColor", "_ReflectionColor" }; private static readonly string[] WaterEmissionStrengthProperties = new string[3] { "_EmissionStrength", "_Emission", "_SpecularIntensity" }; private static readonly string[] CloudColorProperties = new string[6] { "_BaseColor", "_Color", "_Tint", "_CloudColor", "_MainColor", "_CloudLightColor" }; private static readonly string[] CloudShadowColorProperties = new string[3] { "_CloudShadowColor", "_ShadowColor", "_CloudDarkColor" }; private static readonly string[] CloudDensityProperties = new string[6] { "_Density", "_CloudDensity", "_CloudCoverage", "_Cloudiness", "_LayerDensity", "_DetailDensity" }; private static readonly string[] CloudOpacityProperties = new string[4] { "_Opacity", "_CloudOpacity", "_Alpha", "_CloudAlpha" }; private static readonly string[] CloudSoftnessProperties = new string[3] { "_Softness", "_CloudSoftness", "_Feather" }; private static readonly string[] CloudDetailProperties = new string[3] { "_DetailStrength", "_DetailAmount", "_CloudDetail" }; private static readonly string[] SkyColorProperties = new string[7] { "_Tint", "_SkyTint", "_Color", "_BaseColor", "_HorizonColor", "_ZenithColor", "_MainColor" }; private static readonly string[] SkyExposureProperties = new string[5] { "_Exposure", "_SkyExposure", "_Intensity", "_Brightness", "_AtmosphereThickness" }; private static readonly string[] CausticsStrengthProperties = new string[4] { "_CausticsStrength", "_CausticStrength", "_CausticsAmount", "_CausticAmount" }; private static readonly string[] CausticsSpeedProperties = new string[4] { "_CausticsSpeed", "_CausticSpeed", "_FlowSpeed", "_DistortionSpeed" }; private static readonly string[] CausticsScaleProperties = new string[5] { "_CausticsScale", "_CausticScale", "_WaveScale", "_RippleScale", "_DetailScale" }; private static readonly string[] CausticsEmissionColorProperties = new string[4] { "_EmissionColor", "_GlowColor", "_SpecColor", "_RimColor" }; private static readonly string[] CausticsEmissionStrengthProperties = new string[5] { "_Emission", "_EmissionStrength", "_EmissionIntensity", "_Glow", "_GlowStrength" }; private static readonly string[] CausticsUvScrollProperties = new string[6] { "_BaseMap", "_MainTex", "_DetailMap", "_DetailAlbedoMap", "_BumpMap", "_NormalMap" }; private static readonly string[] SurfaceSignatureProperties = new string[7] { "_BaseColor", "_Color", "_MainTex", "_BaseMap", "_BumpMap", "_Metallic", "_Smoothness" }; private ConfigEntry _toggleWindowKey; private ConfigEntry _ignoreHotkeysWhenTyping; private ConfigEntry _enableOtApiIntegration; private ConfigEntry _masterEnabled; private ConfigEntry _syncEnabled; private ConfigEntry _localOnlyMode; private ConfigEntry _acceptHostSync; private ConfigEntry _enableSessionVisualBridgeSync; private ConfigEntry _applySessionVisualBridgeLocally; private ConfigEntry _showNotifications; private ConfigEntry _notificationMinIntervalSeconds; private ConfigEntry _respectSessionVisualLabOwnership; private ConfigEntry _windowVisibleConfig; private ConfigEntry _enableShaderPass; private ConfigEntry _forceVolumeFallback; private ConfigEntry _qualityTier; private ConfigEntry _crtEnabled; private ConfigEntry _crtIntensity; private ConfigEntry _dreamEnabled; private ConfigEntry _dreamIntensity; private ConfigEntry _comicEnabled; private ConfigEntry _comicIntensity; private ConfigEntry _heatwaveEnabled; private ConfigEntry _heatwaveIntensity; private ConfigEntry _heatwaveSpeed; private ConfigEntry _noirEnabled; private ConfigEntry _noirIntensity; private ConfigEntry _vaporEnabled; private ConfigEntry _vaporIntensity; private ConfigEntry _posterizeEnabled; private ConfigEntry _posterizeIntensity; private ConfigEntry _pixelateEnabled; private ConfigEntry _pixelateIntensity; private ConfigEntry _chromaticSplitEnabled; private ConfigEntry _chromaticSplitIntensity; private ConfigEntry _ditherEnabled; private ConfigEntry _ditherIntensity; private ConfigEntry _lensCenterX; private ConfigEntry _lensCenterY; private ConfigEntry _motionBlurEnabled; private ConfigEntry _motionBlurIntensity; private ConfigEntry _depthOfFieldEnabled; private ConfigEntry _depthOfFieldIntensity; private ConfigEntry _anamorphicBloomEnabled; private ConfigEntry _anamorphicBloomIntensity; private ConfigEntry _halftoneEnabled; private ConfigEntry _halftoneIntensity; private ConfigEntry _halftoneDotSize; private ConfigEntry _halftoneAngle; private ConfigEntry _kuwaharaEnabled; private ConfigEntry _kuwaharaIntensity; private ConfigEntry _kuwaharaRadius; private ConfigEntry _selectiveColorEnabled; private ConfigEntry _selectiveColorIntensity; private ConfigEntry _selectiveColorHue; private ConfigEntry _selectiveColorRange; private ConfigEntry _selectiveColorSoftness; private ConfigEntry _radialBlurEnabled; private ConfigEntry _radialBlurIntensity; private ConfigEntry _lensDirtEnabled; private ConfigEntry _lensDirtIntensity; private ConfigEntry _rainOnLensEnabled; private ConfigEntry _rainOnLensIntensity; private ConfigEntry _causticsOverlayEnabled; private ConfigEntry _causticsOverlayIntensity; private ConfigEntry _godrayFakeEnabled; private ConfigEntry _godrayFakeIntensity; private ConfigEntry _filmGateEnabled; private ConfigEntry _filmGateIntensity; private ConfigEntry _glitchPackEnabled; private ConfigEntry _glitchPackIntensity; private ConfigEntry _volumetricFogTintEnabled; private ConfigEntry _volumetricFogTintIntensity; private ConfigEntry _volumetricFogTintDensity; private ConfigEntry _volumetricFogTintHue; private ConfigEntry _lutBlendEnabled; private ConfigEntry _lutBlendAmount; private ConfigEntry _lutPathA; private ConfigEntry _lutPathB; private ConfigEntry _hypnosisEnabled; private ConfigEntry _hypnosisPreset; private ConfigEntry _hypnosisIntensity; private ConfigEntry _hypnosisSpeed; private ConfigEntry _hypnosisWarpAmount; private ConfigEntry _hypnosisSpiralAmount; private ConfigEntry _hypnosisColorBlend; private ConfigEntry _enhancedSkyEnabled; private ConfigEntry _skyIntensity; private ConfigEntry _skyExposure; private ConfigEntry _skyHueShift; private ConfigEntry _skyColorBlend; private ConfigEntry _skyboxMaterialIndex; private ConfigEntry _sunIntensityMultiplier; private ConfigEntry _sunTemperature; private ConfigEntry _sunColorR; private ConfigEntry _sunColorG; private ConfigEntry _sunColorB; private ConfigEntry _sunColorBlend; private ConfigEntry _tonemappingMode; private ConfigEntry _whiteBalanceEnabled; private ConfigEntry _whiteBalanceTemperature; private ConfigEntry _whiteBalanceTint; private ConfigEntry _liftGammaGainEnabled; private ConfigEntry _liftAmount; private ConfigEntry _gammaAmount; private ConfigEntry _gainAmount; private ConfigEntry _splitToningEnabled; private ConfigEntry _splitShadowsR; private ConfigEntry _splitShadowsG; private ConfigEntry _splitShadowsB; private ConfigEntry _splitHighlightsR; private ConfigEntry _splitHighlightsG; private ConfigEntry _splitHighlightsB; private ConfigEntry _splitToningBalance; private ConfigEntry _cloudLayersEnabled; private ConfigEntry _cloudDensity; private ConfigEntry _weatherSystemEnabled; private ConfigEntry _weatherMode; private ConfigEntry _weatherStrength; private ConfigEntry _waterOverrideEnabled; private ConfigEntry _waterClarity; private ConfigEntry _waterWaveStrength; private ConfigEntry _antiAliasingPreset; private ConfigEntry _casSharpening; private ConfigEntry _scannerLogOnSceneLoad; private ConfigEntry _savedProfileJson; private ConfigEntry _debugMode; private ConfigEntry _debugTelemetryIntervalSeconds; private ConfigEntry _enableBuiltInSyncLog; private ConfigEntry _syncLogToBepInEx; private ConfigEntry _syncLogIncludeKeepalive; private ConfigEntry _strictSnapshotHashValidation; private bool _showWindow; private Rect _windowRect = new Rect(80f, 60f, 640f, 700f); private Vector2 _scroll; private Vector2 _syncLogScroll; private UiTab _activeTab; private GUIStyle? _menuTitleStyle; private GUIStyle? _subtitleStyle; private GUIStyle? _bodyLabelStyle; private GUIStyle? _windowStyle; private GUIStyle? _tabStyle; private GUIStyle? _actionBtnStyle; private GUIStyle? _sectionStyle; private GUIStyle? _subCardStyle; private GUIStyle? _sectionHeaderStyle; private GUIStyle? _subCardHeaderStyle; private GUIStyle? _buttonStyle; private GUIStyle? _secondaryButtonStyle; private GUIStyle? _tabInactiveStyle; private GUIStyle[]? _tabActiveStyles; private GUIStyle? _sliderTrackStyle; private GUIStyle? _sliderThumbStyle; private GUIStyle? _toggleStyle; private GUIStyle? _valueLabelStyle; private GUIStyle? _textFieldStyle; private Texture2D? _panelTexture; private Texture2D? _sectionTexture; private Texture2D? _buttonTexture; private Texture2D? _buttonSecondaryTexture; private Texture2D? _buttonPressedTexture; private Texture2D? _tabInactiveTexture; private Texture2D? _tabInactiveHoverTexture; private Texture2D[]? _tabActiveTextures; private Texture2D? _subCardTexture; private Texture2D? _sliderTrackTexture; private Texture2D? _sliderThumbTexture; private Texture2D? _sliderThumbHoverTexture; private Texture2D? _sliderThumbActiveTexture; private Texture2D? _textFieldTexture; private Texture2D? _textFieldFocusedTexture; private NetworkManager? _network; private HostClientSyncPolicy.ClientHandshakeState _clientSyncState; private string _clientSyncStatusReason = "disconnected"; private string _pendingHelloNonce = string.Empty; private string _activeSessionEpoch = string.Empty; private string _hostSessionEpoch = string.Empty; private string _hostSessionEpochFingerprint = string.Empty; private string _lastAcceptedStateHash = string.Empty; private ulong _expectedHostSenderId; private ulong _expectedHostSteamId; private long _revision = 1L; private long _lastAcceptedRevision = -1L; private long _lastSessionVisualBridgeRevision = -1L; private float _nextHelloAt; private float _helloRetryIntervalSeconds = 0.9f; private float _nextStateRequestAt; private float _nextHostKeepaliveAt; private float _lastHostCommitAt; private float _lastSnapshotAcceptedAt; private float _nextHostIdentityRefreshAt; private float _nextUnsyncedNotifyAt; private float _nextPacketSenderMismatchLogAt; private HostClientSyncPolicy.ClientHandshakeState _lastUnsyncedNotifiedState; private string _lastUnsyncedNotifiedReason = string.Empty; private bool _shaderHealthy = true; private bool _warnedFallback; private float _nextNotifyAt; private Type? _rejoinBridgeType; private MethodInfo? _rejoinBridgePublishMethod; private float _nextRejoinBridgeResolveAt; private Type? _smartCheckinBridgeType; private MethodInfo? _smartCheckinBridgePublishMethod; private float _nextSmartCheckinBridgeResolveAt; private Type? _fishingBridgeType; private MethodInfo? _fishingBridgePublishMethod; private float _nextFishingBridgeResolveAt; private Type? _chalkboardBridgeType; private MethodInfo? _chalkboardBridgePublishMethod; private float _nextChalkboardBridgeResolveAt; private Type? _sessionVisualLabBridgeType; private MethodInfo? _sessionVisualLabBridgePublishMethod; private float _nextSessionVisualLabBridgeResolveAt; private float _nextSceneSuspendNotifyAt; private float _nextSceneScanAt; private float _nextWaterApplyAt; private float _nextAaApplyAt; private float _nextDebugTelemetryAt; private DateTime _lastWeatherSelectionDateUtc = DateTime.MinValue; private WeatherMood _activeWeatherMood; private readonly Dictionary _materialBaselines = new Dictionary(); private readonly Dictionary _shaderCounts = new Dictionary(StringComparer.OrdinalIgnoreCase); private readonly List _scanSummaryLines = new List(); private readonly List _scanRenderers = new List(); private readonly HashSet _touchedMaterials = new HashSet(); private readonly Dictionary _clientCapabilityMasks = new Dictionary(); private readonly Dictionary _clientHelloNonces = new Dictionary(); private readonly Dictionary _lastRequestHandledAtByPlayer = new Dictionary(); private readonly List _syncEventLog = new List(); private string _lastSyncEvent = "none"; private bool _renderBaselineCaptured; private Color _baseFogColor; private bool _baseFogEnabled; private float _baseFogDensity; private FogMode _baseFogMode; private AmbientMode _baseAmbientMode; private Color _baseAmbientSkyColor; private Color _baseAmbientEquatorColor; private Color _baseAmbientGroundColor; private Material? _baseSkyboxMaterial; private Material? _runtimeSkyboxMaterial; private Material? _runtimeSkyboxSource; private Material? _starsSkyboxMaterial; private Material? _whiteSkyboxMaterial; private Texture2D? _starsSkyTexture; private Light? _baseSunLight; private Color _baseSunColor; private float _baseSunIntensity; private float _baseSunTemperature = 6500f; private UniversalRenderPipelineAsset? _baseUrpAsset; private float _baseUrpRenderScale = 1f; private bool _renderScaleBaselineCaptured; private Volume? _volume; private VolumeProfile? _profile; private Bloom? _bloom; private ColorAdjustments? _color; private Vignette? _vignette; private ChromaticAberration? _chroma; private LensDistortion? _lens; private FilmGrain? _grain; private MotionBlur? _motionBlur; private DepthOfField? _depthOfField; private Tonemapping? _tonemapping; private WhiteBalance? _whiteBalance; private LiftGammaGain? _liftGammaGain; private SplitToning? _splitToning; private ColorLookup? _colorLookup; private Texture2D? _lutTextureA; private Texture2D? _lutTextureB; private Texture2D? _lutRuntimeBlendTexture; private Texture2D? _posterizeLutTexture; private Texture2D? _selectiveColorLutTexture; private Texture2D? _generatedLensDirtTexture; private Texture2D? _halftoneOverlayTexture; private Texture2D? _glitchScanlineTexture; private string _lutLoadedPathA = string.Empty; private string _lutLoadedPathB = string.Empty; private string _lutPathAUi = string.Empty; private string _lutPathBUi = string.Empty; private bool _lutDirty = true; private float _lutLastBlendApplied = -1f; private int _posterizeLutLevels = -1; private float _selectiveColorLastIntensity = -1f; private float _selectiveColorLastHue = -1f; private float _selectiveColorLastRange = -1f; private float _selectiveColorLastSoftness = -1f; private int _selectiveColorLastPosterizeLevels = -1; private Material? _shaderMaterial; private CommandBuffer? _shaderPassBuffer; private readonly List _effectStack = new List(); private bool _otApiReady; private bool _otApiRegistered; private float _nextOtApiRetryAt; private Type? _otApiType; private Type? _otArgType; private Type? _otArgEnumType; private Type? _otCfgLinkType; private Type? _otAuxTimingType; private object? _otDepot; private MethodInfo? _otCreateDepotMethod; private MethodInfo? _otAddCfgMethod; private MethodInfo? _otNotifyMethod; private int _otApiRegisteredControlCount; private static readonly string[] UiTabLabels = new string[8] { "⚙\nCore", "✨\nEffects", "\ud83e\uddea\nExperimental", "\ud83c\udf0d\nWorld", "\ud83c\udfa8\nAdvanced", "⭐\nQuality", "\ud83d\udcbf\nPresets", "\ud83d\udee0\nTools" }; public static ManualLogSource Log = null; private static Plugin? _instance; private void Awake() { _instance = this; Log = ((BaseUnityPlugin)this).Logger; _toggleWindowKey = ((BaseUnityPlugin)this).Config.Bind("Input", "ToggleWindowKey", (KeyCode)291, "Toggle ShaderPlayground UI."); _ignoreHotkeysWhenTyping = ((BaseUnityPlugin)this).Config.Bind("Input", "IgnoreHotkeysWhenTyping", true, "If true, function-key menu hotkeys are ignored while a text input field is focused."); _enableOtApiIntegration = ((BaseUnityPlugin)this).Config.Bind("Integration", "EnableOtApiIntegration", true, "Enable otAPI controls if otAPI is installed."); _masterEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "MasterEnabled", true, "Master enable."); _syncEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "SyncEnabled", true, "Enable profile sync."); _localOnlyMode = ((BaseUnityPlugin)this).Config.Bind("General", "LocalOnlyMode", false, "Disable sync and run local-only."); _acceptHostSync = ((BaseUnityPlugin)this).Config.Bind("General", "AcceptHostSync", true, "Allow host to override this client's shader profile."); _enableSessionVisualBridgeSync = ((BaseUnityPlugin)this).Config.Bind("Legacy.SessionVisualBridge", "EnableSyncBridge", false, "Legacy bridge path (disabled by default)."); _applySessionVisualBridgeLocally = ((BaseUnityPlugin)this).Config.Bind("Legacy.SessionVisualBridge", "ApplyLocallyWhenSessionVisualLabMissing", false, "Legacy bridge path (disabled by default)."); _showNotifications = ((BaseUnityPlugin)this).Config.Bind("UI", "ShowNotifications", true, "Show notifications."); _notificationMinIntervalSeconds = ((BaseUnityPlugin)this).Config.Bind("UI", "NotificationMinIntervalSeconds", 1.25f, "Min seconds between notifications."); _respectSessionVisualLabOwnership = ((BaseUnityPlugin)this).Config.Bind("Legacy.SessionVisualBridge", "RespectSessionVisualLabOwnership", false, "Legacy ownership guard (disabled by default)."); _windowVisibleConfig = ((BaseUnityPlugin)this).Config.Bind("UI", "WindowVisible", false, "Persisted state for ShaderPlayground settings window."); _enableShaderPass = ((BaseUnityPlugin)this).Config.Bind("Runtime", "EnableShaderPass", true, "Enable fullscreen shader path."); _forceVolumeFallback = ((BaseUnityPlugin)this).Config.Bind("Runtime", "ForceVolumeFallback", false, "Force fallback volume mode."); _qualityTier = ((BaseUnityPlugin)this).Config.Bind("Runtime", "QualityTier", 1, "0 low, 1 medium, 2 high."); _crtEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.CRTVHS", "Enabled", true, "Enable Fisheye."); _crtIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.CRTVHS", "Intensity", 0.06f, "Fisheye intensity."); _dreamEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.DreamBloom", "Enabled", false, "Enable Dream Bloom."); _dreamIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.DreamBloom", "Intensity", 0.45f, "Dream intensity."); _comicEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.ComicSketch", "Enabled", false, "Enable Comic/Sketch."); _comicIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.ComicSketch", "Intensity", 0.4f, "Comic intensity."); _heatwaveEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Heatwave", "Enabled", false, "Enable Breathing."); _heatwaveIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Heatwave", "Intensity", 0.028f, "Breathing intensity."); _heatwaveSpeed = ((BaseUnityPlugin)this).Config.Bind("Effects.Heatwave", "Speed", 1f, "Heatwave speed."); _noirEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Noir", "Enabled", false, "Enable cinematic noir grade."); _noirIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Noir", "Intensity", 0.45f, "Noir intensity."); _vaporEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Vapor", "Enabled", false, "Enable neon/vapor look."); _vaporIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Vapor", "Intensity", 0.4f, "Vapor intensity."); _posterizeEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Posterize", "Enabled", false, "Enable posterize color quantization."); _posterizeIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Posterize", "Intensity", 0.35f, "Posterize intensity."); _pixelateEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Pixelate", "Enabled", false, "Enable pixelate retro scaling."); _pixelateIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Pixelate", "Intensity", 0.25f, "Pixelate strength."); _chromaticSplitEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.ChromaticSplit", "Enabled", false, "Enable RGB split."); _chromaticSplitIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.ChromaticSplit", "Intensity", 0.25f, "Chromatic split intensity."); _ditherEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Dither", "Enabled", false, "Enable stylized dither grain."); _ditherIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Dither", "Intensity", 0.2f, "Dither intensity."); _lensCenterX = ((BaseUnityPlugin)this).Config.Bind("Effects.LensDistortion", "CenterX", 0.5f, "Lens distortion center X (supports off-screen)."); _lensCenterY = ((BaseUnityPlugin)this).Config.Bind("Effects.LensDistortion", "CenterY", 0.5f, "Lens distortion center Y (supports off-screen)."); _motionBlurEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.MotionBlur", "Enabled", false, "Enable Motion Blur."); _motionBlurIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.MotionBlur", "Intensity", 0.2f, "Motion Blur intensity."); _depthOfFieldEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.DepthOfField", "Enabled", false, "Enable Depth of Field."); _depthOfFieldIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.DepthOfField", "Intensity", 0.35f, "Depth of Field intensity."); _anamorphicBloomEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "AnamorphicBloomEnabled", false, "Enable Experimental Anamorphic Bloom (horizontal cinematic streak style)."); _anamorphicBloomIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "AnamorphicBloomIntensity", 0.35f, "Experimental Anamorphic Bloom intensity."); _halftoneEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "HalftoneEnabled", false, "Enable Experimental Halftone comic dots."); _halftoneIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "HalftoneIntensity", 0.35f, "Experimental Halftone amount."); _halftoneDotSize = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "HalftoneDotSize", 1.25f, "Experimental Halftone dot size."); _halftoneAngle = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "HalftoneAngle", 45f, "Experimental Halftone angle in degrees."); _kuwaharaEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "KuwaharaEnabled", false, "Enable Experimental Kuwahara/Oil Paint smoothing."); _kuwaharaIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "KuwaharaIntensity", 0.35f, "Experimental Kuwahara/Oil Paint amount."); _kuwaharaRadius = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "KuwaharaRadius", 2f, "Experimental Kuwahara/Oil Paint radius."); _selectiveColorEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "SelectiveColorEnabled", false, "Enable Experimental Selective Color."); _selectiveColorIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "SelectiveColorIntensity", 0.75f, "Selective Color desaturation amount for out-of-range hues."); _selectiveColorHue = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "SelectiveColorHue", 0f, "Selective Color target hue in degrees (0..360)."); _selectiveColorRange = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "SelectiveColorRange", 35f, "Selective Color hue range in degrees."); _selectiveColorSoftness = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "SelectiveColorSoftness", 0.25f, "Selective Color edge softness."); _radialBlurEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "RadialBlurEnabled", false, "Enable Experimental Radial Blur."); _radialBlurIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "RadialBlurIntensity", 0.35f, "Radial Blur intensity."); _lensDirtEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "LensDirtEnabled", false, "Enable Experimental Lens Dirt overlay via bloom."); _lensDirtIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "LensDirtIntensity", 0.35f, "Lens Dirt intensity."); _rainOnLensEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "RainOnLensEnabled", false, "Enable Experimental Rain-on-Lens."); _rainOnLensIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "RainOnLensIntensity", 0.35f, "Rain-on-Lens intensity."); _causticsOverlayEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "CausticsOverlayEnabled", false, "Enable Experimental Caustics Overlay on world surfaces."); _causticsOverlayIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "CausticsOverlayIntensity", 0.35f, "Caustics Overlay intensity."); _godrayFakeEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "GodrayFakeEnabled", false, "Enable Experimental Godray Fake (cheap sun-direction screen rays)."); _godrayFakeIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "GodrayFakeIntensity", 0.35f, "Godray Fake intensity."); _filmGateEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "FilmGateEnabled", false, "Enable Experimental Film Gate (letterbox + subtle jitter + grain)."); _filmGateIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "FilmGateIntensity", 0.35f, "Film Gate intensity."); _glitchPackEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "GlitchPackEnabled", false, "Enable Experimental Glitch Pack (scanline jitter + channel jumps + digital tearing)."); _glitchPackIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "GlitchPackIntensity", 0.04f, "Glitch Pack intensity."); _volumetricFogTintEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "VolumetricFogTintEnabled", false, "Enable Experimental Volumetric Fog Tint."); _volumetricFogTintIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "VolumetricFogTintIntensity", 0.35f, "Volumetric Fog Tint color intensity."); _volumetricFogTintDensity = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "VolumetricFogTintDensity", 0.4f, "Volumetric Fog Tint density shaping amount."); _volumetricFogTintHue = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "VolumetricFogTintHue", 210f, "Volumetric Fog Tint hue in degrees (0..360)."); _lutBlendEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "LutBlendEnabled", false, "Enable Experimental Color LUT Blend."); _lutBlendAmount = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "LutBlendAmount", 0f, "Color LUT blend amount between LUT A (0) and LUT B (1)."); _lutPathA = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "LutPathA", string.Empty, "Filesystem path to LUT A (PNG/JPG)."); _lutPathB = ((BaseUnityPlugin)this).Config.Bind("Effects.Experimental", "LutPathB", string.Empty, "Filesystem path to LUT B (PNG/JPG)."); _hypnosisEnabled = ((BaseUnityPlugin)this).Config.Bind("Effects.DreamyHypnosis", "Enabled", false, "Enable Dreamy Hypnosis pack."); _hypnosisPreset = ((BaseUnityPlugin)this).Config.Bind("Effects.DreamyHypnosis", "Preset", 1, "0 Custom, 1 Lullaby, 2 Float, 3 Deep Hypnosis."); _hypnosisIntensity = ((BaseUnityPlugin)this).Config.Bind("Effects.DreamyHypnosis", "Intensity", 0.35f, "Master hypnosis intensity (no-flicker)."); _hypnosisSpeed = ((BaseUnityPlugin)this).Config.Bind("Effects.DreamyHypnosis", "Speed", 0.22f, "Hypnosis motion speed (clamped low for comfort)."); _hypnosisWarpAmount = ((BaseUnityPlugin)this).Config.Bind("Effects.DreamyHypnosis", "WarpAmount", 0.32f, "DreamWarp strength."); _hypnosisSpiralAmount = ((BaseUnityPlugin)this).Config.Bind("Effects.DreamyHypnosis", "SpiralAmount", 0.28f, "Vignette spiral strength."); _hypnosisColorBlend = ((BaseUnityPlugin)this).Config.Bind("Effects.DreamyHypnosis", "ColorBlend", 0.45f, "Soft chromatic drift blend."); _enhancedSkyEnabled = ((BaseUnityPlugin)this).Config.Bind("World.Sky", "Enabled", true, "Enable sky and lighting overhaul."); _skyIntensity = ((BaseUnityPlugin)this).Config.Bind("World.Sky", "Intensity", 0.7f, "Sky/lighting strength."); _skyExposure = ((BaseUnityPlugin)this).Config.Bind("World.Sky", "Exposure", 1f, "Skybox exposure multiplier."); _skyHueShift = ((BaseUnityPlugin)this).Config.Bind("World.Sky", "HueShift", 0f, "Sky hue shift in degrees (-180 to 180)."); _skyColorBlend = ((BaseUnityPlugin)this).Config.Bind("World.Sky", "ColorBlend", 0f, "How strongly hue shift applies to sky/fog/ambient."); _skyboxMaterialIndex = ((BaseUnityPlugin)this).Config.Bind("World.Sky", "MaterialIndex", 0, "Selected skybox material index."); _sunIntensityMultiplier = ((BaseUnityPlugin)this).Config.Bind("World.Sun", "IntensityMultiplier", 1f, "Sun intensity multiplier."); _sunTemperature = ((BaseUnityPlugin)this).Config.Bind("World.Sun", "Temperature", 6500f, "Sun color temperature."); _sunColorR = ((BaseUnityPlugin)this).Config.Bind("World.Sun", "ColorR", 1f, "Sun color red channel."); _sunColorG = ((BaseUnityPlugin)this).Config.Bind("World.Sun", "ColorG", 0.97f, "Sun color green channel."); _sunColorB = ((BaseUnityPlugin)this).Config.Bind("World.Sun", "ColorB", 0.9f, "Sun color blue channel."); _sunColorBlend = ((BaseUnityPlugin)this).Config.Bind("World.Sun", "ColorBlend", 0f, "Blend amount for custom sun color."); _tonemappingMode = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.Tonemapping", "Mode", 0, "0 Off, 1 Neutral, 2 ACES."); _whiteBalanceEnabled = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.WhiteBalance", "Enabled", false, "Enable WhiteBalance override."); _whiteBalanceTemperature = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.WhiteBalance", "Temperature", 0f, "WhiteBalance temperature (-100..100)."); _whiteBalanceTint = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.WhiteBalance", "Tint", 0f, "WhiteBalance tint (-100..100)."); _liftGammaGainEnabled = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.LiftGammaGain", "Enabled", false, "Enable Lift/Gamma/Gain override."); _liftAmount = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.LiftGammaGain", "Lift", 0f, "Lift amount (-1..1)."); _gammaAmount = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.LiftGammaGain", "Gamma", 1f, "Gamma amount (0..2)."); _gainAmount = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.LiftGammaGain", "Gain", 1f, "Gain amount (0..2)."); _splitToningEnabled = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.SplitToning", "Enabled", false, "Enable split toning (separate shadow/highlight tints)."); _splitShadowsR = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.SplitToning", "ShadowsR", 0.5f, "Split toning shadows red channel (0..1)."); _splitShadowsG = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.SplitToning", "ShadowsG", 0.5f, "Split toning shadows green channel (0..1)."); _splitShadowsB = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.SplitToning", "ShadowsB", 0.5f, "Split toning shadows blue channel (0..1)."); _splitHighlightsR = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.SplitToning", "HighlightsR", 0.5f, "Split toning highlights red channel (0..1)."); _splitHighlightsG = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.SplitToning", "HighlightsG", 0.5f, "Split toning highlights green channel (0..1)."); _splitHighlightsB = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.SplitToning", "HighlightsB", 0.5f, "Split toning highlights blue channel (0..1)."); _splitToningBalance = ((BaseUnityPlugin)this).Config.Bind("AdvancedColor.SplitToning", "Balance", 0f, "Split toning balance (-100..100)."); _cloudLayersEnabled = ((BaseUnityPlugin)this).Config.Bind("World.Clouds", "Enabled", true, "Enable multi-layer cloud look adjustments."); _cloudDensity = ((BaseUnityPlugin)this).Config.Bind("World.Clouds", "Density", 0.65f, "Cloud density/intensity."); _weatherSystemEnabled = ((BaseUnityPlugin)this).Config.Bind("World.Weather", "Enabled", true, "Enable daily weather mood selection."); _weatherMode = ((BaseUnityPlugin)this).Config.Bind("World.Weather", "Mode", 0, "0 Auto daily, 1 Clear, 2 Golden, 3 Overcast, 4 Storm, 5 Dream."); _weatherStrength = ((BaseUnityPlugin)this).Config.Bind("World.Weather", "Strength", 0.7f, "Weather mood strength."); _waterOverrideEnabled = ((BaseUnityPlugin)this).Config.Bind("World.Water", "Enabled", true, "Enable runtime water material override."); _waterClarity = ((BaseUnityPlugin)this).Config.Bind("World.Water", "Clarity", 0.68f, "Water clarity and tint strength."); _waterWaveStrength = ((BaseUnityPlugin)this).Config.Bind("World.Water", "WaveStrength", 0.62f, "Water wave/normal strength."); _antiAliasingPreset = ((BaseUnityPlugin)this).Config.Bind("ImageQuality", "AntiAliasingPreset", 2, "0 Off, 1 FXAA, 2 SMAA, 3 TAA, 4 CAS-style."); _casSharpening = ((BaseUnityPlugin)this).Config.Bind("ImageQuality", "CasSharpening", 0.35f, "CAS-style sharpening strength."); _scannerLogOnSceneLoad = ((BaseUnityPlugin)this).Config.Bind("Tools", "ShaderScannerLogOnSceneLoad", true, "Log material/shader scanner output on scene load."); _savedProfileJson = ((BaseUnityPlugin)this).Config.Bind("Presets", "SavedProfileJson", string.Empty, "Saved custom preset JSON."); _debugMode = ((BaseUnityPlugin)this).Config.Bind("Debug", "DebugMode", false, "Emit debug telemetry for runtime state, camera/post-processing, and sync ownership."); _debugTelemetryIntervalSeconds = ((BaseUnityPlugin)this).Config.Bind("Debug", "DebugTelemetryIntervalSeconds", 5f, "Seconds between periodic debug telemetry logs."); _enableBuiltInSyncLog = ((BaseUnityPlugin)this).Config.Bind("Debug", "EnableBuiltInSyncLog", true, "Keep an in-game rolling sync/handshake event log."); _syncLogToBepInEx = ((BaseUnityPlugin)this).Config.Bind("Debug", "SyncLogToBepInEx", true, "Write handshake/sync events to BepInEx log."); _syncLogIncludeKeepalive = ((BaseUnityPlugin)this).Config.Bind("Debug", "SyncLogIncludeKeepalive", false, "Include keepalive snapshots in built-in sync log."); _strictSnapshotHashValidation = ((BaseUnityPlugin)this).Config.Bind("Debug", "StrictSnapshotHashValidation", false, "When true (and DebugMode=true), reject host snapshots on hash mismatch. Default false for compatibility."); _lutPathAUi = _lutPathA.Value ?? string.Empty; _lutPathBUi = _lutPathB.Value ?? string.Empty; _showWindow = _windowVisibleConfig.Value; ClampEffectRanges(); BuildEffectStack(); RenderPipelineManager.endCameraRendering += OnEndCameraRendering; SceneManager.sceneLoaded += OnSceneLoaded; ((MonoBehaviour)this).StartCoroutine(HookLoop()); _nextOtApiRetryAt = Time.unscaledTime + 1f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"ShaderPlayground loaded (0.5.2)"); } private void OnDestroy() { _instance = null; RenderPipelineManager.endCameraRendering -= OnEndCameraRendering; SceneManager.sceneLoaded -= OnSceneLoaded; UnhookNetwork(); DestroyVolume(); RestoreMaterialBaselines(); RestoreRenderBaseline(); RestoreRenderScaleBaseline(); if ((Object)(object)_shaderMaterial != (Object)null) { Object.Destroy((Object)(object)_shaderMaterial); } _shaderMaterial = null; CommandBuffer? shaderPassBuffer = _shaderPassBuffer; if (shaderPassBuffer != null) { shaderPassBuffer.Release(); } _shaderPassBuffer = null; if ((Object)(object)_starsSkyboxMaterial != (Object)null) { Object.Destroy((Object)(object)_starsSkyboxMaterial); } if ((Object)(object)_whiteSkyboxMaterial != (Object)null) { Object.Destroy((Object)(object)_whiteSkyboxMaterial); } if ((Object)(object)_starsSkyTexture != (Object)null) { Object.Destroy((Object)(object)_starsSkyTexture); } _starsSkyboxMaterial = null; _whiteSkyboxMaterial = null; _starsSkyTexture = null; DestroyLutTextures(); if ((Object)(object)_generatedLensDirtTexture != (Object)null) { Object.Destroy((Object)(object)_generatedLensDirtTexture); } _generatedLensDirtTexture = null; if ((Object)(object)_halftoneOverlayTexture != (Object)null) { Object.Destroy((Object)(object)_halftoneOverlayTexture); } _halftoneOverlayTexture = null; if ((Object)(object)_glitchScanlineTexture != (Object)null) { Object.Destroy((Object)(object)_glitchScanlineTexture); } _glitchScanlineTexture = null; if ((Object)(object)_panelTexture != (Object)null) { Object.Destroy((Object)(object)_panelTexture); } if ((Object)(object)_sectionTexture != (Object)null) { Object.Destroy((Object)(object)_sectionTexture); } if ((Object)(object)_buttonTexture != (Object)null) { Object.Destroy((Object)(object)_buttonTexture); } if ((Object)(object)_buttonSecondaryTexture != (Object)null) { Object.Destroy((Object)(object)_buttonSecondaryTexture); } if ((Object)(object)_buttonPressedTexture != (Object)null) { Object.Destroy((Object)(object)_buttonPressedTexture); } if ((Object)(object)_tabInactiveTexture != (Object)null) { Object.Destroy((Object)(object)_tabInactiveTexture); } if ((Object)(object)_tabInactiveHoverTexture != (Object)null) { Object.Destroy((Object)(object)_tabInactiveHoverTexture); } if ((Object)(object)_subCardTexture != (Object)null) { Object.Destroy((Object)(object)_subCardTexture); } if ((Object)(object)_sliderTrackTexture != (Object)null) { Object.Destroy((Object)(object)_sliderTrackTexture); } if ((Object)(object)_sliderThumbTexture != (Object)null) { Object.Destroy((Object)(object)_sliderThumbTexture); } if ((Object)(object)_sliderThumbHoverTexture != (Object)null) { Object.Destroy((Object)(object)_sliderThumbHoverTexture); } if ((Object)(object)_sliderThumbActiveTexture != (Object)null) { Object.Destroy((Object)(object)_sliderThumbActiveTexture); } if ((Object)(object)_textFieldTexture != (Object)null) { Object.Destroy((Object)(object)_textFieldTexture); } if ((Object)(object)_textFieldFocusedTexture != (Object)null) { Object.Destroy((Object)(object)_textFieldFocusedTexture); } if (_tabActiveTextures == null) { return; } for (int i = 0; i < _tabActiveTextures.Length; i++) { if ((Object)(object)_tabActiveTextures[i] != (Object)null) { Object.Destroy((Object)(object)_tabActiveTextures[i]); } } } private IEnumerator HookLoop() { while (true) { TryHookNetwork(); yield return (object)new WaitForSeconds(1f); } } private void OnSceneLoaded(Scene _, LoadSceneMode __) { TryHookNetwork(); _nextSceneScanAt = 0f; _nextWaterApplyAt = 0f; _nextAaApplyAt = 0f; _lastWeatherSelectionDateUtc = DateTime.MinValue; RefreshSkyboxMaterialOptions(); if (_scannerLogOnSceneLoad.Value) { RunMaterialScanner(logToConsole: true); } else { RunMaterialScanner(logToConsole: false); } RefreshSkyboxMaterialOptions(); HandleSyncLifecycleReset("scene-load"); } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(_toggleWindowKey.Value) && CanUseMenuHotkey()) { _showWindow = !_showWindow; _windowVisibleConfig.Value = _showWindow; } if (_windowVisibleConfig.Value != _showWindow) { _showWindow = _windowVisibleConfig.Value; } if (_enableOtApiIntegration.Value && (!_otApiReady || !_otApiRegistered) && Time.unscaledTime >= _nextOtApiRetryAt) { _nextOtApiRetryAt = Time.unscaledTime + 10f; TryInitializeOtApi(); } bool flag = IsSceneSuspendedForVisualOverrides(); if (_masterEnabled.Value && !flag) { if (Time.unscaledTime >= _nextSceneScanAt) { _nextSceneScanAt = Time.unscaledTime + 6f; RunMaterialScanner(logToConsole: false); } if (Time.unscaledTime >= _nextAaApplyAt) { _nextAaApplyAt = Time.unscaledTime + 2f; ApplyAntiAliasingPresetToActiveCameras(); } if (Time.unscaledTime >= _nextWaterApplyAt) { float num = (_causticsOverlayEnabled.Value ? 1.5f : 0.75f); _nextWaterApplyAt = Time.unscaledTime + num; ApplyWaterAndCloudOverrides(); } ApplyVisuals(); } else { DisableVisuals(); } if (flag) { if (_showNotifications.Value && Time.unscaledTime >= _nextSceneSuspendNotifyAt) { _nextSceneSuspendNotifyAt = Time.unscaledTime + 8f; Notify("ShaderPlayground paused in menu/desktop scene."); } return; } if (_debugMode.Value && Time.unscaledTime >= _nextDebugTelemetryAt) { _nextDebugTelemetryAt = Time.unscaledTime + Mathf.Clamp(_debugTelemetryIntervalSeconds.Value, 1f, 60f); EmitDebugTelemetry("tick"); } TickHandshakeAndSync(Time.unscaledTime); } private void OnGUI() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) DrawHalftoneOverlay(); DrawLensDirtOverlay(); DrawRainOnLensOverlay(); DrawFilmGateOverlay(); DrawGlitchOverlay(); if (_showWindow) { InitStyles(); ClampWindowToScreen(); _windowRect = GUI.Window(23154, _windowRect, new WindowFunction(DrawWindow), $"Shader Playground ({_toggleWindowKey.Value})", _windowStyle ?? GUI.skin.window); ClampWindowToScreen(); } } private void DrawHalftoneOverlay() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) if (Event.current != null && (int)Event.current.type == 7 && _masterEnabled.Value && _halftoneEnabled.Value && !(_halftoneIntensity.Value <= 0.001f) && !IsSceneSuspendedForVisualOverrides()) { if (_halftoneOverlayTexture == null) { _halftoneOverlayTexture = BuildHalftoneOverlayTexture(); } if (!((Object)(object)_halftoneOverlayTexture == (Object)null)) { float num = Mathf.Clamp01(_halftoneIntensity.Value); float num2 = Mathf.InverseLerp(0.25f, 8f, Mathf.Clamp(_halftoneDotSize.Value, 0.25f, 8f)); float num3 = Mathf.Lerp(220f, 22f, num2); float num4 = Mathf.Max(1f, (float)Screen.width / num3); float num5 = Mathf.Max(1f, (float)Screen.height / num3); Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; GUIUtility.RotateAroundPivot(_halftoneAngle.Value, new Vector2((float)Screen.width * 0.5f, (float)Screen.height * 0.5f)); GUI.color = new Color(0f, 0f, 0f, Mathf.Lerp(0.03f, 0.22f, num)); GUI.DrawTextureWithTexCoords(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)_halftoneOverlayTexture, new Rect(0f, 0f, num4, num5)); GUI.color = color; GUI.matrix = matrix; } } } private static Texture2D BuildHalftoneOverlayTexture() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false, true) { wrapMode = (TextureWrapMode)0, filterMode = (FilterMode)1, hideFlags = (HideFlags)61, name = "ShaderPlayground.HalftoneOverlay" }; float num = 63.5f; float num2 = Mathf.Max(1f, num); for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num3 = (float)j - num; float num4 = (float)i - num; float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4); float num6 = Mathf.Clamp01(1f - Mathf.Pow(num5 / num2, 1.8f)); val.SetPixel(j, i, new Color(0f, 0f, 0f, num6)); } } val.Apply(false, false); return val; } private void DrawLensDirtOverlay() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (Event.current != null && (int)Event.current.type == 7 && _masterEnabled.Value && _lensDirtEnabled.Value && !(_lensDirtIntensity.Value <= 0.001f) && !IsSceneSuspendedForVisualOverrides()) { Texture2D orCreateLensDirtTexture = GetOrCreateLensDirtTexture(); if (!((Object)(object)orCreateLensDirtTexture == (Object)null)) { float num = Mathf.Clamp01(_lensDirtIntensity.Value); Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, Mathf.Lerp(0.04f, 0.28f, num)); GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)orCreateLensDirtTexture, (ScaleMode)0, true); GUI.color = color; } } } private void DrawRainOnLensOverlay() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_0130: Unknown result type (might be due to invalid IL or missing references) if (Event.current != null && (int)Event.current.type == 7 && _masterEnabled.Value && _rainOnLensEnabled.Value && !(_rainOnLensIntensity.Value <= 0.001f) && !IsSceneSuspendedForVisualOverrides()) { Texture2D orCreateLensDirtTexture = GetOrCreateLensDirtTexture(); if (!((Object)(object)orCreateLensDirtTexture == (Object)null)) { float num = Mathf.Clamp01(_rainOnLensIntensity.Value); float unscaledTime = Time.unscaledTime; Rect val = default(Rect); ((Rect)(ref val))..ctor((Mathf.PerlinNoise(unscaledTime * 0.12f, 0.31f) - 0.5f) * 0.08f, Mathf.Repeat((0f - unscaledTime) * Mathf.Lerp(0.01f, 0.06f, num), 1f), 1.12f, 1.12f); float num2 = Mathf.Lerp(0.75f, 1.15f, Mathf.PerlinNoise(0.41f, unscaledTime * 0.9f)); Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, Mathf.Clamp01(Mathf.Lerp(0.02f, 0.2f, num) * num2)); GUI.DrawTextureWithTexCoords(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)orCreateLensDirtTexture, val); GUI.color = color; } } } private void DrawFilmGateOverlay() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_009b: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) if (Event.current != null && (int)Event.current.type == 7 && _masterEnabled.Value && _filmGateEnabled.Value && !(_filmGateIntensity.Value <= 0.001f) && !IsSceneSuspendedForVisualOverrides()) { float num = Mathf.Clamp01(_filmGateIntensity.Value); int num2 = Mathf.Clamp(Mathf.RoundToInt((float)Screen.height * Mathf.Lerp(0.03f, 0.14f, num)), 6, Mathf.Max(8, Screen.height / 3)); float num3 = Mathf.Lerp(0.7f, 1f, num); Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, num3); GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)num2), (Texture)(object)Texture2D.whiteTexture, (ScaleMode)0); GUI.DrawTexture(new Rect(0f, (float)(Screen.height - num2), (float)Screen.width, (float)num2), (Texture)(object)Texture2D.whiteTexture, (ScaleMode)0); GUI.color = color; } } private void DrawGlitchOverlay() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) if (Event.current == null || (int)Event.current.type != 7 || !_masterEnabled.Value || !_glitchPackEnabled.Value || _glitchPackIntensity.Value <= 0.001f || IsSceneSuspendedForVisualOverrides()) { return; } float num = Mathf.Clamp01(_glitchPackIntensity.Value / 0.1f); if (_glitchScanlineTexture == null) { _glitchScanlineTexture = BuildGlitchScanlineTexture(); } if (!((Object)(object)_glitchScanlineTexture == (Object)null)) { float unscaledTime = Time.unscaledTime; float num2 = (Mathf.PerlinNoise(0.37f, unscaledTime * 7.9f) - 0.5f) * 0.18f * num; float num3 = (Mathf.PerlinNoise(unscaledTime * 9.2f, 0.61f) - 0.5f) * 0.12f * num; float num4 = Mathf.Clamp01(Mathf.Sin(unscaledTime * 13.5f) * 0.5f + 0.5f); float num5 = Mathf.Lerp(0.04f, 0.22f, num) * Mathf.Lerp(0.75f, 1.25f, num4); Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, Mathf.Clamp01(num5)); GUI.DrawTextureWithTexCoords(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)_glitchScanlineTexture, new Rect(num3, num2, 1f, 1f)); if (Mathf.PerlinNoise(2.19f, unscaledTime * 5.7f) > Mathf.Lerp(0.86f, 0.62f, num)) { int num6 = Mathf.FloorToInt(Mathf.Repeat(unscaledTime * 143f, Mathf.Max(1f, (float)Screen.height - 24f))); int num7 = Mathf.Clamp(Mathf.RoundToInt(Mathf.Lerp(2f, 14f, num)), 2, 18); float num8 = Mathf.Lerp(0.1f, 0.35f, num); float num9 = (Mathf.PerlinNoise(unscaledTime * 23.3f, 0.2f) - 0.5f) * Mathf.Lerp(16f, 120f, num); GUI.color = new Color(0.92f, 0.94f, 1f, num8); GUI.DrawTexture(new Rect(num9, (float)num6, (float)Screen.width, (float)num7), (Texture)(object)Texture2D.whiteTexture, (ScaleMode)0); } GUI.color = color; } } private bool CanUseMenuHotkey() { if (_ignoreHotkeysWhenTyping.Value) { return !IsAnyTextInputFocused(); } return true; } private static bool IsAnyTextInputFocused() { try { Type type = Type.GetType("UnityEngine.EventSystems.EventSystem, UnityEngine.UI"); if (type == null) { return false; } object obj = type.GetProperty("current", BindingFlags.Static | BindingFlags.Public)?.GetValue(null); if (obj == null) { return false; } object? obj2 = type.GetProperty("currentSelectedGameObject", BindingFlags.Instance | BindingFlags.Public)?.GetValue(obj); GameObject val = (GameObject)((obj2 is GameObject) ? obj2 : null); if ((Object)(object)val == (Object)null) { return false; } Component[] components = val.GetComponents(); for (int i = 0; i < components.Length; i++) { string a = ((object)components[i])?.GetType().Name; if (string.Equals(a, "InputField", StringComparison.Ordinal) || string.Equals(a, "TMP_InputField", StringComparison.Ordinal)) { return true; } } } catch { } return false; } private void DrawWindow(int _) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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) InitStyles(); Color contentColor = GUI.contentColor; GUI.contentColor = UiInk; GUILayout.Label("Shader Playground", _menuTitleStyle ?? GUI.skin.label, Array.Empty()); GUILayout.Label("Standalone shader stack (no VisualLab bridge).", _subtitleStyle ?? GUI.skin.label, Array.Empty()); DrawPastelTabs(); GUILayout.Space(8f); float num = Mathf.Clamp(((Rect)(ref _windowRect)).height - 130f, 120f, Mathf.Max(120f, ((Rect)(ref _windowRect)).height - 70f)); _scroll = GUILayout.BeginScrollView(_scroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) }); bool changed = false; switch (_activeTab) { case UiTab.Core: DrawCoreTab(ref changed); break; case UiTab.Effects: DrawEffectsTab(ref changed); break; case UiTab.Experimental: DrawExperimentalTab(ref changed); break; case UiTab.World: DrawWorldTab(ref changed); break; case UiTab.AdvancedColor: DrawAdvancedColorTab(ref changed); break; case UiTab.Quality: DrawQualityTab(ref changed); break; case UiTab.Presets: DrawPresetTab(ref changed); break; case UiTab.Tools: DrawToolsTab(ref changed); break; } GUILayout.EndScrollView(); if (changed) { Commit("ui-change", notify: false); } GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("✔ Keep It!", _actionBtnStyle ?? _buttonStyle ?? GUI.skin.button, Array.Empty())) { Commit("manual", notify: true); } if (GUILayout.Button("✖ Not Today", _secondaryButtonStyle ?? _buttonStyle ?? GUI.skin.button, Array.Empty())) { _showWindow = false; _windowVisibleConfig.Value = false; } GUILayout.EndHorizontal(); GUI.contentColor = contentColor; GUI.DragWindow(new Rect(0f, 0f, 10000f, 10000f)); } private void DrawPastelTabs() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty()); for (int i = 0; i < UiTabLabels.Length; i++) { bool flag = i == (int)_activeTab; GUIStyle val = (GUIStyle)((!flag) ? (_tabStyle ?? _tabInactiveStyle ?? GUI.skin.button) : ((_tabActiveStyles != null && i < _tabActiveStyles.Length) ? ((object)_tabActiveStyles[i]) : ((object)(_buttonStyle ?? GUI.skin.button)))); if (GUILayout.Button(UiTabLabels[i], val, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(34f), GUILayout.ExpandWidth(true) }) && !flag) { _activeTab = (UiTab)Mathf.Clamp(i, 0, UiTabLabels.Length - 1); _scroll = Vector2.zero; } } GUILayout.EndHorizontal(); } private int DrawSegmentedButtons(int selected, string[] labels) { int num = Mathf.Clamp(selected, 0, labels.Length - 1); GUILayout.BeginHorizontal(Array.Empty()); for (int i = 0; i < labels.Length; i++) { GUIStyle val = ((i == num) ? (_secondaryButtonStyle ?? _buttonStyle ?? GUI.skin.button) : (_tabStyle ?? _tabInactiveStyle ?? GUI.skin.button)); if (GUILayout.Button(labels[i], val, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(30f), GUILayout.ExpandWidth(true) })) { num = i; } } GUILayout.EndHorizontal(); return num; } private void DrawCoreTab(ref bool changed) { BeginSection("Core Runtime"); changed |= Toggle(_masterEnabled, "Master Enabled"); changed |= Toggle(_syncEnabled, "Sync Enabled"); changed |= Toggle(_localOnlyMode, "Local Only"); changed |= Toggle(_acceptHostSync, "Allow Host Sync"); if (_acceptHostSync.Value && _localOnlyMode.Value) { _localOnlyMode.Value = false; changed = true; } changed |= Toggle(_showNotifications, "Show Notifications"); changed |= SliderRow("Notification Min Interval", _notificationMinIntervalSeconds, 0.2f, 5f, "0.00"); changed |= Toggle(_enableShaderPass, "Enable Shader Pass"); changed |= Toggle(_forceVolumeFallback, "Force Volume Fallback"); changed |= Toggle(_enableOtApiIntegration, "Enable otAPI Controls"); if (_syncEnabled.Value && (_localOnlyMode.Value || !_acceptHostSync.Value)) { GUILayout.Label("Host sync disabled by config (Local Only or Allow Host Sync is off).", Array.Empty()); } EndSection(); } private void DrawEffectsTab(ref bool changed) { BeginSection("Post FX Stack"); if (IsClientOnly() && _syncEnabled.Value && !_localOnlyMode.Value && _acceptHostSync.Value) { GUILayout.Label("Host sync is active. Host profile updates can override local effect edits.", Array.Empty()); } changed |= EffectRow("Fisheye", _crtEnabled, _crtIntensity, 0f, 0.1f); changed |= EffectRow("Dream Bloom", _dreamEnabled, _dreamIntensity); changed |= EffectRow("Comic/Sketch", _comicEnabled, _comicIntensity); changed |= EffectRow("Breathing", _heatwaveEnabled, _heatwaveIntensity, 0f, 0.05f); changed |= SliderRow("Breathing Speed", _heatwaveSpeed, 0.2f, 4f, "0.00"); changed |= EffectRow("Noir", _noirEnabled, _noirIntensity); changed |= EffectRow("Vapor", _vaporEnabled, _vaporIntensity); changed |= EffectRow("Posterize", _posterizeEnabled, _posterizeIntensity); changed |= EffectRow("Pixelate", _pixelateEnabled, _pixelateIntensity); changed |= EffectRow("Chromatic Split", _chromaticSplitEnabled, _chromaticSplitIntensity); changed |= EffectRow("Dither", _ditherEnabled, _ditherIntensity); changed |= EffectRow("Motion Blur", _motionBlurEnabled, _motionBlurIntensity); changed |= EffectRow("Depth of Field", _depthOfFieldEnabled, _depthOfFieldIntensity); changed |= SliderRow("Lens Center X", _lensCenterX, -1f, 2f, "0.00"); changed |= SliderRow("Lens Center Y", _lensCenterY, -1f, 2f, "0.00"); EndSection(); } private void DrawWorldTab(ref bool changed) { BeginSection("World Overhaul"); changed |= Toggle(_enhancedSkyEnabled, "Enhanced Sky + Lighting"); changed |= SliderRow("Sky Intensity", _skyIntensity, 0f, 1f, "0.00"); changed |= SliderRow("Sky Exposure", _skyExposure, 0.05f, 2.5f, "0.00"); changed |= SliderRow("Sky Hue Shift", _skyHueShift, -180f, 180f, "0"); changed |= SliderRow("Sky Color Blend", _skyColorBlend, 0f, 1f, "0.00"); GUILayout.Label("Skybox Style", _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); int num = DrawSegmentedButtons(Mathf.Clamp(_skyboxMaterialIndex.Value, 0, SkyboxStyleLabels.Length - 1), SkyboxStyleLabels); if (num != _skyboxMaterialIndex.Value) { _skyboxMaterialIndex.Value = num; changed = true; } changed |= SliderRow("Sun Intensity", _sunIntensityMultiplier, 0f, 3f, "0.00"); changed |= SliderRow("Sun Temperature", _sunTemperature, 1000f, 20000f, "0"); changed |= SliderRow("Sun Color R", _sunColorR, 0f, 1f, "0.00"); changed |= SliderRow("Sun Color G", _sunColorG, 0f, 1f, "0.00"); changed |= SliderRow("Sun Color B", _sunColorB, 0f, 1f, "0.00"); changed |= SliderRow("Sun Color Blend", _sunColorBlend, 0f, 1f, "0.00"); changed |= Toggle(_cloudLayersEnabled, "Cloud Layering"); changed |= SliderRow("Cloud Density", _cloudDensity, 0f, 1f, "0.00"); changed |= Toggle(_weatherSystemEnabled, "Daily Weather System"); GUILayout.Label("Weather Mode", _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); int num2 = DrawSegmentedButtons(Mathf.Clamp(_weatherMode.Value, 0, 5), new string[6] { "Auto", "Clear", "Golden", "Overcast", "Storm", "Dream" }); if (num2 != _weatherMode.Value) { _weatherMode.Value = num2; changed = true; } changed |= SliderRow("Weather Strength", _weatherStrength, 0f, 1f, "0.00"); changed |= Toggle(_waterOverrideEnabled, "Realistic Water"); bool enabled = GUI.enabled; GUI.enabled = enabled && _waterOverrideEnabled.Value; changed |= ReverseSliderRow("Underwater Clarity", _waterClarity, 0f, 1f, "0.00"); changed |= SliderRow("Water Wave Strength", _waterWaveStrength, 0f, 1f, "0.00"); GUI.enabled = enabled; EndSection(); } private void DrawExperimentalTab(ref bool changed) { BeginSection("Experimental"); GUILayout.Label("Effects in this tab are work-in-progress and may change between builds.", Array.Empty()); changed |= EffectRow("Anamorphic Bloom", _anamorphicBloomEnabled, _anamorphicBloomIntensity); GUILayout.Label("Adds cinematic horizontal light streak flavor to bright highlights.", Array.Empty()); changed |= EffectRow("Halftone", _halftoneEnabled, _halftoneIntensity); bool enabled = GUI.enabled; GUI.enabled = enabled && _halftoneEnabled.Value; changed |= SliderRow("Halftone Dot Size", _halftoneDotSize, 0.25f, 8f, "0.00"); changed |= SliderRow("Halftone Angle", _halftoneAngle, 0f, 180f, "0"); GUI.enabled = enabled; GUILayout.Label("Comic print dot quantization with controllable dot size and angle.", Array.Empty()); changed |= EffectRow("Kuwahara/Oil Paint", _kuwaharaEnabled, _kuwaharaIntensity); bool enabled2 = GUI.enabled; GUI.enabled = enabled2 && _kuwaharaEnabled.Value; changed |= SliderRow("Kuwahara Radius", _kuwaharaRadius, 1f, 6f, "0.0"); GUI.enabled = enabled2; GUILayout.Label("Painterly smoothing pass for soft oil-paint style regions.", Array.Empty()); changed |= EffectRow("Selective Color", _selectiveColorEnabled, _selectiveColorIntensity); bool enabled3 = GUI.enabled; GUI.enabled = enabled3 && _selectiveColorEnabled.Value; changed |= SliderRow("Selective Hue", _selectiveColorHue, 0f, 360f, "0"); changed |= SliderRow("Selective Range", _selectiveColorRange, 1f, 180f, "0"); changed |= SliderRow("Selective Softness", _selectiveColorSoftness, 0f, 1f, "0.00"); GUI.enabled = enabled3; GUILayout.Label("Keeps one hue range saturated while desaturating the rest.", Array.Empty()); changed |= EffectRow("Radial Blur", _radialBlurEnabled, _radialBlurIntensity); GUILayout.Label("Center-based blur for dream/warp moments (uses Lens Center X/Y as origin).", Array.Empty()); changed |= EffectRow("Lens Dirt", _lensDirtEnabled, _lensDirtIntensity); GUILayout.Label("Bloom reacts through a procedural lens dirt texture overlay.", Array.Empty()); changed |= EffectRow("Rain-on-Lens", _rainOnLensEnabled, _rainOnLensIntensity); GUILayout.Label("Animated droplets and lens distortion for rainy, wet-camera moments.", Array.Empty()); changed |= EffectRow("Caustics Overlay", _causticsOverlayEnabled, _causticsOverlayIntensity); GUILayout.Label("Moving water-light patterns on world surfaces using material overrides.", Array.Empty()); changed |= EffectRow("Volumetric Fog Tint", _volumetricFogTintEnabled, _volumetricFogTintIntensity); bool enabled4 = GUI.enabled; GUI.enabled = enabled4 && _volumetricFogTintEnabled.Value; changed |= SliderRow("Fog Hue", _volumetricFogTintHue, 0f, 360f, "0"); changed |= SliderRow("Fog Density Shaping", _volumetricFogTintDensity, 0f, 1f, "0.00"); GUI.enabled = enabled4; GUILayout.Label("Stylized fog color + density shaping for atmospheric volume mood.", Array.Empty()); changed |= EffectRow("Godray Fake", _godrayFakeEnabled, _godrayFakeIntensity); GUILayout.Label("Cheap sun-direction screen rays approximation using bloom/vignette/post-exposure.", Array.Empty()); changed |= EffectRow("Film Gate", _filmGateEnabled, _filmGateIntensity); GUILayout.Label("Letterbox bars, subtle camera jitter, and grain for movie mode.", Array.Empty()); changed |= EffectRow("Glitch Pack", _glitchPackEnabled, _glitchPackIntensity, 0f, 0.1f); GUILayout.Label("Scanline jitter, channel offset jumps, and digital tearing.", Array.Empty()); GUILayout.Space(8f); GUILayout.Label("Color LUT Blend", Array.Empty()); changed |= Toggle(_lutBlendEnabled, "Enable LUT Blend"); changed |= SliderRow("LUT Blend", _lutBlendAmount, 0f, 1f, "0.00"); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("LUT A", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(52f) }); string text = GUILayout.TextField(_lutPathAUi ?? string.Empty, _textFieldStyle ?? GUI.skin.textField, Array.Empty()); if (!string.Equals(text, _lutPathAUi, StringComparison.Ordinal)) { _lutPathAUi = text; } if (GUILayout.Button("Set A", _buttonStyle ?? GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { changed |= UpdateLutPathAFromUi(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("LUT B", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(52f) }); string text2 = GUILayout.TextField(_lutPathBUi ?? string.Empty, _textFieldStyle ?? GUI.skin.textField, Array.Empty()); if (!string.Equals(text2, _lutPathBUi, StringComparison.Ordinal)) { _lutPathBUi = text2; } if (GUILayout.Button("Set B", _buttonStyle ?? GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { changed |= UpdateLutPathBFromUi(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Reload LUTs", _buttonStyle ?? GUI.skin.button, Array.Empty())) { ForceReloadLutTextures(); } GUILayout.Label("A: " + DescribeLutTexture(_lutTextureA), Array.Empty()); GUILayout.Label("B: " + DescribeLutTexture(_lutTextureB), Array.Empty()); GUILayout.EndHorizontal(); GUILayout.Label("Expected LUT format: strip (width = height*height), e.g. 1024x32.", Array.Empty()); EndSection(); } private void DrawQualityTab(ref bool changed) { BeginSection("Image Quality"); GUILayout.Label("Runtime Quality Tier", _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); int num = DrawSegmentedButtons(Mathf.Clamp(_qualityTier.Value, 0, 2), new string[3] { "Low", "Medium", "High" }); if (num != _qualityTier.Value) { _qualityTier.Value = num; changed = true; } GUILayout.Label("AA Preset", _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); int num2 = DrawSegmentedButtons(Mathf.Clamp(_antiAliasingPreset.Value, 0, 4), new string[5] { "Off", "FXAA", "SMAA", "TAA", "CAS" }); if (num2 != _antiAliasingPreset.Value) { _antiAliasingPreset.Value = num2; changed = true; } changed |= SliderRow("CAS Sharpening", _casSharpening, 0f, 1f, "0.00"); EndSection(); } private void DrawAdvancedColorTab(ref bool changed) { BeginSection("Tonemapping"); GUILayout.Label("Tonemapping Mode", _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); int num = DrawSegmentedButtons(Mathf.Clamp(_tonemappingMode.Value, 0, 2), new string[3] { "Off", "Neutral", "ACES" }); if (num != _tonemappingMode.Value) { _tonemappingMode.Value = num; changed = true; } EndSection(); BeginSection("White Balance"); changed |= Toggle(_whiteBalanceEnabled, "Enabled"); bool enabled = GUI.enabled; GUI.enabled = enabled && _whiteBalanceEnabled.Value; changed |= SliderRow("Temperature", _whiteBalanceTemperature, -100f, 100f, "0"); changed |= SliderRow("Tint", _whiteBalanceTint, -100f, 100f, "0"); GUI.enabled = enabled; EndSection(); BeginSection("Lift / Gamma / Gain"); changed |= Toggle(_liftGammaGainEnabled, "Enabled"); bool enabled2 = GUI.enabled; GUI.enabled = enabled2 && _liftGammaGainEnabled.Value; changed |= SliderRow("Lift", _liftAmount, -1f, 1f, "0.00"); changed |= SliderRow("Gamma", _gammaAmount, 0f, 2f, "0.00"); changed |= SliderRow("Gain", _gainAmount, 0f, 2f, "0.00"); GUI.enabled = enabled2; EndSection(); BeginSection("Split Toning"); changed |= Toggle(_splitToningEnabled, "Enabled"); bool enabled3 = GUI.enabled; GUI.enabled = enabled3 && _splitToningEnabled.Value; GUILayout.Label("Shadows Tint", Array.Empty()); changed |= SliderRow("Shadows R", _splitShadowsR, 0f, 1f, "0.00"); changed |= SliderRow("Shadows G", _splitShadowsG, 0f, 1f, "0.00"); changed |= SliderRow("Shadows B", _splitShadowsB, 0f, 1f, "0.00"); GUILayout.Label("Highlights Tint", Array.Empty()); changed |= SliderRow("Highlights R", _splitHighlightsR, 0f, 1f, "0.00"); changed |= SliderRow("Highlights G", _splitHighlightsG, 0f, 1f, "0.00"); changed |= SliderRow("Highlights B", _splitHighlightsB, 0f, 1f, "0.00"); changed |= SliderRow("Balance", _splitToningBalance, -100f, 100f, "0"); GUI.enabled = enabled3; EndSection(); } private void DrawPresetTab(ref bool changed) { BeginSection("✨ Built-in Vibes"); BeginSubCard("Mood Presets"); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("☀ Clean", _buttonStyle ?? GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) })) { ApplyPreset(PresetKind.Clean); changed = true; } if (GUILayout.Button("\ud83c\udf9e Noir", _buttonStyle ?? GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) })) { ApplyPreset(PresetKind.Noir); changed = true; } if (GUILayout.Button("\ud83c\udf29 Stormfront", _buttonStyle ?? GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) })) { ApplyPreset(PresetKind.Stormfront); changed = true; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("\ud83c\udf19 Night Time", _buttonStyle ?? GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) })) { ApplyPreset(PresetKind.NightTime); changed = true; } if (GUILayout.Button("\ud83c\udf11 Pitch Black", _buttonStyle ?? GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) })) { ApplyPreset(PresetKind.PitchBlack); changed = true; } if (GUILayout.Button("\ud83d\udc96 Dreamy Style", _buttonStyle ?? GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) })) { ApplyPreset(PresetKind.DreamyStyle); changed = true; } GUILayout.EndHorizontal(); EndSubCard(); BeginSubCard("My Personal Collection"); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("\ud83d\udcbe Save New Look", _buttonStyle ?? GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) })) { _savedProfileJson.Value = JsonUtility.ToJson((object)BuildState("save-slot")); } if (GUILayout.Button("\ud83d\udcc2 Load a Look", _buttonStyle ?? GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) })) { LoadSavedSlot(); } GUILayout.EndHorizontal(); EndSubCard(); EndSection(); } private void DrawToolsTab(ref bool changed) { //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: 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_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) BeginSection("Scanner + Diagnostics"); changed |= Toggle(_scannerLogOnSceneLoad, "Log Scanner On Scene Load"); if (GUILayout.Button("Run Material/Shader Scanner", _buttonStyle ?? GUI.skin.button, Array.Empty())) { RunMaterialScanner(logToConsole: true); } GUILayout.Label($"Renderers: {_scanRenderers.Count} | Unique shaders: {_shaderCounts.Count}", _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); if (_scanSummaryLines.Count > 0) { GUILayout.Label("Top shader matches:", _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); for (int i = 0; i < Mathf.Min(_scanSummaryLines.Count, 10); i++) { GUILayout.Label(_scanSummaryLines[i], _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); } } EndSection(); BeginSection("Handshake + Sync Log"); changed |= Toggle(_enableBuiltInSyncLog, "Enable Built-In Sync Log"); changed |= Toggle(_syncLogToBepInEx, "Write Sync Events To BepInEx Log"); changed |= Toggle(_syncLogIncludeKeepalive, "Include Keepalive Events"); changed |= Toggle(_strictSnapshotHashValidation, "Strict Snapshot Hash Validation"); GUILayout.Label($"State: {_clientSyncState} ({_clientSyncStatusReason})", _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); GUILayout.Label($"Host Sender: {_expectedHostSenderId} | Host Steam: {_expectedHostSteamId}", _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); GUILayout.Label("Epoch: " + FormatForUi(_activeSessionEpoch), _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); GUILayout.Label($"Last Accepted: rev={_lastAcceptedRevision} hash={FormatForUi(_lastAcceptedStateHash)}", _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); GUILayout.Label("Last Event: " + FormatForUi(_lastSyncEvent), _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Clear Sync Log", _buttonStyle ?? GUI.skin.button, Array.Empty())) { _syncEventLog.Clear(); _syncLogScroll = Vector2.zero; _lastSyncEvent = "cleared"; } if (GUILayout.Button("Log Status Snapshot", _buttonStyle ?? GUI.skin.button, Array.Empty())) { EmitSyncEvent("status_snapshot", $"state={_clientSyncState} reason={_clientSyncStatusReason} expectedHostSender={_expectedHostSenderId} expectedHostSteam={_expectedHostSteamId} epoch={_activeSessionEpoch} lastRev={_lastAcceptedRevision} lastHash={_lastAcceptedStateHash}"); } GUILayout.EndHorizontal(); float num = Mathf.Clamp(((Rect)(ref _windowRect)).height * 0.28f, 120f, 220f); _syncLogScroll = GUILayout.BeginScrollView(_syncLogScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) }); if (_syncEventLog.Count == 0) { GUILayout.Label("No sync events yet.", _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); } else { for (int num2 = _syncEventLog.Count - 1; num2 >= 0; num2--) { GUILayout.Label(_syncEventLog[num2], _bodyLabelStyle ?? GUI.skin.label, Array.Empty()); } } GUILayout.EndScrollView(); EndSection(); } private void ApplyPreset(PresetKind preset) { ClearPresetShaderState(); _enhancedSkyEnabled.Value = true; _cloudLayersEnabled.Value = true; _weatherSystemEnabled.Value = true; _waterOverrideEnabled.Value = true; _forceVolumeFallback.Value = false; _qualityTier.Value = 1; _antiAliasingPreset.Value = 2; _casSharpening.Value = 0.3f; _tonemappingMode.Value = 0; _whiteBalanceEnabled.Value = false; _whiteBalanceTemperature.Value = 0f; _whiteBalanceTint.Value = 0f; _liftGammaGainEnabled.Value = false; _liftAmount.Value = 0f; _gammaAmount.Value = 1f; _gainAmount.Value = 1f; _splitToningEnabled.Value = false; _splitShadowsR.Value = 0.5f; _splitShadowsG.Value = 0.5f; _splitShadowsB.Value = 0.5f; _splitHighlightsR.Value = 0.5f; _splitHighlightsG.Value = 0.5f; _splitHighlightsB.Value = 0.5f; _splitToningBalance.Value = 0f; _pixelateEnabled.Value = false; _pixelateIntensity.Value = 0f; _chromaticSplitEnabled.Value = false; _chromaticSplitIntensity.Value = 0f; _ditherEnabled.Value = false; _ditherIntensity.Value = 0f; _lensCenterX.Value = 0.5f; _lensCenterY.Value = 0.5f; _skyboxMaterialIndex.Value = 0; _skyExposure.Value = 1f; _sunIntensityMultiplier.Value = 1f; _sunTemperature.Value = ((_baseSunTemperature > 0f) ? _baseSunTemperature : 6500f); _sunColorR.Value = 1f; _sunColorG.Value = 0.97f; _sunColorB.Value = 0.9f; _sunColorBlend.Value = 0f; _crtEnabled.Value = false; _crtIntensity.Value = 0f; _dreamEnabled.Value = false; _dreamIntensity.Value = 0f; _comicEnabled.Value = false; _comicIntensity.Value = 0f; _heatwaveEnabled.Value = false; _heatwaveIntensity.Value = 0f; _heatwaveSpeed.Value = 1f; _noirEnabled.Value = false; _noirIntensity.Value = 0f; _vaporEnabled.Value = false; _vaporIntensity.Value = 0f; _posterizeEnabled.Value = false; _posterizeIntensity.Value = 0f; _motionBlurEnabled.Value = false; _motionBlurIntensity.Value = 0f; _depthOfFieldEnabled.Value = false; _depthOfFieldIntensity.Value = 0f; _anamorphicBloomEnabled.Value = false; _anamorphicBloomIntensity.Value = 0f; _halftoneEnabled.Value = false; _halftoneIntensity.Value = 0f; _halftoneDotSize.Value = 1.25f; _halftoneAngle.Value = 45f; _kuwaharaEnabled.Value = false; _kuwaharaIntensity.Value = 0f; _kuwaharaRadius.Value = 2f; _selectiveColorEnabled.Value = false; _selectiveColorIntensity.Value = 0f; _selectiveColorHue.Value = 0f; _selectiveColorRange.Value = 35f; _selectiveColorSoftness.Value = 0.25f; _radialBlurEnabled.Value = false; _radialBlurIntensity.Value = 0f; _lensDirtEnabled.Value = false; _lensDirtIntensity.Value = 0f; _rainOnLensEnabled.Value = false; _rainOnLensIntensity.Value = 0f; _causticsOverlayEnabled.Value = false; _causticsOverlayIntensity.Value = 0f; _godrayFakeEnabled.Value = false; _godrayFakeIntensity.Value = 0f; _filmGateEnabled.Value = false; _filmGateIntensity.Value = 0f; _glitchPackEnabled.Value = false; _glitchPackIntensity.Value = 0f; _volumetricFogTintEnabled.Value = false; _volumetricFogTintIntensity.Value = 0f; _volumetricFogTintDensity.Value = 0.4f; _volumetricFogTintHue.Value = 210f; _lutBlendEnabled.Value = false; _lutBlendAmount.Value = 0f; _skyIntensity.Value = 0.68f; _skyHueShift.Value = 0f; _skyColorBlend.Value = 0f; _cloudDensity.Value = 0.62f; _weatherMode.Value = 0; _weatherStrength.Value = 0.62f; _waterClarity.Value = 0.7f; _waterWaveStrength.Value = 0.6f; switch (preset) { case PresetKind.Clean: _qualityTier.Value = 1; _antiAliasingPreset.Value = 2; _casSharpening.Value = 0.25f; _weatherMode.Value = 1; break; case PresetKind.Noir: _noirEnabled.Value = true; _noirIntensity.Value = 0.88f; _comicEnabled.Value = true; _comicIntensity.Value = 0.18f; _weatherMode.Value = 3; _weatherStrength.Value = 0.65f; break; case PresetKind.Stormfront: _weatherMode.Value = 4; _weatherStrength.Value = 0.92f; _cloudDensity.Value = 0.86f; _waterWaveStrength.Value = 0.9f; _comicEnabled.Value = true; _comicIntensity.Value = 0.2f; break; case PresetKind.NightTime: _qualityTier.Value = 0; _antiAliasingPreset.Value = 0; _casSharpening.Value = 1f; _crtEnabled.Value = false; _crtIntensity.Value = 0f; _dreamEnabled.Value = true; _dreamIntensity.Value = 0.12f; _comicEnabled.Value = false; _comicIntensity.Value = 0f; _heatwaveEnabled.Value = false; _heatwaveIntensity.Value = 0f; _heatwaveSpeed.Value = 1f; _noirEnabled.Value = false; _noirIntensity.Value = 0f; _vaporEnabled.Value = false; _vaporIntensity.Value = 0f; _pixelateEnabled.Value = false; _pixelateIntensity.Value = 0f; _chromaticSplitEnabled.Value = false; _chromaticSplitIntensity.Value = 0f; _ditherEnabled.Value = false; _ditherIntensity.Value = 0f; _motionBlurEnabled.Value = false; _motionBlurIntensity.Value = 0f; _depthOfFieldEnabled.Value = true; _depthOfFieldIntensity.Value = 0.24f; _anamorphicBloomEnabled.Value = false; _anamorphicBloomIntensity.Value = 0f; _lensCenterX.Value = 0.5f; _lensCenterY.Value = 0.5f; _enhancedSkyEnabled.Value = true; _skyIntensity.Value = 0f; _skyExposure.Value = 0.92f; _skyHueShift.Value = -106f; _skyColorBlend.Value = 1f; _skyboxMaterialIndex.Value = 1; _sunIntensityMultiplier.Value = 0.76f; _sunTemperature.Value = 7758f; _sunColorR.Value = 0.75f; _sunColorG.Value = 0.76f; _sunColorB.Value = 0.89f; _sunColorBlend.Value = 0.86f; _cloudLayersEnabled.Value = true; _cloudDensity.Value = 1f; _weatherSystemEnabled.Value = true; _weatherMode.Value = 3; _weatherStrength.Value = 1f; _waterOverrideEnabled.Value = true; _waterClarity.Value = 0.7f; _waterWaveStrength.Value = 0.6f; _tonemappingMode.Value = 0; _whiteBalanceEnabled.Value = true; _whiteBalanceTemperature.Value = -6f; _whiteBalanceTint.Value = -2f; _liftGammaGainEnabled.Value = true; _liftAmount.Value = -0.43f; _gammaAmount.Value = 2f; _gainAmount.Value = 0.91f; break; case PresetKind.PitchBlack: _qualityTier.Value = 0; _antiAliasingPreset.Value = 0; _casSharpening.Value = 1f; _crtEnabled.Value = false; _crtIntensity.Value = 0f; _dreamEnabled.Value = true; _dreamIntensity.Value = 0.12f; _comicEnabled.Value = false; _comicIntensity.Value = 0f; _heatwaveEnabled.Value = false; _heatwaveIntensity.Value = 0f; _heatwaveSpeed.Value = 1f; _noirEnabled.Value = false; _noirIntensity.Value = 0f; _vaporEnabled.Value = false; _vaporIntensity.Value = 0f; _pixelateEnabled.Value = false; _pixelateIntensity.Value = 0f; _chromaticSplitEnabled.Value = true; _chromaticSplitIntensity.Value = 1f; _ditherEnabled.Value = false; _ditherIntensity.Value = 0f; _motionBlurEnabled.Value = false; _motionBlurIntensity.Value = 0f; _depthOfFieldEnabled.Value = true; _depthOfFieldIntensity.Value = 0.24f; _anamorphicBloomEnabled.Value = false; _anamorphicBloomIntensity.Value = 0f; _lensCenterX.Value = 0.54f; _lensCenterY.Value = 0.57f; _enhancedSkyEnabled.Value = true; _skyIntensity.Value = 0.25f; _skyExposure.Value = 0.34f; _skyHueShift.Value = -96f; _skyColorBlend.Value = 0.9f; _skyboxMaterialIndex.Value = 1; _sunIntensityMultiplier.Value = 0.88f; _sunTemperature.Value = 18447f; _sunColorR.Value = 0.75f; _sunColorG.Value = 0.76f; _sunColorB.Value = 0.89f; _sunColorBlend.Value = 1f; _cloudLayersEnabled.Value = false; _cloudDensity.Value = 0.28f; _weatherSystemEnabled.Value = true; _weatherMode.Value = 4; _weatherStrength.Value = 1f; _waterOverrideEnabled.Value = false; _waterClarity.Value = 0.7f; _waterWaveStrength.Value = 0.6f; _tonemappingMode.Value = 0; _whiteBalanceEnabled.Value = true; _whiteBalanceTemperature.Value = -5f; _whiteBalanceTint.Value = 15f; _liftGammaGainEnabled.Value = true; _liftAmount.Value = 0.37f; _gammaAmount.Value = 1f; _gainAmount.Value = 1.39f; break; case PresetKind.DreamyStyle: _qualityTier.Value = 1; _antiAliasingPreset.Value = 4; _casSharpening.Value = 1f; _crtEnabled.Value = true; _crtIntensity.Value = 0.02f; _dreamEnabled.Value = true; _dreamIntensity.Value = 0.16f; _comicEnabled.Value = false; _comicIntensity.Value = 0f; _heatwaveEnabled.Value = true; _heatwaveIntensity.Value = 0.02f; _heatwaveSpeed.Value = 0.2f; _noirEnabled.Value = false; _noirIntensity.Value = 0f; _vaporEnabled.Value = true; _vaporIntensity.Value = 0.74f; _motionBlurEnabled.Value = false; _motionBlurIntensity.Value = 0f; _depthOfFieldEnabled.Value = true; _depthOfFieldIntensity.Value = 0.3f; _anamorphicBloomEnabled.Value = false; _anamorphicBloomIntensity.Value = 0f; _enhancedSkyEnabled.Value = true; _skyIntensity.Value = 1f; _skyExposure.Value = 1f; _skyHueShift.Value = 61f; _skyColorBlend.Value = 0.19f; _cloudLayersEnabled.Value = true; _cloudDensity.Value = 1f; _weatherSystemEnabled.Value = true; _weatherMode.Value = 5; _weatherStrength.Value = 1f; _waterOverrideEnabled.Value = true; _waterClarity.Value = 0.7f; _waterWaveStrength.Value = 0.6f; break; } } private void ClearPresetShaderState() { _crtEnabled.Value = false; _crtIntensity.Value = 0f; _dreamEnabled.Value = false; _dreamIntensity.Value = 0f; _comicEnabled.Value = false; _comicIntensity.Value = 0f; _heatwaveEnabled.Value = false; _heatwaveIntensity.Value = 0f; _heatwaveSpeed.Value = 1f; _noirEnabled.Value = false; _noirIntensity.Value = 0f; _vaporEnabled.Value = false; _vaporIntensity.Value = 0f; _posterizeEnabled.Value = false; _posterizeIntensity.Value = 0f; _pixelateEnabled.Value = false; _pixelateIntensity.Value = 0f; _chromaticSplitEnabled.Value = false; _chromaticSplitIntensity.Value = 0f; _ditherEnabled.Value = false; _ditherIntensity.Value = 0f; _lensCenterX.Value = 0.5f; _lensCenterY.Value = 0.5f; _motionBlurEnabled.Value = false; _motionBlurIntensity.Value = 0f; _depthOfFieldEnabled.Value = false; _depthOfFieldIntensity.Value = 0f; _anamorphicBloomEnabled.Value = false; _anamorphicBloomIntensity.Value = 0f; _halftoneEnabled.Value = false; _halftoneIntensity.Value = 0f; _halftoneDotSize.Value = 1.25f; _halftoneAngle.Value = 45f; _kuwaharaEnabled.Value = false; _kuwaharaIntensity.Value = 0f; _kuwaharaRadius.Value = 2f; _selectiveColorEnabled.Value = false; _selectiveColorIntensity.Value = 0f; _selectiveColorHue.Value = 0f; _selectiveColorRange.Value = 35f; _selectiveColorSoftness.Value = 0.25f; _radialBlurEnabled.Value = false; _radialBlurIntensity.Value = 0f; _lensDirtEnabled.Value = false; _lensDirtIntensity.Value = 0f; _rainOnLensEnabled.Value = false; _rainOnLensIntensity.Value = 0f; _causticsOverlayEnabled.Value = false; _causticsOverlayIntensity.Value = 0f; _godrayFakeEnabled.Value = false; _godrayFakeIntensity.Value = 0f; _filmGateEnabled.Value = false; _filmGateIntensity.Value = 0f; _glitchPackEnabled.Value = false; _glitchPackIntensity.Value = 0f; _volumetricFogTintEnabled.Value = false; _volumetricFogTintIntensity.Value = 0f; _volumetricFogTintDensity.Value = 0.4f; _volumetricFogTintHue.Value = 210f; _lutBlendEnabled.Value = false; _lutBlendAmount.Value = 0f; _enhancedSkyEnabled.Value = false; _skyIntensity.Value = 0f; _skyHueShift.Value = 0f; _skyColorBlend.Value = 0f; _cloudLayersEnabled.Value = false; _cloudDensity.Value = 0f; _weatherSystemEnabled.Value = false; _weatherMode.Value = 0; _weatherStrength.Value = 0f; _waterOverrideEnabled.Value = false; _waterClarity.Value = 0f; _waterWaveStrength.Value = 0f; _skyboxMaterialIndex.Value = 0; _skyExposure.Value = 1f; _sunIntensityMultiplier.Value = 1f; _sunTemperature.Value = ((_baseSunTemperature > 0f) ? _baseSunTemperature : 6500f); _sunColorR.Value = 1f; _sunColorG.Value = 0.97f; _sunColorB.Value = 0.9f; _sunColorBlend.Value = 0f; _tonemappingMode.Value = 0; _whiteBalanceEnabled.Value = false; _whiteBalanceTemperature.Value = 0f; _whiteBalanceTint.Value = 0f; _liftGammaGainEnabled.Value = false; _liftAmount.Value = 0f; _gammaAmount.Value = 1f; _gainAmount.Value = 1f; _splitToningEnabled.Value = false; _splitShadowsR.Value = 0.5f; _splitShadowsG.Value = 0.5f; _splitShadowsB.Value = 0.5f; _splitHighlightsR.Value = 0.5f; _splitHighlightsG.Value = 0.5f; _splitHighlightsB.Value = 0.5f; _splitToningBalance.Value = 0f; DisableVisuals(); } private bool Toggle(ConfigEntry cfg, string label) { bool flag = GUILayout.Toggle(cfg.Value, label, _toggleStyle ?? GUI.skin.toggle, Array.Empty()); if (flag == cfg.Value) { return false; } cfg.Value = flag; return true; } private static string FormatForUi(string? value) { if (!string.IsNullOrWhiteSpace(value)) { return value; } return "(none)"; } private bool UpdateLutPathAFromUi() { string text = (_lutPathAUi ?? string.Empty).Trim(); if (string.Equals(text, _lutPathA.Value ?? string.Empty, StringComparison.Ordinal)) { return false; } _lutPathA.Value = text; _lutDirty = true; _lutLastBlendApplied = -1f; return true; } private bool UpdateLutPathBFromUi() { string text = (_lutPathBUi ?? string.Empty).Trim(); if (string.Equals(text, _lutPathB.Value ?? string.Empty, StringComparison.Ordinal)) { return false; } _lutPathB.Value = text; _lutDirty = true; _lutLastBlendApplied = -1f; return true; } private void ForceReloadLutTextures() { _lutDirty = true; _lutLastBlendApplied = -1f; EnsureLutTexturesLoaded(forceReload: true); } private static string DescribeLutTexture(Texture2D? texture) { if ((Object)(object)texture == (Object)null) { return "none"; } return $"{((Texture)texture).width}x{((Texture)texture).height}"; } private bool EffectRow(string label, ConfigEntry enabled, ConfigEntry intensity, float min = 0f, float max = 1f) { bool result = false; GUILayout.BeginHorizontal(Array.Empty()); bool flag = GUILayout.Toggle(enabled.Value, label, _toggleStyle ?? GUI.skin.toggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) }); if (flag != enabled.Value) { enabled.Value = flag; result = true; } float num = Mathf.Clamp(intensity.Value, min, max); if (!Mathf.Approximately(num, intensity.Value)) { intensity.Value = num; result = true; } float num2 = GUILayout.HorizontalSlider(num, min, max, _sliderTrackStyle ?? GUI.skin.horizontalSlider, _sliderThumbStyle ?? GUI.skin.horizontalSliderThumb, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) }); if (!Mathf.Approximately(num2, intensity.Value)) { intensity.Value = num2; result = true; } GUILayout.Label(num2.ToString("0.00"), _valueLabelStyle ?? GUI.skin.label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }); GUILayout.EndHorizontal(); return result; } private bool SliderRow(string label, ConfigEntry config, float min, float max, string format) { bool result = false; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, _bodyLabelStyle ?? GUI.skin.label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) }); float num = GUILayout.HorizontalSlider(config.Value, min, max, _sliderTrackStyle ?? GUI.skin.horizontalSlider, _sliderThumbStyle ?? GUI.skin.horizontalSliderThumb, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); if (!Mathf.Approximately(num, config.Value)) { config.Value = num; result = true; } GUILayout.Label(config.Value.ToString(format), _valueLabelStyle ?? GUI.skin.label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(48f) }); GUILayout.EndHorizontal(); return result; } private bool ReverseSliderRow(string label, ConfigEntry config, float min, float max, string format) { bool result = false; float num = Mathf.Clamp(config.Value, min, max); if (!Mathf.Approximately(num, config.Value)) { config.Value = num; result = true; } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, _bodyLabelStyle ?? GUI.skin.label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) }); float num2 = Mathf.InverseLerp(min, max, num); float num3 = GUILayout.HorizontalSlider(1f - num2, 0f, 1f, _sliderTrackStyle ?? GUI.skin.horizontalSlider, _sliderThumbStyle ?? GUI.skin.horizontalSliderThumb, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); float num4 = Mathf.Lerp(min, max, 1f - num3); if (!Mathf.Approximately(num4, config.Value)) { config.Value = num4; result = true; } GUILayout.Label(config.Value.ToString(format), _valueLabelStyle ?? GUI.skin.label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(48f) }); GUILayout.EndHorizontal(); return result; } private void ClampWindowToScreen() { float num = Mathf.Max(360f, (float)Screen.width - 16f); float num2 = Mathf.Max(320f, (float)Screen.height - 16f); float num3 = Mathf.Min(540f, num); float num4 = Mathf.Min(420f, num2); ((Rect)(ref _windowRect)).width = Mathf.Clamp(((Rect)(ref _windowRect)).width, num3, num); ((Rect)(ref _windowRect)).height = Mathf.Clamp(((Rect)(ref _windowRect)).height, num4, num2); ((Rect)(ref _windowRect)).x = Mathf.Clamp(((Rect)(ref _windowRect)).x, 8f, Mathf.Max(8f, (float)Screen.width - ((Rect)(ref _windowRect)).width - 8f)); ((Rect)(ref _windowRect)).y = Mathf.Clamp(((Rect)(ref _windowRect)).y, 8f, Mathf.Max(8f, (float)Screen.height - ((Rect)(ref _windowRect)).height - 8f)); } private void EnsureGuiStyles() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_01ce: 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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_030f: 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_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0356: 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_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0388: 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_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: 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_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: 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_03da: 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_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_040c: 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_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Expected O, but got Unknown //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Expected O, but got Unknown //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Expected O, but got Unknown //IL_0461: Expected O, but got Unknown //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0471: 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_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0487: 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_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Expected O, but got Unknown //IL_04ab: Expected O, but got Unknown //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: 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_04f1: Expected O, but got Unknown //IL_04f6: Expected O, but got Unknown //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Expected O, but got Unknown //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Expected O, but got Unknown //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Expected O, but got Unknown //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Unknown result type (might be due to invalid IL or missing references) //IL_061a: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Expected O, but got Unknown //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_065b: Unknown result type (might be due to invalid IL or missing references) //IL_0661: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Expected O, but got Unknown //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Expected O, but got Unknown //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Unknown result type (might be due to invalid IL or missing references) //IL_069c: Expected O, but got Unknown //IL_06a1: Expected O, but got Unknown //IL_06ac: Unknown result type (might be due to invalid IL or missing references) //IL_06b1: Unknown result type (might be due to invalid IL or missing references) //IL_06c2: 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_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_06d7: Unknown result type (might be due to invalid IL or missing references) //IL_06e1: Expected O, but got Unknown //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Expected O, but got Unknown //IL_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_0703: Expected O, but got Unknown //IL_0708: Expected O, but got Unknown //IL_0713: Unknown result type (might be due to invalid IL or missing references) //IL_0718: Unknown result type (might be due to invalid IL or missing references) //IL_0720: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Unknown result type (might be due to invalid IL or missing references) //IL_0734: Unknown result type (might be due to invalid IL or missing references) //IL_073e: Unknown result type (might be due to invalid IL or missing references) //IL_0743: Unknown result type (might be due to invalid IL or missing references) //IL_074d: Expected O, but got Unknown //IL_0752: Expected O, but got Unknown //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_075e: 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_076c: 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_077b: Unknown result type (might be due to invalid IL or missing references) //IL_0785: Expected O, but got Unknown //IL_078a: Expected O, but got Unknown //IL_0795: Unknown result type (might be due to invalid IL or missing references) //IL_079a: Unknown result type (might be due to invalid IL or missing references) //IL_07ab: Unknown result type (might be due to invalid IL or missing references) //IL_07b1: Unknown result type (might be due to invalid IL or missing references) //IL_07bb: 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_07d2: Unknown result type (might be due to invalid IL or missing references) //IL_07dc: Unknown result type (might be due to invalid IL or missing references) //IL_07ed: Unknown result type (might be due to invalid IL or missing references) //IL_07f3: Unknown result type (might be due to invalid IL or missing references) //IL_07fd: Unknown result type (might be due to invalid IL or missing references) //IL_0804: Unknown result type (might be due to invalid IL or missing references) //IL_080c: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_0828: Expected O, but got Unknown //IL_082d: Expected O, but got Unknown //IL_0834: Unknown result type (might be due to invalid IL or missing references) //IL_0839: Unknown result type (might be due to invalid IL or missing references) //IL_084a: Unknown result type (might be due to invalid IL or missing references) //IL_0850: 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_086b: Unknown result type (might be due to invalid IL or missing references) //IL_0871: Unknown result type (might be due to invalid IL or missing references) //IL_087b: Unknown result type (might be due to invalid IL or missing references) //IL_088c: Unknown result type (might be due to invalid IL or missing references) //IL_0892: Unknown result type (might be due to invalid IL or missing references) //IL_08a1: Expected O, but got Unknown //IL_08ac: 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_08c2: Unknown result type (might be due to invalid IL or missing references) //IL_08c8: Unknown result type (might be due to invalid IL or missing references) //IL_08d2: 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_08e9: Unknown result type (might be due to invalid IL or missing references) //IL_08f3: Unknown result type (might be due to invalid IL or missing references) //IL_0904: 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_0914: Unknown result type (might be due to invalid IL or missing references) //IL_091b: Unknown result type (might be due to invalid IL or missing references) //IL_0923: Unknown result type (might be due to invalid IL or missing references) //IL_092e: Unknown result type (might be due to invalid IL or missing references) //IL_0933: Unknown result type (might be due to invalid IL or missing references) //IL_093d: Expected O, but got Unknown //IL_093d: Unknown result type (might be due to invalid IL or missing references) //IL_0942: Unknown result type (might be due to invalid IL or missing references) //IL_094c: Expected O, but got Unknown //IL_094c: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) //IL_095f: Expected O, but got Unknown //IL_0966: Unknown result type (might be due to invalid IL or missing references) //IL_0970: Expected O, but got Unknown //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: 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_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_099c: Unknown result type (might be due to invalid IL or missing references) //IL_09a1: Unknown result type (might be due to invalid IL or missing references) //IL_09ad: Unknown result type (might be due to invalid IL or missing references) //IL_09b3: Unknown result type (might be due to invalid IL or missing references) //IL_09bd: Unknown result type (might be due to invalid IL or missing references) //IL_09c9: Unknown result type (might be due to invalid IL or missing references) //IL_09cf: Unknown result type (might be due to invalid IL or missing references) //IL_09d9: Unknown result type (might be due to invalid IL or missing references) //IL_09e5: Unknown result type (might be due to invalid IL or missing references) //IL_09eb: Unknown result type (might be due to invalid IL or missing references) //IL_09f5: Unknown result type (might be due to invalid IL or missing references) //IL_09fd: Expected O, but got Unknown //IL_0a19: Unknown result type (might be due to invalid IL or missing references) //IL_0a1e: Unknown result type (might be due to invalid IL or missing references) //IL_0a29: Unknown result type (might be due to invalid IL or missing references) //IL_0a2e: Unknown result type (might be due to invalid IL or missing references) //IL_0a38: Expected O, but got Unknown //IL_0a38: Unknown result type (might be due to invalid IL or missing references) //IL_0a3d: Unknown result type (might be due to invalid IL or missing references) //IL_0a47: Expected O, but got Unknown //IL_0a47: Unknown result type (might be due to invalid IL or missing references) //IL_0a4c: Unknown result type (might be due to invalid IL or missing references) //IL_0a56: Expected O, but got Unknown //IL_0a56: Unknown result type (might be due to invalid IL or missing references) //IL_0a67: Unknown result type (might be due to invalid IL or missing references) //IL_0a78: Unknown result type (might be due to invalid IL or missing references) //IL_0a89: Unknown result type (might be due to invalid IL or missing references) //IL_0a9f: Expected O, but got Unknown //IL_0aaa: Unknown result type (might be due to invalid IL or missing references) //IL_0aaf: Unknown result type (might be due to invalid IL or missing references) //IL_0aba: Unknown result type (might be due to invalid IL or missing references) //IL_0ac5: Unknown result type (might be due to invalid IL or missing references) //IL_0aca: Unknown result type (might be due to invalid IL or missing references) //IL_0ad4: Expected O, but got Unknown //IL_0ad4: Unknown result type (might be due to invalid IL or missing references) //IL_0adb: Unknown result type (might be due to invalid IL or missing references) //IL_0ae5: Expected O, but got Unknown //IL_0ae5: Unknown result type (might be due to invalid IL or missing references) //IL_0af6: Unknown result type (might be due to invalid IL or missing references) //IL_0b07: Unknown result type (might be due to invalid IL or missing references) //IL_0b18: Unknown result type (might be due to invalid IL or missing references) //IL_0b2e: Expected O, but got Unknown //IL_0b35: Unknown result type (might be due to invalid IL or missing references) //IL_0b3f: Expected O, but got Unknown if (_menuTitleStyle != null && _subtitleStyle != null && _bodyLabelStyle != null && _windowStyle != null && _tabStyle != null && _actionBtnStyle != null && _sectionStyle != null && _subCardStyle != null && _sectionHeaderStyle != null && _subCardHeaderStyle != null && _buttonStyle != null && _secondaryButtonStyle != null && _tabInactiveStyle != null && _tabActiveStyles != null && _sliderTrackStyle != null && _sliderThumbStyle != null && _toggleStyle != null && _valueLabelStyle != null && _textFieldStyle != null) { return; } if (_panelTexture == null) { _panelTexture = BuildSolidTexture(2, 2, UiCream); } if (_sectionTexture == null) { _sectionTexture = BuildSolidTexture(2, 2, UiSectionFill); } if (_buttonTexture == null) { _buttonTexture = BuildSolidTexture(2, 2, UiButtonPrimary); } if (_buttonSecondaryTexture == null) { _buttonSecondaryTexture = BuildSolidTexture(2, 2, UiButtonSecondary); } if (_buttonPressedTexture == null) { _buttonPressedTexture = BuildSolidTexture(2, 2, UiButtonPressed); } if (_tabInactiveTexture == null) { _tabInactiveTexture = BuildSolidTexture(2, 2, UiTabInactive); } if (_tabInactiveHoverTexture == null) { _tabInactiveHoverTexture = BuildSolidTexture(2, 2, Color.Lerp(UiTabInactive, Color.white, 0.1f)); } if (_subCardTexture == null) { _subCardTexture = BuildSolidTexture(2, 2, new Color(1f, 0.98f, 0.94f, 1f)); } if (_sliderTrackTexture == null) { _sliderTrackTexture = BuildSolidTexture(2, 2, UiTabInactive); } if (_sliderThumbTexture == null) { _sliderThumbTexture = BuildSolidTexture(2, 2, new Color(0.33f, 0.26f, 0.2f, 1f)); } if (_sliderThumbHoverTexture == null) { _sliderThumbHoverTexture = BuildSolidTexture(2, 2, new Color(0.28f, 0.22f, 0.17f, 1f)); } if (_sliderThumbActiveTexture == null) { _sliderThumbActiveTexture = BuildSolidTexture(2, 2, new Color(0.45f, 0.33f, 0.24f, 1f)); } if (_textFieldTexture == null) { _textFieldTexture = BuildSolidTexture(2, 2, new Color(1f, 1f, 1f, 0.95f)); } if (_textFieldFocusedTexture == null) { _textFieldFocusedTexture = BuildSolidTexture(2, 2, new Color(1f, 1f, 1f, 1f)); } if (_tabActiveTextures == null) { _tabActiveTextures = (Texture2D[]?)(object)new Texture2D[UiTabLabels.Length]; } for (int i = 0; i < UiTabLabels.Length; i++) { if ((Object)(object)_tabActiveTextures[i] == (Object)null) { Color val = UiTabAccents[i % UiTabAccents.Length]; _tabActiveTextures[i] = BuildSolidTexture(2, 2, Color.Lerp(val, UiTabActiveLighten, 0.18f)); } } GUIStyle val2 = new GUIStyle(GUI.skin.window); val2.normal.background = _panelTexture; val2.normal.textColor = UiInk; val2.onNormal.background = _panelTexture; val2.onNormal.textColor = UiInk; val2.hover.background = _panelTexture; val2.hover.textColor = UiInk; val2.onHover.background = _panelTexture; val2.onHover.textColor = UiInk; val2.active.background = _panelTexture; val2.active.textColor = UiInk; val2.onActive.background = _panelTexture; val2.onActive.textColor = UiInk; val2.focused.background = _panelTexture; val2.focused.textColor = UiInk; val2.onFocused.background = _panelTexture; val2.onFocused.textColor = UiInk; val2.fontStyle = (FontStyle)1; val2.fontSize = 15; val2.border = new RectOffset(0, 0, 0, 0); val2.overflow = new RectOffset(0, 0, 0, 0); val2.padding = new RectOffset(10, 10, 18, 10); _windowStyle = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 28, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val3.normal.textColor = UiInk; val3.margin = new RectOffset(0, 0, 8, 4); _menuTitleStyle = val3; GUIStyle val4 = new GUIStyle(GUI.skin.label) { fontSize = 14, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val4.normal.textColor = UiSubtleInk; val4.margin = new RectOffset(0, 0, 0, 10); _subtitleStyle = val4; GUIStyle val5 = new GUIStyle(GUI.skin.label) { fontSize = 14 }; val5.normal.textColor = UiInk; _bodyLabelStyle = val5; GUIStyle val6 = new GUIStyle(GUI.skin.toggle) { fontSize = 14 }; val6.normal.textColor = UiInk; val6.onNormal.textColor = UiInk; val6.active.textColor = UiInk; val6.onActive.textColor = UiInk; val6.hover.textColor = UiInk; val6.onHover.textColor = UiInk; _toggleStyle = val6; GUIStyle val7 = new GUIStyle(GUI.skin.label) { fontSize = 12, fontStyle = (FontStyle)1, alignment = (TextAnchor)5 }; val7.normal.textColor = UiSubtleInk; _valueLabelStyle = val7; GUIStyle val8 = new GUIStyle(GUI.skin.textField) { fontSize = 12 }; val8.normal.textColor = UiInk; val8.normal.background = _textFieldTexture; val8.focused.textColor = UiInk; val8.focused.background = _textFieldFocusedTexture; _textFieldStyle = val8; GUIStyle val9 = new GUIStyle(GUI.skin.box); val9.normal.background = _sectionTexture; val9.normal.textColor = UiInk; val9.border = new RectOffset(1, 1, 1, 1); val9.padding = new RectOffset(14, 14, 12, 12); val9.margin = new RectOffset(4, 4, 8, 8); _sectionStyle = val9; GUIStyle val10 = new GUIStyle(GUI.skin.box); val10.normal.background = _subCardTexture; val10.normal.textColor = UiInk; val10.border = new RectOffset(1, 1, 1, 1); val10.padding = new RectOffset(10, 10, 10, 10); val10.margin = new RectOffset(8, 8, 6, 8); _subCardStyle = val10; GUIStyle val11 = new GUIStyle(GUI.skin.label) { fontSize = 17, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val11.normal.textColor = UiInk; val11.margin = new RectOffset(0, 0, 0, 7); _sectionHeaderStyle = val11; GUIStyle val12 = new GUIStyle(_sectionHeaderStyle) { fontSize = 14 }; val12.normal.textColor = UiSubtleInk; val12.margin = new RectOffset(0, 0, 0, 5); _subCardHeaderStyle = val12; GUIStyle val13 = new GUIStyle(GUI.skin.button); val13.normal.background = _buttonTexture; val13.normal.textColor = UiInk; val13.hover.background = _buttonTexture; val13.hover.textColor = UiInk; val13.active.background = _buttonPressedTexture; val13.active.textColor = UiInk; val13.fontStyle = (FontStyle)1; val13.fontSize = 16; val13.fixedHeight = 34f; val13.padding = new RectOffset(10, 10, 5, 5); _buttonStyle = val13; GUIStyle val14 = new GUIStyle(_buttonStyle); val14.normal.background = _buttonSecondaryTexture; val14.normal.textColor = UiInk; val14.hover.background = _buttonSecondaryTexture; val14.hover.textColor = UiInk; val14.active.background = _buttonPressedTexture; val14.active.textColor = UiInk; _secondaryButtonStyle = val14; GUIStyle val15 = new GUIStyle(GUI.skin.button); val15.normal.background = _tabInactiveTexture; val15.normal.textColor = UiInk; val15.hover.background = _tabInactiveHoverTexture; val15.hover.textColor = UiInk; val15.active.background = _tabInactiveHoverTexture; val15.active.textColor = UiInk; val15.fontStyle = (FontStyle)1; val15.fontSize = 13; val15.fixedHeight = 42f; val15.margin = new RectOffset(2, 2, 0, 0); val15.padding = new RectOffset(6, 6, 4, 4); val15.alignment = (TextAnchor)4; val15.wordWrap = true; _tabInactiveStyle = val15; _tabStyle = new GUIStyle(_tabInactiveStyle); _tabActiveStyles = (GUIStyle[]?)(object)new GUIStyle[UiTabLabels.Length]; for (int j = 0; j < UiTabLabels.Length; j++) { Texture2D background = _tabActiveTextures[j]; GUIStyle[]? tabActiveStyles = _tabActiveStyles; int num = j; GUIStyle val16 = new GUIStyle(_tabInactiveStyle); val16.normal.background = background; val16.normal.textColor = UiInk; val16.hover.background = background; val16.hover.textColor = UiInk; val16.active.background = background; val16.active.textColor = UiInk; val16.fontStyle = (FontStyle)1; tabActiveStyles[num] = val16; } GUIStyle val17 = new GUIStyle(GUI.skin.horizontalSlider) { fixedHeight = 12f, border = new RectOffset(3, 3, 3, 3), margin = new RectOffset(4, 4, 6, 6), padding = new RectOffset(2, 2, 2, 2) }; val17.normal.background = _sliderTrackTexture; val17.hover.background = _sliderTrackTexture; val17.active.background = _sliderTrackTexture; val17.focused.background = _sliderTrackTexture; _sliderTrackStyle = val17; GUIStyle val18 = new GUIStyle(GUI.skin.horizontalSliderThumb) { fixedWidth = 20f, fixedHeight = 24f, border = new RectOffset(1, 1, 1, 1), margin = new RectOffset(0, 0, -4, -4) }; val18.normal.background = _sliderThumbTexture; val18.hover.background = _sliderThumbHoverTexture; val18.active.background = _sliderThumbActiveTexture; val18.focused.background = _sliderThumbTexture; _sliderThumbStyle = val18; _actionBtnStyle = new GUIStyle(_buttonStyle); } private void InitStyles() { EnsureGuiStyles(); } private void BeginSection(string title) { GUILayout.BeginVertical(_sectionStyle ?? GUI.skin.box, Array.Empty()); GUILayout.Label(title, _sectionHeaderStyle ?? GUI.skin.label, Array.Empty()); } private void BeginSubCard(string title) { GUILayout.BeginVertical(_subCardStyle ?? _sectionStyle ?? GUI.skin.box, Array.Empty()); GUILayout.Label(title, _subCardHeaderStyle ?? _sectionHeaderStyle ?? GUI.skin.label, Array.Empty()); } private static void EndSection() { GUILayout.EndVertical(); } private static void EndSubCard() { GUILayout.EndVertical(); } private static Texture2D BuildSolidTexture(int width, int height, Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Texture2D obj = MakeTex(width, height, color); ((Object)obj).hideFlags = (HideFlags)61; return obj; } private static Texture2D BuildSolidTexture(Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return BuildSolidTexture(2, 2, color); } private static Texture2D MakeTex(int width, int height, Color color) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //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) Texture2D val = new Texture2D(width, height, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = color; } val.SetPixels(array); val.Apply(false, false); return val; } private static Texture2D BuildGlitchScanlineTexture() { //IL_000c: 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) //IL_0019: 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_0028: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false) { hideFlags = (HideFlags)61, filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)0 }; for (int i = 0; i < 256; i++) { float num = Mathf.Clamp01(0.45f + 0.55f * Mathf.Sin((float)i * 0.21f)); float num2 = ((i % 3 == 0) ? 0.7f : ((i % 2 == 0) ? 0.45f : 0.25f)); for (int j = 0; j < 256; j++) { float num3 = Mathf.PerlinNoise((float)j * 0.08f + 3.7f, (float)i * 0.19f + 1.9f); float num4 = Mathf.PerlinNoise((float)j * 0.5f + 11.2f, (float)i * 0.03f + 7.4f); float num5 = Mathf.Clamp01(num2 * num * 0.4f + num3 * 0.16f + ((num4 > 0.92f) ? 0.28f : 0f)); val.SetPixel(j, i, new Color(1f, 1f, 1f, num5)); } } val.Apply(false, false); return val; } private void ClampEffectRanges() { _crtIntensity.Value = Mathf.Clamp(_crtIntensity.Value, 0f, 0.1f); _heatwaveIntensity.Value = Mathf.Clamp(_heatwaveIntensity.Value, 0f, 0.05f); _noirIntensity.Value = Mathf.Clamp01(_noirIntensity.Value); _vaporIntensity.Value = Mathf.Clamp01(_vaporIntensity.Value); _posterizeIntensity.Value = Mathf.Clamp01(_posterizeIntensity.Value); _pixelateIntensity.Value = Mathf.Clamp01(_pixelateIntensity.Value); _chromaticSplitIntensity.Value = Mathf.Clamp01(_chromaticSplitIntensity.Value); _ditherIntensity.Value = Mathf.Clamp01(_ditherIntensity.Value); _lensCenterX.Value = Mathf.Clamp(_lensCenterX.Value, -1f, 2f); _lensCenterY.Value = Mathf.Clamp(_lensCenterY.Value, -1f, 2f); _motionBlurIntensity.Value = Mathf.Clamp01(_motionBlurIntensity.Value); _depthOfFieldIntensity.Value = Mathf.Clamp01(_depthOfFieldIntensity.Value); _anamorphicBloomIntensity.Value = Mathf.Clamp01(_anamorphicBloomIntensity.Value); _halftoneIntensity.Value = Mathf.Clamp01(_halftoneIntensity.Value); _halftoneDotSize.Value = Mathf.Clamp(_halftoneDotSize.Value, 0.25f, 8f); _halftoneAngle.Value = Mathf.Clamp(_halftoneAngle.Value, 0f, 180f); _kuwaharaIntensity.Value = Mathf.Clamp01(_kuwaharaIntensity.Value); _kuwaharaRadius.Value = Mathf.Clamp(_kuwaharaRadius.Value, 1f, 6f); _selectiveColorIntensity.Value = Mathf.Clamp01(_selectiveColorIntensity.Value); _selectiveColorHue.Value = Mathf.Clamp(_selectiveColorHue.Value, 0f, 360f); _selectiveColorRange.Value = Mathf.Clamp(_selectiveColorRange.Value, 1f, 180f); _selectiveColorSoftness.Value = Mathf.Clamp01(_selectiveColorSoftness.Value); _radialBlurIntensity.Value = Mathf.Clamp01(_radialBlurIntensity.Value); _lensDirtIntensity.Value = Mathf.Clamp01(_lensDirtIntensity.Value); _rainOnLensIntensity.Value = Mathf.Clamp01(_rainOnLensIntensity.Value); _causticsOverlayIntensity.Value = Mathf.Clamp01(_causticsOverlayIntensity.Value); _godrayFakeIntensity.Value = Mathf.Clamp01(_godrayFakeIntensity.Value); _filmGateIntensity.Value = Mathf.Clamp01(_filmGateIntensity.Value); _glitchPackIntensity.Value = Mathf.Clamp(_glitchPackIntensity.Value, 0f, 0.1f); _volumetricFogTintIntensity.Value = Mathf.Clamp01(_volumetricFogTintIntensity.Value); _volumetricFogTintDensity.Value = Mathf.Clamp01(_volumetricFogTintDensity.Value); _volumetricFogTintHue.Value = Mathf.Clamp(_volumetricFogTintHue.Value, 0f, 360f); _lutBlendAmount.Value = Mathf.Clamp01(_lutBlendAmount.Value); _skyExposure.Value = Mathf.Clamp(_skyExposure.Value, 0.05f, 2.5f); _sunIntensityMultiplier.Value = Mathf.Clamp(_sunIntensityMultiplier.Value, 0f, 3f); _sunTemperature.Value = Mathf.Clamp(_sunTemperature.Value, 1000f, 20000f); _sunColorR.Value = Mathf.Clamp01(_sunColorR.Value); _sunColorG.Value = Mathf.Clamp01(_sunColorG.Value); _sunColorB.Value = Mathf.Clamp01(_sunColorB.Value); _sunColorBlend.Value = Mathf.Clamp01(_sunColorBlend.Value); _skyboxMaterialIndex.Value = Mathf.Clamp(_skyboxMaterialIndex.Value, 0, 1); _skyHueShift.Value = Mathf.Clamp(_skyHueShift.Value, -180f, 180f); _skyColorBlend.Value = Mathf.Clamp01(_skyColorBlend.Value); _tonemappingMode.Value = Mathf.Clamp(_tonemappingMode.Value, 0, 2); _whiteBalanceTemperature.Value = Mathf.Clamp(_whiteBalanceTemperature.Value, -100f, 100f); _whiteBalanceTint.Value = Mathf.Clamp(_whiteBalanceTint.Value, -100f, 100f); _liftAmount.Value = Mathf.Clamp(_liftAmount.Value, -1f, 1f); _gammaAmount.Value = Mathf.Clamp(_gammaAmount.Value, 0f, 2f); _gainAmount.Value = Mathf.Clamp(_gainAmount.Value, 0f, 2f); _splitShadowsR.Value = Mathf.Clamp01(_splitShadowsR.Value); _splitShadowsG.Value = Mathf.Clamp01(_splitShadowsG.Value); _splitShadowsB.Value = Mathf.Clamp01(_splitShadowsB.Value); _splitHighlightsR.Value = Mathf.Clamp01(_splitHighlightsR.Value); _splitHighlightsG.Value = Mathf.Clamp01(_splitHighlightsG.Value); _splitHighlightsB.Value = Mathf.Clamp01(_splitHighlightsB.Value); _splitToningBalance.Value = Mathf.Clamp(_splitToningBalance.Value, -100f, 100f); _hypnosisEnabled.Value = false; _hypnosisPreset.Value = 0; _hypnosisIntensity.Value = 0f; _hypnosisSpeed.Value = 0f; _hypnosisWarpAmount.Value = 0f; _hypnosisSpiralAmount.Value = 0f; _hypnosisColorBlend.Value = 0f; } private void Commit(string reason, bool notify) { ClampEffectRanges(); EnsureLocalEditOwnership(reason); _revision++; if (ShouldApplyLocalVisuals()) { RunMaterialScanner(logToConsole: false); ApplyAntiAliasingPresetToActiveCameras(); ApplyWaterAndCloudOverrides(); ApplyVisuals(); } else { DisableVisuals(); } if (notify) { Notify("Applied profile (" + reason + ")."); } if (IsHost() && !_localOnlyMode.Value && _syncEnabled.Value) { _lastHostCommitAt = Time.unscaledTime; BroadcastSnapshot(reason); } DebugLog($"Commit reason='{reason}' source={ResolveSyncSourceLabel()} rev={_revision} " + $"master={_masterEnabled.Value} shaderPass={_enableShaderPass.Value && !_forceVolumeFallback.Value && _shaderHealthy}"); } private void EnsureLocalEditOwnership(string reason) { if (IsClientOnly() && _acceptHostSync.Value && _localOnlyMode.Value) { _localOnlyMode.Value = false; } } private void LoadSavedSlot() { try { if (!string.IsNullOrWhiteSpace(_savedProfileJson.Value)) { ProfileStateV1 profileStateV = JsonUtility.FromJson(_savedProfileJson.Value); if (profileStateV != null && profileStateV.ProtocolVersion == 4) { ApplyState(profileStateV); Commit("load-slot", notify: true); } } } catch { } } private void OnEndCameraRendering(ScriptableRenderContext ctx, Camera cam) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (!_masterEnabled.Value || !_enableShaderPass.Value || _forceVolumeFallback.Value || !_shaderHealthy || IsSceneSuspendedForVisualOverrides() || (Object)(object)cam == (Object)null || !((Behaviour)cam).isActiveAndEnabled || (int)cam.cameraType != 1 || (Object)(object)cam.targetTexture != (Object)null || IsTransparentDesktopCamera(cam)) { return; } try { if (!TryRunShaderPass(ctx, cam) && !_warnedFallback) { _warnedFallback = true; Notify("Shader pass unsupported; fallback volume mode active."); } } catch (Exception arg) { _shaderHealthy = false; _enableShaderPass.Value = false; ((BaseUnityPlugin)this).Logger.LogError((object)$"Shader pass auto-disabled: {arg}"); Notify("Shader pass auto-disabled after error."); } } private static bool IsSceneSuspendedForVisualOverrides() { //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) if (IsDesktopPetModeActive() || IsTransparentDesktopCameraActive()) { return true; } Scene activeScene = SceneManager.GetActiveScene(); if (!((Scene)(ref activeScene)).IsValid()) { return false; } string text = ((Scene)(ref activeScene)).name ?? string.Empty; if (text.Length == 0) { return false; } text = text.ToLowerInvariant(); if (!text.Contains("menu") && !text.Contains("title") && !text.Contains("desktop") && !text.Contains("pet") && !text.Contains("loading")) { return text.Contains("launcher"); } return true; } private static bool IsDesktopPetModeActive() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 try { OverlayManager i = MonoSingleton.I; return (Object)(object)i != (Object)null && (int)i.ResolutionMode == 3; } catch { return false; } } private static bool IsTransparentDesktopCameraActive() { try { Camera main = Camera.main; if ((Object)(object)main != (Object)null && IsTransparentDesktopCamera(main)) { return true; } Camera[] allCameras = Camera.allCameras; if (allCameras == null || allCameras.Length == 0) { return false; } for (int i = 0; i < allCameras.Length; i++) { if (IsTransparentDesktopCamera(allCameras[i])) { return true; } } } catch { } return false; } private static bool IsTransparentDesktopCamera(Camera? camera) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_0036: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)camera == (Object)null || !((Behaviour)camera).isActiveAndEnabled) { return false; } if ((int)camera.cameraType != 1 || (Object)(object)camera.targetTexture != (Object)null) { return false; } if ((int)camera.clearFlags == 2) { return camera.backgroundColor.a <= 0.02f; } return false; } private bool TryRunShaderPass(ScriptableRenderContext ctx, Camera cam) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_06ba: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_0769: 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_0839: 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_088d: Unknown result type (might be due to invalid IL or missing references) //IL_0899: Unknown result type (might be due to invalid IL or missing references) //IL_08f7: Unknown result type (might be due to invalid IL or missing references) //IL_095f: Unknown result type (might be due to invalid IL or missing references) //IL_09a2: Unknown result type (might be due to invalid IL or missing references) //IL_0a79: Unknown result type (might be due to invalid IL or missing references) //IL_0c20: Unknown result type (might be due to invalid IL or missing references) //IL_0c25: Unknown result type (might be due to invalid IL or missing references) //IL_0c35: Expected O, but got Unknown //IL_0d59: Unknown result type (might be due to invalid IL or missing references) //IL_0d63: Unknown result type (might be due to invalid IL or missing references) //IL_0d7f: Unknown result type (might be due to invalid IL or missing references) //IL_0d85: Unknown result type (might be due to invalid IL or missing references) //IL_0cc7: Unknown result type (might be due to invalid IL or missing references) //IL_0cd1: Unknown result type (might be due to invalid IL or missing references) //IL_0ce6: Unknown result type (might be due to invalid IL or missing references) //IL_0cf0: Unknown result type (might be due to invalid IL or missing references) //IL_0d0c: Unknown result type (might be due to invalid IL or missing references) //IL_0d12: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_shaderMaterial == (Object)null) { Shader val = Shader.Find("Hidden/ShaderPlayground/HypnosisComposite") ?? Shader.Find("Hidden/ShaderPlayground/Composite") ?? Shader.Find("Hidden/Universal Render Pipeline/Blit") ?? Shader.Find("Hidden/BlitCopy") ?? Shader.Find("Unlit/Texture"); if ((Object)(object)val == (Object)null) { return false; } _shaderMaterial = new Material(val) { hideFlags = (HideFlags)61 }; } float num = 0f; foreach (EffectSlot item in _effectStack) { if (item.GetEnabled() && item.GetIntensity() > num) { num = item.GetIntensity(); } } if (_shaderMaterial.HasProperty("_Intensity")) { _shaderMaterial.SetFloat("_Intensity", num); } if (_shaderMaterial.HasProperty("_TimeX")) { _shaderMaterial.SetFloat("_TimeX", Time.unscaledTime * _heatwaveSpeed.Value); } if (_shaderMaterial.HasProperty("_QualityTier")) { _shaderMaterial.SetFloat("_QualityTier", (float)Mathf.Clamp(_qualityTier.Value, 0, 2)); } float num2 = (_crtEnabled.Value ? _crtIntensity.Value : 0f); float num3 = (_dreamEnabled.Value ? _dreamIntensity.Value : 0f); float num4 = (_comicEnabled.Value ? _comicIntensity.Value : 0f); float num5 = (_halftoneEnabled.Value ? Mathf.Clamp01(_halftoneIntensity.Value) : 0f); float num6 = Mathf.Clamp(_halftoneDotSize.Value, 0.25f, 8f); float num7 = Mathf.Clamp(_halftoneAngle.Value, 0f, 180f); float num8 = (_kuwaharaEnabled.Value ? Mathf.Clamp01(_kuwaharaIntensity.Value) : 0f); float num9 = Mathf.Clamp(_kuwaharaRadius.Value, 1f, 6f); float num10 = (_selectiveColorEnabled.Value ? Mathf.Clamp01(_selectiveColorIntensity.Value) : 0f); float num11 = Mathf.Clamp(_selectiveColorHue.Value, 0f, 360f); float num12 = Mathf.Clamp(_selectiveColorRange.Value, 1f, 180f); float num13 = Mathf.Clamp01(_selectiveColorSoftness.Value); float num14 = (_radialBlurEnabled.Value ? Mathf.Clamp01(_radialBlurIntensity.Value) : 0f); float num15 = (_rainOnLensEnabled.Value ? Mathf.Clamp01(_rainOnLensIntensity.Value) : 0f); float num16 = (_causticsOverlayEnabled.Value ? Mathf.Clamp01(_causticsOverlayIntensity.Value) : 0f); float num17 = (_godrayFakeEnabled.Value ? Mathf.Clamp01(_godrayFakeIntensity.Value) : 0f); float num18 = (_filmGateEnabled.Value ? Mathf.Clamp01(_filmGateIntensity.Value) : 0f); float num19 = (_glitchPackEnabled.Value ? Mathf.Clamp01(_glitchPackIntensity.Value / 0.1f) : 0f); float num20 = (_posterizeEnabled.Value ? Mathf.Clamp01(_posterizeIntensity.Value) : 0f); float num21 = (_pixelateEnabled.Value ? Mathf.Clamp01(_pixelateIntensity.Value) : 0f); float num22 = (_chromaticSplitEnabled.Value ? Mathf.Clamp01(_chromaticSplitIntensity.Value) : 0f); float num23 = (_ditherEnabled.Value ? Mathf.Clamp01(_ditherIntensity.Value) : 0f); Vector2 viewport = default(Vector2); ((Vector2)(ref viewport))..ctor(0.5f, 0.5f); float visibility = 0f; if (num17 > 0.001f) { TryGetGodraySource(out viewport, out visibility); num17 *= visibility; } if (_shaderMaterial.HasProperty("_CrtAmount")) { _shaderMaterial.SetFloat("_CrtAmount", num2); } if (_shaderMaterial.HasProperty("_DreamAmount")) { _shaderMaterial.SetFloat("_DreamAmount", num3); } if (_shaderMaterial.HasProperty("_ComicAmount")) { _shaderMaterial.SetFloat("_ComicAmount", Mathf.Clamp01(num4)); } if (_shaderMaterial.HasProperty("_HalftoneAmount")) { _shaderMaterial.SetFloat("_HalftoneAmount", num5); } if (_shaderMaterial.HasProperty("_HalftoneSize")) { _shaderMaterial.SetFloat("_HalftoneSize", num6); } if (_shaderMaterial.HasProperty("_HalftoneAngle")) { _shaderMaterial.SetFloat("_HalftoneAngle", num7); } if (_shaderMaterial.HasProperty("_HalftoneAngleRad")) { _shaderMaterial.SetFloat("_HalftoneAngleRad", num7 * (MathF.PI / 180f)); } if (_shaderMaterial.HasProperty("_KuwaharaAmount")) { _shaderMaterial.SetFloat("_KuwaharaAmount", num8); } if (_shaderMaterial.HasProperty("_KuwaharaRadius")) { _shaderMaterial.SetFloat("_KuwaharaRadius", num9); } if (_shaderMaterial.HasProperty("_KuwaharaParams")) { _shaderMaterial.SetVector("_KuwaharaParams", new Vector4(num8, num9, 0f, 0f)); } if (_shaderMaterial.HasProperty("_SelectiveColorAmount")) { _shaderMaterial.SetFloat("_SelectiveColorAmount", num10); } if (_shaderMaterial.HasProperty("_SelectiveColorHue")) { _shaderMaterial.SetFloat("_SelectiveColorHue", num11); } if (_shaderMaterial.HasProperty("_SelectiveColorRange")) { _shaderMaterial.SetFloat("_SelectiveColorRange", num12); } if (_shaderMaterial.HasProperty("_SelectiveColorSoftness")) { _shaderMaterial.SetFloat("_SelectiveColorSoftness", num13); } if (_shaderMaterial.HasProperty("_SelectiveColorParams")) { _shaderMaterial.SetVector("_SelectiveColorParams", new Vector4(num10, num11, num12, num13)); } if (_shaderMaterial.HasProperty("_RadialBlurAmount")) { _shaderMaterial.SetFloat("_RadialBlurAmount", num14); } if (_shaderMaterial.HasProperty("_RadialBlurCenter")) { _shaderMaterial.SetVector("_RadialBlurCenter", new Vector4(_lensCenterX.Value, _lensCenterY.Value, 0f, 0f)); } if (_shaderMaterial.HasProperty("_RadialBlurParams")) { _shaderMaterial.SetVector("_RadialBlurParams", new Vector4(num14, _lensCenterX.Value, _lensCenterY.Value, 0f)); } if (_shaderMaterial.HasProperty("_RainOnLensAmount")) { _shaderMaterial.SetFloat("_RainOnLensAmount", num15); } if (_shaderMaterial.HasProperty("_RainOnLensParams")) { _shaderMaterial.SetVector("_RainOnLensParams", new Vector4(num15, _lensCenterX.Value, _lensCenterY.Value, Time.unscaledTime)); } if (_shaderMaterial.HasProperty("_CausticsOverlayAmount")) { _shaderMaterial.SetFloat("_CausticsOverlayAmount", num16); } if (_shaderMaterial.HasProperty("_CausticsOverlayParams")) { _shaderMaterial.SetVector("_CausticsOverlayParams", new Vector4(num16, Time.unscaledTime, _lensCenterX.Value, _lensCenterY.Value)); } if (_shaderMaterial.HasProperty("_GodrayFakeAmount")) { _shaderMaterial.SetFloat("_GodrayFakeAmount", num17); } if (_shaderMaterial.HasProperty("_GodrayFakeParams")) { _shaderMaterial.SetVector("_GodrayFakeParams", new Vector4(num17, viewport.x, viewport.y, Time.unscaledTime)); } if (_shaderMaterial.HasProperty("_FilmGateAmount")) { _shaderMaterial.SetFloat("_FilmGateAmount", num18); } if (_shaderMaterial.HasProperty("_FilmGateParams")) { _shaderMaterial.SetVector("_FilmGateParams", new Vector4(num18, (float)Screen.width, (float)Screen.height, Time.unscaledTime)); } if (_shaderMaterial.HasProperty("_GlitchPackAmount")) { _shaderMaterial.SetFloat("_GlitchPackAmount", num19); } if (_shaderMaterial.HasProperty("_GlitchPackParams")) { _shaderMaterial.SetVector("_GlitchPackParams", new Vector4(num19, Time.unscaledTime, _lensCenterX.Value, _lensCenterY.Value)); } if (_shaderMaterial.HasProperty("_HalftoneParams")) { float num24 = num7 * (MathF.PI / 180f); _shaderMaterial.SetVector("_HalftoneParams", new Vector4(num5, num6, Mathf.Cos(num24), Mathf.Sin(num24))); } if (_shaderMaterial.HasProperty("_PosterizeAmount")) { _shaderMaterial.SetFloat("_PosterizeAmount", num20); } if (_shaderMaterial.HasProperty("_PixelateAmount")) { _shaderMaterial.SetFloat("_PixelateAmount", num21); } if (_shaderMaterial.HasProperty("_ChromaticSplitAmount")) { _shaderMaterial.SetFloat("_ChromaticSplitAmount", num22); } if (_shaderMaterial.HasProperty("_DitherAmount")) { _shaderMaterial.SetFloat("_DitherAmount", num23); } if (_shaderMaterial.HasProperty("_LensCenter")) { _shaderMaterial.SetVector("_LensCenter", new Vector4(_lensCenterX.Value, _lensCenterY.Value, 0f, 0f)); } if (_shaderMaterial.HasProperty("_HeatAmount")) { _shaderMaterial.SetFloat("_HeatAmount", _heatwaveEnabled.Value ? _heatwaveIntensity.Value : 0f); } if (_shaderMaterial.HasProperty("_SharpenAmount")) { _shaderMaterial.SetFloat("_SharpenAmount", (_antiAliasingPreset.Value == 4) ? _casSharpening.Value : 0f); } if (_shaderMaterial.HasProperty("_HypnosisEnabled")) { _shaderMaterial.SetFloat("_HypnosisEnabled", 0f); } if (_shaderMaterial.HasProperty("_HypnosisIntensity")) { _shaderMaterial.SetFloat("_HypnosisIntensity", 0f); } if (_shaderMaterial.HasProperty("_HypnosisSpeed")) { _shaderMaterial.SetFloat("_HypnosisSpeed", 0f); } if (_shaderMaterial.HasProperty("_HypnosisWarp")) { _shaderMaterial.SetFloat("_HypnosisWarp", 0f); } if (_shaderMaterial.HasProperty("_HypnosisSpiral")) { _shaderMaterial.SetFloat("_HypnosisSpiral", 0f); } if (_shaderMaterial.HasProperty("_HypnosisColorBlend")) { _shaderMaterial.SetFloat("_HypnosisColorBlend", 0f); } if (_shaderMaterial.HasProperty("_HypnosisPreset")) { _shaderMaterial.SetFloat("_HypnosisPreset", 0f); } if (_shaderPassBuffer == null) { _shaderPassBuffer = new CommandBuffer { name = "ShaderPlaygroundPass" }; } _shaderPassBuffer.Clear(); int num25 = ((!(num21 > 0.001f)) ? 1 : Mathf.Clamp(Mathf.RoundToInt(Mathf.Lerp(1f, 14f, num21)), 1, 14)); if (num25 > 1) { int num26 = Mathf.Max(1, cam.pixelWidth / num25); int num27 = Mathf.Max(1, cam.pixelHeight / num25); _shaderPassBuffer.GetTemporaryRT(ShaderPixelRtId, num26, num27, 0, (FilterMode)0); _shaderPassBuffer.GetTemporaryRT(ShaderTempRtId, -1, -1, 0, (FilterMode)0); _shaderPassBuffer.Blit(RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)2), RenderTargetIdentifier.op_Implicit(ShaderPixelRtId)); _shaderPassBuffer.Blit(RenderTargetIdentifier.op_Implicit(ShaderPixelRtId), RenderTargetIdentifier.op_Implicit(ShaderTempRtId), _shaderMaterial, 0); _shaderPassBuffer.Blit(RenderTargetIdentifier.op_Implicit(ShaderTempRtId), RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)2)); _shaderPassBuffer.ReleaseTemporaryRT(ShaderTempRtId); _shaderPassBuffer.ReleaseTemporaryRT(ShaderPixelRtId); } else { _shaderPassBuffer.GetTemporaryRT(ShaderTempRtId, -1, -1, 0, (FilterMode)1); _shaderPassBuffer.Blit(RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)2), RenderTargetIdentifier.op_Implicit(ShaderTempRtId), _shaderMaterial, 0); _shaderPassBuffer.Blit(RenderTargetIdentifier.op_Implicit(ShaderTempRtId), RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)2)); _shaderPassBuffer.ReleaseTemporaryRT(ShaderTempRtId); } ((ScriptableRenderContext)(ref ctx)).ExecuteCommandBuffer(_shaderPassBuffer); return true; } private void EnsureVolume() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if (!((Object)(object)_volume != (Object)null) || !((Object)(object)_profile != (Object)null)) { GameObject val = GameObject.Find("ShaderPlayground.RuntimeVolume"); if ((Object)(object)val == (Object)null) { val = new GameObject("ShaderPlayground.RuntimeVolume"); Object.DontDestroyOnLoad((Object)(object)val); } val.layer = 0; _volume = val.GetComponent() ?? val.AddComponent(); _volume.isGlobal = true; _volume.priority = 12000f; _profile = _volume.sharedProfile; if ((Object)(object)_profile == (Object)null) { _profile = ScriptableObject.CreateInstance(); _volume.sharedProfile = _profile; } if (!_profile.TryGet(ref _bloom)) { _bloom = _profile.Add(true); } if (!_profile.TryGet(ref _color)) { _color = _profile.Add(true); } if (!_profile.TryGet(ref _vignette)) { _vignette = _profile.Add(true); } if (!_profile.TryGet(ref _chroma)) { _chroma = _profile.Add(true); } if (!_profile.TryGet(ref _lens)) { _lens = _profile.Add(true); } if (!_profile.TryGet(ref _grain)) { _grain = _profile.Add(true); } if (!_profile.TryGet(ref _motionBlur)) { _motionBlur = _profile.Add(true); } if (!_profile.TryGet(ref _depthOfField)) { _depthOfField = _profile.Add(true); } if (!_profile.TryGet(ref _colorLookup)) { _colorLookup = _profile.Add(true); } if (!_profile.TryGet(ref _tonemapping)) { _tonemapping = _profile.Add(true); } if (!_profile.TryGet(ref _whiteBalance)) { _whiteBalance = _profile.Add(true); } if (!_profile.TryGet(ref _liftGammaGain)) { _liftGammaGain = _profile.Add(true); } if (!_profile.TryGet(ref _splitToning)) { _splitToning = _profile.Add(true); } } } private void ApplyVisuals() { //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0c15: Unknown result type (might be due to invalid IL or missing references) //IL_0c5f: Unknown result type (might be due to invalid IL or missing references) //IL_0c64: Unknown result type (might be due to invalid IL or missing references) //IL_0c73: Unknown result type (might be due to invalid IL or missing references) //IL_0c4e: Unknown result type (might be due to invalid IL or missing references) //IL_062b: 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_0656: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_0b7e: Unknown result type (might be due to invalid IL or missing references) //IL_0764: Unknown result type (might be due to invalid IL or missing references) //IL_0769: Unknown result type (might be due to invalid IL or missing references) //IL_0773: Unknown result type (might be due to invalid IL or missing references) //IL_163e: Unknown result type (might be due to invalid IL or missing references) //IL_166f: Unknown result type (might be due to invalid IL or missing references) //IL_16a0: Unknown result type (might be due to invalid IL or missing references) //IL_1732: Unknown result type (might be due to invalid IL or missing references) //IL_1737: Unknown result type (might be due to invalid IL or missing references) //IL_1792: Unknown result type (might be due to invalid IL or missing references) //IL_1797: Unknown result type (might be due to invalid IL or missing references) //IL_12d5: Unknown result type (might be due to invalid IL or missing references) //IL_12ee: Unknown result type (might be due to invalid IL or missing references) //IL_1307: Unknown result type (might be due to invalid IL or missing references) //IL_130d: Unknown result type (might be due to invalid IL or missing references) //IL_1320: Unknown result type (might be due to invalid IL or missing references) //IL_1348: Unknown result type (might be due to invalid IL or missing references) //IL_1361: Unknown result type (might be due to invalid IL or missing references) //IL_1372: Unknown result type (might be due to invalid IL or missing references) EnsureVolume(); if ((Object)(object)_volume == (Object)null) { return; } CaptureRenderBaselineIfNeeded(); float num = _qualityTier.Value switch { 0 => 0.55f, 1 => 1f, _ => 1.35f, }; float num2 = (_noirEnabled.Value ? Mathf.Clamp01(_noirIntensity.Value) : 0f); float num3 = (_vaporEnabled.Value ? Mathf.Clamp01(_vaporIntensity.Value) : 0f); float num4 = (_heatwaveEnabled.Value ? Mathf.Clamp01(_heatwaveIntensity.Value) : 0f); float num5 = (_crtEnabled.Value ? Mathf.Clamp01(_crtIntensity.Value) : 0f); float num6 = (_dreamEnabled.Value ? Mathf.Clamp01(_dreamIntensity.Value) : 0f); float num7 = (_comicEnabled.Value ? Mathf.Clamp01(_comicIntensity.Value) : 0f); float pixelAmount = (_pixelateEnabled.Value ? Mathf.Clamp01(_pixelateIntensity.Value) : 0f); float num8 = (_chromaticSplitEnabled.Value ? Mathf.Clamp01(_chromaticSplitIntensity.Value) : 0f); float num9 = (_ditherEnabled.Value ? Mathf.Clamp01(_ditherIntensity.Value) : 0f); float num10 = (_motionBlurEnabled.Value ? Mathf.Clamp01(_motionBlurIntensity.Value) : 0f); float num11 = (_depthOfFieldEnabled.Value ? Mathf.Clamp01(_depthOfFieldIntensity.Value) : 0f); float num12 = (_anamorphicBloomEnabled.Value ? Mathf.Clamp01(_anamorphicBloomIntensity.Value) : 0f); float num13 = (_halftoneEnabled.Value ? Mathf.Clamp01(_halftoneIntensity.Value) : 0f); float num14 = (_kuwaharaEnabled.Value ? Mathf.Clamp01(_kuwaharaIntensity.Value) : 0f); float num15 = (_radialBlurEnabled.Value ? Mathf.Clamp01(_radialBlurIntensity.Value) : 0f); float num16 = (_lensDirtEnabled.Value ? Mathf.Clamp01(_lensDirtIntensity.Value) : 0f); float num17 = (_rainOnLensEnabled.Value ? Mathf.Clamp01(_rainOnLensIntensity.Value) : 0f); float num18 = (_godrayFakeEnabled.Value ? Mathf.Clamp01(_godrayFakeIntensity.Value) : 0f); float num19 = (_filmGateEnabled.Value ? Mathf.Clamp01(_filmGateIntensity.Value) : 0f); float num20 = (_glitchPackEnabled.Value ? Mathf.Clamp01(_glitchPackIntensity.Value / 0.1f) : 0f); float unscaledTime = Time.unscaledTime; float num21 = ((num20 > 0.001f) ? Mathf.Clamp01(Mathf.PerlinNoise(1.91f, unscaledTime * 10.5f) * 0.55f + (Mathf.Sin(unscaledTime * 22f) * 0.5f + 0.5f) * 0.45f) : 0f); float num22 = ((num20 > 0.001f && Mathf.PerlinNoise(unscaledTime * 16.7f, 0.23f) > Mathf.Lerp(0.92f, 0.68f, num20)) ? 1f : 0f); float num23 = Mathf.Clamp01(num7); float num24 = num3 * 0.2f; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); float num25 = 0f; if (num18 > 0.001f) { if (TryGetGodraySource(out var viewport, out var visibility)) { val = viewport; num25 = Mathf.Clamp01(num18 * visibility); } else { ((Vector2)(ref val))..ctor(0.5f, 0.16f); num25 = Mathf.Clamp01(num18 * 0.35f); } } ((Behaviour)_volume).enabled = true; _volume.weight = 1f; ApplyPixelateRenderScaleOverride(pixelAmount); ApplySkyAndWeatherLighting(); if ((Object)(object)_bloom != (Object)null) { ((VolumeParameter)_bloom.intensity).overrideState = true; ((VolumeParameter)(object)_bloom.intensity).value = (num6 * 4.5f + num3 * 1.35f + num5 * 0.2f + num12 * 2.6f + num16 * 0.65f + num18 * 0.55f + num15 * 0.25f + num13 * 0.12f + num14 * 0.2f) * num + (_enhancedSkyEnabled.Value ? (0.45f * _skyIntensity.Value) : 0f); MinFloatParameter intensity = _bloom.intensity; ((VolumeParameter)(object)intensity).value = ((VolumeParameter)(object)intensity).value + (num20 * 0.35f + num21 * 0.55f + num22 * 0.8f) * num; ((VolumeParameter)_bloom.threshold).overrideState = true; ((VolumeParameter)(object)_bloom.threshold).value = ((num12 > 0.001f) ? Mathf.Lerp(0.82f, 0.35f, num12) : ((num6 > 0.01f) ? 0.55f : 0.9f)); ((VolumeParameter)_bloom.scatter).overrideState = true; ((VolumeParameter)(object)_bloom.scatter).value = ((num12 > 0.001f) ? Mathf.Lerp(0.18f, 0.06f, num12) : ((num6 > 0.001f) ? Mathf.Lerp(0.38f, 0.62f, num6) : 0.58f)); ((VolumeParameter)_bloom.tint).overrideState = true; ((VolumeParameter)(object)_bloom.tint).value = ((num12 > 0.001f) ? Color.Lerp(Color.white, new Color(0.96f, 0.94f, 1f, 1f), Mathf.Clamp01(num12 * 0.45f)) : Color.white); if (num25 > 0.001f) { MinFloatParameter intensity2 = _bloom.intensity; ((VolumeParameter)(object)intensity2).value = ((VolumeParameter)(object)intensity2).value + num25 * Mathf.Lerp(0.45f, 2.1f, num / 1.35f); ((VolumeParameter)(object)_bloom.threshold).value = Mathf.Lerp(((VolumeParameter)(object)_bloom.threshold).value, 0.52f, num25 * 0.85f); ((VolumeParameter)(object)_bloom.scatter).value = Mathf.Lerp(((VolumeParameter)(object)_bloom.scatter).value, 0.2f, num25 * 0.65f); Color val2 = default(Color); ((Color)(ref val2))..ctor(Mathf.Clamp01(_sunColorR.Value + 0.12f), Mathf.Clamp01(_sunColorG.Value + 0.08f), Mathf.Clamp01(_sunColorB.Value + 0.02f), 1f); ((VolumeParameter)(object)_bloom.tint).value = Color.Lerp(((VolumeParameter)(object)_bloom.tint).value, val2, num25 * 0.55f); } TryApplyBloomLensDirt(_bloom, Mathf.Max(num16, num17 * 0.82f)); } if ((Object)(object)_chroma != (Object)null) { ((VolumeParameter)_chroma.intensity).overrideState = true; ((VolumeParameter)(object)_chroma.intensity).value = (num5 * 0.25f + num4 * 0.1f + num3 * 0.9f + num8 * 0.95f + num12 * 0.12f + num17 * 0.22f + num25 * 0.12f + num20 * 0.5f + num21 * 0.65f + num22 * 0.85f) * num; } if ((Object)(object)_lens != (Object)null) { float num26 = Mathf.Clamp01(0.35f + 0.65f * Mathf.PerlinNoise(0.17f, unscaledTime * 0.31f)); float num27 = (Mathf.Sin(unscaledTime * 1.47f) + Mathf.Sin(unscaledTime * 2.13f + 1.1f) + Mathf.Sin(unscaledTime * 0.83f + 2.6f)) * 0.3333f; float num28 = num17 * (0.35f + 0.95f * num26) * num27; float num29 = (Mathf.PerlinNoise(unscaledTime * 13.1f, 3.4f) - 0.5f) * 2f * (3.5f * num20 + 7f * num22); ((VolumeParameter)_lens.intensity).overrideState = true; float num30 = Mathf.Sin(Time.unscaledTime * _heatwaveSpeed.Value); ((VolumeParameter)(object)_lens.intensity).value = ((num5 > 0f) ? (-12f * num5) : 0f) + ((num4 > 0f) ? (num30 * 14f * num4) : 0f) + num28 + num29; ((VolumeParameter)_lens.scale).overrideState = true; ((VolumeParameter)(object)_lens.scale).value = 1f; ((VolumeParameter)_lens.xMultiplier).overrideState = true; ((VolumeParameter)(object)_lens.xMultiplier).value = Mathf.Lerp(1f, 1.18f, num12); ((VolumeParameter)_lens.yMultiplier).overrideState = true; ((VolumeParameter)(object)_lens.yMultiplier).value = Mathf.Lerp(1f, 0.9f, num12); ((VolumeParameter)_lens.center).overrideState = true; float num31 = Mathf.Clamp(_lensCenterX.Value, -1f, 2f); float num32 = Mathf.Clamp(_lensCenterY.Value, -1f, 2f); float num33 = (Mathf.PerlinNoise(unscaledTime * 0.27f, 0.41f) - 0.5f) * 0.025f * num17; float num34 = (Mathf.PerlinNoise(0.73f, unscaledTime * 0.29f) - 0.5f) * 0.02f * num17 - Mathf.Abs(Mathf.Sin(unscaledTime * 0.71f + 0.8f)) * 0.01f * num17; float num35 = (Mathf.PerlinNoise(8.31f, unscaledTime * 0.97f) - 0.5f) * 0.04f * num19; float num36 = (Mathf.PerlinNoise(unscaledTime * 1.03f, 2.47f) - 0.5f) * 0.025f * num19; float num37 = (Mathf.PerlinNoise(4.81f, unscaledTime * 19.7f) - 0.5f) * 0.22f * num20 + ((num22 > 0f) ? (Mathf.Sign(Mathf.Sin(unscaledTime * 37f)) * 0.25f * num20) : 0f); float num38 = (Mathf.PerlinNoise(unscaledTime * 17.3f, 7.11f) - 0.5f) * 0.08f * num20; ((VolumeParameter)(object)_lens.center).value = new Vector2(Mathf.Clamp(num31 + num33 + num35 + num37, -1f, 2f), Mathf.Clamp(num32 + num34 + num36 + num38, -1f, 2f)); } if ((Object)(object)_vignette != (Object)null) { ((VolumeParameter)_vignette.intensity).overrideState = true; ((VolumeParameter)(object)_vignette.intensity).value = num5 * 0.24f + num23 * 0.2f + num2 * 0.35f + num24 * 0.12f + num17 * 0.08f; ((VolumeParameter)_vignette.color).overrideState = true; ((VolumeParameter)(object)_vignette.color).value = new Color(0f, 0f, 0f, 1f); ((VolumeParameter)_vignette.center).overrideState = true; ((VolumeParameter)(object)_vignette.center).value = (Vector2)((num25 > 0.001f) ? Vector2.Lerp(new Vector2(0.5f, 0.5f), val, Mathf.Clamp01(num25 * 0.8f)) : new Vector2(0.5f, 0.5f)); ((VolumeParameter)_vignette.smoothness).overrideState = true; ((VolumeParameter)(object)_vignette.smoothness).value = Mathf.Lerp(Mathf.Lerp(0.45f, 0.36f, num19), 0.28f, num25); ((VolumeParameter)(object)_vignette.smoothness).value = Mathf.Lerp(((VolumeParameter)(object)_vignette.smoothness).value, 0.22f, num20 * 0.55f + num22 * 0.35f); ((VolumeParameter)_vignette.rounded).overrideState = true; ((VolumeParameter)(object)_vignette.rounded).value = true; } if ((Object)(object)_grain != (Object)null) { ((VolumeParameter)_grain.type).overrideState = true; ((VolumeParameter)(object)_grain.type).value = (FilmGrainLookup)((num9 > 0.001f || num13 > 0.001f) ? 4 : 0); ((VolumeParameter)_grain.intensity).overrideState = true; ((VolumeParameter)(object)_grain.intensity).value = num5 * 0.45f + num2 * 0.3f + num9 * 0.75f + num13 * 0.62f + num17 * 0.26f + num16 * 0.24f + num15 * 0.2f + num19 * 0.34f + num20 * 0.38f + num21 * 0.42f + num22 * 0.55f; ((VolumeParameter)_grain.response).overrideState = true; ((VolumeParameter)(object)_grain.response).value = Mathf.Lerp(0.72f, 1f, Mathf.Clamp01(Mathf.Max(new float[3] { num9, num13 * 0.9f, num17 * 0.65f }))); } if ((Object)(object)_motionBlur != (Object)null) { ((VolumeComponent)_motionBlur).active = _motionBlurEnabled.Value; if (((VolumeComponent)_motionBlur).active) { ((VolumeParameter)_motionBlur.intensity).overrideState = true; ((VolumeParameter)(object)_motionBlur.intensity).value = num10; ((VolumeParameter)_motionBlur.clamp).overrideState = true; ((VolumeParameter)(object)_motionBlur.clamp).value = Mathf.Lerp(0.02f, 0.08f, num10); } } if ((Object)(object)_depthOfField != (Object)null) { float num39 = Mathf.Clamp01(Mathf.Max(new float[3] { num11, num15 * 0.78f, num14 * Mathf.Lerp(0.35f, 0.9f, Mathf.InverseLerp(1f, 6f, Mathf.Clamp(_kuwaharaRadius.Value, 1f, 6f))) })); ((VolumeComponent)_depthOfField).active = _depthOfFieldEnabled.Value || num15 > 0.001f || num14 > 0.001f; if (((VolumeComponent)_depthOfField).active) { float num40 = num39; ((VolumeParameter)_depthOfField.mode).overrideState = true; ((VolumeParameter)(object)_depthOfField.mode).value = (DepthOfFieldMode)1; ((VolumeParameter)_depthOfField.gaussianStart).overrideState = true; ((VolumeParameter)(object)_depthOfField.gaussianStart).value = Mathf.Lerp(12f, 2.2f, num40); ((VolumeParameter)_depthOfField.gaussianEnd).overrideState = true; ((VolumeParameter)(object)_depthOfField.gaussianEnd).value = Mathf.Lerp(75f, 14f, num40); ((VolumeParameter)_depthOfField.gaussianMaxRadius).overrideState = true; ((VolumeParameter)(object)_depthOfField.gaussianMaxRadius).value = ((num40 > 0.66f) ? 2f : 1f); ((VolumeParameter)_depthOfField.highQualitySampling).overrideState = true; ((VolumeParameter)(object)_depthOfField.highQualitySampling).value = _qualityTier.Value >= 2; } } if ((Object)(object)_color != (Object)null) { ((VolumeParameter)_color.contrast).overrideState = true; ((VolumeParameter)(object)_color.contrast).value = num23 * 35f + num5 * 20f + num2 * 30f + num3 * 18f + num24 * 14f + num13 * 18f + num14 * 9f + num15 * 6f + num12 * 10f + num20 * 24f + num22 * 28f + ((_antiAliasingPreset.Value == 4) ? Mathf.Lerp(4f, 18f, _casSharpening.Value) : 0f); ((VolumeParameter)_color.saturation).overrideState = true; ((VolumeParameter)(object)_color.saturation).value = num23 * -65f + num6 * 18f + num3 * 28f + num13 * -24f + num14 * -10f + num2 * -92f + num20 * -14f + num21 * 8f + ((_weatherSystemEnabled.Value && _activeWeatherMood == WeatherMood.Storm) ? (-10f * _weatherStrength.Value) : 0f); ((VolumeParameter)_color.hueShift).overrideState = true; ((VolumeParameter)(object)_color.hueShift).value = ((num4 > 0f) ? (3f * num4) : (-8f * num5)) + num3 * 14f + (Mathf.PerlinNoise(5.73f, unscaledTime * 12.4f) - 0.5f) * 26f * num20 + ((num22 > 0f) ? (Mathf.Sign(Mathf.Sin(unscaledTime * 44f)) * 18f) : 0f) * num20; ((VolumeParameter)_color.postExposure).overrideState = true; ((VolumeParameter)(object)_color.postExposure).value = num6 * 0.18f + num3 * 0.45f - num24 * 0.08f - num2 * 0.6f + num25 * 0.38f - num15 * 0.06f + num19 * -0.08f + num21 * 0.12f - num20 * 0.06f; ((VolumeParameter)_color.colorFilter).overrideState = true; ((VolumeParameter)(object)_color.colorFilter).value = Color.Lerp(Color.white, Color.Lerp(new Color(0.95f, 0.96f, 1f, 1f), new Color(0.98f, 0.9f, 0.86f, 1f), num3), Mathf.Clamp01(num3 + num2 * 0.35f)); if (num2 > 0.01f) { ((VolumeParameter)(object)_color.colorFilter).value = Color.Lerp(((VolumeParameter)(object)_color.colorFilter).value, new Color(0.92f, 0.9f, 0.84f, 1f), Mathf.Clamp01(num2 * 0.8f)); } if (_liftGammaGainEnabled.Value) { float num41 = Mathf.Clamp(_liftAmount.Value, -1f, 1f); float num42 = Mathf.Clamp(_gammaAmount.Value, 0f, 2f) - 1f; float num43 = Mathf.Clamp(_gainAmount.Value, 0f, 2f) - 1f; FloatParameter postExposure = _color.postExposure; ((VolumeParameter)(object)postExposure).value = ((VolumeParameter)(object)postExposure).value + (num43 * 0.85f - num42 * 0.35f + num41 * 0.35f); ClampedFloatParameter contrast = _color.contrast; ((VolumeParameter)(object)contrast).value = ((VolumeParameter)(object)contrast).value + (num43 * 22f - num42 * 18f + Mathf.Abs(num41) * 6f); ClampedFloatParameter saturation = _color.saturation; ((VolumeParameter)(object)saturation).value = ((VolumeParameter)(object)saturation).value + (num43 * 10f - num41 * 8f); } } if ((Object)(object)_tonemapping != (Object)null) { ((VolumeComponent)_tonemapping).active = _tonemappingMode.Value > 0; if (((VolumeComponent)_tonemapping).active) { ((VolumeParameter)_tonemapping.mode).overrideState = true; ((VolumeParameter)(object)_tonemapping.mode).value = (TonemappingMode)((_tonemappingMode.Value < 2) ? 1 : 2); } } if ((Object)(object)_whiteBalance != (Object)null) { ((VolumeComponent)_whiteBalance).active = _whiteBalanceEnabled.Value; if (((VolumeComponent)_whiteBalance).active) { ((VolumeParameter)_whiteBalance.temperature).overrideState = true; ((VolumeParameter)(object)_whiteBalance.temperature).value = Mathf.Clamp(_whiteBalanceTemperature.Value, -100f, 100f); ((VolumeParameter)_whiteBalance.tint).overrideState = true; ((VolumeParameter)(object)_whiteBalance.tint).value = Mathf.Clamp(_whiteBalanceTint.Value, -100f, 100f); } } if ((Object)(object)_liftGammaGain != (Object)null) { ((VolumeComponent)_liftGammaGain).active = _liftGammaGainEnabled.Value; if (((VolumeComponent)_liftGammaGain).active) { float num44 = Mathf.Clamp(_liftAmount.Value, -1f, 1f); float num45 = Mathf.Clamp(_gammaAmount.Value, 0f, 2f); float num46 = Mathf.Clamp(_gainAmount.Value, 0f, 2f); ((VolumeParameter)_liftGammaGain.lift).overrideState = true; ((VolumeParameter)(object)_liftGammaGain.lift).value = new Vector4(num44, num44, num44, 0f); ((VolumeParameter)_liftGammaGain.gamma).overrideState = true; ((VolumeParameter)(object)_liftGammaGain.gamma).value = new Vector4(num45, num45, num45, 0f); ((VolumeParameter)_liftGammaGain.gain).overrideState = true; ((VolumeParameter)(object)_liftGammaGain.gain).value = new Vector4(num46, num46, num46, 0f); } } if ((Object)(object)_splitToning != (Object)null) { ((VolumeComponent)_splitToning).active = _splitToningEnabled.Value; if (((VolumeComponent)_splitToning).active) { ((VolumeParameter)_splitToning.shadows).overrideState = true; ((VolumeParameter)(object)_splitToning.shadows).value = Color.op_Implicit(new Vector4(Mathf.Clamp01(_splitShadowsR.Value), Mathf.Clamp01(_splitShadowsG.Value), Mathf.Clamp01(_splitShadowsB.Value), 0f)); ((VolumeParameter)_splitToning.highlights).overrideState = true; ((VolumeParameter)(object)_splitToning.highlights).value = Color.op_Implicit(new Vector4(Mathf.Clamp01(_splitHighlightsR.Value), Mathf.Clamp01(_splitHighlightsG.Value), Mathf.Clamp01(_splitHighlightsB.Value), 0f)); ((VolumeParameter)_splitToning.balance).overrideState = true; ((VolumeParameter)(object)_splitToning.balance).value = Mathf.Clamp(_splitToningBalance.Value, -100f, 100f); } } ApplyLutBlend(); } private void TryApplyBloomLensDirt(Bloom bloom, float intensity) { if ((Object)(object)bloom == (Object)null) { return; } try { object memberValue = GetMemberValue(bloom, "dirtIntensity"); object memberValue2 = GetMemberValue(bloom, "dirtTexture"); if (memberValue != null && memberValue2 != null) { if (intensity <= 0.001f) { SetVolumeParameterValue(memberValue, 0f, overrideState: true); SetVolumeParameterValue(memberValue2, null, overrideState: true); } else { Texture2D orCreateLensDirtTexture = GetOrCreateLensDirtTexture(); SetVolumeParameterValue(memberValue2, orCreateLensDirtTexture, overrideState: true); SetVolumeParameterValue(memberValue, Mathf.Lerp(0.35f, 8f, intensity), overrideState: true); } } } catch { } } private Texture2D GetOrCreateLensDirtTexture() { //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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0049: Expected O, but got Unknown //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_generatedLensDirtTexture != (Object)null) { return _generatedLensDirtTexture; } Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1, hideFlags = (HideFlags)61, name = "ShaderPlayground.LensDirt" }; float[] array = new float[65536]; Random random = new Random(1975); for (int i = 0; i < 256; i++) { float num = (float)i / 255f; for (int j = 0; j < 256; j++) { float num2 = (float)j / 255f; int num3 = i * 256 + j; float num4 = Mathf.PerlinNoise(num2 * 3.7f + 0.13f, num * 3.1f + 0.71f); float num5 = Mathf.PerlinNoise(num2 * 9.1f + 3.4f, num * 8.7f + 5.2f); array[num3] = num4 * 0.08f + num5 * 0.035f; } } for (int k = 0; k < 190; k++) { float num6 = (float)random.NextDouble(); float num7 = (float)random.NextDouble(); float num8 = Mathf.Lerp(0.005f, 0.06f, (float)random.NextDouble()); float num9 = Mathf.Lerp(0.05f, 0.32f, (float)random.NextDouble()); int num10 = Mathf.Max(0, Mathf.FloorToInt((num6 - num8) * 256f)); int num11 = Mathf.Min(255, Mathf.CeilToInt((num6 + num8) * 256f)); int num12 = Mathf.Max(0, Mathf.FloorToInt((num7 - num8) * 256f)); int num13 = Mathf.Min(255, Mathf.CeilToInt((num7 + num8) * 256f)); for (int l = num12; l <= num13; l++) { float num14 = (float)l / 255f; for (int m = num10; m <= num11; m++) { float num15 = (float)m / 255f - num6; float num16 = num14 - num7; float num17 = Mathf.Sqrt(num15 * num15 + num16 * num16); if (!(num17 > num8)) { float num18 = 1f - num17 / num8; array[l * 256 + m] += num18 * num18 * num9; } } } } for (int n = 0; n < 28; n++) { float num19 = (float)random.NextDouble(); float num20 = (float)random.NextDouble(); float num21 = Mathf.Lerp(0f, MathF.PI, (float)random.NextDouble()); float num22 = Mathf.Lerp(0.08f, 0.36f, (float)random.NextDouble()); float num23 = Mathf.Lerp(0.0015f, 0.006f, (float)random.NextDouble()); float num24 = Mathf.Lerp(0.04f, 0.18f, (float)random.NextDouble()); float num25 = Mathf.Cos(num21); float num26 = Mathf.Sin(num21); for (int num27 = 0; num27 < 256; num27++) { float num28 = (float)num27 / 255f; for (int num29 = 0; num29 < 256; num29++) { float num30 = (float)num29 / 255f - num19; float num31 = num28 - num20; if (!(Mathf.Abs(num30 * num25 + num31 * num26) > num22 * 0.5f)) { float num32 = Mathf.Abs((0f - num30) * num26 + num31 * num25); if (!(num32 > num23)) { float num33 = 1f - Mathf.Clamp01(num32 / num23); array[num27 * 256 + num29] += num33 * num24; } } } } } for (int num34 = 0; num34 < 256; num34++) { float num35 = (float)num34 / 255f - 0.5f; for (int num36 = 0; num36 < 256; num36++) { float num37 = (float)num36 / 255f - 0.5f; float num38 = Mathf.Sqrt(num37 * num37 + num35 * num35) * 1.75f; float num39 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(num38)); int num40 = num34 * 256 + num36; array[num40] = Mathf.Clamp01(array[num40] * Mathf.Lerp(0.75f, 1.15f, num39)); } } Color32[] array2 = (Color32[])(object)new Color32[65536]; for (int num41 = 0; num41 < array.Length; num41++) { byte b = (byte)Mathf.RoundToInt(Mathf.Pow(Mathf.Clamp01(array[num41]), 1.35f) * 255f); array2[num41] = new Color32(b, b, b, b); } val.SetPixels32(array2); val.Apply(false, false); _generatedLensDirtTexture = val; return val; } private static object? GetMemberValue(object instance, string memberName) { Type type = instance.GetType(); FieldInfo field = type.GetField(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(instance); } PropertyInfo property = type.GetProperty(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if ((object)property == null || !property.CanRead) { return null; } return property.GetValue(instance); } private static bool SetVolumeParameterValue(object parameter, object? value, bool overrideState) { if (parameter == null) { return false; } Type type = parameter.GetType(); FieldInfo field = type.GetField("overrideState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(parameter, overrideState); } FieldInfo field2 = type.GetField("value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 == null) { return false; } if (value == null) { field2.SetValue(parameter, null); return true; } Type fieldType = field2.FieldType; if (fieldType.IsAssignableFrom(value.GetType())) { field2.SetValue(parameter, value); return true; } try { object value2 = Convert.ChangeType(value, fieldType, CultureInfo.InvariantCulture); field2.SetValue(parameter, value2); return true; } catch { return false; } } private void ApplyLutBlend() { if ((Object)(object)_colorLookup == (Object)null) { return; } Texture2D val = null; float num = 1f; if (_lutBlendEnabled.Value) { EnsureLutTexturesLoaded(forceReload: false); if ((Object)(object)_lutTextureA != (Object)null) { float num2 = Mathf.Clamp01(_lutBlendAmount.Value); val = (((Object)(object)_lutTextureB == (Object)null || num2 <= 0.001f) ? _lutTextureA : ((!(num2 >= 0.999f)) ? BuildBlendedLutTexture(_lutTextureA, _lutTextureB, num2) : _lutTextureB)); } } bool flag = _selectiveColorEnabled.Value && _selectiveColorIntensity.Value > 0.001f; bool flag2 = _posterizeEnabled.Value && _posterizeIntensity.Value > 0.001f; bool flag3 = _halftoneEnabled.Value && _halftoneIntensity.Value > 0.001f; if ((Object)(object)val == (Object)null && flag) { int posterizeLevels = (flag2 ? GetPosterizeLevels() : (-1)); val = EnsureSelectiveColorLutTexture(Mathf.Clamp01(_selectiveColorIntensity.Value), Mathf.Clamp(_selectiveColorHue.Value, 0f, 360f), Mathf.Clamp(_selectiveColorRange.Value, 1f, 180f), Mathf.Clamp01(_selectiveColorSoftness.Value), posterizeLevels); } if ((Object)(object)val == (Object)null && flag2) { int posterizeLevels2 = GetPosterizeLevels(); val = EnsurePosterizeLutTexture(posterizeLevels2); } if ((Object)(object)val == (Object)null && flag3) { float num3 = Mathf.Clamp01(_halftoneIntensity.Value); float num4 = Mathf.InverseLerp(0.25f, 8f, Mathf.Clamp(_halftoneDotSize.Value, 0.25f, 8f)); int levels = Mathf.Clamp(Mathf.RoundToInt(Mathf.Lerp(12f, 4f, Mathf.Clamp01(num3 * (0.55f + 0.45f * num4)))), 4, 12); val = EnsurePosterizeLutTexture(levels); num = Mathf.Lerp(0.3f, 0.85f, num3); } if ((Object)(object)val == (Object)null || !IsValidStripLut(val)) { DisableLutBlend(); return; } ((VolumeComponent)_colorLookup).active = true; ((VolumeParameter)_colorLookup.texture).overrideState = true; ((VolumeParameter)(object)_colorLookup.texture).value = (Texture)(object)val; ((VolumeParameter)_colorLookup.contribution).overrideState = true; ((VolumeParameter)(object)_colorLookup.contribution).value = Mathf.Clamp01(num); } private Texture2D? EnsureSelectiveColorLutTexture(float intensity, float targetHueDeg, float rangeDeg, float softness, int posterizeLevels) { //IL_00e3: 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_00ef: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_024f: 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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) int num = 1024; int num2 = 32; float num3 = NormalizeHueDegrees(targetHueDeg); float num4 = Mathf.Clamp(rangeDeg, 1f, 180f); float num5 = Mathf.Clamp01(softness); if (!((Object)(object)_selectiveColorLutTexture == (Object)null) && ((Texture)_selectiveColorLutTexture).width == num && ((Texture)_selectiveColorLutTexture).height == num2 && !(Mathf.Abs(_selectiveColorLastIntensity - intensity) > 0.0005f) && !(Mathf.Abs(_selectiveColorLastHue - num3) > 0.01f) && !(Mathf.Abs(_selectiveColorLastRange - num4) > 0.01f) && !(Mathf.Abs(_selectiveColorLastSoftness - num5) > 0.0005f) && _selectiveColorLastPosterizeLevels == posterizeLevels) { return _selectiveColorLutTexture; } if ((Object)(object)_selectiveColorLutTexture != (Object)null) { Object.Destroy((Object)(object)_selectiveColorLutTexture); _selectiveColorLutTexture = null; } Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false, true) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1, hideFlags = (HideFlags)61, name = "ShaderPlayground.SelectiveColorLUT" }; Color32[] array = (Color32[])(object)new Color32[num * num2]; float num6 = 31f; float num7 = ((posterizeLevels > 1) ? ((float)posterizeLevels - 1f) : 1f); float softnessDegrees = Mathf.Max(0.0001f, num4 * Mathf.Lerp(0.2f, 2f, num5)); float num13 = default(float); float num14 = default(float); float num15 = default(float); for (int i = 0; i < 32; i++) { float num8 = (float)i / num6; int num9 = i * num; for (int j = 0; j < 32; j++) { float num10 = (float)j / num6; int num11 = num9 + j * 32; for (int k = 0; k < 32; k++) { float num12 = (float)k / num6; Color.RGBToHSV(new Color(num12, num8, num10, 1f), ref num13, ref num14, ref num15); float num16 = ComputeHueKeepFactor(Mathf.Abs(Mathf.DeltaAngle(num13 * 360f, num3)), num4, softnessDegrees); float num17 = 1f - intensity * (1f - num16); num14 = Mathf.Clamp01(num14 * num17); Color val2 = Color.HSVToRGB(num13, num14, num15, true); if (posterizeLevels >= 3) { val2.r = Mathf.Round(val2.r * num7) / num7; val2.g = Mathf.Round(val2.g * num7) / num7; val2.b = Mathf.Round(val2.b * num7) / num7; } array[num11 + k] = Color32.op_Implicit(val2); } } } val.SetPixels32(array); val.Apply(false, false); _selectiveColorLutTexture = val; _selectiveColorLastIntensity = intensity; _selectiveColorLastHue = num3; _selectiveColorLastRange = num4; _selectiveColorLastSoftness = num5; _selectiveColorLastPosterizeLevels = posterizeLevels; return _selectiveColorLutTexture; } private static float NormalizeHueDegrees(float hue) { float num = hue % 360f; if (num < 0f) { num += 360f; } return num; } private static float ComputeHueKeepFactor(float hueDistance, float range, float softnessDegrees) { if (hueDistance <= range) { return 1f; } float num = Mathf.Clamp01((hueDistance - range) / softnessDegrees); num = num * num * (3f - 2f * num); return 1f - num; } private void DisableLutBlend() { if (!((Object)(object)_colorLookup == (Object)null)) { ((VolumeComponent)_colorLookup).active = false; ((VolumeParameter)_colorLookup.texture).overrideState = true; ((VolumeParameter)(object)_colorLookup.texture).value = null; ((VolumeParameter)_colorLookup.contribution).overrideState = true; ((VolumeParameter)(object)_colorLookup.contribution).value = 0f; } } private Texture2D? BuildBlendedLutTexture(Texture2D lutA, Texture2D lutB, float blend) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_0120: 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_0129: 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_0132: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_015d: 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_0172: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)lutA == (Object)null || (Object)(object)lutB == (Object)null) { return null; } if (((Texture)lutA).width != ((Texture)lutB).width || ((Texture)lutA).height != ((Texture)lutB).height) { if (_showNotifications.Value) { Notify("LUT A/B sizes mismatch. Use matching strip LUT dimensions."); } return null; } if ((Object)(object)_lutRuntimeBlendTexture == (Object)null || ((Texture)_lutRuntimeBlendTexture).width != ((Texture)lutA).width || ((Texture)_lutRuntimeBlendTexture).height != ((Texture)lutA).height) { if ((Object)(object)_lutRuntimeBlendTexture != (Object)null) { Object.Destroy((Object)(object)_lutRuntimeBlendTexture); } _lutRuntimeBlendTexture = new Texture2D(((Texture)lutA).width, ((Texture)lutA).height, (TextureFormat)4, false, true) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1, hideFlags = (HideFlags)61, name = "ShaderPlayground.LutBlend" }; _lutLastBlendApplied = -1f; } if (Mathf.Abs(_lutLastBlendApplied - blend) < 0.001f && !_lutDirty) { return _lutRuntimeBlendTexture; } Color32[] pixels = lutA.GetPixels32(); Color32[] pixels2 = lutB.GetPixels32(); Color32[] array = (Color32[])(object)new Color32[pixels.Length]; for (int i = 0; i < pixels.Length; i++) { Color32 val = pixels[i]; Color32 val2 = pixels2[i]; array[i] = new Color32((byte)((float)(int)val.r + (float)(val2.r - val.r) * blend), (byte)((float)(int)val.g + (float)(val2.g - val.g) * blend), (byte)((float)(int)val.b + (float)(val2.b - val.b) * blend), (byte)((float)(int)val.a + (float)(val2.a - val.a) * blend)); } _lutRuntimeBlendTexture.SetPixels32(array); _lutRuntimeBlendTexture.Apply(false, false); _lutLastBlendApplied = blend; _lutDirty = false; return _lutRuntimeBlendTexture; } private int GetPosterizeLevels() { float num = Mathf.Clamp01(_posterizeIntensity.Value); return Mathf.Clamp(Mathf.RoundToInt(Mathf.Lerp(32f, 3f, num)), 3, 32); } private Texture2D? EnsurePosterizeLutTexture(int levels) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if (levels < 2) { return null; } int num = 1024; int num2 = 32; if (!((Object)(object)_posterizeLutTexture == (Object)null) && _posterizeLutLevels == levels && ((Texture)_posterizeLutTexture).width == num && ((Texture)_posterizeLutTexture).height == num2) { return _posterizeLutTexture; } if ((Object)(object)_posterizeLutTexture != (Object)null) { Object.Destroy((Object)(object)_posterizeLutTexture); _posterizeLutTexture = null; } Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false, true) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1, hideFlags = (HideFlags)61, name = "ShaderPlayground.PosterizeLUT" }; Color32[] array = (Color32[])(object)new Color32[num * num2]; float num3 = 31f; float num4 = (float)levels - 1f; for (int i = 0; i < 32; i++) { float num5 = Mathf.Round((float)i / num3 * num4) / num4; int num6 = i * num; for (int j = 0; j < 32; j++) { float num7 = Mathf.Round((float)j / num3 * num4) / num4; int num8 = num6 + j * 32; for (int k = 0; k < 32; k++) { float num9 = Mathf.Round((float)k / num3 * num4) / num4; array[num8 + k] = Color32.op_Implicit(new Color(num9, num5, num7, 1f)); } } } val.SetPixels32(array); val.Apply(false, false); _posterizeLutTexture = val; _posterizeLutLevels = levels; return _posterizeLutTexture; } private void EnsureLutTexturesLoaded(bool forceReload) { if (!forceReload && !_lutDirty) { return; } string text = (_lutPathA.Value ?? string.Empty).Trim(); string text2 = (_lutPathB.Value ?? string.Empty).Trim(); if (!forceReload && string.Equals(text, _lutLoadedPathA, StringComparison.Ordinal) && string.Equals(text2, _lutLoadedPathB, StringComparison.Ordinal)) { _lutDirty = false; return; } if ((Object)(object)_lutTextureA != (Object)null) { Object.Destroy((Object)(object)_lutTextureA); _lutTextureA = null; } if ((Object)(object)_lutTextureB != (Object)null) { Object.Destroy((Object)(object)_lutTextureB); _lutTextureB = null; } if ((Object)(object)_lutRuntimeBlendTexture != (Object)null) { Object.Destroy((Object)(object)_lutRuntimeBlendTexture); _lutRuntimeBlendTexture = null; } _lutTextureA = TryLoadLutFromPath(text, "A"); _lutTextureB = TryLoadLutFromPath(text2, "B"); _lutLoadedPathA = text; _lutLoadedPathB = text2; _lutDirty = false; _lutLastBlendApplied = -1f; } private Texture2D? TryLoadLutFromPath(string inputPath, string label) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown if (string.IsNullOrWhiteSpace(inputPath)) { return null; } string text = Environment.ExpandEnvironmentVariables(inputPath.Trim().Trim('"')); if (!File.Exists(text)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[ShaderPlayground] LUT " + label + " file not found: " + text)); return null; } try { byte[] array = File.ReadAllBytes(text); if (array.Length == 0) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[ShaderPlayground] LUT " + label + " file is empty: " + text)); return null; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false, true) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1, hideFlags = (HideFlags)61, name = "ShaderPlayground.LUT." + label }; if (!ImageConversion.LoadImage(val, array, false)) { Object.Destroy((Object)(object)val); ((BaseUnityPlugin)this).Logger.LogWarning((object)("[ShaderPlayground] LUT " + label + " decode failed: " + text)); return null; } if (!IsValidStripLut(val)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)string.Format("[{0}] LUT {1} has invalid strip dimensions {2}x{3} (expected width=height^2).", "ShaderPlayground", label, ((Texture)val).width, ((Texture)val).height)); Object.Destroy((Object)(object)val); return null; } val.Apply(false, false); return val; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[ShaderPlayground] LUT " + label + " load failed: " + ex.GetBaseException().Message)); return null; } } private static bool IsValidStripLut(Texture2D texture) { if ((Object)(object)texture == (Object)null || ((Texture)texture).width <= 0 || ((Texture)texture).height <= 0) { return false; } return ((Texture)texture).width == ((Texture)texture).height * ((Texture)texture).height; } private void DestroyLutTextures() { if ((Object)(object)_lutTextureA != (Object)null) { Object.Destroy((Object)(object)_lutTextureA); } if ((Object)(object)_lutTextureB != (Object)null) { Object.Destroy((Object)(object)_lutTextureB); } if ((Object)(object)_lutRuntimeBlendTexture != (Object)null) { Object.Destroy((Object)(object)_lutRuntimeBlendTexture); } if ((Object)(object)_posterizeLutTexture != (Object)null) { Object.Destroy((Object)(object)_posterizeLutTexture); } if ((Object)(object)_selectiveColorLutTexture != (Object)null) { Object.Destroy((Object)(object)_selectiveColorLutTexture); } _lutTextureA = null; _lutTextureB = null; _lutRuntimeBlendTexture = null; _posterizeLutTexture = null; _selectiveColorLutTexture = null; _lutLoadedPathA = string.Empty; _lutLoadedPathB = string.Empty; _lutDirty = true; _lutLastBlendApplied = -1f; _posterizeLutLevels = -1; _selectiveColorLastIntensity = -1f; _selectiveColorLastHue = -1f; _selectiveColorLastRange = -1f; _selectiveColorLastSoftness = -1f; _selectiveColorLastPosterizeLevels = -1; } private void DisableVisuals() { DisableLutBlend(); if ((Object)(object)_volume != (Object)null) { ((Behaviour)_volume).enabled = false; _volume.weight = 0f; } RestoreMaterialBaselines(); RestoreRenderBaseline(); RestoreRenderScaleBaseline(); } private bool ShouldApplyLocalVisuals() { if (!_masterEnabled.Value) { return false; } if (IsSceneSuspendedForVisualOverrides()) { return false; } return true; } private void DestroyVolume() { if ((Object)(object)_volume != (Object)null) { try { Object.Destroy((Object)(object)((Component)_volume).gameObject); } catch { } } _volume = null; _profile = null; } private void CaptureRenderBaselineIfNeeded() { //IL_000a: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!_renderBaselineCaptured) { _baseFogColor = RenderSettings.fogColor; _baseFogEnabled = RenderSettings.fog; _baseFogDensity = RenderSettings.fogDensity; _baseFogMode = RenderSettings.fogMode; _baseAmbientMode = RenderSettings.ambientMode; _baseAmbientSkyColor = RenderSettings.ambientSkyColor; _baseAmbientEquatorColor = RenderSettings.ambientEquatorColor; _baseAmbientGroundColor = RenderSettings.ambientGroundColor; _baseSkyboxMaterial = RenderSettings.skybox; _baseSunLight = (Light?)(((Object)(object)RenderSettings.sun != (Object)null) ? ((object)RenderSettings.sun) : ((object)ResolvePrimarySunLight())); if ((Object)(object)_baseSunLight != (Object)null) { _baseSunColor = _baseSunLight.color; _baseSunIntensity = _baseSunLight.intensity; _baseSunTemperature = _baseSunLight.colorTemperature; } _renderBaselineCaptured = true; } } private void RestoreRenderBaseline() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if (_renderBaselineCaptured) { RenderSettings.fogColor = _baseFogColor; RenderSettings.fog = _baseFogEnabled; RenderSettings.fogDensity = _baseFogDensity; RenderSettings.fogMode = _baseFogMode; RenderSettings.ambientMode = _baseAmbientMode; RenderSettings.ambientSkyColor = _baseAmbientSkyColor; RenderSettings.ambientEquatorColor = _baseAmbientEquatorColor; RenderSettings.ambientGroundColor = _baseAmbientGroundColor; RenderSettings.skybox = _baseSkyboxMaterial; if ((Object)(object)_runtimeSkyboxMaterial != (Object)null) { Object.Destroy((Object)(object)_runtimeSkyboxMaterial); _runtimeSkyboxMaterial = null; _runtimeSkyboxSource = null; } if ((Object)(object)_baseSunLight != (Object)null) { _baseSunLight.color = _baseSunColor; _baseSunLight.intensity = _baseSunIntensity; _baseSunLight.colorTemperature = _baseSunTemperature; } _renderBaselineCaptured = false; } } private static Light? ResolvePrimarySunLight() { //IL_001d: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 Light[] array = Resources.FindObjectsOfTypeAll(); foreach (Light val in array) { if (!((Object)(object)val == (Object)null)) { Scene scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).IsValid() && (int)val.type == 1) { return val; } } } return null; } private bool TryGetGodraySource(out Vector2 viewport, out float visibility) { //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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00dd: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_00f4: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_009e: Invalid comparison between Unknown and I4 //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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) //IL_0181: Unknown result type (might be due to invalid IL or missing references) viewport = new Vector2(0.5f, 0.5f); visibility = 0f; Light val = (((Object)(object)_baseSunLight != (Object)null) ? _baseSunLight : ResolvePrimarySunLight()); if ((Object)(object)val == (Object)null || !((Behaviour)val).enabled) { return false; } Camera val2 = Camera.main; if ((Object)(object)val2 == (Object)null || !((Behaviour)val2).isActiveAndEnabled) { Camera[] allCameras = Camera.allCameras; foreach (Camera val3 in allCameras) { if ((Object)(object)val3 != (Object)null && ((Behaviour)val3).isActiveAndEnabled && ((Component)val3).gameObject.activeInHierarchy && (int)val3.cameraType == 1) { val2 = val3; break; } } } if ((Object)(object)val2 == (Object)null) { return false; } Vector3 position = ((Component)val2).transform.position; Vector3 forward = ((Component)val).transform.forward; Vector3 val4 = position + -((Vector3)(ref forward)).normalized * 2500f; Vector3 val5 = val2.WorldToViewportPoint(val4); if (val5.z <= 0f) { return false; } viewport = new Vector2(Mathf.Clamp01(val5.x), Mathf.Clamp01(val5.y)); float num = ((val5.x < 0f) ? (0f - val5.x) : ((val5.x > 1f) ? (val5.x - 1f) : 0f)); float num2 = ((val5.y < 0f) ? (0f - val5.y) : ((val5.y > 1f) ? (val5.y - 1f) : 0f)); float num3 = Mathf.Clamp01(Mathf.Sqrt(num * num + num2 * num2) * 2.2f); float num4 = ((_weatherSystemEnabled.Value && _activeWeatherMood == WeatherMood.Storm) ? Mathf.Lerp(1f, 0.45f, Mathf.Clamp01(_weatherStrength.Value)) : 1f); float num5 = Mathf.Clamp01(val.intensity * Mathf.Clamp(_sunIntensityMultiplier.Value, 0f, 3f) / 1.6f); visibility = Mathf.Clamp01((1f - num3) * num4 * Mathf.Max(0.2f, num5)); return visibility > 0.001f; } private void EnsureRuntimeSkyboxMaterial(Material source) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown if ((Object)(object)source == (Object)null) { return; } if ((Object)(object)_runtimeSkyboxMaterial == (Object)null || _runtimeSkyboxSource != source) { if ((Object)(object)_runtimeSkyboxMaterial != (Object)null) { Object.Destroy((Object)(object)_runtimeSkyboxMaterial); } _runtimeSkyboxMaterial = new Material(source) { hideFlags = (HideFlags)61 }; _runtimeSkyboxSource = source; } if (RenderSettings.skybox != _runtimeSkyboxMaterial) { RenderSettings.skybox = _runtimeSkyboxMaterial; } } private void RefreshSkyboxMaterialOptions() { _skyboxMaterialIndex.Value = Mathf.Clamp(_skyboxMaterialIndex.Value, 0, 1); } private Material? GetSelectedSkyboxSourceMaterial() { int num = Mathf.Clamp(_skyboxMaterialIndex.Value, 0, 1); _skyboxMaterialIndex.Value = num; if (num == 1) { return GetOrCreateWhiteSkyboxMaterial(); } return _baseSkyboxMaterial ?? RenderSettings.skybox; } private Material? GetOrCreateStarsSkyboxMaterial() { //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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_starsSkyboxMaterial != (Object)null) { return _starsSkyboxMaterial; } Shader val = Shader.Find("Skybox/Panoramic"); if ((Object)(object)val == (Object)null) { return _baseSkyboxMaterial ?? RenderSettings.skybox; } _starsSkyboxMaterial = new Material(val) { hideFlags = (HideFlags)61, name = "ShaderPlayground.StarsSkybox" }; Texture2D orCreateStarsSkyTexture = GetOrCreateStarsSkyTexture(); if ((Object)(object)orCreateStarsSkyTexture != (Object)null) { if (_starsSkyboxMaterial.HasProperty("_MainTex")) { _starsSkyboxMaterial.SetTexture("_MainTex", (Texture)(object)orCreateStarsSkyTexture); } if (_starsSkyboxMaterial.HasProperty("_ImageType")) { _starsSkyboxMaterial.SetFloat("_ImageType", 0f); } if (_starsSkyboxMaterial.HasProperty("_Mapping")) { _starsSkyboxMaterial.SetFloat("_Mapping", 0f); } if (_starsSkyboxMaterial.HasProperty("_Layout")) { _starsSkyboxMaterial.SetFloat("_Layout", 0f); } if (_starsSkyboxMaterial.HasProperty("_Tint")) { _starsSkyboxMaterial.SetColor("_Tint", new Color(0.95f, 0.95f, 1f, 1f)); } if (_starsSkyboxMaterial.HasProperty("_Exposure")) { _starsSkyboxMaterial.SetFloat("_Exposure", 1f); } if (_starsSkyboxMaterial.HasProperty("_Rotation")) { _starsSkyboxMaterial.SetFloat("_Rotation", 0f); } } return _starsSkyboxMaterial; } private Material? GetOrCreateWhiteSkyboxMaterial() { //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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0075: 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) if ((Object)(object)_whiteSkyboxMaterial != (Object)null) { return _whiteSkyboxMaterial; } Shader val = Shader.Find("Skybox/Procedural"); if ((Object)(object)val == (Object)null) { return _baseSkyboxMaterial ?? RenderSettings.skybox; } _whiteSkyboxMaterial = new Material(val) { hideFlags = (HideFlags)61, name = "ShaderPlayground.WhiteSkybox" }; if (_whiteSkyboxMaterial.HasProperty("_SkyTint")) { _whiteSkyboxMaterial.SetColor("_SkyTint", Color.black); } if (_whiteSkyboxMaterial.HasProperty("_GroundColor")) { _whiteSkyboxMaterial.SetColor("_GroundColor", Color.black); } if (_whiteSkyboxMaterial.HasProperty("_Exposure")) { _whiteSkyboxMaterial.SetFloat("_Exposure", 0.08f); } if (_whiteSkyboxMaterial.HasProperty("_SunSize")) { _whiteSkyboxMaterial.SetFloat("_SunSize", 0.02f); } if (_whiteSkyboxMaterial.HasProperty("_AtmosphereThickness")) { _whiteSkyboxMaterial.SetFloat("_AtmosphereThickness", 0f); } return _whiteSkyboxMaterial; } private Texture2D? GetOrCreateStarsSkyTexture() { //IL_0021: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_starsSkyTexture != (Object)null) { return _starsSkyTexture; } Texture2D val = new Texture2D(512, 256, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)0, filterMode = (FilterMode)1, name = "ShaderPlayground.StarsTexture", hideFlags = (HideFlags)61 }; int num = 173221; Color val2 = default(Color); for (int i = 0; i < 256; i++) { for (int j = 0; j < 512; j++) { num = num * 1103515245 + 12345; float num2 = (float)((num >> 16) & 0x7FFF) / 32767f; ((Color)(ref val2))..ctor(0.012f, 0.014f, 0.03f, 1f); if (num2 > 0.996f) { float num3 = Mathf.Lerp(0.75f, 1f, num2); ((Color)(ref val2))..ctor(num3, num3, Mathf.Lerp(0.92f, 1f, num2), 1f); } val.SetPixel(j, i, val2); } } val.Apply(false, false); _starsSkyTexture = val; return _starsSkyTexture; } private static UniversalRenderPipelineAsset? ResolveUrpAsset() { RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline; return (UniversalRenderPipelineAsset?)(((object)((currentRenderPipeline is UniversalRenderPipelineAsset) ? currentRenderPipeline : null)) ?? ((object)/*isinst with value type is only supported in some contexts*/)); } private void CaptureRenderScaleBaselineIfNeeded() { if (!_renderScaleBaselineCaptured) { _baseUrpAsset = ResolveUrpAsset(); if (!((Object)(object)_baseUrpAsset == (Object)null)) { _baseUrpRenderScale = _baseUrpAsset.renderScale; _renderScaleBaselineCaptured = true; } } } private void RestoreRenderScaleBaseline() { if (_renderScaleBaselineCaptured && !((Object)(object)_baseUrpAsset == (Object)null)) { _baseUrpAsset.renderScale = _baseUrpRenderScale; _renderScaleBaselineCaptured = false; } } private void ApplyPixelateRenderScaleOverride(float pixelAmount) { if (pixelAmount <= 0.001f) { RestoreRenderScaleBaseline(); return; } CaptureRenderScaleBaselineIfNeeded(); UniversalRenderPipelineAsset val = _baseUrpAsset ?? ResolveUrpAsset(); if (!((Object)(object)val == (Object)null)) { float num = Mathf.Lerp(1f, 0.3f, Mathf.Clamp01(pixelAmount)); val.renderScale = Mathf.Clamp(num, 0.25f, 1f); } } private void ApplySkyAndWeatherLighting() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_057b: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_058d: 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_0591: 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_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: 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) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: 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_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: 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_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0460: 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_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: 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_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: 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_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_07de: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Unknown result type (might be due to invalid IL or missing references) //IL_07e6: Unknown result type (might be due to invalid IL or missing references) //IL_07f1: Unknown result type (might be due to invalid IL or missing references) //IL_07f6: Unknown result type (might be due to invalid IL or missing references) //IL_07f9: Unknown result type (might be due to invalid IL or missing references) //IL_0804: Unknown result type (might be due to invalid IL or missing references) //IL_0809: Unknown result type (might be due to invalid IL or missing references) //IL_080c: Unknown result type (might be due to invalid IL or missing references) //IL_081d: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_0825: Unknown result type (might be due to invalid IL or missing references) //IL_086d: Unknown result type (might be due to invalid IL or missing references) //IL_0872: 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_08ba: Unknown result type (might be due to invalid IL or missing references) //IL_08bc: Unknown result type (might be due to invalid IL or missing references) //IL_08ce: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06c2: Unknown result type (might be due to invalid IL or missing references) //IL_06c7: Unknown result type (might be due to invalid IL or missing references) //IL_07be: Unknown result type (might be due to invalid IL or missing references) //IL_072f: 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) bool flag = _volumetricFogTintEnabled.Value && _volumetricFogTintIntensity.Value > 0.001f; if (!_enhancedSkyEnabled.Value) { if (!flag) { RestoreRenderBaseline(); return; } CaptureRenderBaselineIfNeeded(); Color fogColor = _baseFogColor; float fogDensity = Mathf.Max(0.0001f, _baseFogDensity); ApplyVolumetricFogTint(ref fogColor, ref fogDensity, 1f); RenderSettings.fog = true; RenderSettings.fogColor = fogColor; RenderSettings.fogDensity = fogDensity; return; } CaptureRenderBaselineIfNeeded(); RefreshActiveWeatherMood(); float num = Mathf.Clamp01(_weatherStrength.Value); float num2 = Mathf.Clamp01(_skyIntensity.Value); float num3 = Mathf.Clamp01(Mathf.Lerp(num2 * 0.55f, num2, num)); Color val = default(Color); ((Color)(ref val))..ctor(0.52f, 0.68f, 0.88f); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.48f, 0.56f, 0.66f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.28f, 0.34f, 0.31f); Color fogColor2 = default(Color); ((Color)(ref fogColor2))..ctor(0.62f, 0.71f, 0.81f); Color val4 = default(Color); ((Color)(ref val4))..ctor(1f, 0.97f, 0.9f); float num4 = ((_baseSunIntensity > 0f) ? _baseSunIntensity : 1.1f); float fogDensity2 = Mathf.Max(0.0004f, _baseFogDensity); switch (_activeWeatherMood) { case WeatherMood.Golden: ((Color)(ref val))..ctor(0.76f, 0.67f, 0.58f); ((Color)(ref val2))..ctor(0.82f, 0.62f, 0.48f); ((Color)(ref val3))..ctor(0.38f, 0.31f, 0.23f); ((Color)(ref fogColor2))..ctor(0.89f, 0.67f, 0.52f); ((Color)(ref val4))..ctor(1f, 0.84f, 0.62f); num4 = Mathf.Max(1.3f, _baseSunIntensity + 0.3f); fogDensity2 = Mathf.Max(_baseFogDensity, 0.0013f); break; case WeatherMood.Overcast: ((Color)(ref val))..ctor(0.51f, 0.56f, 0.64f); ((Color)(ref val2))..ctor(0.47f, 0.5f, 0.54f); ((Color)(ref val3))..ctor(0.29f, 0.31f, 0.33f); ((Color)(ref fogColor2))..ctor(0.57f, 0.6f, 0.64f); ((Color)(ref val4))..ctor(0.9f, 0.92f, 0.95f); num4 = Mathf.Max(0.75f, _baseSunIntensity * 0.72f); fogDensity2 = Mathf.Max(_baseFogDensity, 0.0018f); break; case WeatherMood.Storm: ((Color)(ref val))..ctor(0.27f, 0.33f, 0.41f); ((Color)(ref val2))..ctor(0.24f, 0.28f, 0.33f); ((Color)(ref val3))..ctor(0.16f, 0.19f, 0.22f); ((Color)(ref fogColor2))..ctor(0.36f, 0.41f, 0.46f); ((Color)(ref val4))..ctor(0.72f, 0.79f, 0.9f); num4 = Mathf.Max(0.55f, _baseSunIntensity * 0.58f); fogDensity2 = Mathf.Max(_baseFogDensity, 0.0032f); break; case WeatherMood.Dream: ((Color)(ref val))..ctor(0.66f, 0.58f, 0.78f); ((Color)(ref val2))..ctor(0.61f, 0.55f, 0.71f); ((Color)(ref val3))..ctor(0.38f, 0.31f, 0.42f); ((Color)(ref fogColor2))..ctor(0.73f, 0.62f, 0.79f); ((Color)(ref val4))..ctor(0.98f, 0.85f, 1f); num4 = Mathf.Max(0.95f, _baseSunIntensity * 0.92f); fogDensity2 = Mathf.Max(_baseFogDensity, 0.0016f); break; } if (_cloudLayersEnabled.Value) { float num5 = Mathf.Clamp01(_cloudDensity.Value); if (num5 > 0.001f) { Color val5 = Color.Lerp(new Color(0.92f, 0.94f, 0.98f, 1f), new Color(0.52f, 0.57f, 0.64f, 1f), num5); val = Color.Lerp(val, val * val5, 0.78f * num5); val2 = Color.Lerp(val2, val2 * val5, 0.72f * num5); val3 = Color.Lerp(val3, val3 * new Color(0.84f, 0.86f, 0.9f, 1f), 0.35f * num5); fogColor2 = Color.Lerp(fogColor2, new Color(0.52f, 0.57f, 0.63f, 1f), 0.58f * num5); fogDensity2 = Mathf.Max(fogDensity2, Mathf.Lerp(0.0012f, 0.0048f, num5)); num4 = Mathf.Lerp(num4, Mathf.Max(0.24f, _baseSunIntensity * 0.42f), 0.8f * num5); } } float num6 = Mathf.Clamp(_skyHueShift.Value, -180f, 180f); float num7 = Mathf.Max(Mathf.Clamp01(_skyColorBlend.Value), Mathf.Clamp01(Mathf.Abs(num6) / 120f)); if (num7 > 0.001f) { val = Color.Lerp(val, ShiftHue(val, num6), num7); val2 = Color.Lerp(val2, ShiftHue(val2, num6), num7); val3 = Color.Lerp(val3, ShiftHue(val3, num6 * 0.45f), num7 * 0.6f); fogColor2 = Color.Lerp(fogColor2, ShiftHue(fogColor2, num6 * 0.85f), num7 * 0.8f); val4 = Color.Lerp(val4, ShiftHue(val4, num6 * 0.4f), num7 * 0.45f); } ApplyVolumetricFogTint(ref fogColor2, ref fogDensity2, num3); int num8 = Mathf.Clamp(_skyboxMaterialIndex.Value, 0, 1); Material selectedSkyboxSourceMaterial = GetSelectedSkyboxSourceMaterial(); if ((Object)(object)selectedSkyboxSourceMaterial != (Object)null) { EnsureRuntimeSkyboxMaterial(selectedSkyboxSourceMaterial); } if ((Object)(object)_runtimeSkyboxMaterial != (Object)null) { float num9 = Mathf.Clamp01(((_activeWeatherMood == WeatherMood.Storm) ? 0.5f : 0f) + ((_activeWeatherMood == WeatherMood.Overcast) ? 0.3f : 0f) + (_cloudLayersEnabled.Value ? (_cloudDensity.Value * 0.45f) : 0f)); Color value = Color.Lerp(val, new Color(0.07f, 0.09f, 0.14f, 1f), num9); float value2 = Mathf.Lerp(1f, 0.18f, Mathf.Clamp01(num3 * 0.7f + num9 * 0.8f)) * Mathf.Clamp(_skyExposure.Value, 0.05f, 2.5f); if (num8 == 1) { if (_runtimeSkyboxMaterial.HasProperty("_SkyTint")) { _runtimeSkyboxMaterial.SetColor("_SkyTint", Color.black); } if (_runtimeSkyboxMaterial.HasProperty("_GroundColor")) { _runtimeSkyboxMaterial.SetColor("_GroundColor", Color.black); } if (_runtimeSkyboxMaterial.HasProperty("_Exposure")) { _runtimeSkyboxMaterial.SetFloat("_Exposure", Mathf.Clamp(0.08f * Mathf.Clamp(_skyExposure.Value, 0.05f, 2.5f), 0.02f, 0.3f)); } } else { SetMaterialColor(_runtimeSkyboxMaterial, SkyColorProperties, value); SetMaterialFloat(_runtimeSkyboxMaterial, SkyExposureProperties, value2); } } RenderSettings.ambientMode = (AmbientMode)1; RenderSettings.ambientSkyColor = Color.Lerp(_baseAmbientSkyColor, val, num3); RenderSettings.ambientEquatorColor = Color.Lerp(_baseAmbientEquatorColor, val2, num3); RenderSettings.ambientGroundColor = Color.Lerp(_baseAmbientGroundColor, val3, num3); RenderSettings.fog = true; RenderSettings.fogColor = Color.Lerp(_baseFogColor, fogColor2, num3); RenderSettings.fogDensity = Mathf.Lerp(_baseFogDensity, fogDensity2, num3); Light val6 = (((Object)(object)_baseSunLight != (Object)null) ? _baseSunLight : ResolvePrimarySunLight()); if ((Object)(object)val6 != (Object)null) { Color val7 = Color.Lerp(_baseSunColor, val4, num3); Color val8 = default(Color); ((Color)(ref val8))..ctor(Mathf.Clamp01(_sunColorR.Value), Mathf.Clamp01(_sunColorG.Value), Mathf.Clamp01(_sunColorB.Value), 1f); val6.color = Color.Lerp(val7, val8, Mathf.Clamp01(_sunColorBlend.Value)); val6.intensity = Mathf.Lerp(_baseSunIntensity, num4, num3) * Mathf.Clamp(_sunIntensityMultiplier.Value, 0f, 3f); val6.useColorTemperature = true; val6.colorTemperature = Mathf.Clamp(_sunTemperature.Value, 1000f, 20000f); } } private void ApplyVolumetricFogTint(ref Color fogColor, ref float fogDensity, float blendFactor) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if (_volumetricFogTintEnabled.Value) { float num = Mathf.Clamp01(_volumetricFogTintIntensity.Value); if (!(num <= 0.001f)) { float num2 = Mathf.Clamp01(_volumetricFogTintDensity.Value); float num3 = Mathf.Repeat(_volumetricFogTintHue.Value / 360f, 1f); Color val = Color.HSVToRGB(num3, Mathf.Lerp(0.35f, 0.95f, num), Mathf.Lerp(0.35f, 0.86f, num)); val.a = 1f; float num4 = Mathf.Clamp01(num * Mathf.Lerp(0.35f, 0.95f, Mathf.Clamp01(blendFactor))); fogColor = Color.Lerp(fogColor, val, num4); float num5 = Mathf.Max(0.0001f, fogDensity); float num6 = Mathf.Lerp(1f, 1.95f + num2 * 7.2f, num); float num7 = 0.5f + 0.5f * Mathf.Sin(Time.unscaledTime * 0.23f + num3 * MathF.PI * 2f); float num8 = Mathf.Lerp(1f, Mathf.Lerp(0.85f, 1.35f, num7), num * num2 * 0.35f); fogDensity = Mathf.Clamp(num5 * num6 * num8, 5E-05f, 0.12f); RenderSettings.fogMode = (FogMode)3; } } } private void RefreshActiveWeatherMood() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (!_weatherSystemEnabled.Value) { _activeWeatherMood = WeatherMood.Clear; return; } if (_weatherMode.Value > 0) { _activeWeatherMood = _weatherMode.Value switch { 1 => WeatherMood.Clear, 2 => WeatherMood.Golden, 3 => WeatherMood.Overcast, 4 => WeatherMood.Storm, 5 => WeatherMood.Dream, _ => WeatherMood.Clear, }; return; } DateTime date = DateTime.UtcNow.Date; if (!(_lastWeatherSelectionDateUtc == date)) { _lastWeatherSelectionDateUtc = date; Scene activeScene = SceneManager.GetActiveScene(); string text = ((Scene)(ref activeScene)).name ?? string.Empty; int num = date.DayOfYear + text.GetHashCode() + DateTime.UtcNow.Year * 11; WeatherMood[] array = new WeatherMood[5] { WeatherMood.Clear, WeatherMood.Golden, WeatherMood.Overcast, WeatherMood.Storm, WeatherMood.Dream }; int num2 = Mathf.Abs(num) % array.Length; _activeWeatherMood = array[num2]; } } private void RunMaterialScanner(bool logToConsole) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) _scanRenderers.Clear(); _shaderCounts.Clear(); _scanSummaryLines.Clear(); Renderer[] array = Resources.FindObjectsOfTypeAll(); foreach (Renderer val in array) { if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null) { continue; } Scene scene = ((Component)val).gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { continue; } _scanRenderers.Add(val); Material[] sharedMaterials = val.sharedMaterials; if (sharedMaterials == null) { continue; } foreach (Material val2 in sharedMaterials) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.shader == (Object)null)) { string key = ((Object)val2.shader).name ?? "Unknown"; if (_shaderCounts.TryGetValue(key, out var value)) { _shaderCounts[key] = value + 1; } else { _shaderCounts[key] = 1; } } } } bool flag = false; foreach (KeyValuePair item in _shaderCounts.OrderByDescending, int>((KeyValuePair k) => k.Value)) { string key2 = item.Key; int value2 = item.Value; bool flag2 = MatchesAnyKeyword(key2, WaterKeywords); bool flag3 = MatchesAnyKeyword(key2, CloudKeywords); bool flag4 = MatchesAnyKeyword(key2, SkyKeywords); if (flag2 || flag3 || flag4) { flag = true; string arg = ((flag2 ? "Water" : string.Empty) + (flag3 ? "|Cloud" : string.Empty) + (flag4 ? "|Sky" : string.Empty)).Trim('|'); _scanSummaryLines.Add($"[{arg}] {key2} x{value2}"); if (_scanSummaryLines.Count >= 24) { break; } } } if (!flag) { foreach (KeyValuePair item2 in _shaderCounts.OrderByDescending, int>((KeyValuePair k) => k.Value).Take(12)) { _scanSummaryLines.Add($"{item2.Key} x{item2.Value}"); } } if (logToConsole) { ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} scanner: {1} renderers, {2} unique shaders.", "ShaderPlayground", _scanRenderers.Count, _shaderCounts.Count)); for (int l = 0; l < Mathf.Min(_scanSummaryLines.Count, 20); l++) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[ShaderPlayground] " + _scanSummaryLines[l])); } } } private void ApplyWaterAndCloudOverrides() { if (!_waterOverrideEnabled.Value && !_cloudLayersEnabled.Value && !_enhancedSkyEnabled.Value && !_causticsOverlayEnabled.Value) { RestoreMaterialBaselines(); return; } if (_scanRenderers.Count == 0) { RunMaterialScanner(logToConsole: false); } _touchedMaterials.Clear(); for (int i = 0; i < _scanRenderers.Count; i++) { Renderer val = _scanRenderers[i]; if ((Object)(object)val == (Object)null) { continue; } Material[] sharedMaterials = val.sharedMaterials; if (sharedMaterials == null) { continue; } foreach (Material val2 in sharedMaterials) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.shader == (Object)null)) { string value = ((Object)val2.shader).name ?? string.Empty; bool flag = MatchesAnyKeyword(value, WaterKeywords) || HasAnyProperty(val2, WaterSignatureProperties); bool flag2 = MatchesAnyKeyword(value, CloudKeywords) || HasAnyProperty(val2, CloudSignatureProperties); bool flag3 = MatchesAnyKeyword(value, SkyKeywords); if (_waterOverrideEnabled.Value && flag) { ApplyWaterMaterialOverrides(val2); _touchedMaterials.Add(val2); } if (_cloudLayersEnabled.Value && flag2) { ApplyCloudMaterialOverrides(val2); _touchedMaterials.Add(val2); } if (_enhancedSkyEnabled.Value && flag3) { ApplySkyMaterialOverrides(val2); _touchedMaterials.Add(val2); } if (_causticsOverlayEnabled.Value && flag) { ApplyCausticsSurfaceOverrides(val2); _touchedMaterials.Add(val2); } } } } RestoreUntouchedMaterialBaselines(); } private void EnsureMaterialBaseline(Material material) { //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_001e: Expected O, but got Unknown if (!_materialBaselines.ContainsKey(material)) { Material value = new Material(material) { hideFlags = (HideFlags)61 }; _materialBaselines[material] = value; } } private void ApplyWaterMaterialOverrides(Material material) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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) EnsureMaterialBaseline(material); float num = Mathf.Clamp01(_waterClarity.Value); float num2 = Mathf.Clamp01(_waterWaveStrength.Value); Color value = Color.Lerp(new Color(0.08f, 0.2f, 0.23f, 0.76f), new Color(0.25f, 0.55f, 0.62f, 0.82f), num); Color value2 = Color.Lerp(new Color(0.03f, 0.08f, 0.14f, 0.92f), new Color(0.08f, 0.2f, 0.33f, 0.94f), num); Color value3 = Color.Lerp(new Color(0.78f, 0.88f, 0.94f, 0.75f), Color.white, num); SetMaterialColor(material, WaterSurfaceColorProperties, value); SetMaterialColor(material, WaterDeepColorProperties, value2); SetMaterialColor(material, WaterFoamColorProperties, value3); SetMaterialFloat(material, WaterSmoothnessProperties, Mathf.Lerp(0.02f, 0.2f, num)); SetMaterialFloat(material, WaterNormalStrengthProperties, Mathf.Lerp(0.05f, 2f, num2)); SetMaterialFloat(material, WaterWaveStrengthProperties, Mathf.Lerp(0.02f, 2.35f, num2)); SetMaterialFloat(material, WaterWaveScaleProperties, Mathf.Lerp(0.25f, 3f, num2)); SetMaterialFloat(material, WaterWaveSpeedProperties, Mathf.Lerp(0.08f, 1.75f, num2)); SetMaterialFloat(material, WaterFoamAmountProperties, Mathf.Lerp(0.03f, 1.25f, num2)); SetMaterialFloat(material, WaterRefractionProperties, Mathf.Lerp(0.005f, 0.14f, num)); SetMaterialColor(material, WaterEmissionColorProperties, new Color(0.03f, 0.06f, 0.08f, 1f)); SetMaterialFloat(material, WaterEmissionStrengthProperties, 0f); } private void ApplyCloudMaterialOverrides(Material material) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) EnsureMaterialBaseline(material); float num = Mathf.Clamp01(_cloudDensity.Value); float num2 = ((_activeWeatherMood == WeatherMood.Storm) ? Mathf.Clamp01(_weatherStrength.Value) : 0f); Color val = Color.Lerp(new Color(0.93f, 0.95f, 0.97f, 1f), new Color(0.56f, 0.62f, 0.7f, 1f), num2); Color val2 = Color.Lerp(new Color(0.76f, 0.82f, 0.9f, 1f), new Color(0.23f, 0.27f, 0.34f, 1f), num2); SetMaterialColor(material, CloudColorProperties, Color.Lerp(val2, val, 0.55f)); SetMaterialColor(material, CloudShadowColorProperties, val2); SetMaterialFloat(material, CloudDensityProperties, Mathf.Lerp(0.12f, 1.65f, num)); SetMaterialFloat(material, CloudOpacityProperties, Mathf.Lerp(0.18f, 0.98f, num)); SetMaterialFloat(material, CloudSoftnessProperties, Mathf.Lerp(0.03f, 1.1f, num)); SetMaterialFloat(material, CloudDetailProperties, Mathf.Lerp(0.08f, 1.45f, num)); } private void ApplySkyMaterialOverrides(Material material) { //IL_0091: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_0105: 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_010f: 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) EnsureMaterialBaseline(material); float num = Mathf.Clamp01(_skyIntensity.Value); float num2 = (_cloudLayersEnabled.Value ? Mathf.Clamp01(_cloudDensity.Value) : 0f); float num3 = (_weatherSystemEnabled.Value ? Mathf.Clamp01(_weatherStrength.Value) : 0f); float num4 = Mathf.Clamp01(num * 0.55f + num2 * 0.35f + num3 * 0.25f); Color val = Color.Lerp(new Color(0.64f, 0.76f, 0.92f, 1f), new Color(0.08f, 0.1f, 0.16f, 1f), num4); float num5 = Mathf.Clamp(_skyHueShift.Value, -180f, 180f); float num6 = Mathf.Max(Mathf.Clamp01(_skyColorBlend.Value), Mathf.Clamp01(Mathf.Abs(num5) / 120f)); if (num6 > 0.001f) { val = Color.Lerp(val, ShiftHue(val, num5), num6); } float value = Mathf.Lerp(1f, 0.2f, num4) * Mathf.Clamp(_skyExposure.Value, 0.05f, 2.5f); SetMaterialColor(material, SkyColorProperties, val); SetMaterialFloat(material, SkyExposureProperties, value); } private static bool IsCausticsSurfaceCandidate(Renderer renderer, Material material, string shaderName, bool isWater, bool isCloud, bool isSky) { if ((Object)(object)renderer == (Object)null || (Object)(object)material == (Object)null) { return false; } if (isWater || isCloud || isSky) { return false; } if (!renderer.enabled || renderer is SkinnedMeshRenderer) { return false; } if (material.renderQueue >= 3000) { return false; } string[] obj = new string[5] { ((Object)renderer).name, " ", ((Object)((Component)renderer).gameObject).name, " ", null }; Transform parent = ((Component)renderer).transform.parent; obj[4] = ((parent != null) ? ((Object)parent).name : null); string value = string.Concat(obj).ToLowerInvariant(); if (MatchesAnyKeyword(value, CharacterKeywords)) { return false; } bool num = MatchesAnyKeyword(shaderName, SurfaceKeywords) || MatchesAnyKeyword(value, SurfaceKeywords); bool flag = HasAnyProperty(material, SurfaceSignatureProperties); return num || flag; } private void ApplyCausticsSurfaceOverrides(Material material) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: 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) EnsureMaterialBaseline(material); float num = Mathf.Clamp01(_causticsOverlayIntensity.Value); float unscaledTime = Time.unscaledTime; float num2 = Mathf.Abs((float)(((Object)material).GetInstanceID() % 997) / 997f); float num3 = 0.5f + 0.5f * Mathf.Sin(unscaledTime * (1.25f + num2) + num2 * 6.28318f); float num4 = Mathf.PerlinNoise(num2 * 12.7f + unscaledTime * 0.18f, num2 * 9.3f + unscaledTime * 0.22f); float num5 = Mathf.Clamp01(num3 * 0.6f + num4 * 0.4f); float num6 = num * Mathf.Lerp(0.35f, 1f, num5); Color value = Color.Lerp(new Color(0.1f, 0.35f, 0.45f, 1f), new Color(0.52f, 0.9f, 1f, 1f), num5); SetMaterialColor(material, CausticsEmissionColorProperties, value); SetMaterialFloat(material, CausticsEmissionStrengthProperties, Mathf.Lerp(0f, 0.6f, num6)); SetMaterialFloat(material, CausticsStrengthProperties, Mathf.Lerp(0f, 0.8f, num6)); SetMaterialFloat(material, CausticsScaleProperties, Mathf.Lerp(0.45f, 1.35f, 1f - num * 0.35f + num5 * 0.15f)); SetMaterialFloat(material, CausticsSpeedProperties, Mathf.Lerp(0.03f, 0.35f, num)); Vector2 offset = new Vector2(Mathf.Sin(unscaledTime * 0.21f + num2 * 5f), Mathf.Cos(unscaledTime * 0.27f + num2 * 7f)) * (0.01f + 0.025f * num); SetMaterialTextureOffset(material, CausticsUvScrollProperties, offset); } private void RestoreUntouchedMaterialBaselines() { if (_materialBaselines.Count == 0) { return; } List list = new List(); foreach (KeyValuePair materialBaseline in _materialBaselines) { if (!_touchedMaterials.Contains(materialBaseline.Key)) { list.Add(materialBaseline.Key); } } for (int i = 0; i < list.Count; i++) { Material val = list[i]; if ((Object)(object)val == (Object)null || !_materialBaselines.TryGetValue(val, out Material value)) { continue; } try { if ((Object)(object)val != (Object)null && (Object)(object)value != (Object)null) { val.CopyPropertiesFromMaterial(value); } } catch { } if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } _materialBaselines.Remove(val); } } private void RestoreMaterialBaselines() { if (_materialBaselines.Count == 0) { return; } foreach (KeyValuePair materialBaseline in _materialBaselines) { try { if ((Object)(object)materialBaseline.Key != (Object)null && (Object)(object)materialBaseline.Value != (Object)null) { materialBaseline.Key.CopyPropertiesFromMaterial(materialBaseline.Value); } } catch { } if ((Object)(object)materialBaseline.Value != (Object)null) { Object.Destroy((Object)(object)materialBaseline.Value); } } _materialBaselines.Clear(); _touchedMaterials.Clear(); } private void ApplyAntiAliasingPresetToActiveCameras() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_0068: 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_00a9: Unknown result type (might be due to invalid IL or missing references) Camera[] allCameras = Camera.allCameras; if (allCameras == null || allCameras.Length == 0) { return; } foreach (Camera val in allCameras) { if ((Object)(object)val == (Object)null || !((Behaviour)val).isActiveAndEnabled || (int)val.cameraType != 1 || (Object)(object)val.targetTexture != (Object)null) { continue; } UniversalAdditionalCameraData universalAdditionalCameraData = CameraExtensions.GetUniversalAdditionalCameraData(val); if (!((Object)(object)universalAdditionalCameraData == (Object)null)) { universalAdditionalCameraData.renderPostProcessing = true; LayerMask volumeLayerMask = universalAdditionalCameraData.volumeLayerMask; int value = ((LayerMask)(ref volumeLayerMask)).value; value |= 1; if ((Object)(object)_volume != (Object)null) { value |= 1 << ((Component)_volume).gameObject.layer; } universalAdditionalCameraData.volumeLayerMask = LayerMask.op_Implicit(value); if ((Object)(object)universalAdditionalCameraData.volumeTrigger == (Object)null) { universalAdditionalCameraData.volumeTrigger = ((Component)val).transform; } switch (Mathf.Clamp(_antiAliasingPreset.Value, 0, 4)) { case 0: universalAdditionalCameraData.antialiasing = (AntialiasingMode)0; break; case 1: universalAdditionalCameraData.antialiasing = (AntialiasingMode)1; universalAdditionalCameraData.antialiasingQuality = (AntialiasingQuality)1; break; case 2: universalAdditionalCameraData.antialiasing = (AntialiasingMode)2; universalAdditionalCameraData.antialiasingQuality = (AntialiasingQuality)2; break; case 3: universalAdditionalCameraData.antialiasing = (AntialiasingMode)3; universalAdditionalCameraData.antialiasingQuality = (AntialiasingQuality)1; universalAdditionalCameraData.resetHistory = false; break; case 4: universalAdditionalCameraData.antialiasing = (AntialiasingMode)1; universalAdditionalCameraData.antialiasingQuality = (AntialiasingQuality)2; break; } } } } private static bool MatchesAnyKeyword(string value, IReadOnlyList keywords) { if (string.IsNullOrWhiteSpace(value)) { return false; } for (int i = 0; i < keywords.Count; i++) { if (value.IndexOf(keywords[i], StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } private static bool HasAnyProperty(Material material, IReadOnlyList properties) { for (int i = 0; i < properties.Count; i++) { if (material.HasProperty(properties[i])) { return true; } } return false; } private static void SetMaterialColor(Material material, string property, Color value) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (material.HasProperty(property)) { material.SetColor(property, value); } } private static void SetMaterialColor(Material material, IReadOnlyList properties, Color value) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < properties.Count; i++) { SetMaterialColor(material, properties[i], value); } } private static void SetMaterialFloat(Material material, string property, float value) { if (material.HasProperty(property)) { material.SetFloat(property, value); } } private static void SetMaterialFloat(Material material, IReadOnlyList properties, float value) { for (int i = 0; i < properties.Count; i++) { SetMaterialFloat(material, properties[i], value); } } private static void SetMaterialTextureOffset(Material material, string property, Vector2 offset) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (!material.HasProperty(property)) { return; } try { material.SetTextureOffset(property, offset); } catch { } } private static void SetMaterialTextureOffset(Material material, IReadOnlyList properties, Vector2 offset) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < properties.Count; i++) { SetMaterialTextureOffset(material, properties[i], offset); } } private static Color ShiftHue(Color color, float degrees) { //IL_0000: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) float num2 = default(float); float num3 = default(float); float num = default(float); Color.RGBToHSV(color, ref num, ref num2, ref num3); num = Mathf.Repeat(num + degrees / 360f, 1f); Color result = Color.HSVToRGB(num, num2, num3); result.a = color.a; return result; } private bool IsSessionVisualLabOwningVisuals() { return false; } private void TryHookNetwork() { NetworkManager val = NetworkManager.main ?? Object.FindFirstObjectByType(); if (!((Object)(object)val == (Object)null) && val != _network) { UnhookNetwork(); _network = val; RegisterContracts(); _network.Subscribe((PlayerBroadcastDelegate)OnPayload, true); _network.Subscribe((PlayerBroadcastDelegate)OnPayload, false); HandleSyncLifecycleReset("network-hook"); } } private void UnhookNetwork() { if ((Object)(object)_network != (Object)null) { try { _network.Unsubscribe((PlayerBroadcastDelegate)OnPayload, true); _network.Unsubscribe((PlayerBroadcastDelegate)OnPayload, false); } catch { } } _network = null; ResetSyncState("network-unhook"); _clientCapabilityMasks.Clear(); _clientHelloNonces.Clear(); } private bool IsHost() { if ((Object)(object)_network != (Object)null) { if (!_network.isServer) { return _network.isHost; } return true; } return false; } private bool IsClientOnly() { if ((Object)(object)_network != (Object)null && _network.isClient) { return !_network.isServer; } return false; } private ulong LocalPlayerIdOrZero() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) try { NetworkManager? network = _network; long result; if (network == null) { result = 0L; } else { PlayerID localPlayer = network.localPlayer; result = (long)((PlayerID)(ref localPlayer)).id.value; } return (ulong)result; } catch { return 0uL; } } private int GetLocalCapabilityMask() { return 3; } private void SendHello(string reason) { if (!((Object)(object)_network == (Object)null) && IsClientOnly() && !_localOnlyMode.Value && _syncEnabled.Value && _acceptHostSync.Value) { if (string.IsNullOrWhiteSpace(_pendingHelloNonce)) { _pendingHelloNonce = Guid.NewGuid().ToString("N"); } EmitSyncEvent("hello_sent", "reason=" + reason + " nonce=" + _pendingHelloNonce); SendToServer(Msg.Hello, new HelloV2 { ProtocolVersion = 4, ClientPlayerId = LocalPlayerIdOrZero(), ClientNonce = _pendingHelloNonce, Reason = reason, CapabilityMask = GetLocalCapabilityMask(), PluginVersion = "0.5.2" }); } } private void SendStateRequest(string reason) { if (!((Object)(object)_network == (Object)null) && IsClientOnly() && !_localOnlyMode.Value && _syncEnabled.Value && _acceptHostSync.Value) { EmitSyncEvent("state_request_sent", $"reason={reason} epoch={_activeSessionEpoch} wantRev={_lastAcceptedRevision + 1}"); SendToServer(Msg.StateRequest, new StateRequestV2 { ProtocolVersion = 4, SessionEpoch = _activeSessionEpoch, WantRevision = Math.Max(0L, _lastAcceptedRevision + 1), Reason = reason }); } } private void BroadcastSnapshot(string reason) { if (!((Object)(object)_network == (Object)null)) { StateSnapshotV2 stateSnapshotV = BuildSnapshot(reason); EmitSyncEvent("snapshot_broadcast", $"reason={reason} epoch={stateSnapshotV.SessionEpoch} rev={stateSnapshotV.Revision} hash={stateSnapshotV.StateHash} hasState={stateSnapshotV.State != null} stateJsonLen={stateSnapshotV.StateJson?.Length ?? 0}"); SendToAll(Msg.StateSnapshot, stateSnapshotV); } } private void SendSnapshotToPlayer(PlayerID target, string reason) { //IL_002c: 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) if (!((Object)(object)_network == (Object)null)) { StateSnapshotV2 stateSnapshotV = BuildSnapshot(reason); EmitSyncEvent("snapshot_sent", $"target={((PlayerID)(ref target)).id.value} reason={reason} epoch={stateSnapshotV.SessionEpoch} rev={stateSnapshotV.Revision} hash={stateSnapshotV.StateHash} hasState={stateSnapshotV.State != null} stateJsonLen={stateSnapshotV.StateJson?.Length ?? 0}"); SendToPlayer(target, Msg.StateSnapshot, stateSnapshotV); } } private StateSnapshotV2 BuildSnapshot(string reason) { ProfileStateV1 profileStateV = BuildState(reason); string text = JsonUtility.ToJson((object)profileStateV); return new StateSnapshotV2 { ProtocolVersion = 4, SessionEpoch = EnsureHostSessionEpoch(), Revision = profileStateV.Revision, StateHash = ComputeStateHash(profileStateV), State = profileStateV, Profile = profileStateV, ProfileState = profileStateV, StateJson = text, ProfileJson = text, Reason = reason, SentAtUtc = DateTime.UtcNow.ToString("O") }; } private void SendHelloAck(PlayerID target, HelloV2 hello, string reason) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) ProfileStateV1 profileStateV = BuildState("hello-ack"); HelloAckV2 helloAckV = new HelloAckV2 { ProtocolVersion = 4, ClientNonce = (hello.ClientNonce ?? string.Empty), SessionEpoch = EnsureHostSessionEpoch(), HostPlayerId = LocalPlayerIdOrZero(), HostCapabilityMask = GetLocalCapabilityMask(), CurrentRevision = profileStateV.Revision, StateHash = ComputeStateHash(profileStateV), SentAtUtc = DateTime.UtcNow.ToString("O") }; EmitSyncEvent("hello_ack_sent", $"target={((PlayerID)(ref target)).id.value} reason={reason} nonce={helloAckV.ClientNonce} epoch={helloAckV.SessionEpoch} rev={helloAckV.CurrentRevision} hash={helloAckV.StateHash}"); SendToPlayer(target, Msg.HelloAck, helloAckV); } private ProfileStateV1 BuildState(string reason) { return new ProfileStateV1 { ProtocolVersion = 4, Revision = _revision, MasterEnabled = _masterEnabled.Value, EnableShaderPass = _enableShaderPass.Value, QualityTier = _qualityTier.Value, C = _crtEnabled.Value, Ci = Mathf.Clamp(_crtIntensity.Value, 0f, 0.1f), D = _dreamEnabled.Value, Di = _dreamIntensity.Value, K = _comicEnabled.Value, Ki = _comicIntensity.Value, H = _heatwaveEnabled.Value, Hi = Mathf.Clamp(_heatwaveIntensity.Value, 0f, 0.05f), Hs = _heatwaveSpeed.Value, S = _noirEnabled.Value, Si = Mathf.Clamp01(_noirIntensity.Value), V = _vaporEnabled.Value, Vi = Mathf.Clamp01(_vaporIntensity.Value), Pr = _posterizeEnabled.Value, Pri = Mathf.Clamp01(_posterizeIntensity.Value), Px = _pixelateEnabled.Value, Pxi = Mathf.Clamp01(_pixelateIntensity.Value), Cs = _chromaticSplitEnabled.Value, Csi = Mathf.Clamp01(_chromaticSplitIntensity.Value), Dt = _ditherEnabled.Value, Dti = Mathf.Clamp01(_ditherIntensity.Value), LensCx = Mathf.Clamp(_lensCenterX.Value, -1f, 2f), LensCy = Mathf.Clamp(_lensCenterY.Value, -1f, 2f), Mb = _motionBlurEnabled.Value, Mbi = Mathf.Clamp01(_motionBlurIntensity.Value), Df = _depthOfFieldEnabled.Value, Dfi = Mathf.Clamp01(_depthOfFieldIntensity.Value), Ab = _anamorphicBloomEnabled.Value, Abi = Mathf.Clamp01(_anamorphicBloomIntensity.Value), Hf = _halftoneEnabled.Value, Hfi = Mathf.Clamp01(_halftoneIntensity.Value), Hfs = Mathf.Clamp(_halftoneDotSize.Value, 0.25f, 8f), Hfa = Mathf.Clamp(_halftoneAngle.Value, 0f, 180f), Kw = _kuwaharaEnabled.Value, Kwi = Mathf.Clamp01(_kuwaharaIntensity.Value), Kwr = Mathf.Clamp(_kuwaharaRadius.Value, 1f, 6f), Sc = _selectiveColorEnabled.Value, Sci = Mathf.Clamp01(_selectiveColorIntensity.Value), Sch = Mathf.Clamp(_selectiveColorHue.Value, 0f, 360f), Scr = Mathf.Clamp(_selectiveColorRange.Value, 1f, 180f), Scs = Mathf.Clamp01(_selectiveColorSoftness.Value), Rb = _radialBlurEnabled.Value, Rbi = Mathf.Clamp01(_radialBlurIntensity.Value), Ld = _lensDirtEnabled.Value, Ldi = Mathf.Clamp01(_lensDirtIntensity.Value), Rn = _rainOnLensEnabled.Value, Rni = Mathf.Clamp01(_rainOnLensIntensity.Value), Ca = _causticsOverlayEnabled.Value, Cai = Mathf.Clamp01(_causticsOverlayIntensity.Value), Gd = _godrayFakeEnabled.Value, Gdi = Mathf.Clamp01(_godrayFakeIntensity.Value), Fg = _filmGateEnabled.Value, Fgi = Mathf.Clamp01(_filmGateIntensity.Value), Gl = _glitchPackEnabled.Value, Gli = Mathf.Clamp(_glitchPackIntensity.Value, 0f, 0.1f), Vf = _volumetricFogTintEnabled.Value, Vfi = Mathf.Clamp01(_volumetricFogTintIntensity.Value), Vfd = Mathf.Clamp01(_volumetricFogTintDensity.Value), Vfh = Mathf.Clamp(_volumetricFogTintHue.Value, 0f, 360f), Lb = _lutBlendEnabled.Value, Lbi = Mathf.Clamp01(_lutBlendAmount.Value), HypnosisEnabled = false, HypnosisPreset = 0, HypnosisIntensity = 0f, HypnosisSpeed = 0f, HypnosisWarpAmount = 0f, HypnosisSpiralAmount = 0f, HypnosisColorBlend = 0f, Sky = _enhancedSkyEnabled.Value, SkyI = _skyIntensity.Value, SkyExposure = Mathf.Clamp(_skyExposure.Value, 0.05f, 2.5f), SkyHue = _skyHueShift.Value, SkyColorBlend = _skyColorBlend.Value, SkyboxIndex = Mathf.Clamp(_skyboxMaterialIndex.Value, 0, 1), SunIntensity = Mathf.Clamp(_sunIntensityMultiplier.Value, 0f, 3f), SunTemp = Mathf.Clamp(_sunTemperature.Value, 1000f, 20000f), SunR = Mathf.Clamp01(_sunColorR.Value), SunG = Mathf.Clamp01(_sunColorG.Value), SunB = Mathf.Clamp01(_sunColorB.Value), SunBlend = Mathf.Clamp01(_sunColorBlend.Value), Tm = Mathf.Clamp(_tonemappingMode.Value, 0, 2), Wb = _whiteBalanceEnabled.Value, WbTemp = Mathf.Clamp(_whiteBalanceTemperature.Value, -100f, 100f), WbTint = Mathf.Clamp(_whiteBalanceTint.Value, -100f, 100f), Lgg = _liftGammaGainEnabled.Value, Lift = Mathf.Clamp(_liftAmount.Value, -1f, 1f), Gamma = Mathf.Clamp(_gammaAmount.Value, 0f, 2f), Gain = Mathf.Clamp(_gainAmount.Value, 0f, 2f), St = _splitToningEnabled.Value, StSr = Mathf.Clamp01(_splitShadowsR.Value), StSg = Mathf.Clamp01(_splitShadowsG.Value), StSb = Mathf.Clamp01(_splitShadowsB.Value), StHr = Mathf.Clamp01(_splitHighlightsR.Value), StHg = Mathf.Clamp01(_splitHighlightsG.Value), StHb = Mathf.Clamp01(_splitHighlightsB.Value), StBal = Mathf.Clamp(_splitToningBalance.Value, -100f, 100f), Clouds = _cloudLayersEnabled.Value, CloudD = _cloudDensity.Value, Weather = _weatherSystemEnabled.Value, WeatherMode = _weatherMode.Value, WeatherStrength = _weatherStrength.Value, Water = _waterOverrideEnabled.Value, WaterClarity = _waterClarity.Value, WaterWave = _waterWaveStrength.Value, AaPreset = _antiAliasingPreset.Value, CasSharp = _casSharpening.Value, Reason = reason, SentAtUtc = DateTime.UtcNow.ToString("O") }; } private void ApplyState(ProfileStateV1 s) { _revision = s.Revision; _masterEnabled.Value = s.MasterEnabled; _enableShaderPass.Value = s.EnableShaderPass; _qualityTier.Value = Mathf.Clamp(s.QualityTier, 0, 2); _crtEnabled.Value = s.C; _crtIntensity.Value = Mathf.Clamp(s.Ci, 0f, 0.1f); _dreamEnabled.Value = s.D; _dreamIntensity.Value = Mathf.Clamp01(s.Di); _comicEnabled.Value = s.K; _comicIntensity.Value = Mathf.Clamp01(s.Ki); _heatwaveEnabled.Value = s.H; _heatwaveIntensity.Value = Mathf.Clamp(s.Hi, 0f, 0.05f); _heatwaveSpeed.Value = Mathf.Clamp(s.Hs, 0.2f, 4f); _noirEnabled.Value = s.S; _noirIntensity.Value = Mathf.Clamp01(s.Si); _vaporEnabled.Value = s.V; _vaporIntensity.Value = Mathf.Clamp01(s.Vi); _posterizeEnabled.Value = s.Pr; _posterizeIntensity.Value = Mathf.Clamp01(s.Pri); _pixelateEnabled.Value = s.Px; _pixelateIntensity.Value = Mathf.Clamp01(s.Pxi); _chromaticSplitEnabled.Value = s.Cs; _chromaticSplitIntensity.Value = Mathf.Clamp01(s.Csi); _ditherEnabled.Value = s.Dt; _ditherIntensity.Value = Mathf.Clamp01(s.Dti); _lensCenterX.Value = Mathf.Clamp(s.LensCx, -1f, 2f); _lensCenterY.Value = Mathf.Clamp(s.LensCy, -1f, 2f); _motionBlurEnabled.Value = s.Mb; _motionBlurIntensity.Value = Mathf.Clamp01(s.Mbi); _depthOfFieldEnabled.Value = s.Df; _depthOfFieldIntensity.Value = Mathf.Clamp01(s.Dfi); _anamorphicBloomEnabled.Value = s.Ab; _anamorphicBloomIntensity.Value = Mathf.Clamp01(s.Abi); _halftoneEnabled.Value = s.Hf; _halftoneIntensity.Value = Mathf.Clamp01(s.Hfi); _halftoneDotSize.Value = Mathf.Clamp(s.Hfs, 0.25f, 8f); _halftoneAngle.Value = Mathf.Clamp(s.Hfa, 0f, 180f); _kuwaharaEnabled.Value = s.Kw; _kuwaharaIntensity.Value = Mathf.Clamp01(s.Kwi); _kuwaharaRadius.Value = Mathf.Clamp(s.Kwr, 1f, 6f); _selectiveColorEnabled.Value = s.Sc; _selectiveColorIntensity.Value = Mathf.Clamp01(s.Sci); _selectiveColorHue.Value = Mathf.Clamp(s.Sch, 0f, 360f); _selectiveColorRange.Value = Mathf.Clamp(s.Scr, 1f, 180f); _selectiveColorSoftness.Value = Mathf.Clamp01(s.Scs); _radialBlurEnabled.Value = s.Rb; _radialBlurIntensity.Value = Mathf.Clamp01(s.Rbi); _lensDirtEnabled.Value = s.Ld; _lensDirtIntensity.Value = Mathf.Clamp01(s.Ldi); _rainOnLensEnabled.Value = s.Rn; _rainOnLensIntensity.Value = Mathf.Clamp01(s.Rni); _causticsOverlayEnabled.Value = s.Ca; _causticsOverlayIntensity.Value = Mathf.Clamp01(s.Cai); _godrayFakeEnabled.Value = s.Gd; _godrayFakeIntensity.Value = Mathf.Clamp01(s.Gdi); _filmGateEnabled.Value = s.Fg; _filmGateIntensity.Value = Mathf.Clamp01(s.Fgi); _glitchPackEnabled.Value = s.Gl; _glitchPackIntensity.Value = Mathf.Clamp(s.Gli, 0f, 0.1f); _volumetricFogTintEnabled.Value = s.Vf; _volumetricFogTintIntensity.Value = Mathf.Clamp01(s.Vfi); _volumetricFogTintDensity.Value = Mathf.Clamp01(s.Vfd); _volumetricFogTintHue.Value = Mathf.Clamp(s.Vfh, 0f, 360f); _lutBlendEnabled.Value = s.Lb; _lutBlendAmount.Value = Mathf.Clamp01(s.Lbi); _lutDirty = true; _lutLastBlendApplied = -1f; _hypnosisEnabled.Value = false; _hypnosisPreset.Value = 0; _hypnosisIntensity.Value = 0f; _hypnosisSpeed.Value = 0f; _hypnosisWarpAmount.Value = 0f; _hypnosisSpiralAmount.Value = 0f; _hypnosisColorBlend.Value = 0f; _enhancedSkyEnabled.Value = s.Sky; _skyIntensity.Value = Mathf.Clamp01(s.SkyI); _skyExposure.Value = Mathf.Clamp(s.SkyExposure, 0.05f, 2.5f); _skyHueShift.Value = Mathf.Clamp(s.SkyHue, -180f, 180f); _skyColorBlend.Value = Mathf.Clamp01(s.SkyColorBlend); _skyboxMaterialIndex.Value = Mathf.Clamp(s.SkyboxIndex, 0, 1); _sunIntensityMultiplier.Value = Mathf.Clamp(s.SunIntensity, 0f, 3f); _sunTemperature.Value = Mathf.Clamp(s.SunTemp, 1000f, 20000f); _sunColorR.Value = Mathf.Clamp01(s.SunR); _sunColorG.Value = Mathf.Clamp01(s.SunG); _sunColorB.Value = Mathf.Clamp01(s.SunB); _sunColorBlend.Value = Mathf.Clamp01(s.SunBlend); RefreshSkyboxMaterialOptions(); _tonemappingMode.Value = Mathf.Clamp(s.Tm, 0, 2); _whiteBalanceEnabled.Value = s.Wb; _whiteBalanceTemperature.Value = Mathf.Clamp(s.WbTemp, -100f, 100f); _whiteBalanceTint.Value = Mathf.Clamp(s.WbTint, -100f, 100f); _liftGammaGainEnabled.Value = s.Lgg; _liftAmount.Value = Mathf.Clamp(s.Lift, -1f, 1f); _gammaAmount.Value = Mathf.Clamp(s.Gamma, 0f, 2f); _gainAmount.Value = Mathf.Clamp(s.Gain, 0f, 2f); _splitToningEnabled.Value = s.St; _splitShadowsR.Value = Mathf.Clamp01(s.StSr); _splitShadowsG.Value = Mathf.Clamp01(s.StSg); _splitShadowsB.Value = Mathf.Clamp01(s.StSb); _splitHighlightsR.Value = Mathf.Clamp01(s.StHr); _splitHighlightsG.Value = Mathf.Clamp01(s.StHg); _splitHighlightsB.Value = Mathf.Clamp01(s.StHb); _splitToningBalance.Value = Mathf.Clamp(s.StBal, -100f, 100f); _cloudLayersEnabled.Value = s.Clouds; _cloudDensity.Value = Mathf.Clamp01(s.CloudD); _weatherSystemEnabled.Value = s.Weather; _weatherMode.Value = Mathf.Clamp(s.WeatherMode, 0, 5); _weatherStrength.Value = Mathf.Clamp01(s.WeatherStrength); _waterOverrideEnabled.Value = s.Water; _waterClarity.Value = Mathf.Clamp01(s.WaterClarity); _waterWaveStrength.Value = Mathf.Clamp01(s.WaterWave); _antiAliasingPreset.Value = Mathf.Clamp(s.AaPreset, 0, 4); _casSharpening.Value = Mathf.Clamp01(s.CasSharp); } private void OnPayload(PlayerID sender, NetworkPayloadV1 payload, bool asServer) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_011b: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) if (payload?.Data == null) { return; } if (!Codec.TryDecode(payload.Data, out var e)) { EmitSyncEvent("packet_rejected", $"reason=decode_failed sender={((PlayerID)(ref sender)).id.value}"); return; } ulong value = ((PlayerID)(ref sender)).id.value; if (e.SenderPlayerId != 0L && value != 0L && e.SenderPlayerId != value && (_debugMode.Value || Time.unscaledTime >= _nextPacketSenderMismatchLogAt)) { _nextPacketSenderMismatchLogAt = Time.unscaledTime + (_debugMode.Value ? 1f : 20f); EmitSyncEvent("packet_sender_mismatch", $"msg={e.MessageType} envelopeSender={e.SenderPlayerId} transportSender={value}"); } ulong effectiveSenderId = ((value != 0L) ? value : e.SenderPlayerId); switch ((Msg)e.MessageType) { case Msg.Hello: HandleHello(sender, e.Json, asServer); break; case Msg.HelloAck: HandleHelloAck(sender, effectiveSenderId, e.Json, asServer); break; case Msg.StateRequest: HandleStateRequest(sender, e.Json, asServer); break; case Msg.StateSnapshot: HandleStateSnapshot(sender, effectiveSenderId, e.Json, asServer); break; default: EmitSyncEvent("packet_rejected", $"reason=unknown_msg sender={((PlayerID)(ref sender)).id.value} msg={e.MessageType}"); break; } } private void TickHandshakeAndSync(float now) { if ((Object)(object)_network == (Object)null || _localOnlyMode.Value || !_syncEnabled.Value) { if (_clientSyncState != 0) { ResetSyncState("sync-disabled"); } return; } if (IsHost()) { EnsureHostSessionEpoch(); if (HostClientSyncPolicy.ShouldHostSendKeepalive(isHost: true, now, _nextHostKeepaliveAt, _lastHostCommitAt, out var nextAt)) { _nextHostKeepaliveAt = nextAt; if (_clientCapabilityMasks.Count > 0) { BroadcastSnapshot("keepalive"); } } return; } if (!IsClientOnly() || !_acceptHostSync.Value) { if (_clientSyncState != 0) { ResetSyncState("not-client-or-accept-disabled"); } return; } if (now >= _nextHostIdentityRefreshAt) { _nextHostIdentityRefreshAt = now + 1f; if (DetectHostMigrationOrSessionChange()) { BeginClientHandshake("host_migration_detected"); } } if (_clientSyncState == HostClientSyncPolicy.ClientHandshakeState.Disconnected) { BeginClientHandshake("client-attach"); } if (HostClientSyncPolicy.ShouldMarkClientStale(_clientSyncState, now, _lastSnapshotAcceptedAt)) { _clientSyncState = HostClientSyncPolicy.ClientHandshakeState.Stale; _clientSyncStatusReason = "snapshot-timeout"; _nextStateRequestAt = now; EmitSyncEvent("resync_requested", "reason=stale-timeout"); } if (HostClientSyncPolicy.ShouldClientSendHello(_clientSyncState, now, _nextHelloAt)) { SendHello((_clientSyncState == HostClientSyncPolicy.ClientHandshakeState.AwaitHelloAck) ? "handshake" : "retry"); _nextHelloAt = now + _helloRetryIntervalSeconds; _helloRetryIntervalSeconds = HostClientSyncPolicy.NextHelloRetryInterval(_helloRetryIntervalSeconds); } if (HostClientSyncPolicy.ShouldClientSendStateRequest(_clientSyncState, now, _nextStateRequestAt)) { SendStateRequest((_clientSyncState == HostClientSyncPolicy.ClientHandshakeState.Stale) ? "stale-resync" : "hello-ack"); _nextStateRequestAt = now + 2.25f; } if (_clientSyncState != HostClientSyncPolicy.ClientHandshakeState.Synced && _showNotifications.Value && (now >= _nextUnsyncedNotifyAt || _clientSyncState != _lastUnsyncedNotifiedState || !string.Equals(_clientSyncStatusReason, _lastUnsyncedNotifiedReason, StringComparison.Ordinal))) { _nextUnsyncedNotifyAt = now + 45f; _lastUnsyncedNotifiedState = _clientSyncState; _lastUnsyncedNotifiedReason = _clientSyncStatusReason ?? string.Empty; Notify($"Host sync pending ({_clientSyncState})."); } } private void HandleSyncLifecycleReset(string reason) { if ((Object)(object)_network == (Object)null) { ResetSyncState("lifecycle-no-network"); } else if (_localOnlyMode.Value || !_syncEnabled.Value) { ResetSyncState("lifecycle-sync-disabled"); } else if (IsHost()) { EnsureHostSessionEpoch(); _nextHostKeepaliveAt = Time.unscaledTime + 7f; } else if (IsClientOnly() && _acceptHostSync.Value) { BeginClientHandshake(reason); } } private void ResetSyncState(string reason) { _clientSyncState = HostClientSyncPolicy.ClientHandshakeState.Disconnected; _clientSyncStatusReason = reason; _pendingHelloNonce = string.Empty; _activeSessionEpoch = string.Empty; _lastAcceptedRevision = -1L; _lastAcceptedStateHash = string.Empty; _lastSnapshotAcceptedAt = 0f; _nextHelloAt = 0f; _helloRetryIntervalSeconds = 0.9f; _nextStateRequestAt = 0f; _expectedHostSenderId = 0uL; _expectedHostSteamId = 0uL; _lastUnsyncedNotifiedState = HostClientSyncPolicy.ClientHandshakeState.Disconnected; _lastUnsyncedNotifiedReason = reason ?? string.Empty; EmitSyncEvent("sync_reset", "reason=" + reason); } private void BeginClientHandshake(string reason) { if (!((Object)(object)_network == (Object)null) && IsClientOnly() && !_localOnlyMode.Value && _syncEnabled.Value && _acceptHostSync.Value) { _expectedHostSteamId = ResolveLobbyOwnerSteamIdOrZero(); _expectedHostSenderId = ResolveHostSenderIdFromPanel(_expectedHostSteamId); _pendingHelloNonce = Guid.NewGuid().ToString("N"); _activeSessionEpoch = string.Empty; _lastAcceptedRevision = -1L; _lastAcceptedStateHash = string.Empty; _lastSnapshotAcceptedAt = 0f; _nextHelloAt = Time.unscaledTime; _nextStateRequestAt = Time.unscaledTime; _helloRetryIntervalSeconds = 0.9f; _clientSyncState = HostClientSyncPolicy.ClientHandshakeState.AwaitHelloAck; _clientSyncStatusReason = reason; EmitSyncEvent("resync_requested", $"reason={reason} expectedHostSteam={_expectedHostSteamId} expectedHostSender={_expectedHostSenderId}"); } } private bool DetectHostMigrationOrSessionChange() { if ((Object)(object)_network == (Object)null || !IsClientOnly() || _localOnlyMode.Value || !_syncEnabled.Value || !_acceptHostSync.Value) { return false; } string lobbyCode = ResolveLobbyCode(); ulong num = ResolveLobbyOwnerSteamIdOrZero(); ulong num2 = ResolveHostSenderIdFromPanel(num); string text = ComputeSessionEpoch(lobbyCode, num); bool flag = _expectedHostSteamId != 0 && num != 0 && num != _expectedHostSteamId; bool flag2 = _expectedHostSenderId != 0 && num2 != 0 && num2 != _expectedHostSenderId; bool flag3 = !string.IsNullOrWhiteSpace(_activeSessionEpoch) && !string.Equals(text, _activeSessionEpoch, StringComparison.Ordinal); if (!flag && !flag2 && !flag3) { return false; } EmitSyncEvent("host_migration_detected", $"hostChanged={flag} senderChanged={flag2} epochChanged={flag3} oldHostSteam={_expectedHostSteamId} newHostSteam={num} oldHostSender={_expectedHostSenderId} newHostSender={num2} oldEpoch={_activeSessionEpoch} newEpoch={text}"); return true; } private void HandleHello(PlayerID sender, string payloadJson, bool asServer) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_0124: 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_0157: 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_00c3: Unknown result type (might be due to invalid IL or missing references) if (asServer && IsHost() && !_localOnlyMode.Value && _syncEnabled.Value) { HelloV2 helloV; try { helloV = JsonUtility.FromJson(payloadJson); } catch (Exception ex) { EmitSyncEvent("hello_ack_rejected", $"reason=parse sender={((PlayerID)(ref sender)).id.value} msg={ex.GetBaseException().Message}"); return; } if (helloV == null || helloV.ProtocolVersion != 4) { EmitSyncEvent("hello_ack_rejected", $"reason=protocol_mismatch sender={((PlayerID)(ref sender)).id.value}"); return; } if (helloV.ClientPlayerId != 0L && helloV.ClientPlayerId != ((PlayerID)(ref sender)).id.value) { EmitSyncEvent("hello_ack_rejected", $"reason=sender_mismatch sender={((PlayerID)(ref sender)).id.value} claimed={helloV.ClientPlayerId}"); return; } if (string.IsNullOrWhiteSpace(helloV.ClientNonce)) { EmitSyncEvent("hello_ack_rejected", $"reason=nonce_missing sender={((PlayerID)(ref sender)).id.value}"); return; } _clientCapabilityMasks[((PlayerID)(ref sender)).id.value] = helloV.CapabilityMask; _clientHelloNonces[((PlayerID)(ref sender)).id.value] = helloV.ClientNonce; SendHelloAck(sender, helloV, helloV.Reason ?? "hello"); } } private void HandleHelloAck(PlayerID sender, ulong effectiveSenderId, string payloadJson, bool asServer) { if (IsClientOnly() && !_localOnlyMode.Value && _syncEnabled.Value && _acceptHostSync.Value) { HelloAckV2 helloAckV; try { helloAckV = JsonUtility.FromJson(payloadJson); } catch (Exception ex) { EmitSyncEvent("hello_ack_rejected", $"reason=parse sender={effectiveSenderId} msg={ex.GetBaseException().Message}"); return; } if (helloAckV == null || helloAckV.ProtocolVersion != 4) { EmitSyncEvent("hello_ack_rejected", $"reason=protocol_mismatch sender={effectiveSenderId}"); return; } if (!IsSenderCurrentHost(effectiveSenderId, out string rejectReason)) { EmitSyncEvent("hello_ack_rejected", $"reason={rejectReason} sender={effectiveSenderId}"); return; } if (string.IsNullOrWhiteSpace(_pendingHelloNonce) || !string.Equals(helloAckV.ClientNonce, _pendingHelloNonce, StringComparison.Ordinal)) { EmitSyncEvent("hello_ack_rejected", $"reason=nonce_mismatch sender={effectiveSenderId} expected={_pendingHelloNonce} got={helloAckV.ClientNonce}"); return; } if (helloAckV.HostPlayerId != 0L && helloAckV.HostPlayerId != effectiveSenderId) { EmitSyncEvent("hello_ack_rejected", $"reason=host_player_mismatch sender={effectiveSenderId} hostField={helloAckV.HostPlayerId}"); return; } if (string.IsNullOrWhiteSpace(helloAckV.SessionEpoch)) { EmitSyncEvent("hello_ack_rejected", $"reason=session_epoch_missing sender={effectiveSenderId}"); return; } _activeSessionEpoch = helloAckV.SessionEpoch; _clientSyncState = HostClientSyncPolicy.ClientHandshakeState.AwaitSnapshot; _clientSyncStatusReason = "awaiting-snapshot"; _helloRetryIntervalSeconds = 0.9f; _nextStateRequestAt = Time.unscaledTime; _expectedHostSenderId = effectiveSenderId; _expectedHostSteamId = ResolveSenderSteamIdOrZero(effectiveSenderId); EmitSyncEvent("hello_ack_accepted", $"sender={effectiveSenderId} epoch={helloAckV.SessionEpoch} rev={helloAckV.CurrentRevision} hash={helloAckV.StateHash}"); } } private void HandleStateRequest(PlayerID sender, string payloadJson, bool asServer) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if (!asServer || !IsHost() || _localOnlyMode.Value || !_syncEnabled.Value) { return; } StateRequestV2 stateRequestV; try { stateRequestV = JsonUtility.FromJson(payloadJson); } catch (Exception ex) { EmitSyncEvent("snapshot_rejected", $"reason=request_parse sender={((PlayerID)(ref sender)).id.value} msg={ex.GetBaseException().Message}"); return; } if (stateRequestV == null || stateRequestV.ProtocolVersion != 4) { EmitSyncEvent("snapshot_rejected", $"reason=request_protocol_mismatch sender={((PlayerID)(ref sender)).id.value}"); return; } if (!ShouldAllowHostRequestResponse(((PlayerID)(ref sender)).id.value)) { EmitSyncEvent("snapshot_rejected", $"reason=request_rate_limit sender={((PlayerID)(ref sender)).id.value}"); return; } string text = EnsureHostSessionEpoch(); if (!string.IsNullOrWhiteSpace(stateRequestV.SessionEpoch) && !string.Equals(stateRequestV.SessionEpoch, text, StringComparison.Ordinal)) { EmitSyncEvent("resync_requested", $"reason=session_epoch_mismatch sender={((PlayerID)(ref sender)).id.value} requested={stateRequestV.SessionEpoch} actual={text}"); } SendSnapshotToPlayer(sender, string.IsNullOrWhiteSpace(stateRequestV.Reason) ? "state-request" : stateRequestV.Reason); } private void HandleStateSnapshot(PlayerID sender, ulong effectiveSenderId, string payloadJson, bool asServer) { if (IsHost() || _localOnlyMode.Value || !_syncEnabled.Value || !_acceptHostSync.Value || !IsClientOnly()) { return; } StateSnapshotV2 stateSnapshotV; try { stateSnapshotV = JsonUtility.FromJson(payloadJson); } catch (Exception ex) { EmitSyncEvent("snapshot_rejected", $"reason=parse sender={effectiveSenderId} msg={ex.GetBaseException().Message}"); return; } if (stateSnapshotV == null || stateSnapshotV.ProtocolVersion != 4) { EmitSyncEvent("snapshot_rejected", $"reason=protocol_mismatch sender={effectiveSenderId}"); return; } EmitSyncEvent("snapshot_received", $"sender={effectiveSenderId} epoch={stateSnapshotV.SessionEpoch} rev={stateSnapshotV.Revision} hash={stateSnapshotV.StateHash} hasState={stateSnapshotV.State != null} hasProfile={stateSnapshotV.Profile != null} hasProfileState={stateSnapshotV.ProfileState != null} stateJsonLen={stateSnapshotV.StateJson?.Length ?? 0} profileJsonLen={stateSnapshotV.ProfileJson?.Length ?? 0}"); if (!IsSenderCurrentHost(effectiveSenderId, out string rejectReason)) { EmitSyncEvent("snapshot_rejected", $"reason={rejectReason} sender={effectiveSenderId}"); return; } if (_clientSyncState == HostClientSyncPolicy.ClientHandshakeState.AwaitHelloAck) { EmitSyncEvent("snapshot_rejected", $"reason=no_hello_ack sender={effectiveSenderId}"); return; } if (!TryHydrateSnapshotState(stateSnapshotV, payloadJson, out string reason)) { EmitSyncEvent("snapshot_rejected", $"reason=state_missing sender={effectiveSenderId} details={reason}"); return; } int num = stateSnapshotV.State?.ProtocolVersion ?? stateSnapshotV.ProtocolVersion; bool flag = num == 1; if (num != 4 && !flag) { EmitSyncEvent("snapshot_rejected", $"reason=state_protocol_mismatch sender={effectiveSenderId} expected={4} got={num}"); return; } if (string.IsNullOrWhiteSpace(stateSnapshotV.SessionEpoch)) { EmitSyncEvent("snapshot_rejected", $"reason=session_missing sender={effectiveSenderId}"); return; } if (!string.IsNullOrWhiteSpace(_activeSessionEpoch) && !string.Equals(stateSnapshotV.SessionEpoch, _activeSessionEpoch, StringComparison.Ordinal)) { EmitSyncEvent("snapshot_rejected", $"reason=stale_session sender={effectiveSenderId} snapshot={stateSnapshotV.SessionEpoch} active={_activeSessionEpoch}"); BeginClientHandshake("session-mismatch"); return; } ProfileStateV1 state = stateSnapshotV.State; if (state == null) { EmitSyncEvent("snapshot_rejected", $"reason=state_null sender={effectiveSenderId}"); return; } string text = ComputeStateHash(state); if (!string.Equals(text, stateSnapshotV.StateHash, StringComparison.Ordinal)) { if (_strictSnapshotHashValidation.Value && _debugMode.Value) { EmitSyncEvent("snapshot_rejected", $"reason=hash_mismatch_strict sender={effectiveSenderId} expected={stateSnapshotV.StateHash} computed={text} hydrate={reason} stateProto={state.ProtocolVersion} stateRev={state.Revision}"); return; } EmitSyncEvent("snapshot_hash_mismatch_accepted", $"sender={effectiveSenderId} expected={stateSnapshotV.StateHash} computed={text} hydrate={reason} stateProto={state.ProtocolVersion} stateRev={state.Revision}"); if (string.IsNullOrWhiteSpace(stateSnapshotV.StateHash) || !string.Equals(stateSnapshotV.StateHash, text, StringComparison.Ordinal)) { stateSnapshotV.StateHash = text; } } switch (HostClientSyncPolicy.ClassifySnapshot(stateSnapshotV.SessionEpoch, stateSnapshotV.Revision, stateSnapshotV.StateHash, _activeSessionEpoch, _lastAcceptedRevision, _lastAcceptedStateHash)) { case HostClientSyncPolicy.SnapshotValidationResult.Duplicate: _lastSnapshotAcceptedAt = Time.unscaledTime; if (_clientSyncState != HostClientSyncPolicy.ClientHandshakeState.Synced) { _clientSyncState = HostClientSyncPolicy.ClientHandshakeState.Synced; _clientSyncStatusReason = "synced"; } EmitSyncEvent("snapshot_heartbeat", $"sender={effectiveSenderId} rev={stateSnapshotV.Revision} hash={stateSnapshotV.StateHash}"); return; case HostClientSyncPolicy.SnapshotValidationResult.Stale: EmitSyncEvent("snapshot_rejected", $"reason=stale_revision sender={effectiveSenderId} rev={stateSnapshotV.Revision} accepted={_lastAcceptedRevision}"); return; case HostClientSyncPolicy.SnapshotValidationResult.Gap: EmitSyncEvent("resync_requested", $"reason=revision_gap sender={effectiveSenderId} rev={stateSnapshotV.Revision} accepted={_lastAcceptedRevision}"); _clientSyncState = HostClientSyncPolicy.ClientHandshakeState.Stale; _clientSyncStatusReason = "revision-gap"; _nextStateRequestAt = Time.unscaledTime; return; case HostClientSyncPolicy.SnapshotValidationResult.SessionMismatch: EmitSyncEvent("snapshot_rejected", $"reason=session_mismatch sender={effectiveSenderId}"); BeginClientHandshake("session-mismatch"); return; case HostClientSyncPolicy.SnapshotValidationResult.Invalid: EmitSyncEvent("snapshot_rejected", $"reason=invalid_payload sender={effectiveSenderId}"); return; } _activeSessionEpoch = stateSnapshotV.SessionEpoch; _lastAcceptedRevision = stateSnapshotV.Revision; _lastAcceptedStateHash = stateSnapshotV.StateHash; _lastSnapshotAcceptedAt = Time.unscaledTime; _clientSyncState = HostClientSyncPolicy.ClientHandshakeState.Synced; _clientSyncStatusReason = "synced"; _lastUnsyncedNotifiedState = HostClientSyncPolicy.ClientHandshakeState.Synced; _lastUnsyncedNotifiedReason = _clientSyncStatusReason; _expectedHostSenderId = effectiveSenderId; _expectedHostSteamId = ResolveSenderSteamIdOrZero(effectiveSenderId); if (flag) { stateSnapshotV.State.ProtocolVersion = 4; EmitSyncEvent("snapshot_legacy_state_protocol_accepted", $"sender={effectiveSenderId} protocol={num} upgraded={4}"); } ApplyState(stateSnapshotV.State); if (ShouldApplyLocalVisuals()) { RunMaterialScanner(logToConsole: false); ApplyAntiAliasingPresetToActiveCameras(); ApplyWaterAndCloudOverrides(); ApplyVisuals(); } else { DisableVisuals(); } EmitSyncEvent("snapshot_applied", $"sender={effectiveSenderId} epoch={stateSnapshotV.SessionEpoch} rev={stateSnapshotV.Revision} hash={stateSnapshotV.StateHash} reason={stateSnapshotV.Reason}"); Notify($"Synced profile from host (rev {stateSnapshotV.Revision})."); } private bool ShouldAllowHostRequestResponse(ulong senderId) { float unscaledTime = Time.unscaledTime; if (_lastRequestHandledAtByPlayer.TryGetValue(senderId, out var value) && !HostClientSyncPolicy.ShouldAllowHostRequestResponse(ref value, unscaledTime)) { _lastRequestHandledAtByPlayer[senderId] = value; return false; } _lastRequestHandledAtByPlayer[senderId] = unscaledTime; return true; } private bool TryHydrateSnapshotState(StateSnapshotV2 snapshot, string payloadJson, out string reason) { reason = "none"; if (snapshot.State != null) { reason = "state_field"; return true; } StateSnapshotV2 stateSnapshotV = snapshot; if (stateSnapshotV.State == null) { stateSnapshotV.State = snapshot.Profile; } if (snapshot.State != null) { reason = "profile_field"; return true; } stateSnapshotV = snapshot; if (stateSnapshotV.State == null) { stateSnapshotV.State = snapshot.ProfileState; } if (snapshot.State != null) { reason = "profile_state_field"; return true; } if (!string.IsNullOrWhiteSpace(snapshot.StateJson)) { try { snapshot.State = JsonUtility.FromJson(snapshot.StateJson); if (snapshot.State != null) { reason = "state_json_field"; return true; } } catch (Exception ex) { reason = "state_json_parse:" + ex.GetBaseException().Message; } } if (!string.IsNullOrWhiteSpace(snapshot.ProfileJson)) { try { snapshot.State = JsonUtility.FromJson(snapshot.ProfileJson); if (snapshot.State != null) { reason = "profile_json_field"; return true; } } catch (Exception ex2) { reason = "profile_json_parse:" + ex2.GetBaseException().Message; } } try { StateSnapshotCompatV1 stateSnapshotCompatV = JsonUtility.FromJson(payloadJson); if (stateSnapshotCompatV != null) { if (snapshot.ProtocolVersion == 0 && stateSnapshotCompatV.ProtocolVersion != 0) { snapshot.ProtocolVersion = stateSnapshotCompatV.ProtocolVersion; } if (string.IsNullOrWhiteSpace(snapshot.SessionEpoch) && !string.IsNullOrWhiteSpace(stateSnapshotCompatV.SessionEpoch)) { snapshot.SessionEpoch = stateSnapshotCompatV.SessionEpoch; } if (snapshot.Revision == 0L && stateSnapshotCompatV.Revision != 0L) { snapshot.Revision = stateSnapshotCompatV.Revision; } if (string.IsNullOrWhiteSpace(snapshot.StateHash) && !string.IsNullOrWhiteSpace(stateSnapshotCompatV.StateHash)) { snapshot.StateHash = stateSnapshotCompatV.StateHash; } if (string.IsNullOrWhiteSpace(snapshot.Reason) && !string.IsNullOrWhiteSpace(stateSnapshotCompatV.Reason)) { snapshot.Reason = stateSnapshotCompatV.Reason; } if (string.IsNullOrWhiteSpace(snapshot.SentAtUtc) && !string.IsNullOrWhiteSpace(stateSnapshotCompatV.SentAtUtc)) { snapshot.SentAtUtc = stateSnapshotCompatV.SentAtUtc; } stateSnapshotV = snapshot; if (stateSnapshotV.State == null) { stateSnapshotV.State = stateSnapshotCompatV.State; } stateSnapshotV = snapshot; if (stateSnapshotV.State == null) { stateSnapshotV.State = stateSnapshotCompatV.Profile; } stateSnapshotV = snapshot; if (stateSnapshotV.State == null) { stateSnapshotV.State = stateSnapshotCompatV.ProfileState; } if (snapshot.State != null) { reason = "compat_object"; } if (snapshot.State == null && !string.IsNullOrWhiteSpace(stateSnapshotCompatV.StateJson)) { snapshot.State = JsonUtility.FromJson(stateSnapshotCompatV.StateJson); if (snapshot.State != null) { reason = "compat_state_json"; } } if (snapshot.State == null && !string.IsNullOrWhiteSpace(stateSnapshotCompatV.ProfileJson)) { snapshot.State = JsonUtility.FromJson(stateSnapshotCompatV.ProfileJson); if (snapshot.State != null) { reason = "compat_profile_json"; } } } } catch (Exception ex3) { reason = "compat_parse:" + ex3.GetBaseException().Message; } if (snapshot.State == null && (TryExtractJsonObjectField(payloadJson, "State", out string objectJson) || TryExtractJsonObjectField(payloadJson, "state", out objectJson) || TryExtractJsonObjectField(payloadJson, "Profile", out objectJson) || TryExtractJsonObjectField(payloadJson, "profile", out objectJson) || TryExtractJsonObjectField(payloadJson, "ProfileState", out objectJson) || TryExtractJsonObjectField(payloadJson, "profileState", out objectJson))) { try { snapshot.State = JsonUtility.FromJson(objectJson); if (snapshot.State != null) { reason = "extracted_object"; } } catch (Exception ex4) { reason = "extract_parse:" + ex4.GetBaseException().Message; } } if (snapshot.State == null && LooksLikeProfileStateRoot(payloadJson)) { try { ProfileStateV1 profileStateV = JsonUtility.FromJson(payloadJson); if (profileStateV != null && profileStateV.ProtocolVersion > 0) { snapshot.State = profileStateV; reason = "direct_state_root"; if (string.IsNullOrWhiteSpace(snapshot.SessionEpoch)) { snapshot.SessionEpoch = _activeSessionEpoch; } if (snapshot.Revision == 0L) { snapshot.Revision = profileStateV.Revision; } if (string.IsNullOrWhiteSpace(snapshot.StateHash)) { snapshot.StateHash = ComputeStateHash(profileStateV); } } } catch (Exception ex5) { reason = "direct_parse:" + ex5.GetBaseException().Message; } } if (snapshot.State == null) { string text = payloadJson ?? string.Empty; if (text.Length > 180) { text = text.Substring(0, 180); } reason = "unresolved payload_snippet='" + text + "'"; return false; } return true; } private static bool LooksLikeProfileStateRoot(string payloadJson) { if (string.IsNullOrWhiteSpace(payloadJson)) { return false; } if (payloadJson.IndexOf("\"MasterEnabled\"", StringComparison.OrdinalIgnoreCase) >= 0 && payloadJson.IndexOf("\"EnableShaderPass\"", StringComparison.OrdinalIgnoreCase) >= 0) { return payloadJson.IndexOf("\"StateHash\"", StringComparison.OrdinalIgnoreCase) < 0; } return false; } private static bool TryExtractJsonObjectField(string payloadJson, string fieldName, out string objectJson) { objectJson = string.Empty; if (string.IsNullOrWhiteSpace(payloadJson) || string.IsNullOrWhiteSpace(fieldName)) { return false; } string text = "\"" + fieldName + "\""; int num = payloadJson.IndexOf(text, StringComparison.OrdinalIgnoreCase); if (num < 0) { return false; } int num2 = payloadJson.IndexOf(':', num + text.Length); if (num2 < 0) { return false; } int i; for (i = num2 + 1; i < payloadJson.Length && char.IsWhiteSpace(payloadJson[i]); i++) { } if (i >= payloadJson.Length || payloadJson[i] != '{') { return false; } int num3 = i; int num4 = 0; bool flag = false; bool flag2 = false; for (int j = i; j < payloadJson.Length; j++) { char c = payloadJson[j]; if (flag) { if (flag2) { flag2 = false; continue; } switch (c) { case '\\': flag2 = true; break; case '"': flag = false; break; } continue; } switch (c) { case '"': flag = true; break; case '{': num4++; break; case '}': num4--; if (num4 == 0) { objectJson = payloadJson.Substring(num3, j - num3 + 1); return true; } break; } } return false; } private bool IsSenderCurrentHost(ulong senderPlayerId, out string rejectReason) { rejectReason = string.Empty; if (senderPlayerId == 0L) { rejectReason = "sender_zero"; return false; } ulong num = ResolveLobbyOwnerSteamIdOrZero(); if (num == 0L) { rejectReason = "host_steam_unresolved"; return false; } ulong num2 = ResolveSenderSteamIdOrZero(senderPlayerId); if (num2 == 0L) { ulong num3 = ResolveHostSenderIdFromPanel(num); if (num3 != 0L && senderPlayerId == num3) { _expectedHostSteamId = num; _expectedHostSenderId = num3; return true; } rejectReason = "sender_steam_unresolved"; return false; } if (num2 != num) { rejectReason = $"non_host_sender senderSteam={num2} hostSteam={num}"; return false; } ulong num4 = ResolveHostSenderIdFromPanel(num); if (num4 != 0L && senderPlayerId != num4) { rejectReason = $"sender_player_mismatch expected={num4}"; return false; } _expectedHostSteamId = num; _expectedHostSenderId = ((num4 != 0L) ? num4 : senderPlayerId); return true; } private string EnsureHostSessionEpoch() { string text = ResolveLobbyCode(); ulong num = ResolveLobbyOwnerSteamIdOrZero(); if (num == 0L) { num = ResolveSenderSteamIdOrZero(LocalPlayerIdOrZero()); } string text2 = $"{text}|{num}"; if (string.Equals(text2, _hostSessionEpochFingerprint, StringComparison.Ordinal) && !string.IsNullOrWhiteSpace(_hostSessionEpoch)) { return _hostSessionEpoch; } _hostSessionEpochFingerprint = text2; _hostSessionEpoch = ComputeSessionEpoch(text, num); _clientCapabilityMasks.Clear(); _clientHelloNonces.Clear(); _lastRequestHandledAtByPlayer.Clear(); EmitSyncEvent("host_migration_detected", "epoch=" + _hostSessionEpoch + " fingerprint=" + text2); return _hostSessionEpoch; } private static string ComputeSessionEpoch(string lobbyCode, ulong hostSteamId) { return ComputeStableHash($"{lobbyCode}|{hostSteamId}"); } private static string ComputeStateHash(ProfileStateV1 state) { if (state == null) { return "0000000000000000"; } return ComputeStableHash(state.ProtocolVersion + "|" + state.Revision + "|" + state.MasterEnabled + "|" + state.EnableShaderPass + "|" + state.QualityTier + "|" + state.C + "|" + F(state.Ci) + "|" + state.D + "|" + F(state.Di) + "|" + state.K + "|" + F(state.Ki) + "|" + state.H + "|" + F(state.Hi) + "|" + F(state.Hs) + "|" + state.S + "|" + F(state.Si) + "|" + state.V + "|" + F(state.Vi) + "|" + state.Pr + "|" + F(state.Pri) + "|" + state.Px + "|" + F(state.Pxi) + "|" + state.Cs + "|" + F(state.Csi) + "|" + state.Dt + "|" + F(state.Dti) + "|" + F(state.LensCx) + "|" + F(state.LensCy) + "|" + state.Mb + "|" + F(state.Mbi) + "|" + state.Df + "|" + F(state.Dfi) + "|" + state.Ab + "|" + F(state.Abi) + "|" + state.Hf + "|" + F(state.Hfi) + "|" + F(state.Hfs) + "|" + F(state.Hfa) + "|" + state.Kw + "|" + F(state.Kwi) + "|" + F(state.Kwr) + "|" + state.Sc + "|" + F(state.Sci) + "|" + F(state.Sch) + "|" + F(state.Scr) + "|" + F(state.Scs) + "|" + state.Rb + "|" + F(state.Rbi) + "|" + state.Ld + "|" + F(state.Ldi) + "|" + state.Rn + "|" + F(state.Rni) + "|" + state.Ca + "|" + F(state.Cai) + "|" + state.Gd + "|" + F(state.Gdi) + "|" + state.Fg + "|" + F(state.Fgi) + "|" + state.Gl + "|" + F(state.Gli) + "|" + state.Vf + "|" + F(state.Vfi) + "|" + F(state.Vfd) + "|" + F(state.Vfh) + "|" + state.Lb + "|" + F(state.Lbi) + "|" + state.Sky + "|" + F(state.SkyI) + "|" + F(state.SkyExposure) + "|" + F(state.SkyHue) + "|" + F(state.SkyColorBlend) + "|" + state.SkyboxIndex + "|" + F(state.SunIntensity) + "|" + F(state.SunTemp) + "|" + F(state.SunR) + "|" + F(state.SunG) + "|" + F(state.SunB) + "|" + F(state.SunBlend) + "|" + state.Tm + "|" + state.Wb + "|" + F(state.WbTemp) + "|" + F(state.WbTint) + "|" + state.Lgg + "|" + F(state.Lift) + "|" + F(state.Gamma) + "|" + F(state.Gain) + "|" + state.St + "|" + F(state.StSr) + "|" + F(state.StSg) + "|" + F(state.StSb) + "|" + F(state.StHr) + "|" + F(state.StHg) + "|" + F(state.StHb) + "|" + F(state.StBal) + "|" + state.Clouds + "|" + F(state.CloudD) + "|" + state.Weather + "|" + state.WeatherMode + "|" + F(state.WeatherStrength) + "|" + state.Water + "|" + F(state.WaterClarity) + "|" + F(state.WaterWave) + "|" + state.AaPreset + "|" + F(state.CasSharp)); static string F(float value) { return value.ToString("0.0000", CultureInfo.InvariantCulture); } } private static string ComputeStableHash(string input) { ulong num = 1469598103934665603uL; for (int i = 0; i < input.Length; i++) { num ^= input[i]; num *= 1099511628211L; } return num.ToString("X16"); } private string ResolveLobbyCode() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) try { MultiplayerManager i = MonoSingleton.I; if ((Object)(object)i != (Object)null && !string.IsNullOrWhiteSpace(i.LobbyCode)) { return i.LobbyCode; } Lobby? obj; if (i == null) { obj = null; } else { LobbyManager lobbyManager = i._lobbyManager; obj = ((lobbyManager != null) ? new Lobby?(lobbyManager.CurrentLobby) : null); } string text = ReadMemberAsString(obj, "sessionCode", "SessionCode", "code", "Code", "lobbyCode", "LobbyCode"); if (!string.IsNullOrWhiteSpace(text)) { return text; } } catch { } return "none"; } private ulong ResolveLobbyOwnerSteamIdOrZero() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) try { MultiplayerManager i = MonoSingleton.I; Lobby? obj; if (i == null) { obj = null; } else { LobbyManager lobbyManager = i._lobbyManager; obj = ((lobbyManager != null) ? new Lobby?(lobbyManager.CurrentLobby) : null); } if (ulong.TryParse(ReadMemberAsString(obj, "owner", "Owner", "ownerId", "OwnerId", "hostSteamId", "HostSteamId", "hostId", "HostId"), out var result) && result != 0) { return result; } } catch { } return ResolveLobbyOwnerViaSteamApi(ResolveLobbyCode()); } private static ulong ResolveLobbyOwnerViaSteamApi(string lobbyCode) { if (!ulong.TryParse(lobbyCode, out var result) || result == 0L) { return 0uL; } try { Type type = Type.GetType("Steamworks.SteamMatchmaking, com.rlabrecque.steamworks.net"); Type type2 = Type.GetType("Steamworks.CSteamID, com.rlabrecque.steamworks.net"); if (type == null || type2 == null) { return 0uL; } object obj = type2.GetConstructor(new Type[1] { typeof(ulong) })?.Invoke(new object[1] { result }); if (obj == null) { return 0uL; } return ReadSteamId(type.GetMethod("GetLobbyOwner", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { type2 }, null)?.Invoke(null, new object[1] { obj })); } catch { return 0uL; } } private ulong ResolveHostSenderIdFromPanel(ulong hostSteamId) { //IL_0069: 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) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (hostSteamId == 0L) { return 0uL; } try { PlayerPanelController i = NetworkSingleton.I; if (i?.PlayerIDs == null || i.PlayerSteamIDs == null) { return 0uL; } int num = Math.Min(i.PlayerIDs.Count, i.PlayerSteamIDs.Count); for (int j = 0; j < num; j++) { if (ulong.TryParse(i.PlayerSteamIDs[j], out var result) && result == hostSteamId) { PlayerID val = i.PlayerIDs[j]; return ((PlayerID)(ref val)).id.value; } } } catch { } return 0uL; } private ulong ResolveSenderSteamIdOrZero(ulong senderPlayerId) { //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_0058: Unknown result type (might be due to invalid IL or missing references) if (senderPlayerId == 0L) { return 0uL; } try { PlayerPanelController i = NetworkSingleton.I; if (i?.PlayerIDs == null || i.PlayerSteamIDs == null) { return 0uL; } int num = Math.Min(i.PlayerIDs.Count, i.PlayerSteamIDs.Count); for (int j = 0; j < num; j++) { PlayerID val = i.PlayerIDs[j]; ulong result; if (((PlayerID)(ref val)).id.value == senderPlayerId) { return ulong.TryParse(i.PlayerSteamIDs[j], out result) ? result : 0; } } } catch { } return 0uL; } private static ulong ReadSteamId(object? value) { if (value == null) { return 0uL; } if (value is ulong num && num != 0) { return num; } if (ulong.TryParse(value.ToString(), out var result) && result != 0) { return result; } Type type = value.GetType(); FieldInfo field = type.GetField("m_SteamID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.GetValue(value) is ulong num2 && num2 != 0) { return num2; } PropertyInfo property = type.GetProperty("m_SteamID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.GetValue(value) is ulong num3 && num3 != 0) { return num3; } return 0uL; } private static string? ReadMemberAsString(object? target, params string[] names) { if (target == null || names == null || names.Length == 0) { return null; } Type type = target.GetType(); foreach (string name in names) { PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { try { object value = property.GetValue(target); if (value != null) { string text = value.ToString(); if (!string.IsNullOrWhiteSpace(text)) { return text; } } } catch { } } FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { continue; } try { object value2 = field.GetValue(target); if (value2 != null) { string text2 = value2.ToString(); if (!string.IsNullOrWhiteSpace(text2)) { return text2; } } } catch { } } return null; } private void EmitSyncEvent(string eventName, string details) { bool flag = _syncLogIncludeKeepalive != null && _syncLogIncludeKeepalive.Value; bool num = string.Equals(eventName, "snapshot_broadcast", StringComparison.Ordinal) && details.IndexOf("reason=keepalive", StringComparison.OrdinalIgnoreCase) >= 0; bool flag2 = string.Equals(eventName, "snapshot_broadcast", StringComparison.Ordinal) && details.IndexOf("reason=ui-change", StringComparison.OrdinalIgnoreCase) >= 0; if (!num || flag || _debugMode.Value) { string line = (_lastSyncEvent = $"[{DateTime.Now:HH:mm:ss}] {eventName} :: {details}"); if (_enableBuiltInSyncLog != null && _enableBuiltInSyncLog.Value) { AppendSyncLog(line); } if (_debugMode.Value || (_syncLogToBepInEx != null && _syncLogToBepInEx.Value && !flag2)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[ShaderPlayground][Sync] " + eventName + " :: " + details)); } } } private void AppendSyncLog(string line) { if (_syncEventLog.Count >= 220) { _syncEventLog.RemoveRange(0, _syncEventLog.Count - 219); } _syncEventLog.Add(line); } private string ResolveSyncSourceLabel() { if (IsHost()) { return "host-local:" + EnsureHostSessionEpoch(); } if (IsClientOnly() && _clientSyncState == HostClientSyncPolicy.ClientHandshakeState.Synced && _expectedHostSenderId != 0L) { return $"host-sync:{_expectedHostSenderId}"; } if (IsClientOnly()) { return $"sync-pending:{_clientSyncState}"; } return "local"; } private void EmitDebugTelemetry(string reason) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) try { int num = 0; int num2 = 0; int num3 = 0; Camera[] allCameras = Camera.allCameras; foreach (Camera val in allCameras) { if ((Object)(object)val == (Object)null || !((Behaviour)val).isActiveAndEnabled || (int)val.cameraType != 1 || (Object)(object)val.targetTexture != (Object)null) { continue; } num++; UniversalAdditionalCameraData universalAdditionalCameraData = CameraExtensions.GetUniversalAdditionalCameraData(val); if (!((Object)(object)universalAdditionalCameraData == (Object)null)) { if (universalAdditionalCameraData.renderPostProcessing) { num2++; } if ((int)universalAdditionalCameraData.antialiasing != 0) { num3++; } } } Camera main = Camera.main; string text = (((Object)(object)main == (Object)null) ? "none" : $"{((Object)main).name} enabled={((Behaviour)main).isActiveAndEnabled} clear={main.clearFlags} bgA={main.backgroundColor.a:0.00}"); DebugLog($"Telemetry[{reason}] source={ResolveSyncSourceLabel()} rev={_revision}/{_lastAcceptedRevision} " + $"master={_masterEnabled.Value} localOnly={_localOnlyMode.Value} sync={_syncEnabled.Value} acceptHost={_acceptHostSync.Value} " + $"hs={_clientSyncState} hostSender={_expectedHostSenderId} hostSteam={_expectedHostSteamId} epoch={_activeSessionEpoch} " + $"volumeActive={(Object)(object)_volume != (Object)null && ((Behaviour)_volume).enabled} shaderPass={_enableShaderPass.Value && !_forceVolumeFallback.Value && _shaderHealthy} " + $"cams={num} postFxCams={num2} aaCams={num3} mainCam={text} " + $"effects[fisheye={_crtEnabled.Value}:{_crtIntensity.Value:0.000},dream={_dreamEnabled.Value}:{_dreamIntensity.Value:0.000},comic={_comicEnabled.Value}:{_comicIntensity.Value:0.000},breathing={_heatwaveEnabled.Value}:{_heatwaveIntensity.Value:0.000}@{_heatwaveSpeed.Value:0.00},noir={_noirEnabled.Value}:{_noirIntensity.Value:0.000},vapor={_vaporEnabled.Value}:{_vaporIntensity.Value:0.000},posterize={_posterizeEnabled.Value}:{_posterizeIntensity.Value:0.000},pixelate={_pixelateEnabled.Value}:{_pixelateIntensity.Value:0.000},chromSplit={_chromaticSplitEnabled.Value}:{_chromaticSplitIntensity.Value:0.000},dither={_ditherEnabled.Value}:{_ditherIntensity.Value:0.000},anamorphic={_anamorphicBloomEnabled.Value}:{_anamorphicBloomIntensity.Value:0.000},halftone={_halftoneEnabled.Value}:{_halftoneIntensity.Value:0.000}@{_halftoneDotSize.Value:0.00}/{_halftoneAngle.Value:0},kuwahara={_kuwaharaEnabled.Value}:{_kuwaharaIntensity.Value:0.000}@{_kuwaharaRadius.Value:0.0},selective={_selectiveColorEnabled.Value}:{_selectiveColorIntensity.Value:0.000}@{_selectiveColorHue.Value:0}/{_selectiveColorRange.Value:0}/{_selectiveColorSoftness.Value:0.00},radialBlur={_radialBlurEnabled.Value}:{_radialBlurIntensity.Value:0.000},lensDirt={_lensDirtEnabled.Value}:{_lensDirtIntensity.Value:0.000},rainOnLens={_rainOnLensEnabled.Value}:{_rainOnLensIntensity.Value:0.000},caustics={_causticsOverlayEnabled.Value}:{_causticsOverlayIntensity.Value:0.000},godray={_godrayFakeEnabled.Value}:{_godrayFakeIntensity.Value:0.000},filmGate={_filmGateEnabled.Value}:{_filmGateIntensity.Value:0.000},glitch={_glitchPackEnabled.Value}:{_glitchPackIntensity.Value:0.000},fogTint={_volumetricFogTintEnabled.Value}:{_volumetricFogTintIntensity.Value:0.000}@{_volumetricFogTintHue.Value:0}/{_volumetricFogTintDensity.Value:0.00},lutBlend={_lutBlendEnabled.Value}:{_lutBlendAmount.Value:0.000},splitTone={_splitToningEnabled.Value}:S({_splitShadowsR.Value:0.00},{_splitShadowsG.Value:0.00},{_splitShadowsB.Value:0.00})H({_splitHighlightsR.Value:0.00},{_splitHighlightsG.Value:0.00},{_splitHighlightsB.Value:0.00})B({_splitToningBalance.Value:0}),lensCenter={_lensCenterX.Value:0.00},{_lensCenterY.Value:0.00},motionBlur={_motionBlurEnabled.Value}:{_motionBlurIntensity.Value:0.000},depthOfField={_depthOfFieldEnabled.Value}:{_depthOfFieldIntensity.Value:0.000}] " + $"world[sky={_enhancedSkyEnabled.Value}:{_skyIntensity.Value:0.00} exposure={_skyExposure.Value:0.00} hue={_skyHueShift.Value:0} blend={_skyColorBlend.Value:0.00} skybox={_skyboxMaterialIndex.Value},sun={_sunIntensityMultiplier.Value:0.00}/{_sunTemperature.Value:0} rgb={_sunColorR.Value:0.00},{_sunColorG.Value:0.00},{_sunColorB.Value:0.00}@{_sunColorBlend.Value:0.00},clouds={_cloudLayersEnabled.Value}:{_cloudDensity.Value:0.00},weather={_weatherSystemEnabled.Value}:{_weatherMode.Value}/{_weatherStrength.Value:0.00},water={_waterOverrideEnabled.Value}:{_waterClarity.Value:0.00}/{_waterWaveStrength.Value:0.00}]"); } catch (Exception ex) { DebugLog("Telemetry[" + reason + "] failed: " + ex.GetBaseException().Message); } } private void DebugLog(string message) { if (_debugMode.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[ShaderPlayground][Debug] " + message)); } } private void SendToPlayer(PlayerID target, Msg type, T payload) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_network == (Object)null)) { byte[] data = Codec.Encode((byte)type, LocalPlayerIdOrZero(), JsonUtility.ToJson((object)payload)); _network.Send(target, new NetworkPayloadV1 { Data = data }, (Channel)2); } } private void SendToAll(Msg type, T payload) { if (!((Object)(object)_network == (Object)null)) { byte[] data = Codec.Encode((byte)type, LocalPlayerIdOrZero(), JsonUtility.ToJson((object)payload)); _network.SendToAll(new NetworkPayloadV1 { Data = data }, (Channel)2); } } private void SendToServer(Msg type, T payload) { if (!((Object)(object)_network == (Object)null)) { byte[] data = Codec.Encode((byte)type, LocalPlayerIdOrZero(), JsonUtility.ToJson((object)payload)); _network.SendToServer(new NetworkPayloadV1 { Data = data }, (Channel)2); } } private static void RegisterContracts() { if (!Hasher.IsRegistered(typeof(NetworkPayloadV1))) { Hasher.PrepareType(typeof(NetworkPayloadV1)); } RegisterPacker(); } [RegisterPackers(-10)] private static void RegisterForPurrNet() { NetworkRegister.Hash(typeof(NetworkPayloadV1).TypeHandle); RegisterPacker(); } private static void RegisterPacker() { Packer.RegisterWriter((WriteFunc)WritePayload); Packer.RegisterReader((ReadFunc)ReadPayload); } private static void WritePayload(BitPacker p, NetworkPayloadV1 n) { Packer.Write(p, n?.Data ?? Array.Empty()); } private static void ReadPayload(BitPacker p, ref NetworkPayloadV1 n) { if (n == null) { n = new NetworkPayloadV1(); } byte[] data = n.Data; Packer.Read(p, ref data); n.Data = data ?? Array.Empty(); } private void BuildEffectStack() { _effectStack.Clear(); _effectStack.Add(new EffectSlot("crt", () => _crtEnabled.Value, () => _crtIntensity.Value)); _effectStack.Add(new EffectSlot("dream", () => _dreamEnabled.Value, () => _dreamIntensity.Value)); _effectStack.Add(new EffectSlot("comic", () => _comicEnabled.Value, () => _comicIntensity.Value)); _effectStack.Add(new EffectSlot("heat", () => _heatwaveEnabled.Value, () => _heatwaveIntensity.Value)); _effectStack.Add(new EffectSlot("noir", () => _noirEnabled.Value, () => _noirIntensity.Value)); _effectStack.Add(new EffectSlot("vapor", () => _vaporEnabled.Value, () => _vaporIntensity.Value)); _effectStack.Add(new EffectSlot("posterize", () => _posterizeEnabled.Value, () => _posterizeIntensity.Value)); _effectStack.Add(new EffectSlot("pixelate", () => _pixelateEnabled.Value, () => _pixelateIntensity.Value)); _effectStack.Add(new EffectSlot("chromatic-split", () => _chromaticSplitEnabled.Value, () => _chromaticSplitIntensity.Value)); _effectStack.Add(new EffectSlot("dither", () => _ditherEnabled.Value, () => _ditherIntensity.Value)); _effectStack.Add(new EffectSlot("exp-halftone", () => _halftoneEnabled.Value, () => _halftoneIntensity.Value)); _effectStack.Add(new EffectSlot("exp-kuwahara", () => _kuwaharaEnabled.Value, () => _kuwaharaIntensity.Value)); _effectStack.Add(new EffectSlot("exp-selective-color", () => _selectiveColorEnabled.Value, () => _selectiveColorIntensity.Value)); _effectStack.Add(new EffectSlot("exp-radial-blur", () => _radialBlurEnabled.Value, () => _radialBlurIntensity.Value)); _effectStack.Add(new EffectSlot("exp-lens-dirt", () => _lensDirtEnabled.Value, () => _lensDirtIntensity.Value)); _effectStack.Add(new EffectSlot("exp-rain-on-lens", () => _rainOnLensEnabled.Value, () => _rainOnLensIntensity.Value)); _effectStack.Add(new EffectSlot("exp-caustics-overlay", () => _causticsOverlayEnabled.Value, () => _causticsOverlayIntensity.Value)); _effectStack.Add(new EffectSlot("exp-godray-fake", () => _godrayFakeEnabled.Value, () => _godrayFakeIntensity.Value)); _effectStack.Add(new EffectSlot("exp-film-gate", () => _filmGateEnabled.Value, () => _filmGateIntensity.Value)); _effectStack.Add(new EffectSlot("exp-glitch-pack", () => _glitchPackEnabled.Value, () => _glitchPackIntensity.Value)); _effectStack.Add(new EffectSlot("exp-volumetric-fog-tint", () => _volumetricFogTintEnabled.Value, () => _volumetricFogTintIntensity.Value)); _effectStack.Add(new EffectSlot("motion-blur", () => _motionBlurEnabled.Value, () => _motionBlurIntensity.Value)); _effectStack.Add(new EffectSlot("depth-of-field", () => _depthOfFieldEnabled.Value, () => _depthOfFieldIntensity.Value)); _effectStack.Add(new EffectSlot("exp-anamorphic-bloom", () => _anamorphicBloomEnabled.Value, () => _anamorphicBloomIntensity.Value)); } private void TryInitializeOtApi() { if (!_enableOtApiIntegration.Value) { _otApiReady = false; _otApiRegistered = false; _otApiRegisteredControlCount = 0; return; } try { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetType("_otAPI.otAPI", throwOnError: false) != null); if (assembly == null) { _otApiReady = false; return; } _otApiType = assembly.GetType("_otAPI.otAPI", throwOnError: false); _otArgType = assembly.GetType("_otAPI.Arg", throwOnError: false); _otArgEnumType = assembly.GetType("_otAPI.ArgType", throwOnError: false); _otCfgLinkType = assembly.GetType("_otAPI.CfgLink", throwOnError: false); _otAuxTimingType = assembly.GetType("_otAPI.AuxTiming", throwOnError: false); if (_otApiType == null || _otArgType == null || _otArgEnumType == null || _otCfgLinkType == null) { _otApiReady = false; return; } MethodInfo[] methods = _otApiType.GetMethods(BindingFlags.Static | BindingFlags.Public); _otCreateDepotMethod = methods.FirstOrDefault((MethodInfo m) => m.Name == "CreateDepot" && m.GetParameters().Length == 5); _otAddCfgMethod = methods.FirstOrDefault((MethodInfo m) => m.Name == "AddCfg" && m.GetParameters().Length >= 5); _otNotifyMethod = methods.FirstOrDefault((MethodInfo m) => m.Name == "Notify"); if (_otCreateDepotMethod == null || _otAddCfgMethod == null) { _otApiReady = false; return; } if (_otDepot == null) { _otDepot = _otCreateDepotMethod.Invoke(null, new object[5] { "Shader Playground", "SPG", "Damon", "Host-syncable shader controls", "spg" }); } _otApiReady = _otDepot != null; if (_otApiReady && !_otApiRegistered) { _otApiRegisteredControlCount = RegisterOtApiControls(); _otApiRegistered = _otApiRegisteredControlCount > 0; if (_otApiRegistered) { ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} otAPI controls ready ({1} controls).", "ShaderPlayground", _otApiRegisteredControlCount)); TryOtApiNotify("ShaderPlayground: otAPI controls registered."); } } } catch (Exception ex) { _otApiReady = false; ((BaseUnityPlugin)this).Logger.LogWarning((object)("ShaderPlayground otAPI integration unavailable: " + ex.GetBaseException().Message)); } } private int RegisterOtApiControls() { return 0 + (RegisterOtApiBool("Enable otAPI Integration", "Enable or disable otAPI control registration.", _enableOtApiIntegration, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Settings Window Visible", "Show or hide ShaderPlayground in-game window.", _windowVisibleConfig, delegate { _showWindow = _windowVisibleConfig.Value; }) ? 1 : 0) + (RegisterOtApiBool("Master Enabled", "Enable or disable ShaderPlayground.", _masterEnabled, delegate { Commit("otapi-master-toggle", notify: false); }) ? 1 : 0) + (RegisterOtApiBool("Sync Enabled", "Host-authoritative sync toggle.", _syncEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Local Only Mode", "Run local-only without sync.", _localOnlyMode, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Allow Host Sync", "Allow host profile to override this client.", _acceptHostSync, delegate { if (_acceptHostSync.Value && _localOnlyMode.Value) { _localOnlyMode.Value = false; } }) ? 1 : 0) + (RegisterOtApiBool("Show Notifications", "Show ShaderPlayground notifications.", _showNotifications, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Enable Shader Pass", "Enable fullscreen shader path.", _enableShaderPass, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Force Volume Fallback", "Force built-in volume-only mode.", _forceVolumeFallback, delegate { }) ? 1 : 0) + (RegisterOtApiInt("Quality Tier", "0 low, 1 medium, 2 high.", _qualityTier, 0, 2, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Fisheye Enabled", "Enable Fisheye effect.", _crtEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Fisheye Intensity", "Fisheye intensity.", _crtIntensity, 0f, 0.1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Dream Enabled", "Enable Dream Bloom effect.", _dreamEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Dream Intensity", "Dream Bloom intensity.", _dreamIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Comic Enabled", "Enable Comic/Sketch effect.", _comicEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Comic Intensity", "Comic/Sketch intensity.", _comicIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Breathing Enabled", "Enable Breathing effect.", _heatwaveEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Breathing", "Breathing intensity.", _heatwaveIntensity, 0f, 0.05f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Breathing Speed", "Breathing speed.", _heatwaveSpeed, 0.2f, 4f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Noir Enabled", "Enable cinematic noir grade.", _noirEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Noir Intensity", "Noir intensity.", _noirIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Vapor Enabled", "Enable neon/vapor grade.", _vaporEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Vapor Intensity", "Vapor intensity.", _vaporIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Posterize Enabled", "Enable posterize color quantization.", _posterizeEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Posterize Intensity", "Posterize strength.", _posterizeIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Pixelate Enabled", "Enable pixelate retro scaling.", _pixelateEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Pixelate Intensity", "Pixelate strength.", _pixelateIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Chromatic Split Enabled", "Enable RGB split.", _chromaticSplitEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Chromatic Split Intensity", "RGB split intensity.", _chromaticSplitIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Dither Enabled", "Enable stylized dither grain.", _ditherEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Dither Intensity", "Dither intensity.", _ditherIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Anamorphic Bloom Enabled", "Enable experimental anamorphic bloom.", _anamorphicBloomEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Anamorphic Bloom Intensity", "Experimental anamorphic bloom intensity.", _anamorphicBloomIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Halftone Enabled", "Enable experimental halftone comic dots.", _halftoneEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Halftone Intensity", "Experimental halftone amount.", _halftoneIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Halftone Dot Size", "Experimental halftone dot size.", _halftoneDotSize, 0.25f, 8f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Halftone Angle", "Experimental halftone angle in degrees.", _halftoneAngle, 0f, 180f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Kuwahara Enabled", "Enable experimental Kuwahara/Oil Paint smoothing.", _kuwaharaEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Kuwahara Intensity", "Experimental Kuwahara/Oil Paint amount.", _kuwaharaIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Kuwahara Radius", "Experimental Kuwahara/Oil Paint radius.", _kuwaharaRadius, 1f, 6f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Selective Color Enabled", "Enable selective hue retention with out-of-range desaturation.", _selectiveColorEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Selective Color Intensity", "Selective Color desaturation amount.", _selectiveColorIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Selective Color Hue", "Selective Color target hue in degrees.", _selectiveColorHue, 0f, 360f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Selective Color Range", "Selective Color hue range in degrees.", _selectiveColorRange, 1f, 180f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Selective Color Softness", "Selective Color edge softness.", _selectiveColorSoftness, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Radial Blur Enabled", "Enable center-based radial blur.", _radialBlurEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Radial Blur Intensity", "Radial blur intensity.", _radialBlurIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Lens Dirt Enabled", "Enable bloom-reactive lens dirt overlay.", _lensDirtEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Lens Dirt Intensity", "Lens dirt intensity.", _lensDirtIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Rain-on-Lens Enabled", "Enable animated rain droplet lens distortion.", _rainOnLensEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Rain-on-Lens Intensity", "Rain-on-Lens intensity.", _rainOnLensIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Caustics Overlay Enabled", "Enable moving water-light patterns on world surfaces.", _causticsOverlayEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Caustics Overlay Intensity", "Caustics Overlay intensity.", _causticsOverlayIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Godray Fake Enabled", "Enable cheap sun-direction screen rays approximation.", _godrayFakeEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Godray Fake Intensity", "Godray Fake intensity.", _godrayFakeIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Film Gate Enabled", "Enable movie-mode letterbox + jitter + grain.", _filmGateEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Film Gate Intensity", "Film Gate intensity.", _filmGateIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Glitch Pack Enabled", "Enable scanline jitter, channel jumps, and digital tearing.", _glitchPackEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Glitch Pack Intensity", "Glitch Pack intensity.", _glitchPackIntensity, 0f, 0.1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Volumetric Fog Tint Enabled", "Enable stylized fog tint and density shaping.", _volumetricFogTintEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Volumetric Fog Tint Intensity", "Volumetric fog color intensity.", _volumetricFogTintIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Volumetric Fog Tint Density", "Volumetric fog density shaping amount.", _volumetricFogTintDensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Volumetric Fog Tint Hue", "Volumetric fog hue in degrees.", _volumetricFogTintHue, 0f, 360f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("LUT Blend Enabled", "Enable experimental LUT A/B blend.", _lutBlendEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("LUT Blend Amount", "Blend between LUT A (0) and LUT B (1).", _lutBlendAmount, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Lens Center X", "Lens distortion center X.", _lensCenterX, -1f, 2f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Lens Center Y", "Lens distortion center Y.", _lensCenterY, -1f, 2f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Motion Blur Enabled", "Enable motion blur.", _motionBlurEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Motion Blur Intensity", "Motion blur intensity.", _motionBlurIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Depth Of Field Enabled", "Enable depth of field.", _depthOfFieldEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Depth Of Field Intensity", "Depth of field intensity.", _depthOfFieldIntensity, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Sky Exposure", "Skybox exposure multiplier.", _skyExposure, 0.05f, 2.5f, delegate { }) ? 1 : 0) + (RegisterOtApiInt("Skybox Style", "0 Original, 1 Black.", _skyboxMaterialIndex, 0, 1, delegate { RefreshSkyboxMaterialOptions(); _skyboxMaterialIndex.Value = Mathf.Clamp(_skyboxMaterialIndex.Value, 0, 1); }) ? 1 : 0) + (RegisterOtApiFloat("Sun Intensity", "Sun intensity multiplier.", _sunIntensityMultiplier, 0f, 3f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Sun Temperature", "Sun color temperature.", _sunTemperature, 1000f, 20000f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Sun Color R", "Sun color red.", _sunColorR, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Sun Color G", "Sun color green.", _sunColorG, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Sun Color B", "Sun color blue.", _sunColorB, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Sun Color Blend", "Sun custom color blend.", _sunColorBlend, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiInt("Tonemapping Mode", "0 Off, 1 Neutral, 2 ACES.", _tonemappingMode, 0, 2, delegate { }) ? 1 : 0) + (RegisterOtApiBool("White Balance Enabled", "Enable WhiteBalance override.", _whiteBalanceEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("White Balance Temp", "WhiteBalance temperature.", _whiteBalanceTemperature, -100f, 100f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("White Balance Tint", "WhiteBalance tint.", _whiteBalanceTint, -100f, 100f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("LiftGammaGain Enabled", "Enable Lift/Gamma/Gain override.", _liftGammaGainEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Lift Amount", "Lift amount.", _liftAmount, -1f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Gamma Amount", "Gamma amount.", _gammaAmount, 0f, 2f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Gain Amount", "Gain amount.", _gainAmount, 0f, 2f, delegate { }) ? 1 : 0) + (RegisterOtApiBool("Split Toning Enabled", "Enable split toning shadows/highlights tint.", _splitToningEnabled, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Split Shadows R", "Split toning shadows red channel.", _splitShadowsR, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Split Shadows G", "Split toning shadows green channel.", _splitShadowsG, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Split Shadows B", "Split toning shadows blue channel.", _splitShadowsB, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Split Highlights R", "Split toning highlights red channel.", _splitHighlightsR, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Split Highlights G", "Split toning highlights green channel.", _splitHighlightsG, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Split Highlights B", "Split toning highlights blue channel.", _splitHighlightsB, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Split Toning Balance", "Split toning balance (-100 shadow bias, 100 highlight bias).", _splitToningBalance, -100f, 100f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Sky Hue Shift", "Shift sky hue in degrees.", _skyHueShift, -180f, 180f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Sky Color Blend", "Blend amount for hue-shifted sky color.", _skyColorBlend, 0f, 1f, delegate { }) ? 1 : 0) + (RegisterOtApiFloat("Notify Interval", "Minimum time between notifications.", _notificationMinIntervalSeconds, 0.2f, 5f, delegate { }) ? 1 : 0); } private bool RegisterOtApiBool(string name, string description, ConfigEntry config, Action callback) { Array args = CreateOtApiArgArray(); object cfgLink = TryCreateOtApiCfgLink("Bool", config); return RegisterOtApiControl(name, description, args, cfgLink, callback); } private bool RegisterOtApiFloat(string name, string description, ConfigEntry config, float min, float max, Action callback) { object obj = TryCreateOtApiArg("Float", optional: true, min, max); Array args = ((obj == null) ? CreateOtApiArgArray() : CreateOtApiArgArray(obj)); object cfgLink = TryCreateOtApiCfgLink("Float", config); return RegisterOtApiControl(name, description, args, cfgLink, callback); } private bool RegisterOtApiInt(string name, string description, ConfigEntry config, int min, int max, Action callback) { object obj = TryCreateOtApiArg("Int", optional: true, min, max); Array args = ((obj == null) ? CreateOtApiArgArray() : CreateOtApiArgArray(obj)); object cfgLink = TryCreateOtApiCfgLink("Int", config); return RegisterOtApiControl(name, description, args, cfgLink, callback); } private bool RegisterOtApiControl(string name, string description, Array args, object? cfgLink, Action callback) { if (_otAddCfgMethod == null || _otDepot == null || _otArgType == null) { return false; } try { ParameterInfo[] parameters = _otAddCfgMethod.GetParameters(); object[] array = new object[parameters.Length]; array[0] = name; array[1] = description; array[2] = _otDepot; array[3] = args; array[4] = cfgLink; if (parameters.Length >= 6) { array[5] = CreateCallbackDelegate(parameters[5].ParameterType, callback); } if (parameters.Length >= 7) { array[6] = ((_otAuxTimingType != null) ? Enum.ToObject(_otAuxTimingType, 1) : null); } _otAddCfgMethod.Invoke(null, array); return true; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogDebug((object)("ShaderPlayground otAPI AddCfg '" + name + "' failed: " + ex.GetBaseException().Message)); return false; } } private object? TryCreateOtApiArg(string argTypeName, bool optional, float min = 0f, float max = 0f) { if (_otArgType == null || _otArgEnumType == null) { return null; } try { object obj = Enum.Parse(_otArgEnumType, argTypeName); ConstructorInfo[] constructors = _otArgType.GetConstructors(BindingFlags.Instance | BindingFlags.Public); foreach (ConstructorInfo constructorInfo in constructors) { ParameterInfo[] parameters = constructorInfo.GetParameters(); if (parameters.Length == 2 && parameters[0].ParameterType == _otArgEnumType && parameters[1].ParameterType == typeof(bool)) { return constructorInfo.Invoke(new object[2] { obj, optional }); } if (parameters.Length == 4 && parameters[0].ParameterType == _otArgEnumType && parameters[1].ParameterType == typeof(bool) && parameters[2].ParameterType == typeof(float) && parameters[3].ParameterType == typeof(float)) { return constructorInfo.Invoke(new object[4] { obj, optional, min, max }); } if (parameters.Length == 4 && parameters[0].ParameterType == _otArgEnumType && parameters[1].ParameterType == typeof(bool) && parameters[2].ParameterType == typeof(int) && parameters[3].ParameterType == typeof(int)) { return constructorInfo.Invoke(new object[4] { obj, optional, Mathf.RoundToInt(min), Mathf.RoundToInt(max) }); } } } catch { } return null; } private object? TryCreateOtApiCfgLink(string argTypeName, object configEntry) { if (_otCfgLinkType == null || _otArgEnumType == null) { return null; } try { object obj = Enum.Parse(_otArgEnumType, argTypeName); ConstructorInfo[] constructors = _otCfgLinkType.GetConstructors(BindingFlags.Instance | BindingFlags.Public); foreach (ConstructorInfo constructorInfo in constructors) { ParameterInfo[] parameters = constructorInfo.GetParameters(); if (parameters.Length == 5 && !(parameters[0].ParameterType != _otArgEnumType) && parameters[1].ParameterType.IsAssignableFrom(configEntry.GetType())) { return constructorInfo.Invoke(new object[5] { obj, configEntry, "was changed to", "is currently set to", false }); } } } catch { } return null; } private Array CreateOtApiArgArray(params object?[] args) { if (_otArgType == null) { return Array.Empty(); } Array array = Array.CreateInstance(_otArgType, args.Length); for (int i = 0; i < args.Length; i++) { array.SetValue(args[i], i); } return array; } private static object? CreateCallbackDelegate(Type expected, Action callback) { if (expected.IsAssignableFrom(typeof(Action))) { return callback; } try { return Delegate.CreateDelegate(expected, callback.Target, callback.Method, throwOnBindFailure: false); } catch { return null; } } private void Notify(string message) { if (!_showNotifications.Value || Time.unscaledTime < _nextNotifyAt) { return; } _nextNotifyAt = Time.unscaledTime + Mathf.Clamp(_notificationMinIntervalSeconds.Value, 0.2f, 10f); try { TextChannelManager i = NetworkSingleton.I; if (i != null) { i.AddNotification("[ShaderPlayground] " + message); } } catch { } TryOtApiNotify(message); } private void TryOtApiNotify(string message) { if (!_otApiReady || _otNotifyMethod == null) { return; } try { if (_otNotifyMethod.GetParameters().Length == 1) { _otNotifyMethod.Invoke(null, new object[1] { message }); } else { _otNotifyMethod.Invoke(null, new object[2] { message, null }); } } catch { } } private void TryPublishShaderStateToSessionVisualBridges(string reason) { if (_enableSessionVisualBridgeSync.Value && IsHost()) { string profileJson = JsonUtility.ToJson((object)BuildSessionVisualBridgeProfileFromShader(reason)); bool localOnlyMode = !_syncEnabled.Value || _localOnlyMode.Value; TryPublishToBridge("io.damon.ontogether.rejoinstaterecovery", "RejoinStateRecovery.Plugin", "RejoinStateRecovery", ref _rejoinBridgeType, ref _rejoinBridgePublishMethod, ref _nextRejoinBridgeResolveAt, profileJson, localOnlyMode, "shaderplayground:" + reason); TryPublishToBridge("io.damon.ontogether.smartcheckinprompts", "SmartCheckinPrompts.Plugin", "SmartCheckinPrompts", ref _smartCheckinBridgeType, ref _smartCheckinBridgePublishMethod, ref _nextSmartCheckinBridgeResolveAt, profileJson, localOnlyMode, "shaderplayground:" + reason); TryPublishToBridge("io.damon.ontogether.fishingtackleboxjournal", "FishingTackleboxJournal.Plugin", "FishingTackleboxJournal", ref _fishingBridgeType, ref _fishingBridgePublishMethod, ref _nextFishingBridgeResolveAt, profileJson, localOnlyMode, "shaderplayground:" + reason); TryPublishToBridge("io.damon.ontogether.chalkboardimageimporter", "ChalkboardImageImporter.Plugin", "ChalkboardImageImporter", ref _chalkboardBridgeType, ref _chalkboardBridgePublishMethod, ref _nextChalkboardBridgeResolveAt, profileJson, localOnlyMode, "shaderplayground:" + reason); TryPublishToBridge("io.damon.ontogether.sessionvisuallab", "SessionVisualLab.Plugin", "SessionVisualLab", ref _sessionVisualLabBridgeType, ref _sessionVisualLabBridgePublishMethod, ref _nextSessionVisualLabBridgeResolveAt, profileJson, localOnlyMode, "shaderplayground:" + reason); } } private void TryPublishToBridge(string bridgePluginGuid, string bridgeTypeName, string bridgeLabel, ref Type? bridgeType, ref MethodInfo? bridgePublishMethod, ref float nextResolveAt, string profileJson, bool localOnlyMode, string reason) { try { if (bridgePublishMethod == null && Time.unscaledTime >= nextResolveAt) { nextResolveAt = Time.unscaledTime + 3f; bridgeType = null; if (Chainloader.PluginInfos.TryGetValue(bridgePluginGuid, out var value) && (Object)(object)((value != null) ? value.Instance : null) != (Object)null) { Type type = ((object)value.Instance).GetType(); if (string.Equals(type.FullName, bridgeTypeName, StringComparison.Ordinal)) { bridgeType = type; } } bridgePublishMethod = bridgeType?.GetMethod("TryPublishSessionVisualStateFromHost", BindingFlags.Static | BindingFlags.Public); } if (!(bridgePublishMethod == null)) { bridgePublishMethod.Invoke(null, new object[5] { profileJson, _revision, _masterEnabled.Value, localOnlyMode, reason }); } } catch (Exception ex) { bridgePublishMethod = null; nextResolveAt = Time.unscaledTime + 3f; ((BaseUnityPlugin)this).Logger.LogDebug((object)(bridgeLabel + " bridge publish failed: " + ex.GetBaseException().Message)); } } private SessionVisualProfileV1 BuildSessionVisualBridgeProfileFromShader(string reason) { if (!ShouldApplyLocalVisuals()) { return CreateBridgeDisabledProfile(reason); } SessionVisualProfileV1 sessionVisualProfileV = SessionVisualProfileV1.CreateBalancedPreset(); sessionVisualProfileV.Label = "Shader " + reason; sessionVisualProfileV.Revision = _revision; sessionVisualProfileV.LastUpdatedUtc = DateTime.UtcNow.ToString("O"); float num = (_crtEnabled.Value ? Mathf.Clamp01(_crtIntensity.Value) : 0f); float num2 = (_dreamEnabled.Value ? Mathf.Clamp01(_dreamIntensity.Value) : 0f); float num3 = (_comicEnabled.Value ? Mathf.Clamp01(_comicIntensity.Value) : 0f); float num4 = (_heatwaveEnabled.Value ? Mathf.Clamp01(_heatwaveIntensity.Value) : 0f); sessionVisualProfileV.SessionColorLabEnabled = num > 0.01f || num2 > 0.01f || num3 > 0.01f; sessionVisualProfileV.SessionColorStrength = Mathf.Clamp01(0.05f + num * 0.18f + num2 * 0.08f + num3 * 0.12f); sessionVisualProfileV.BloomEnabled = num2 > 0.01f || num > 0.15f; sessionVisualProfileV.BloomIntensity = Mathf.Clamp(0.1f + num2 * 0.9f + num * 0.25f, 0f, 2f); sessionVisualProfileV.BloomScatter = Mathf.Clamp01(0.45f + num2 * 0.5f); sessionVisualProfileV.ColorGradingEnabled = num3 > 0.01f || num > 0.01f || num2 > 0.01f; sessionVisualProfileV.Contrast = Mathf.Clamp(num * 12f + num3 * 46f, -60f, 60f); sessionVisualProfileV.Saturation = Mathf.Clamp(num2 * 18f - num3 * 70f, -100f, 100f); sessionVisualProfileV.HueShift = Mathf.Clamp(num4 * 8f - num * 10f, -180f, 180f); sessionVisualProfileV.VignetteEnabled = num > 0.01f || num3 > 0.01f; sessionVisualProfileV.VignetteIntensity = Mathf.Clamp(num * 0.28f + num3 * 0.18f, 0f, 0.6f); sessionVisualProfileV.ChromaticAberrationEnabled = num > 0.01f || num4 > 0.01f; sessionVisualProfileV.ChromaticAberrationIntensity = Mathf.Clamp01(num * 0.22f + num4 * 0.12f); sessionVisualProfileV.LensDistortionEnabled = num > 0.01f || num4 > 0.01f; sessionVisualProfileV.LensDistortionIntensity = Mathf.Clamp(-0.12f * num + 0.16f * num4, -0.35f, 0.35f); sessionVisualProfileV.DepthOfFieldEnabled = num2 > 0.4f; sessionVisualProfileV.MotionBlurEnabled = num4 > 0.01f; sessionVisualProfileV.MotionBlurIntensity = Mathf.Clamp(num4 * 0.22f, 0f, 0.5f); NormalizeSessionVisualProfile(sessionVisualProfileV); return sessionVisualProfileV; } private SessionVisualProfileV1 CreateBridgeDisabledProfile(string reason) { SessionVisualProfileV1 sessionVisualProfileV = SessionVisualProfileV1.CreateBalancedPreset(); sessionVisualProfileV.Label = "Shader disabled (" + reason + ")"; sessionVisualProfileV.Revision = _revision; sessionVisualProfileV.LastUpdatedUtc = DateTime.UtcNow.ToString("O"); sessionVisualProfileV.SessionColorLabEnabled = false; sessionVisualProfileV.SessionColorStrength = 0f; sessionVisualProfileV.BloomEnabled = false; sessionVisualProfileV.BloomIntensity = 0f; sessionVisualProfileV.BloomScatter = 0f; sessionVisualProfileV.ColorGradingEnabled = false; sessionVisualProfileV.Contrast = 0f; sessionVisualProfileV.Saturation = 0f; sessionVisualProfileV.HueShift = 0f; sessionVisualProfileV.VignetteEnabled = false; sessionVisualProfileV.VignetteIntensity = 0f; sessionVisualProfileV.ChromaticAberrationEnabled = false; sessionVisualProfileV.ChromaticAberrationIntensity = 0f; sessionVisualProfileV.LensDistortionEnabled = false; sessionVisualProfileV.LensDistortionIntensity = 0f; sessionVisualProfileV.DepthOfFieldEnabled = false; sessionVisualProfileV.MotionBlurEnabled = false; sessionVisualProfileV.MotionBlurIntensity = 0f; return sessionVisualProfileV; } public static bool TryPublishSessionVisualStateFromHost(string profileJson, long revision, bool masterEnabled, bool localOnlyMode, string reason) { return false; } private bool ReceiveSessionVisualStateFromHost(string profileJson, long revision, bool masterEnabled, bool localOnlyMode, string reason) { if (!_enableSessionVisualBridgeSync.Value) { return false; } SessionVisualProfileV1 sessionVisualProfileV; try { sessionVisualProfileV = (string.IsNullOrWhiteSpace(profileJson) ? SessionVisualProfileV1.CreateBalancedPreset() : (JsonUtility.FromJson(profileJson) ?? SessionVisualProfileV1.CreateBalancedPreset())); } catch { sessionVisualProfileV = SessionVisualProfileV1.CreateBalancedPreset(); } NormalizeSessionVisualProfile(sessionVisualProfileV); long num = Math.Max(0L, revision); if (num <= _lastSessionVisualBridgeRevision) { return true; } _lastSessionVisualBridgeRevision = num; ProfileStateV1 profileStateV = BuildStateFromSessionVisualProfile(sessionVisualProfileV, num, masterEnabled, "svl-bridge:" + reason); if (IsHost() && _syncEnabled.Value && !_localOnlyMode.Value && !localOnlyMode) { SendToAll(Msg.StateSnapshot, new StateSnapshotV2 { ProtocolVersion = 4, SessionEpoch = EnsureHostSessionEpoch(), Revision = profileStateV.Revision, StateHash = ComputeStateHash(profileStateV), State = profileStateV, Reason = "svl-bridge:" + reason, SentAtUtc = DateTime.UtcNow.ToString("O") }); _nextHostKeepaliveAt = Time.unscaledTime + 7f; } return true; } private static ProfileStateV1 BuildStateFromSessionVisualProfile(SessionVisualProfileV1 profile, long revision, bool masterEnabled, string reason) { float num = Mathf.Clamp01(Mathf.Max(new float[3] { profile.VignetteEnabled ? (profile.VignetteIntensity / 0.6f) : 0f, profile.ChromaticAberrationEnabled ? profile.ChromaticAberrationIntensity : 0f, profile.SessionColorLabEnabled ? profile.SessionColorStrength : 0f })); float num2 = (profile.BloomEnabled ? Mathf.Clamp01(Mathf.Max(profile.BloomIntensity / 0.75f, profile.BloomScatter)) : 0f); float num3 = (profile.ColorGradingEnabled ? Mathf.Clamp01(Mathf.Max(new float[3] { Mathf.Abs(profile.Contrast) / 60f, Mathf.Abs(profile.Saturation) / 100f, Mathf.Abs(profile.HueShift) / 180f })) : 0f); float num4 = (profile.LensDistortionEnabled ? Mathf.Clamp01(Mathf.Abs(profile.LensDistortionIntensity) / 0.35f) : 0f); int num5 = 0; if (profile.BloomEnabled && profile.BloomIntensity > 0.35f) { num5++; } if (profile.DepthOfFieldEnabled) { num5++; } if (profile.MotionBlurEnabled) { num5++; } if (profile.LensDistortionEnabled) { num5++; } int num6 = ((num5 >= 3) ? 2 : ((num5 >= 1) ? 1 : 0)); return new ProfileStateV1 { ProtocolVersion = 4, Revision = revision, MasterEnabled = masterEnabled, EnableShaderPass = true, QualityTier = num6, C = (num > 0.01f), Ci = num, D = (num2 > 0.01f), Di = num2, K = (num3 > 0.01f), Ki = num3, H = (num4 > 0.01f), Hi = num4, Hs = Mathf.Clamp(0.8f + (profile.MotionBlurEnabled ? (profile.MotionBlurIntensity * 4f) : 0f) + (profile.DepthOfFieldEnabled ? 0.35f : 0f), 0.2f, 4f), S = false, Si = 0f, V = false, Vi = 0f, Pr = false, Pri = 0f, Px = false, Pxi = 0f, Cs = false, Csi = 0f, Dt = false, Dti = 0f, LensCx = 0.5f, LensCy = 0.5f, Mb = profile.MotionBlurEnabled, Mbi = (profile.MotionBlurEnabled ? Mathf.Clamp01(profile.MotionBlurIntensity / 0.5f) : 0f), Df = profile.DepthOfFieldEnabled, Dfi = (profile.DepthOfFieldEnabled ? 0.5f : 0f), Ab = false, Abi = 0f, Hf = false, Hfi = 0f, Hfs = 1.25f, Hfa = 45f, Kw = false, Kwi = 0f, Kwr = 2f, Sc = false, Sci = 0f, Sch = 0f, Scr = 35f, Scs = 0.25f, Rb = false, Rbi = 0f, Ld = false, Ldi = 0f, Rn = false, Rni = 0f, Ca = false, Cai = 0f, Gd = false, Gdi = 0f, Fg = false, Fgi = 0f, Gl = false, Gli = 0f, Vf = false, Vfi = 0f, Vfd = 0.4f, Vfh = 210f, Lb = false, Lbi = 0f, HypnosisEnabled = false, HypnosisPreset = 0, HypnosisIntensity = 0f, HypnosisSpeed = 0f, HypnosisWarpAmount = 0f, HypnosisSpiralAmount = 0f, HypnosisColorBlend = 0f, Sky = true, SkyI = 0.62f, SkyExposure = 1f, SkyHue = 0f, SkyColorBlend = 0f, SkyboxIndex = 0, SunIntensity = 1f, SunTemp = 6500f, SunR = 1f, SunG = 0.97f, SunB = 0.9f, SunBlend = 0f, Tm = 0, Wb = false, WbTemp = 0f, WbTint = 0f, Lgg = false, Lift = 0f, Gamma = 1f, Gain = 1f, St = false, StSr = 0.5f, StSg = 0.5f, StSb = 0.5f, StHr = 0.5f, StHg = 0.5f, StHb = 0.5f, StBal = 0f, Clouds = true, CloudD = 0.6f, Weather = true, WeatherMode = 0, WeatherStrength = 0.6f, Water = true, WaterClarity = 0.65f, WaterWave = Mathf.Clamp01(0.45f + num4 * 0.35f), AaPreset = ((num6 >= 2) ? 3 : 2), CasSharp = ((num6 >= 1) ? 0.28f : 0.2f), Reason = reason, SentAtUtc = DateTime.UtcNow.ToString("O") }; } private static void NormalizeSessionVisualProfile(SessionVisualProfileV1 p) { p.Revision = Math.Max(0L, p.Revision); p.SessionColorStrength = Mathf.Clamp01(p.SessionColorStrength); p.BloomIntensity = Mathf.Clamp(p.BloomIntensity, 0f, 2f); p.BloomScatter = Mathf.Clamp01(p.BloomScatter); p.Contrast = Mathf.Clamp(p.Contrast, -60f, 60f); p.Saturation = Mathf.Clamp(p.Saturation, -100f, 100f); p.HueShift = Mathf.Clamp(p.HueShift, -180f, 180f); p.VignetteIntensity = Mathf.Clamp(p.VignetteIntensity, 0f, 0.6f); p.ChromaticAberrationIntensity = Mathf.Clamp01(p.ChromaticAberrationIntensity); p.LensDistortionIntensity = Mathf.Clamp(p.LensDistortionIntensity, -0.35f, 0.35f); p.MotionBlurIntensity = Mathf.Clamp(p.MotionBlurIntensity, 0f, 0.5f); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ShaderPlayground"; public const string PLUGIN_NAME = "ShaderPlayground"; public const string PLUGIN_VERSION = "0.5.2"; } }