2023-07-08 23:42:42 +03:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using Mono.Cecil;
|
|
|
|
|
2024-03-05 22:48:21 +02:00
|
|
|
namespace IcyClawz.CustomInteractions;
|
|
|
|
|
|
|
|
public static class Prepatch
|
2023-07-08 23:42:42 +03:00
|
|
|
{
|
2024-03-05 22:48:21 +02:00
|
|
|
public static IEnumerable<string> TargetDLLs => ["Assembly-CSharp.dll"];
|
2023-07-08 23:42:42 +03:00
|
|
|
|
2024-03-05 22:48:21 +02:00
|
|
|
public static void Patch(AssemblyDefinition assembly)
|
|
|
|
{
|
2024-04-02 10:56:51 +03:00
|
|
|
TypeDefinition type = assembly.MainModule.GetType("DynamicInteractionClass");
|
2024-03-05 22:48:21 +02:00
|
|
|
FieldDefinition field = type.Fields.SingleOrDefault(c => c.Name is "action_0");
|
|
|
|
field.IsFamily = true;
|
|
|
|
field.IsInitOnly = false;
|
|
|
|
MethodDefinition ctor = type.Methods.SingleOrDefault(c => c.Name is ".ctor");
|
|
|
|
ParameterDefinition param = ctor.Parameters.SingleOrDefault(c => c.Name is "callback");
|
|
|
|
param.IsOptional = true;
|
|
|
|
param.HasDefault = true;
|
|
|
|
param.Constant = null;
|
|
|
|
//assembly.Write("Assembly-CSharp-CustomInteractions.dll");
|
2023-07-08 23:42:42 +03:00
|
|
|
}
|
|
|
|
}
|