Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

Commit

Permalink
use actual switch, performs better, I mean it's only 1 dispatch targe…
Browse files Browse the repository at this point in the history
…t right now
  • Loading branch information
Tyler-IN committed May 11, 2020
1 parent c11ec47 commit 00728a0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/Antijank/Injections.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ public static class Injections {

public static readonly MethodInfo Method = Type.GetMethod("Dispatch", Public | Static | DeclaredOnly);

private static readonly Delegate[] Switchboard = {
(Action<object, object[]>) MbEventExceptionHandler.InvokeListReplacementBase
};

[NonVersionable]
[TargetedPatchingOptOut("Optimization.")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Dispatch(int token, object data) {
if (data is object[] args) {
try {
Switchboard[token].DynamicInvoke(args);
switch (token) {
case 0:
MbEventExceptionHandler.InvokeListReplacementBase(args[0], args[1] as object[]);
return;
}
return;
}
catch (Exception ex) {
Expand Down

0 comments on commit 00728a0

Please sign in to comment.