Init
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
"Games"
|
||||
{
|
||||
"cstrike"
|
||||
{
|
||||
"Offsets"
|
||||
{
|
||||
"IsMoving"
|
||||
{
|
||||
"windows" "74"
|
||||
"linux" "75"
|
||||
}
|
||||
}
|
||||
|
||||
"Signatures"
|
||||
{
|
||||
"CLagCompensationManager::BacktrackPlayer"
|
||||
{
|
||||
"library" "server"
|
||||
"linux" "@_ZN23CLagCompensationManager15BacktrackPlayerEP11CBasePlayerf"
|
||||
}
|
||||
}
|
||||
|
||||
"Functions"
|
||||
{
|
||||
"CLagCompensationManager__BacktrackPlayer"
|
||||
{
|
||||
"signature" "CLagCompensationManager::BacktrackPlayer"
|
||||
"callconv" "thiscall"
|
||||
"return" "void"
|
||||
"this" "ignore"
|
||||
"arguments"
|
||||
{
|
||||
"pPlayer"
|
||||
{
|
||||
"type" "cbaseentity"
|
||||
}
|
||||
"flTargetTime"
|
||||
{
|
||||
"type" "float"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"csgo"
|
||||
{
|
||||
"Offsets"
|
||||
{
|
||||
"IsMoving"
|
||||
{
|
||||
"windows" "80"
|
||||
"linux" "81"
|
||||
}
|
||||
}
|
||||
|
||||
"Signatures"
|
||||
{
|
||||
"CLagCompensationManager::BacktrackEntity"
|
||||
{
|
||||
"library" "server"
|
||||
"linux" "\x55\x89\xE5\x57\x56\x53\x81\xEC\x6C\x01\x00\x00\x8B\x0D\x2A\x2A\x2A\x2A\x0F\xB6\x45\x20"
|
||||
"windows" "\x55\x8B\xEC\x83\xE4\xF8\x81\xEC\xC4\x00\x00\x00\x89\x4C\x24\x34"
|
||||
}
|
||||
}
|
||||
|
||||
"Functions"
|
||||
{
|
||||
"CLagCompensationManager__BacktrackEntity"
|
||||
{
|
||||
"signature" "CLagCompensationManager::BacktrackEntity"
|
||||
"callconv" "thiscall"
|
||||
"return" "bool"
|
||||
"this" "ignore"
|
||||
"arguments"
|
||||
{
|
||||
"entity"
|
||||
{
|
||||
"type" "cbaseentity"
|
||||
}
|
||||
"flTargetTime"
|
||||
{
|
||||
"type" "float"
|
||||
}
|
||||
"track"
|
||||
{
|
||||
"type" "objectptr"
|
||||
}
|
||||
"restore"
|
||||
{
|
||||
"type" "objectptr"
|
||||
}
|
||||
"change"
|
||||
{
|
||||
"type" "objectptr"
|
||||
}
|
||||
"wantsAnims"
|
||||
{
|
||||
"type" "bool"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
#include <sourcemod>
|
||||
#include <sdkhooks>
|
||||
#include <sdktools>
|
||||
#include <dhooks>
|
||||
|
||||
#pragma semicolon 1
|
||||
#pragma newdecls required
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "FixLagCompensation",
|
||||
author = "BotoX + xen(CS:GO support)",
|
||||
description = "Disable player hitbox lag compensation when on moving objects",
|
||||
version = "1.0",
|
||||
url = ""
|
||||
};
|
||||
|
||||
Handle g_hBacktrackPlayer;
|
||||
Handle g_hBacktrackEntity;
|
||||
Handle g_hIsMoving;
|
||||
|
||||
public void OnPluginStart()
|
||||
{
|
||||
Handle hGameData = LoadGameConfigFile("FixLagCompensation.games");
|
||||
if(!hGameData)
|
||||
SetFailState("Failed to load FixLagCompensation gamedata.");
|
||||
|
||||
if (GetEngineVersion() != Engine_CSGO)
|
||||
{
|
||||
// void CLagCompensationManager::BacktrackPlayer( CBasePlayer *pPlayer, float flTargetTime )
|
||||
g_hBacktrackPlayer = DHookCreateFromConf(hGameData, "CLagCompensationManager__BacktrackPlayer");
|
||||
if(!g_hBacktrackPlayer)
|
||||
{
|
||||
delete hGameData;
|
||||
SetFailState("Failed to setup detour for CLagCompensationManager__BacktrackPlayer");
|
||||
}
|
||||
|
||||
if(!DHookEnableDetour(g_hBacktrackPlayer, false, Detour_OnBacktrackPlayer))
|
||||
{
|
||||
delete hGameData;
|
||||
SetFailState("Failed to detour CLagCompensationManager__BacktrackPlayer.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// bool CLagCompensationManager::BacktrackEntity( CBaseEntity *entity, float flTargetTime, LagRecordList *track, LagRecord *restore, LagRecord *change, bool wantsAnims )
|
||||
g_hBacktrackEntity = DHookCreateFromConf(hGameData, "CLagCompensationManager__BacktrackEntity");
|
||||
if(!g_hBacktrackEntity)
|
||||
{
|
||||
delete hGameData;
|
||||
SetFailState("Failed to setup detour for CLagCompensationManager__BacktrackEntity");
|
||||
}
|
||||
|
||||
if(!DHookEnableDetour(g_hBacktrackEntity, false, Detour_OnBacktrackEntity))
|
||||
{
|
||||
delete hGameData;
|
||||
SetFailState("Failed to detour CLagCompensationManager__BacktrackEntity.");
|
||||
}
|
||||
}
|
||||
|
||||
// CBaseEntity::IsMoving
|
||||
StartPrepSDKCall(SDKCall_Entity);
|
||||
if(!PrepSDKCall_SetFromConf(hGameData, SDKConf_Virtual, "IsMoving"))
|
||||
{
|
||||
delete hGameData;
|
||||
SetFailState("PrepSDKCall_SetFromConf(hGameData, SDKConf_Virtual, \"IsMoving\") failed!");
|
||||
}
|
||||
PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain);
|
||||
g_hIsMoving = EndPrepSDKCall();
|
||||
|
||||
delete hGameData;
|
||||
}
|
||||
|
||||
// CS:S
|
||||
public MRESReturn Detour_OnBacktrackPlayer(Handle hParams)
|
||||
{
|
||||
if(DHookIsNullParam(hParams, 1))
|
||||
return MRES_Ignored;
|
||||
|
||||
int client = DHookGetParam(hParams, 1);
|
||||
if(client < 1 || client > MaxClients)
|
||||
return MRES_Ignored;
|
||||
|
||||
int GroundEntity = GetEntPropEnt(client, Prop_Data, "m_hGroundEntity");
|
||||
if(GroundEntity <= 0)
|
||||
return MRES_Ignored;
|
||||
|
||||
bool bIsMoving = SDKCall(g_hIsMoving, GroundEntity);
|
||||
|
||||
if(bIsMoving)
|
||||
return MRES_Supercede;
|
||||
|
||||
return MRES_Ignored;
|
||||
}
|
||||
|
||||
// CS:GO
|
||||
public MRESReturn Detour_OnBacktrackEntity(Handle hReturn, Handle hParams)
|
||||
{
|
||||
if(DHookIsNullParam(hParams, 1))
|
||||
return MRES_Ignored;
|
||||
|
||||
int client = DHookGetParam(hParams, 1);
|
||||
if(client < 1 || client > MaxClients)
|
||||
return MRES_Ignored;
|
||||
|
||||
int GroundEntity = GetEntPropEnt(client, Prop_Data, "m_hGroundEntity");
|
||||
if(GroundEntity <= 0)
|
||||
return MRES_Ignored;
|
||||
|
||||
bool bIsMoving = SDKCall(g_hIsMoving, GroundEntity);
|
||||
|
||||
if(bIsMoving)
|
||||
{
|
||||
DHookSetReturn(hReturn, false);
|
||||
return MRES_Supercede;
|
||||
}
|
||||
|
||||
return MRES_Ignored;
|
||||
}
|
||||
Reference in New Issue
Block a user