Decompiled source of BlackScreenFix v1.0.0

BlackScreenFix.dll

Decompiled 4 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using UISystem;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using WildSkies.Mediators;
using Wildskies.UI.Panel;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BlackScreenFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Nines (Natives)")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BlackScreenFix")]
[assembly: AssemblyTitle("BlackScreenFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BlackScreenFix
{
	[BepInPlugin("BlackScreenFix", "BlackScreenFix", "1.0.0")]
	public class Plugin : BasePlugin
	{
		internal static ManualLogSource Log;

		internal static Harmony harmonyInstance;

		private static readonly Action<PanelElement> OnGetPanel = Action<PanelElement>.op_Implicit((Action<PanelElement>)delegate(PanelElement panelElement)
		{
			((PanelElement)((Il2CppObjectBase)panelElement).Cast<LoadingPanel>()).Hide();
		});

		private static bool _enableHide = true;

		public override void Load()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("BlackScreenFix");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
			harmonyInstance = Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
		}

		public override bool Unload()
		{
			Harmony obj = harmonyInstance;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
			return true;
		}

		[HarmonyPatch(typeof(UIInputMediator), "Update")]
		[HarmonyPrefix]
		public static void UIInputMediator_Update(UIInputMediator __instance)
		{
			if (__instance._ui.IsServiceReady && !__instance._sceneService.AreWeLoadingOrInLobby())
			{
				if (_enableHide && Keyboard.current.altKey.isPressed && ((ButtonControl)Keyboard.current.hKey).wasPressedThisFrame)
				{
					_enableHide = false;
					__instance._ui.PanelManager.GetPanel((UIPanelType)25, OnGetPanel);
				}
				if (!_enableHide && (!Keyboard.current.altKey.isPressed || !((ButtonControl)Keyboard.current.hKey).isPressed))
				{
					_enableHide = true;
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "BlackScreenFix";

		public const string PLUGIN_NAME = "BlackScreenFix";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}