Decompiled source of CaughtIn4K v0.0.3

slenlen.caughtin4k.dll

Decompiled 7 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using CaughtIn4K.Config;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("slenlen.caughtin4k")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Customize the resolution for the video recorder")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("CaughtIn4K")]
[assembly: AssemblyTitle("slenlen.caughtin4k")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
namespace CaughtIn4K
{
	[BepInPlugin("slenlen.caughtin4k", "CaughtIn4K", "0.0.1")]
	public class CaughtIn4kPlugin : BaseUnityPlugin
	{
		public static CaughtIn4kPlugin Instance { get; private set; }

		internal static Harmony Harmony { get; private set; }

		internal static CaughtIn4KConfig config { get; private set; }

		private void Awake()
		{
			Instance = this;
			config = new CaughtIn4KConfig(((BaseUnityPlugin)this).Config);
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "slenlen.caughtin4k");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin slenlen.caughtin4k is loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "slenlen.caughtin4k";

		public const string PLUGIN_NAME = "CaughtIn4K";

		public const string PLUGIN_VERSION = "0.0.1";
	}
}
namespace CaughtIn4K.Patches
{
	[HarmonyPatch(typeof(VideoCamera))]
	internal class VideoCamera_Patch
	{
		[HarmonyTranspiler]
		[HarmonyPatch("CreateRenderTexture")]
		private static IEnumerable<CodeInstruction> UpdateRenderTexture(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)420, (string)null)
			}).SetOperandAndAdvance((object)CaughtIn4kPlugin.config.RESOLUTION_X.Value).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)420, (string)null)
			})
				.SetOperandAndAdvance((object)CaughtIn4kPlugin.config.RESOLUTION_Y.Value)
				.InstructionEnumeration();
		}
	}
}
namespace CaughtIn4K.Config
{
	internal class CaughtIn4KConfig
	{
		internal ConfigEntry<int> RESOLUTION_X;

		internal ConfigEntry<int> RESOLUTION_Y;

		internal CaughtIn4KConfig(ConfigFile cfgFile)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			RESOLUTION_X = cfgFile.Bind<int>("Main", "ResolutionX", 840, new ConfigDescription("The Video Camera's Horizontal Resolution\nDifferent aspect ratios than the vanilla one (1:1) actually seem to work reasonably fine.", (AcceptableValueBase)null, new object[0]));
			RESOLUTION_Y = cfgFile.Bind<int>("Main", "ResolutionY", 840, new ConfigDescription("The Video Camera's Vertical Resolution\nDefault values are 2x the vanilla resolution. Be aware that raising the total resolution (x*y) too high can cause huge file sizes, CPU utilization and RAM Usage.", (AcceptableValueBase)null, new object[0]));
		}
	}
}