Skip to content

Commit

Permalink
Some Recodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariki authored and Mariki committed Oct 26, 2024
1 parent dddcbf7 commit fc718e9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Exiled.Events/Patches/Fixes/VoiceChatTpsFix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Exiled.Events.Patches.Fixes
{
using System.Collections.Generic;
using System.Configuration;
using System.Reflection.Emit;

using API.Features.Pools;
Expand All @@ -27,11 +28,15 @@ internal static class VoiceChatTpsFix
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);
int index = newInstructions.FindIndex(instruction => instruction.Calls(Method(typeof(UnityEngine.Mathf), nameof(UnityEngine.Mathf.Abs), new System.Type[] { typeof(float) }))) + 11;
int offset = 0;
int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Newarr) + offset;
newInstructions.InsertRange(index, new CodeInstruction[]
{
// popped 24000
new CodeInstruction(OpCodes.Pop),
new CodeInstruction(OpCodes.Ldc_I4_S, 480),

// loadded 480
new CodeInstruction(OpCodes.Ldc_I4, 480),
});

for (int z = 0; z < newInstructions.Count; z++)
Expand Down

0 comments on commit fc718e9

Please sign in to comment.