using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Microsoft.CodeAnalysis; using Mono.Cecil; [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("R2API.Skins.Patcher")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c6f4f4413f610d6c7f11bdd61955aa5c78dac091")] [assembly: AssemblyProduct("R2API.Skins.Patcher")] [assembly: AssemblyTitle("R2API.Skins.Patcher")] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 R2API { internal static class SkinsPatcher { [CompilerGenerated] private sealed class d__1 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; string IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = "RoR2.dll"; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new d__1(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } public const string skillVariants = "r2api_skillVariants"; public const string skinSkillVariantsDef = "r2api_skinSkillVariantsDef"; public static IEnumerable TargetDLLs { [IteratorStateMachine(typeof(d__1))] get { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(-2); } } public static void Patch(AssemblyDefinition assembly) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Expected O, but got Unknown //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Expected O, but got Unknown //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Expected O, but got Unknown //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Expected O, but got Unknown TypeDefinition type = assembly.MainModule.GetType("RoR2.CharacterModel/RendererInfo"); if (type != null) { type.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type2 = assembly.MainModule.GetType("RoR2.SkinDefParams/MeshReplacement"); if (type2 != null) { type2.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type3 = assembly.MainModule.GetType("RoR2.CharacterModel/LightInfo"); if (type3 != null) { type3.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type4 = assembly.MainModule.GetType("RoR2.SkinDefParams/ProjectileGhostReplacement"); if (type4 != null) { type4.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type5 = assembly.MainModule.GetType("RoR2.SkinDefParams/MinionSkinReplacement"); if (type5 != null) { type5.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type6 = assembly.MainModule.GetType("RoR2.SkinDef/MeshReplacementTemplate"); if (type6 != null) { type6.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type7 = assembly.MainModule.GetType("RoR2.SkinDef/LightReplacementTemplate"); if (type7 != null) { type7.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type8 = assembly.MainModule.GetType("RoR2.SkinDef/GhostReplacementTemplate"); if (type8 != null) { type8.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type9 = assembly.MainModule.GetType("RoR2.SkinDef/MinionSkinTemplate"); if (type9 != null) { type9.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type10 = assembly.MainModule.GetType("RoR2.SkinDef"); if (type10 != null) { type10.Fields.Add(new FieldDefinition("r2api_onSkinApplied", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(Delegate)))); TypeDefinition type11 = assembly.MainModule.GetType("RoR2.SkinDef/RuntimeSkin"); if (type11 != null) { type11.Fields.Add(new FieldDefinition("r2api_skinDef", (FieldAttributes)6, assembly.MainModule.ImportReference((TypeReference)(object)type10))); } } TypeDefinition type12 = assembly.MainModule.GetType("RoR2.SkinDefParams"); if (type12 != null) { type12.Fields.Add(new FieldDefinition("r2api_skinSkillVariantsDef", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object)))); } TypeDefinition type13 = assembly.MainModule.GetType("RoR2.ModelSkinController"); if (type13 != null) { type13.Fields.Add(new FieldDefinition("r2api_skinSkillVariantsDef", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object)))); } } } }