Kasuromi-SniperMeleeFix icon

SniperMeleeFix

The absolute fastest possible fix for sniper melee.

Last updated 2 years ago
Total downloads 5793
Total rating 7 
Categories Client Mods
Dependency string Kasuromi-SniperMeleeFix-1.0.0
Dependants 18 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack_GTFO-2.0.0 icon
BepInEx-BepInExPack_GTFO

BepInEx pack for GTFO. Preconfigured and includes Unity Base DLLs.

Preferred version: 2.0.0

README

Sniper Melee Fix

This plugin fixes an internal misconfiguration with interpolation of enemy positions (hereafter sniper melee).

FAQ

Q: Will this get me banned for using it?

A: At the time of release, there is no way for the 10 Chambers Collective to find out if you are using SniperMeleeFix and therefore cannot get you banned.

Use at your own risk, I am not responsible for any issues that might occur

Q: How does this SniperMeleeFix differ from Frog's SniperMeleeFix?

A: My fix for sniper melee is detourless and doesn't do any post-load runtime allocations, effectively making it the fastest (non static) solution to sniper melee.

Q: How does this SniperMeleeFix differ from NetworkingHotfix?

A: NetworkingHotfix disables interpolation and the entire position buffer system which makes enemies teleport to the host's position causing jitter while SniperMeleeFix modifies the interpolation system to work with the full buffer.

Put Simply: Enemies will not jitter with SniperMeleeFix unlike NetworkingHotfix (plus it's faster)

Q: Can you explain the fix in detail?

We disassemble PositionSnapshotBuffer's NextPosition method which looks like this:

Vector3 nextPosition;
/* snip */
if (this.m_buffer.Count != 0) {
    // 0.5f is 't' in the linear interpolation function
    nextPosition = this.Interpolate(0.5f);
}
else { /* snip */ }
return nextPosition;

We look for the assembly instruction which passes the 0.5f constant into the method and grab it's address. Which looks like this:

movss xmm2, [0xCONSTANT_ADDR]

After locating the instruction, we look for a nearby unused region of memory (hereafter cave) that will contain our new interpolation constant.

And then all that's left to do is modify the instruction to use the memory that contains our interpolation constant

movss xmm2, [0xCAVE_ADDR] ; Replaced CONSTANT_ADDR with CAVE_ADDR

Yes, we change 8 bytes in memory and the problem is gone without any detours and post-load allocations...

Q: Why is this the fastest fix for sniper melee?

A: It modifies a memory constant which has no effect on the game's performance, unlike Frog's SniperMeleeFix which applies a native detour and allocates memory at runtime.

By modifying the constant we are able to get rid of (in order): Detour Trampoline -> Unmanaged to Managed Transition -> CoreCLR Marshalling -> Managed Allocation (Extra time at Garbage Collection) -> Multiplication (Actual fix) -> Managed to Unmanaged Transition + GC Transition to Unmanaged

Everything stated above is done for every enemy every time it wants to move and that adds up.

This plugin avoids that completely, you can't get any faster than that - it's the same speed as if the plugin wasn't there.

Credits

  • mccad00 - Plugin Icon
  • 10 Chambers Collective - Creating a gamebreaking issue and refusing to fix it for months
  • Dr. R3ddit MD - Gaslighting the community about the issue, invalidating our fix as a possible solution & pretending like the fix requires "core system changes"
  • bro - Hosted One Lobby & Emotional Support