You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0ad1e84
Browse filesBrowse the repository at this point in the historyBrowse files
if(n.Keyis"ParameterTypeNames" or "parameterTypeNames")ptn=n.Value;
179
-
stringpc="-1";
180
-
foreach(varninh.NamedArgs)
181
-
if(n.Keyis"ParameterCount" or "parameterCount")pc=n.Value;
182
-
183
-
sb.AppendLine($" var asm = global::StArray.ModManager.Il2Cpp.Il2CppAssembly.Get({a});");
184
-
sb.AppendLine($" if (asm == null) return false;");
185
-
sb.AppendLine($" var cls = asm.GetClass(\"\", {c});");
186
-
sb.AppendLine($" if (cls == null) return false;");
187
-
if(ptn!=null)
188
-
sb.AppendLine($" var method = cls.GetMethod({m}, {ptn});");
168
+
if(h.HasUnmanagedCallersOnly)
169
+
sb.AppendLine($" var d = typeof({h.ContainingType}).GetMethod(\"{h.MethodName}\", global::System.Reflection.BindingFlags.Static | global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic)!.MethodHandle.GetFunctionPointer();");
189
170
else
190
-
sb.AppendLine($" var method = cls.GetMethod({m}, {pc});");
191
-
sb.AppendLine($" if (method == null) return false;");
192
-
sb.AppendLine($" var t = method.FunctionPtr;");
193
-
sb.AppendLine($" _{sf}_origPtr = t;");
194
-
sb.AppendLine($" _{sf}_wrap = {h.MethodName};");
195
-
sb.AppendLine($" var d = global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(_{sf}_wrap);");
171
+
{
172
+
sb.AppendLine($" _{sf}_wrap = {h.MethodName};");
173
+
sb.AppendLine($" var d = global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(_{sf}_wrap);");
174
+
}
196
175
sb.AppendLine($" var o = global::StArray.ModManager.Runtime.HookHelper.Hook(t, d);");
197
176
sb.AppendLine($" if (o == nint.Zero) return false;");
sb.AppendLine($" if (method == null) return false;");
223
218
sb.AppendLine($" var t = method.FunctionPtr;");
224
219
sb.AppendLine($" _{sf}_origPtr = t;");
225
-
sb.AppendLine($" _{sf}_wrap = {h.MethodName};");
226
-
sb.AppendLine($" var d = global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(_{sf}_wrap);");
220
+
if(h.HasUnmanagedCallersOnly)
221
+
sb.AppendLine($" var d = typeof({h.ContainingType}).GetMethod(\"{h.MethodName}\", global::System.Reflection.BindingFlags.Static | global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic)!.MethodHandle.GetFunctionPointer();");
222
+
else
223
+
{
224
+
sb.AppendLine($" _{sf}_wrap = {h.MethodName};");
225
+
sb.AppendLine($" var d = global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(_{sf}_wrap);");
226
+
}
227
227
sb.AppendLine($" var o = global::StArray.ModManager.Runtime.HookHelper.Hook(t, d);");
228
228
sb.AppendLine($" if (o == nint.Zero) return false;");
0 commit comments