Decompiled source of BorderlessFix v1.0.0

GDWeave/mods/BorderlessFix/BorderlessFix.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BorderlessFix.Mods;
using GDWeave;
using GDWeave.Godot;
using GDWeave.Godot.Variants;
using GDWeave.Modding;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("BorderlessFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8b3d7b38177ccd8f4adb9b6ab0cd5dccc138cab6")]
[assembly: AssemblyProduct("BorderlessFix")]
[assembly: AssemblyTitle("BorderlessFix")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace BorderlessFix
{
	public class Config
	{
	}
	public class Mod : IMod, global::System.IDisposable
	{
		public Config Config;

		public Mod(IModInterface modInterface)
		{
			Config = modInterface.ReadConfig<Config>();
			modInterface.Logger.Information("BorderlessFix is active!");
			modInterface.RegisterScriptMod((IScriptMod)(object)new OptionsTweaks.OptionsMenuModifier());
		}

		public void Dispose()
		{
		}
	}
}
namespace BorderlessFix.Mods
{
	public class OptionsTweaks
	{
		public class OptionsMenuModifier : IScriptMod
		{
			[CompilerGenerated]
			private sealed class <Modify>d__2 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
			{
				private int <>1__state;

				private Token <>2__current;

				private int <>l__initialThreadId;

				private string path;

				public string <>3__path;

				private global::System.Collections.Generic.IEnumerable<Token> tokens;

				public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

				public OptionsMenuModifier <>4__this;

				private MultiTokenWaiter <setAlwaysOnTop>5__1;

				private MultiTokenWaiter <windowedCheck>5__2;

				private TokenWaiter <maximizeWindow>5__3;

				private MultiTokenWaiter <centerWindow>5__4;

				private TokenConsumer <newlineConsumer>5__5;

				private global::System.Collections.Generic.IEnumerator<Token> <>s__6;

				private Token <token>5__7;

				Token global::System.Collections.Generic.IEnumerator<Token>.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				object global::System.Collections.IEnumerator.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				[DebuggerHidden]
				public <Modify>d__2(int <>1__state)
				{
					this.<>1__state = <>1__state;
					<>l__initialThreadId = Environment.CurrentManagedThreadId;
				}

				[DebuggerHidden]
				void global::System.IDisposable.Dispose()
				{
					int num = <>1__state;
					if (num != -3 && (uint)(num - 1) > 28u)
					{
						return;
					}
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}

				private bool MoveNext()
				{
					//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
					//IL_04ff: Expected O, but got Unknown
					//IL_0519: Unknown result type (might be due to invalid IL or missing references)
					//IL_0523: Expected O, but got Unknown
					//IL_051e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0528: Expected O, but got Unknown
					//IL_054b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0555: Expected O, but got Unknown
					//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
					//IL_05d1: Expected O, but got Unknown
					//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
					//IL_05f3: Expected O, but got Unknown
					//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
					//IL_05f8: Expected O, but got Unknown
					//IL_0664: Unknown result type (might be due to invalid IL or missing references)
					//IL_066e: Expected O, but got Unknown
					//IL_0692: Unknown result type (might be due to invalid IL or missing references)
					//IL_069c: Expected O, but got Unknown
					//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
					//IL_06c3: Expected O, but got Unknown
					//IL_06e7: Unknown result type (might be due to invalid IL or missing references)
					//IL_06f1: Expected O, but got Unknown
					//IL_0715: Unknown result type (might be due to invalid IL or missing references)
					//IL_071f: Expected O, but got Unknown
					//IL_0743: Unknown result type (might be due to invalid IL or missing references)
					//IL_074d: Expected O, but got Unknown
					//IL_076c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0776: Expected O, but got Unknown
					//IL_079a: Unknown result type (might be due to invalid IL or missing references)
					//IL_07a4: Expected O, but got Unknown
					//IL_07bf: Unknown result type (might be due to invalid IL or missing references)
					//IL_07c9: Expected O, but got Unknown
					//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
					//IL_07ce: Expected O, but got Unknown
					//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
					//IL_07fc: Expected O, but got Unknown
					//IL_0817: Unknown result type (might be due to invalid IL or missing references)
					//IL_0821: Expected O, but got Unknown
					//IL_081c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0826: Expected O, but got Unknown
					//IL_084a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0854: Expected O, but got Unknown
					//IL_08c4: Unknown result type (might be due to invalid IL or missing references)
					//IL_08ce: Expected O, but got Unknown
					//IL_08eb: Unknown result type (might be due to invalid IL or missing references)
					//IL_08f5: Expected O, but got Unknown
					//IL_0919: Unknown result type (might be due to invalid IL or missing references)
					//IL_0923: Expected O, but got Unknown
					//IL_0940: Unknown result type (might be due to invalid IL or missing references)
					//IL_094a: Expected O, but got Unknown
					//IL_096e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0978: Expected O, but got Unknown
					//IL_099c: Unknown result type (might be due to invalid IL or missing references)
					//IL_09a6: Expected O, but got Unknown
					//IL_0226: Unknown result type (might be due to invalid IL or missing references)
					//IL_0230: Expected O, but got Unknown
					//IL_0327: Unknown result type (might be due to invalid IL or missing references)
					//IL_0331: Expected O, but got Unknown
					//IL_0352: Unknown result type (might be due to invalid IL or missing references)
					//IL_035c: Expected O, but got Unknown
					//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
					//IL_03f7: Expected O, but got Unknown
					//IL_0417: Unknown result type (might be due to invalid IL or missing references)
					//IL_0421: Expected O, but got Unknown
					try
					{
						switch (<>1__state)
						{
						default:
							return false;
						case 0:
							<>1__state = -1;
							<setAlwaysOnTop>5__1 = new MultiTokenWaiter(new Func<Token, bool>[7]
							{
								delegate(Token t)
								{
									IdentifierToken val12 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
									return val12 != null && val12.Name == "set_window_always_on_top";
								},
								(Token t) => (int)t.Type == 80,
								delegate(Token t)
								{
									IdentifierToken val11 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
									return val11 != null && val11.Name == "PlayerData";
								},
								(Token t) => (int)t.Type == 84,
								delegate(Token t)
								{
									IdentifierToken val10 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
									return val10 != null && val10.Name == "player_options";
								},
								(Token t) => (int)t.Type == 84,
								delegate(Token t)
								{
									IdentifierToken val9 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
									return val9 != null && val9.Name == "fullscreen";
								}
							}, false, false);
							<windowedCheck>5__2 = new MultiTokenWaiter(new Func<Token, bool>[7]
							{
								delegate(Token t)
								{
									ConstantToken val7 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
									int result2;
									if (val7 != null)
									{
										Variant value2 = val7.Value;
										IntVariant val8 = (IntVariant)(object)((value2 is IntVariant) ? value2 : null);
										if (val8 != null)
										{
											result2 = ((val8.Value == 1) ? 1 : 0);
											goto IL_0026;
										}
									}
									result2 = 0;
									goto IL_0026;
									IL_0026:
									return (byte)result2 != 0;
								},
								(Token t) => (int)t.Type == 86,
								(Token t) => (int)t.Type == 89,
								delegate(Token t)
								{
									IdentifierToken val6 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
									return val6 != null && val6.Name == "OS";
								},
								(Token t) => (int)t.Type == 84,
								delegate(Token t)
								{
									IdentifierToken val5 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
									return val5 != null && val5.Name == "window_size";
								},
								(Token t) => (int)t.Type == 23
							}, false, false);
							<maximizeWindow>5__3 = new TokenWaiter((Func<Token, bool>)delegate(Token t)
							{
								IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val4 != null && val4.Name == "window_maximized";
							}, false);
							<centerWindow>5__4 = new MultiTokenWaiter(new Func<Token, bool>[4]
							{
								delegate(Token t)
								{
									IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
									return val3 != null && val3.Name == "fullscreen";
								},
								(Token t) => (int)t.Type == 7,
								delegate(Token t)
								{
									ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
									int result;
									if (val != null)
									{
										Variant value = val.Value;
										IntVariant val2 = (IntVariant)(object)((value is IntVariant) ? value : null);
										if (val2 != null)
										{
											result = ((val2.Value == 0) ? 1 : 0);
											goto IL_0026;
										}
									}
									result = 0;
									goto IL_0026;
									IL_0026:
									return (byte)result != 0;
								},
								(Token t) => (int)t.Type == 86
							}, false, false);
							<newlineConsumer>5__5 = new TokenConsumer((Func<Token, bool>)((Token t) => (int)t.Type == 89));
							<>s__6 = tokens.GetEnumerator();
							<>1__state = -3;
							goto IL_09e7;
						case 1:
							<>1__state = -3;
							<newlineConsumer>5__5.Reset();
							goto IL_04ac;
						case 2:
							<>1__state = -3;
							<>2__current = new Token((TokenType)7, (uint?)null);
							<>1__state = 3;
							return true;
						case 3:
							<>1__state = -3;
							<>2__current = (Token)new ConstantToken((Variant)new IntVariant(2L, false));
							<>1__state = 4;
							return true;
						case 4:
							<>1__state = -3;
							<>2__current = new Token((TokenType)81, (uint?)null);
							<>1__state = 5;
							return true;
						case 5:
							<>1__state = -3;
							<newlineConsumer>5__5.SetReady();
							goto IL_09df;
						case 6:
							<>1__state = -3;
							<>2__current = new Token((TokenType)23, (uint?)null);
							<>1__state = 7;
							return true;
						case 7:
							<>1__state = -3;
							<>2__current = (Token)new ConstantToken((Variant)new BoolVariant(false));
							<>1__state = 8;
							return true;
						case 8:
							<>1__state = -3;
							<newlineConsumer>5__5.SetReady();
							goto IL_09df;
						case 9:
							<>1__state = -3;
							<>2__current = (Token)new IdentifierToken("OS");
							<>1__state = 10;
							return true;
						case 10:
							<>1__state = -3;
							<>2__current = new Token((TokenType)84, (uint?)null);
							<>1__state = 11;
							return true;
						case 11:
							<>1__state = -3;
							<>2__current = (Token)new IdentifierToken("get_screen_size");
							<>1__state = 12;
							return true;
						case 12:
							<>1__state = -3;
							<>2__current = new Token((TokenType)80, (uint?)null);
							<>1__state = 13;
							return true;
						case 13:
							<>1__state = -3;
							<>2__current = new Token((TokenType)81, (uint?)null);
							<>1__state = 14;
							return true;
						case 14:
							<>1__state = -3;
							<>2__current = new Token((TokenType)16, (uint?)null);
							<>1__state = 15;
							return true;
						case 15:
							<>1__state = -3;
							<>2__current = new Token((TokenType)4, (uint?)5u);
							<>1__state = 16;
							return true;
						case 16:
							<>1__state = -3;
							<>2__current = new Token((TokenType)80, (uint?)null);
							<>1__state = 17;
							return true;
						case 17:
							<>1__state = -3;
							<>2__current = (Token)new ConstantToken((Variant)new IntVariant(0L, false));
							<>1__state = 18;
							return true;
						case 18:
							<>1__state = -3;
							<>2__current = new Token((TokenType)82, (uint?)null);
							<>1__state = 19;
							return true;
						case 19:
							<>1__state = -3;
							<>2__current = (Token)new ConstantToken((Variant)new IntVariant(1L, false));
							<>1__state = 20;
							return true;
						case 20:
							<>1__state = -3;
							<>2__current = new Token((TokenType)81, (uint?)null);
							<>1__state = 21;
							return true;
						case 21:
							<>1__state = -3;
							<newlineConsumer>5__5.SetReady();
							goto IL_09df;
						case 22:
							<>1__state = -3;
							<>2__current = new Token((TokenType)89, (uint?)2u);
							<>1__state = 23;
							return true;
						case 23:
							<>1__state = -3;
							<>2__current = (Token)new IdentifierToken("OS");
							<>1__state = 24;
							return true;
						case 24:
							<>1__state = -3;
							<>2__current = new Token((TokenType)84, (uint?)null);
							<>1__state = 25;
							return true;
						case 25:
							<>1__state = -3;
							<>2__current = (Token)new IdentifierToken("center_window");
							<>1__state = 26;
							return true;
						case 26:
							<>1__state = -3;
							<>2__current = new Token((TokenType)80, (uint?)null);
							<>1__state = 27;
							return true;
						case 27:
							<>1__state = -3;
							<>2__current = new Token((TokenType)81, (uint?)null);
							<>1__state = 28;
							return true;
						case 28:
							<>1__state = -3;
							goto IL_09df;
						case 29:
							{
								<>1__state = -3;
								goto IL_09df;
							}
							IL_09df:
							<token>5__7 = null;
							goto IL_09e7;
							IL_09e7:
							do
							{
								if (((global::System.Collections.IEnumerator)<>s__6).MoveNext())
								{
									<token>5__7 = <>s__6.Current;
									continue;
								}
								<>m__Finally1();
								<>s__6 = null;
								return false;
							}
							while (<newlineConsumer>5__5.Check(<token>5__7));
							if (<newlineConsumer>5__5.Ready)
							{
								<>2__current = <token>5__7;
								<>1__state = 1;
								return true;
							}
							goto IL_04ac;
							IL_04ac:
							if (<setAlwaysOnTop>5__1.Check(<token>5__7))
							{
								<>2__current = <token>5__7;
								<>1__state = 2;
								return true;
							}
							if (<maximizeWindow>5__3.Check(<token>5__7))
							{
								<>2__current = <token>5__7;
								<>1__state = 6;
								return true;
							}
							if (<windowedCheck>5__2.Check(<token>5__7))
							{
								<>2__current = <token>5__7;
								<>1__state = 9;
								return true;
							}
							if (<centerWindow>5__4.Check(<token>5__7))
							{
								<>2__current = <token>5__7;
								<>1__state = 22;
								return true;
							}
							<>2__current = <token>5__7;
							<>1__state = 29;
							return true;
						}
					}
					catch
					{
						//try-fault
						((global::System.IDisposable)this).Dispose();
						throw;
					}
				}

				bool global::System.Collections.IEnumerator.MoveNext()
				{
					//ILSpy generated this explicit interface implementation from .override directive in MoveNext
					return this.MoveNext();
				}

				private void <>m__Finally1()
				{
					<>1__state = -1;
					if (<>s__6 != null)
					{
						((global::System.IDisposable)<>s__6).Dispose();
					}
				}

				[DebuggerHidden]
				void global::System.Collections.IEnumerator.Reset()
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					throw new NotSupportedException();
				}

				[DebuggerHidden]
				global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
				{
					<Modify>d__2 <Modify>d__;
					if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
					{
						<>1__state = 0;
						<Modify>d__ = this;
					}
					else
					{
						<Modify>d__ = new <Modify>d__2(0)
						{
							<>4__this = <>4__this
						};
					}
					<Modify>d__.path = <>3__path;
					<Modify>d__.tokens = <>3__tokens;
					return <Modify>d__;
				}

				[DebuggerHidden]
				global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
				{
					return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
				}
			}

			public bool ShouldRun(string path)
			{
				return path == "res://Scenes/Singletons/OptionsMenu/options_menu.gdc";
			}

			[IteratorStateMachine(typeof(<Modify>d__2))]
			public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
			{
				MultiTokenWaiter setAlwaysOnTop = new MultiTokenWaiter(new Func<Token, bool>[7]
				{
					delegate(Token t)
					{
						IdentifierToken val12 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
						return val12 != null && val12.Name == "set_window_always_on_top";
					},
					(Token t) => (int)t.Type == 80,
					delegate(Token t)
					{
						IdentifierToken val11 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
						return val11 != null && val11.Name == "PlayerData";
					},
					(Token t) => (int)t.Type == 84,
					delegate(Token t)
					{
						IdentifierToken val10 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
						return val10 != null && val10.Name == "player_options";
					},
					(Token t) => (int)t.Type == 84,
					delegate(Token t)
					{
						IdentifierToken val9 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
						return val9 != null && val9.Name == "fullscreen";
					}
				}, false, false);
				MultiTokenWaiter windowedCheck = new MultiTokenWaiter(new Func<Token, bool>[7]
				{
					delegate(Token t)
					{
						ConstantToken val7 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
						int result2;
						if (val7 != null)
						{
							Variant value2 = val7.Value;
							IntVariant val8 = (IntVariant)(object)((value2 is IntVariant) ? value2 : null);
							if (val8 != null)
							{
								result2 = ((val8.Value == 1) ? 1 : 0);
								goto IL_0026;
							}
						}
						result2 = 0;
						goto IL_0026;
						IL_0026:
						return (byte)result2 != 0;
					},
					(Token t) => (int)t.Type == 86,
					(Token t) => (int)t.Type == 89,
					delegate(Token t)
					{
						IdentifierToken val6 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
						return val6 != null && val6.Name == "OS";
					},
					(Token t) => (int)t.Type == 84,
					delegate(Token t)
					{
						IdentifierToken val5 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
						return val5 != null && val5.Name == "window_size";
					},
					(Token t) => (int)t.Type == 23
				}, false, false);
				TokenWaiter maximizeWindow = new TokenWaiter((Func<Token, bool>)delegate(Token t)
				{
					IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val4 != null && val4.Name == "window_maximized";
				}, false);
				MultiTokenWaiter centerWindow = new MultiTokenWaiter(new Func<Token, bool>[4]
				{
					delegate(Token t)
					{
						IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
						return val3 != null && val3.Name == "fullscreen";
					},
					(Token t) => (int)t.Type == 7,
					delegate(Token t)
					{
						ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
						int result;
						if (val != null)
						{
							Variant value = val.Value;
							IntVariant val2 = (IntVariant)(object)((value is IntVariant) ? value : null);
							if (val2 != null)
							{
								result = ((val2.Value == 0) ? 1 : 0);
								goto IL_0026;
							}
						}
						result = 0;
						goto IL_0026;
						IL_0026:
						return (byte)result != 0;
					},
					(Token t) => (int)t.Type == 86
				}, false, false);
				TokenConsumer newlineConsumer = new TokenConsumer((Func<Token, bool>)((Token t) => (int)t.Type == 89));
				global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
				try
				{
					while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
					{
						Token token = enumerator.Current;
						if (!newlineConsumer.Check(token))
						{
							if (newlineConsumer.Ready)
							{
								yield return token;
								newlineConsumer.Reset();
							}
							if (setAlwaysOnTop.Check(token))
							{
								yield return token;
								yield return new Token((TokenType)7, (uint?)null);
								yield return (Token)new ConstantToken((Variant)new IntVariant(2L, false));
								yield return new Token((TokenType)81, (uint?)null);
								newlineConsumer.SetReady();
							}
							else if (maximizeWindow.Check(token))
							{
								yield return token;
								yield return new Token((TokenType)23, (uint?)null);
								yield return (Token)new ConstantToken((Variant)new BoolVariant(false));
								newlineConsumer.SetReady();
							}
							else if (windowedCheck.Check(token))
							{
								yield return token;
								yield return (Token)new IdentifierToken("OS");
								yield return new Token((TokenType)84, (uint?)null);
								yield return (Token)new IdentifierToken("get_screen_size");
								yield return new Token((TokenType)80, (uint?)null);
								yield return new Token((TokenType)81, (uint?)null);
								yield return new Token((TokenType)16, (uint?)null);
								yield return new Token((TokenType)4, (uint?)5u);
								yield return new Token((TokenType)80, (uint?)null);
								yield return (Token)new ConstantToken((Variant)new IntVariant(0L, false));
								yield return new Token((TokenType)82, (uint?)null);
								yield return (Token)new ConstantToken((Variant)new IntVariant(1L, false));
								yield return new Token((TokenType)81, (uint?)null);
								newlineConsumer.SetReady();
							}
							else if (centerWindow.Check(token))
							{
								yield return token;
								yield return new Token((TokenType)89, (uint?)2u);
								yield return (Token)new IdentifierToken("OS");
								yield return new Token((TokenType)84, (uint?)null);
								yield return (Token)new IdentifierToken("center_window");
								yield return new Token((TokenType)80, (uint?)null);
								yield return new Token((TokenType)81, (uint?)null);
							}
							else
							{
								yield return token;
							}
						}
					}
				}
				finally
				{
					((global::System.IDisposable)enumerator)?.Dispose();
				}
			}
		}
	}
}