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.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime.Injection;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("pixelate")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Go Go Gadget pixels")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0")]
[assembly: AssemblyProduct("pixelate")]
[assembly: AssemblyTitle("pixelate")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BigWalkPixelate
{
public enum ColorTintOption
{
Default,
GameBoy,
VirtualBoy,
Amber,
HighContrastNeon,
C64,
AppleII,
GameGear,
PocketCamera,
Microvision,
CyberNeonPink,
MatrixCode,
PlasmaBlue,
ToxicWaste,
EventHorizon,
SepiaTone,
Vaporwave,
SunsetBleed,
Midnight,
Infrared,
NightVision,
Sonar,
Blueprint,
CRTStrayLight,
GlitchStatic,
ShaolinGold,
ShogunGreen,
BloodSplatter,
TenzinMonk,
CREAM,
LiquidSword,
BobbyDigital,
IronMic,
LoudRecords,
VHSBleed,
BootlegCCTV,
Gravediggaz
}
public enum OverlayStyleOption
{
None,
Scanlines,
LCDGrid
}
[BepInPlugin("com.gogogadgetjustice.bigwalkpixelate", "BigWalkPixelate", "7.5.0")]
public class BigWalkPixelatePlugin : BasePlugin
{
internal static int Divisor = 8;
internal static bool Enabled = false;
internal static Camera CamBound;
internal static RenderTexture RT;
internal ConfigEntry<int> DivisorPref;
internal ConfigEntry<bool> EnabledPref;
internal ConfigEntry<int> HotkeyPref;
internal ConfigEntry<bool> PixelatePref;
internal ConfigEntry<ColorTintOption> ColorTintPref;
internal ConfigEntry<OverlayStyleOption> OverlayStylePref;
internal ConfigEntry<float> OverlayIntensityPref;
internal ConfigEntry<bool> CinematicBarsPref;
public static BigWalkPixelatePlugin Instance { get; private set; }
internal static int EffectiveDivisor => (Instance != null && !Instance.PixelatePref.Value) ? 1 : Divisor;
public override void Load()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Expected O, but got Unknown
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Expected O, but got Unknown
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Expected O, but got Unknown
Instance = this;
ClassInjector.RegisterTypeInIl2Cpp<PixelateCore>();
DivisorPref = ((BasePlugin)this).Config.Bind<int>("1. Core", "Divisor", 8, new ConfigDescription("Render resolution divisor.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(4, 16), Array.Empty<object>()));
EnabledPref = ((BasePlugin)this).Config.Bind<bool>("1. Core", "EnabledOnStart", true, "Start with the mod ON.");
HotkeyPref = ((BasePlugin)this).Config.Bind<int>("1. Core", "HotkeyKeyCode", 291, "Toggle mod hotkey (F10=291).");
PixelatePref = ((BasePlugin)this).Config.Bind<bool>("1. Core", "EnablePixelation", true, "Enables low-res blocky pixelation.");
ColorTintPref = ((BasePlugin)this).Config.Bind<ColorTintOption>("2. Retro Styling", "ColorTint", ColorTintOption.VirtualBoy, "Color tint profile.");
OverlayStylePref = ((BasePlugin)this).Config.Bind<OverlayStyleOption>("2. Retro Styling", "OverlayStyle", OverlayStyleOption.Scanlines, "Screen overlay style.");
OverlayIntensityPref = ((BasePlugin)this).Config.Bind<float>("2. Retro Styling", "OverlayIntensity", 0.35f, new ConfigDescription("Darkness of the overlay.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
CinematicBarsPref = ((BasePlugin)this).Config.Bind<bool>("2. Retro Styling", "Force4x3Ratio", false, "Adds black bars to the sides to simulate an old 4:3 TV.");
Divisor = Math.Max(4, DivisorPref.Value);
Enabled = EnabledPref.Value;
ManualLogSource log = ((BasePlugin)Instance).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(56, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BigWalkPixelate] v7.5.0 loaded (GUI Pipeline Restored).");
}
log.LogInfo(val);
GameObject val2 = new GameObject("BigWalkPixelateCore");
Object.DontDestroyOnLoad((Object)(object)val2);
val2.AddComponent<PixelateCore>();
}
internal static void ToggleMod()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
Enabled = !Enabled;
ManualLogSource log = ((BasePlugin)Instance).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BigWalkPixelate] Mod Toggled ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Enabled ? "ON" : "OFF");
}
log.LogInfo(val);
if (!Enabled && (Object)(object)CamBound != (Object)null)
{
CamBound.targetTexture = null;
}
}
internal static void RebuildRT()
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
if ((Object)(object)RT != (Object)null)
{
RT.Release();
Object.Destroy((Object)(object)RT);
RT = null;
}
int effectiveDivisor = EffectiveDivisor;
int num = Math.Max(64, Screen.width / effectiveDivisor);
int num2 = Math.Max(64, Screen.height / effectiveDivisor);
RT = new RenderTexture(num, num2, 24);
RT.antiAliasing = 1;
((Texture)RT).filterMode = (FilterMode)0;
RT.Create();
if ((Object)(object)CamBound != (Object)null)
{
CamBound.targetTexture = RT;
}
}
}
public class PixelateCore : MonoBehaviour
{
private Texture2D _solidTex;
public PixelateCore(IntPtr ptr)
: base(ptr)
{
}
private void EnsureTextures()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_solidTex == (Object)null || ((Object)_solidTex).m_CachedPtr == IntPtr.Zero)
{
_solidTex = new Texture2D(1, 1, (TextureFormat)5, false);
_solidTex.SetPixel(0, 0, Color.white);
_solidTex.Apply();
}
}
private void OnDestroy()
{
if ((Object)(object)_solidTex != (Object)null)
{
Object.Destroy((Object)(object)_solidTex);
}
}
private void Update()
{
try
{
BigWalkPixelatePlugin instance = BigWalkPixelatePlugin.Instance;
if (Input.GetKeyDown((KeyCode)instance.HotkeyPref.Value))
{
BigWalkPixelatePlugin.ToggleMod();
}
if (!BigWalkPixelatePlugin.Enabled)
{
return;
}
if (BigWalkPixelatePlugin.Divisor != instance.DivisorPref.Value)
{
BigWalkPixelatePlugin.Divisor = Math.Max(4, instance.DivisorPref.Value);
BigWalkPixelatePlugin.RebuildRT();
}
Camera val = Camera.main;
bool flag = (Object)(object)val != (Object)null && (((Object)val).name.ToLower().Contains("ui") || ((Object)val).name.ToLower().Contains("canvas") || ((Object)val).name.ToLower().Contains("overlay"));
if ((Object)(object)val == (Object)null || flag)
{
foreach (Camera item in Object.FindObjectsOfType<Camera>())
{
string text = ((Object)item).name.ToLower();
if (text.Contains("ui") || text.Contains("canvas") || text.Contains("minimap") || (item.cullingMask & 1) == 0)
{
continue;
}
val = item;
break;
}
if ((Object)(object)val == (Object)null)
{
return;
}
}
int num = Math.Max(64, Screen.width / BigWalkPixelatePlugin.EffectiveDivisor);
if ((Object)(object)BigWalkPixelatePlugin.CamBound != (Object)(object)val || (Object)(object)BigWalkPixelatePlugin.RT == (Object)null || Math.Abs(((Texture)BigWalkPixelatePlugin.RT).width - num) > 2)
{
BigWalkPixelatePlugin.CamBound = val;
BigWalkPixelatePlugin.RebuildRT();
}
if ((Object)(object)BigWalkPixelatePlugin.CamBound != (Object)null && (Object)(object)BigWalkPixelatePlugin.RT != (Object)null && (Object)(object)BigWalkPixelatePlugin.CamBound.targetTexture != (Object)(object)BigWalkPixelatePlugin.RT)
{
BigWalkPixelatePlugin.CamBound.targetTexture = BigWalkPixelatePlugin.RT;
}
}
catch (Exception value)
{
Debug.LogError(Object.op_Implicit($"[BigWalkPixelate] Update Error: {value}"));
}
}
private void OnGUI()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Invalid comparison between Unknown and I4
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: 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_0568: Unknown result type (might be due to invalid IL or missing references)
//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
//IL_0798: Unknown result type (might be due to invalid IL or missing references)
//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
//IL_0709: Unknown result type (might be due to invalid IL or missing references)
//IL_0740: Unknown result type (might be due to invalid IL or missing references)
//IL_0783: Unknown result type (might be due to invalid IL or missing references)
//IL_05f8: 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_06c0: Unknown result type (might be due to invalid IL or missing references)
BigWalkPixelatePlugin instance = BigWalkPixelatePlugin.Instance;
if (!BigWalkPixelatePlugin.Enabled || instance == null || (Object)(object)BigWalkPixelatePlugin.RT == (Object)null || (int)Event.current.type != 7)
{
return;
}
EnsureTextures();
Rect val = default(Rect);
((Rect)(ref val))..ctor(0f, 0f, (float)Screen.width, (float)Screen.height);
if (instance.CinematicBarsPref.Value)
{
float num = 1.3333334f;
float num2 = (float)Screen.width / (float)Screen.height;
if (num2 > num)
{
int num3 = Mathf.RoundToInt((float)Screen.height * num);
int num4 = (Screen.width - num3) / 2;
((Rect)(ref val))..ctor((float)num4, 0f, (float)num3, (float)Screen.height);
}
}
Color white = Color.white;
switch (instance.ColorTintPref.Value)
{
case ColorTintOption.C64:
((Color)(ref white))..ctor(0.35f, 0.31f, 0.65f, 1f);
break;
case ColorTintOption.AppleII:
((Color)(ref white))..ctor(0.12f, 0.75f, 0.12f, 1f);
break;
case ColorTintOption.GameGear:
((Color)(ref white))..ctor(0.1f, 0.3f, 0.5f, 1f);
break;
case ColorTintOption.PocketCamera:
((Color)(ref white))..ctor(0.5f, 0.55f, 0.45f, 1f);
break;
case ColorTintOption.Microvision:
((Color)(ref white))..ctor(0.4f, 0.45f, 0.1f, 1f);
break;
case ColorTintOption.CyberNeonPink:
((Color)(ref white))..ctor(3f, 0.1f, 1.5f, 1f);
break;
case ColorTintOption.MatrixCode:
((Color)(ref white))..ctor(0f, 2.5f, 0.2f, 1f);
break;
case ColorTintOption.PlasmaBlue:
((Color)(ref white))..ctor(0.2f, 1.5f, 3f, 1f);
break;
case ColorTintOption.ToxicWaste:
((Color)(ref white))..ctor(1.8f, 2.5f, 0f, 1f);
break;
case ColorTintOption.EventHorizon:
((Color)(ref white))..ctor(0.8f, 0f, 2.5f, 1f);
break;
case ColorTintOption.SepiaTone:
((Color)(ref white))..ctor(1.2f, 0.9f, 0.6f, 1f);
break;
case ColorTintOption.Vaporwave:
((Color)(ref white))..ctor(0.9f, 0.5f, 1.2f, 1f);
break;
case ColorTintOption.SunsetBleed:
((Color)(ref white))..ctor(2.5f, 0.6f, 0.2f, 1f);
break;
case ColorTintOption.Midnight:
((Color)(ref white))..ctor(0.1f, 0.15f, 0.4f, 1f);
break;
case ColorTintOption.Infrared:
((Color)(ref white))..ctor(3f, 0f, 0f, 1f);
break;
case ColorTintOption.NightVision:
((Color)(ref white))..ctor(0.4f, 1.8f, 0.4f, 1f);
break;
case ColorTintOption.Sonar:
((Color)(ref white))..ctor(0f, 1.2f, 1.2f, 1f);
break;
case ColorTintOption.Blueprint:
((Color)(ref white))..ctor(0f, 0.4f, 2f, 1f);
break;
case ColorTintOption.CRTStrayLight:
((Color)(ref white))..ctor(0.7f, 0.8f, 0.9f, 1f);
break;
case ColorTintOption.GlitchStatic:
((Color)(ref white))..ctor(1.5f, 1.5f, 1.5f, 1f);
break;
case ColorTintOption.ShaolinGold:
((Color)(ref white))..ctor(1.8f, 1.3f, 0.2f, 1f);
break;
case ColorTintOption.ShogunGreen:
((Color)(ref white))..ctor(0.2f, 0.8f, 0.4f, 1f);
break;
case ColorTintOption.BloodSplatter:
((Color)(ref white))..ctor(1.9f, 0.1f, 0.1f, 1f);
break;
case ColorTintOption.TenzinMonk:
((Color)(ref white))..ctor(1.6f, 0.6f, 0.1f, 1f);
break;
case ColorTintOption.CREAM:
((Color)(ref white))..ctor(1.4f, 1.3f, 0.9f, 1f);
break;
case ColorTintOption.LiquidSword:
((Color)(ref white))..ctor(0.6f, 0.8f, 1.1f, 1f);
break;
case ColorTintOption.BobbyDigital:
((Color)(ref white))..ctor(0.1f, 1.8f, 1.1f, 1f);
break;
case ColorTintOption.IronMic:
((Color)(ref white))..ctor(0.6f, 0.6f, 0.7f, 1f);
break;
case ColorTintOption.LoudRecords:
((Color)(ref white))..ctor(1.5f, 1.5f, 0f, 1f);
break;
case ColorTintOption.VHSBleed:
((Color)(ref white))..ctor(1.1f, 0.7f, 1.3f, 1f);
break;
case ColorTintOption.BootlegCCTV:
((Color)(ref white))..ctor(0.7f, 1.2f, 0.8f, 1f);
break;
case ColorTintOption.Gravediggaz:
((Color)(ref white))..ctor(0.1f, 0.2f, 0.35f, 1f);
break;
}
GUI.color = white;
GUI.DrawTexture(val, (Texture)(object)BigWalkPixelatePlugin.RT, (ScaleMode)0, false);
float value = instance.OverlayIntensityPref.Value;
if (value > 0f && instance.OverlayStylePref.Value != OverlayStyleOption.None)
{
GUI.color = new Color(0f, 0f, 0f, value);
if (instance.OverlayStylePref.Value == OverlayStyleOption.Scanlines)
{
for (int i = (int)((Rect)(ref val)).y; (float)i < ((Rect)(ref val)).y + ((Rect)(ref val)).height; i += 4)
{
GUI.DrawTexture(new Rect(((Rect)(ref val)).x, (float)i, ((Rect)(ref val)).width, 2f), (Texture)(object)_solidTex);
}
}
else if (instance.OverlayStylePref.Value == OverlayStyleOption.LCDGrid)
{
for (int j = (int)((Rect)(ref val)).y; (float)j < ((Rect)(ref val)).y + ((Rect)(ref val)).height; j += 3)
{
GUI.DrawTexture(new Rect(((Rect)(ref val)).x, (float)j, ((Rect)(ref val)).width, 1f), (Texture)(object)_solidTex);
}
for (int k = (int)((Rect)(ref val)).x; (float)k < ((Rect)(ref val)).x + ((Rect)(ref val)).width; k += 3)
{
GUI.DrawTexture(new Rect((float)k, ((Rect)(ref val)).y, 1f, ((Rect)(ref val)).height), (Texture)(object)_solidTex);
}
}
}
if (instance.CinematicBarsPref.Value)
{
GUI.color = Color.black;
if (((Rect)(ref val)).x > 0f)
{
GUI.DrawTexture(new Rect(0f, 0f, ((Rect)(ref val)).x, (float)Screen.height), (Texture)(object)_solidTex, (ScaleMode)0, false);
GUI.DrawTexture(new Rect(((Rect)(ref val)).x + ((Rect)(ref val)).width, 0f, (float)Screen.width - (((Rect)(ref val)).x + ((Rect)(ref val)).width), (float)Screen.height), (Texture)(object)_solidTex, (ScaleMode)0, false);
}
}
GUI.color = Color.white;
GUI.matrix = Matrix4x4.identity;
}
}
}