mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-06 18:08:26 +00:00
Use signature instead of doing netprop±offset (#1158)
This commit is contained in:
parent
578636d528
commit
21c6204062
@ -44,6 +44,14 @@
|
||||
|
||||
"csgo"
|
||||
{
|
||||
"Addresses"
|
||||
{
|
||||
"m_surfaceFriction"
|
||||
{
|
||||
"signature" "CBasePlayer->m_surfaceFriction"
|
||||
"read" "4" // skip the first 4 bytes
|
||||
}
|
||||
}
|
||||
"Offsets"
|
||||
{
|
||||
// search string: "func_pushable" and you can find CBaseTrigger::PassesTriggerFilters / CBaseVPhysicsTrigger::PassesTriggerFilters. Follow references to these functions to find the vtable and then calculate the offset...
|
||||
@ -134,11 +142,30 @@
|
||||
"windows" "\x55\x8B\xEC\x83\xEC\x0C\x57\x8B\xF9\x8B\x87\x2A\x2A\x2A\x2A\xD1\xE8\xA8\x01\x0F\x84"
|
||||
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x5C\x8B\x55\x08\xC7\x44\x24\x2A\x2A\x2A\x2A\x2A\x89\x14\x24\xE8"
|
||||
}
|
||||
// search string: "sv_friction", look for instruction like this: "mov some_register, offset sv_friction_cvar"
|
||||
// xref sv_friction_cvar, look for the place that it gets called and has this:
|
||||
// *(float*)(a1[1] + some_offset) * (float(__thiscall)(void*))(*(uintptr_t*)sv_friction + GetFloatIndex*sizeof(void*))(sv_friction)
|
||||
// make a signature for some_offset
|
||||
// if it's unclear: https://youtu.be/xiNQ00X4R_I
|
||||
"CBasePlayer->m_surfaceFriction"
|
||||
{
|
||||
"windows" "\xF3\x0F\x10\x80\x2A\x2A\x2A\x2A\xF3\x0F\x59\x45\x2A\xF3\x0F\x11\x45"
|
||||
"linux" "\xF3\x0F\x59\xB2\x2A\x2A\x2A\x2A\xF3\x0F\x59\xF0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"cstrike"
|
||||
{
|
||||
"Addresses"
|
||||
{
|
||||
"m_surfaceFriction"
|
||||
{
|
||||
"signature" "CBasePlayer->m_surfaceFriction"
|
||||
"read" "2" // skip the first 2 bytes
|
||||
}
|
||||
}
|
||||
|
||||
"Offsets"
|
||||
{
|
||||
// https://asherkin.github.io/vtable/
|
||||
@ -174,12 +201,6 @@
|
||||
"windows" "358"
|
||||
"linux" "359"
|
||||
}
|
||||
// TODO
|
||||
"m_surfaceFriction"
|
||||
{
|
||||
"windows" "104"
|
||||
"linux" "104"
|
||||
}
|
||||
// find in CCSGameMovement::CheckForLadders which references CCSPlayer::CanGrabLadder
|
||||
"CCSPlayer::m_lastStandingPos"
|
||||
{
|
||||
@ -266,6 +287,14 @@
|
||||
"windows" "\x55\x8B\xEC\x83\xEC\x08\x57\x8B\x7D\x08\x8B\x87\x2A\x2A\x2A\x2A\xD1\xE8\xA8\x01\x0F\x84"
|
||||
"linux" "@_ZN11CBaseEntity24PhysicsRemoveTouchedListEPS_"
|
||||
}
|
||||
// look for function CGameMovement::CategorizePosition
|
||||
// and you will see something something *(_DWORD*)(a1[1] + some_offset) = 0x3F800000
|
||||
// make a signature at "mov dword ptr[eax+some_offset], 3F800000h"
|
||||
"CBasePlayer->m_surfaceFriction"
|
||||
{
|
||||
"windows" "\xC7\x80\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x07\xFF\x90"
|
||||
"linux" "\xC7\x80\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x03\x89\x1C\x24\xFF\x90\x2A\x2A\x2A\x2A\x8B\x53\x04"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -114,9 +114,16 @@ public void OnPluginStart()
|
||||
|
||||
GameData gamedata = new GameData("shavit.games");
|
||||
|
||||
if ((g_iSurfaceFrictionOffset = gamedata.GetOffset("m_surfaceFriction")) == -1)
|
||||
Address surfaceFrctionAddress = gamedata.GetAddress("m_surfaceFriction");
|
||||
|
||||
if (surfaceFrctionAddress == Address_Null)
|
||||
{
|
||||
LogError("[XUTAX] Invalid offset supplied, defaulting friction values");
|
||||
g_iSurfaceFrictionOffset = -1;
|
||||
LogError("[XUTAX] The address of m_surfaceFriction is null, defaulting friction values");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_iSurfaceFrictionOffset = view_as<int>(surfaceFrctionAddress);
|
||||
}
|
||||
|
||||
delete gamedata;
|
||||
@ -127,18 +134,6 @@ public void OnPluginStart()
|
||||
ConVar sv_air_max_wishspeed = FindConVar("sv_air_max_wishspeed");
|
||||
sv_air_max_wishspeed.AddChangeHook(OnWishSpeedChanged);
|
||||
g_flAirSpeedCap = sv_air_max_wishspeed.FloatValue;
|
||||
|
||||
if (g_iSurfaceFrictionOffset != -1)
|
||||
{
|
||||
g_iSurfaceFrictionOffset = FindSendPropInfo("CBasePlayer", "m_ubEFNoInterpParity") - g_iSurfaceFrictionOffset;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_iSurfaceFrictionOffset != -1)
|
||||
{
|
||||
g_iSurfaceFrictionOffset += FindSendPropInfo("CBasePlayer", "m_szLastPlaceName");
|
||||
}
|
||||
}
|
||||
|
||||
AddCommandListener(CommandListener_Toggler, "+autostrafer");
|
||||
@ -163,7 +158,6 @@ public void OnPluginStart()
|
||||
|
||||
RegConsoleCmd("sm_tasm", Command_TasSettingsMenu, "Opens the TAS settings menu.");
|
||||
RegConsoleCmd("sm_tasmenu", Command_TasSettingsMenu, "Opens the TAS settings menu.");
|
||||
RegAdminCmd("sm_xutax_scan", Command_ScanOffsets, ADMFLAG_CHEATS, "Scan for possible offset locations");
|
||||
|
||||
//Convar.AutoExecConfig();
|
||||
|
||||
@ -616,50 +610,6 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
stock void FindNewFrictionOffset(int client, bool logOnly = false)
|
||||
{
|
||||
if (gEV_Type == Engine_CSGO)
|
||||
{
|
||||
int startingOffset = FindSendPropInfo("CBasePlayer", "m_ubEFNoInterpParity");
|
||||
for (int i = 16; i >= -128; --i)
|
||||
{
|
||||
float friction = GetEntDataFloat(client, startingOffset + i);
|
||||
if (friction == 0.25 || friction == 1.0)
|
||||
{
|
||||
if (logOnly)
|
||||
{
|
||||
PrintToConsole(client, "Found offset canidate: %i", i * -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_iSurfaceFrictionOffset = startingOffset - i;
|
||||
LogError("[XUTAX] Current offset is out of date. Please update to new offset: %i", i * -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int startingOffset = FindSendPropInfo("CBasePlayer", "m_szLastPlaceName");
|
||||
for (int i = 1; i <= 128; ++i)
|
||||
{
|
||||
float friction = GetEntDataFloat(client, startingOffset + i);
|
||||
if (friction == 0.25 || friction == 1.0)
|
||||
{
|
||||
if(logOnly)
|
||||
{
|
||||
PrintToConsole(client, "Found offset canidate: %i", i);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_iSurfaceFrictionOffset = startingOffset + i;
|
||||
LogError("[XUTAX] Current offset is out of date. Please update to new offset: %i", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenTasSettingsMenu(int client, int pos=0)
|
||||
{
|
||||
char display[64];
|
||||
@ -890,13 +840,6 @@ public Action Command_TasSettingsMenu(int client, int args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_ScanOffsets(int client, int args)
|
||||
{
|
||||
FindNewFrictionOffset(client, .logOnly = true);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
// natives
|
||||
public any Native_SetAutostrafeEnabled(Handle plugin, int numParams)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user