Decompiled source of AdjustExposure v1.0.1

ValheimAdjustBrightness.dll

Decompiled a day ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using UnityEngine.PostProcessing;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Aidin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A mod for Valheim that allows to customize exposure and tonemapping settings")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+889c9e0985c36fa6c50d9ca81f4d2169ef952f84")]
[assembly: AssemblyProduct("AdjustBrightness")]
[assembly: AssemblyTitle("ValheimAdjustBrightness")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/aidinabedi/ValheimAdjustBrightness")]
[assembly: AssemblyVersion("1.0.0.0")]
internal static class Manifest
{
	public const string ProjectName = "ValheimAdjustBrightness";

	public const string Product = "AdjustBrightness";

	public const string Description = "A mod for Valheim that allows to customize exposure and tonemapping settings";

	public const string Version = "1.0.0";

	public const string Authors = "Aidin";
}
namespace ValheimAdjustBrightness
{
	[BepInPlugin("ValheimAdjustBrightness", "AdjustBrightness", "1.0.0")]
	[BepInProcess("valheim.exe")]
	public class AdjustBrightnessPlugin : BaseUnityPlugin
	{
		public const string ID = "ValheimAdjustBrightness";

		private static ConfigEntry<float> _exposure;

		private static ConfigEntry<Tonemapper> _tonemapper;

		private Harmony _harmony;

		private void Awake()
		{
			_exposure = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Exposure", 1f, "Adjusts the overall exposure of the scene in EV units.");
			_tonemapper = ((BaseUnityPlugin)this).Config.Bind<Tonemapper>("General", "Tonemapper", (Tonemapper)1, "Tonemapping algorithm to use at the end of the color grading process.");
			_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "ValheimAdjustBrightness");
		}

		public static void AdjustColorGradingSettings(ref Settings settings)
		{
			//IL_0020: 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)
			settings.basic.postExposure = _exposure.Value;
			settings.tonemapping.tonemapper = _tonemapper.Value;
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchAll("ValheimAdjustBrightness");
			}
		}

		public static void Log(string message)
		{
			Debug.Log((object)("ValheimAdjustBrightness: " + message));
		}
	}
}
namespace ValheimAdjustBrightness.GamePatches
{
	[HarmonyPatch(typeof(PostProcessingBehaviour), "OnPreCull")]
	internal static class PostProcessingBehaviour_OnPreCull_Patch
	{
		private static void Postfix(ref ColorGradingComponent ___m_ColorGrading)
		{
			//IL_0007: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			Settings settings = ((PostProcessingComponent<ColorGradingModel>)(object)___m_ColorGrading).model.settings;
			AdjustBrightnessPlugin.AdjustColorGradingSettings(ref settings);
			((PostProcessingComponent<ColorGradingModel>)(object)___m_ColorGrading).model.settings = settings;
		}
	}
}

ValheimAdjustExposure.dll

Decompiled a day ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using UnityEngine.PostProcessing;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Aidin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A mod for Valheim that allows to customize exposure and tonemapping settings")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+889c9e0985c36fa6c50d9ca81f4d2169ef952f84")]
[assembly: AssemblyProduct("AdjustExposure")]
[assembly: AssemblyTitle("ValheimAdjustExposure")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/aidinabedi/ValheimAdjustExposure")]
[assembly: AssemblyVersion("1.0.1.0")]
internal static class Manifest
{
	public const string ProjectName = "ValheimAdjustExposure";

	public const string Product = "AdjustExposure";

	public const string Description = "A mod for Valheim that allows to customize exposure and tonemapping settings";

	public const string Version = "1.0.1";

	public const string Authors = "Aidin";
}
namespace ValheimAdjustExposure
{
	[BepInPlugin("ValheimAdjustExposure", "AdjustExposure", "1.0.1")]
	[BepInProcess("valheim.exe")]
	public class AdjustExposurePlugin : BaseUnityPlugin
	{
		public const string ID = "ValheimAdjustExposure";

		private static ConfigEntry<float> _exposure;

		private static ConfigEntry<Tonemapper> _tonemapper;

		private Harmony _harmony;

		private void Awake()
		{
			_exposure = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Exposure", 1f, "Adjusts the overall exposure of the scene in EV units.");
			_tonemapper = ((BaseUnityPlugin)this).Config.Bind<Tonemapper>("General", "Tonemapper", (Tonemapper)1, "Tonemapping algorithm to use at the end of the color grading process.");
			_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "ValheimAdjustExposure");
		}

		public static void AdjustColorGradingSettings(ref Settings settings)
		{
			//IL_0020: 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)
			settings.basic.postExposure = _exposure.Value;
			settings.tonemapping.tonemapper = _tonemapper.Value;
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchAll("ValheimAdjustExposure");
			}
		}

		public static void Log(string message)
		{
			Debug.Log((object)("ValheimAdjustExposure: " + message));
		}
	}
}
namespace ValheimAdjustExposure.GamePatches
{
	[HarmonyPatch(typeof(PostProcessingBehaviour), "OnPreCull")]
	internal static class PostProcessingBehaviour_OnPreCull_Patch
	{
		private static void Postfix(ref ColorGradingComponent ___m_ColorGrading)
		{
			//IL_0007: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			Settings settings = ((PostProcessingComponent<ColorGradingModel>)(object)___m_ColorGrading).model.settings;
			AdjustExposurePlugin.AdjustColorGradingSettings(ref settings);
			((PostProcessingComponent<ColorGradingModel>)(object)___m_ColorGrading).model.settings = settings;
		}
	}
}