just updating plugins to 64bit support

This commit is contained in:
jenz
2026-11-22 22:12:20 +01:00
parent 7a4f26c2bd
commit 2dca39be8a
32 changed files with 2990 additions and 516 deletions
@@ -0,0 +1,156 @@
"Games"
{
"#default"
{
"#supported"
{
"engine" "orangebox_valve"
"engine" "css"
}
"Addresses"
{
"CBaseServer"
{
"windows"
{
"signature" "CVEngineServer::CreateFakeClient"
"read" "8"
}
"linux"
{
"signature" "sv"
}
"linux64"
{
"signature" "sv"
}
"mac"
{
"signature" "sv"
}
}
}
"Signatures"
{
"CVEngineServer::CreateFakeClient"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x56\xFF\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x8B"
}
"sv"
{
"library" "engine"
"linux" "@sv"
"linux64" "@sv"
"mac" "@sv"
}
}
}
"#default"
{
"#supported"
{
"engine" "orangebox"
"engine" "left4dead"
"engine" "left4dead2"
}
"Addresses"
{
"CBaseServer"
{
"windows"
{
"signature" "CVEngineServer::CreateFakeClient"
"read" "6"
}
"linux"
{
"signature" "sv"
}
"linux64"
{
"signature" "sv"
}
"mac"
{
"signature" "sv"
}
}
}
"Signatures"
{
"CVEngineServer::CreateFakeClient"
{
"library" "engine"
"windows" "\x8B\x44\x24\x04\x50\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0"
}
"sv"
{
"library" "engine"
"linux" "@sv"
"linux64" "@sv"
"mac" "@sv"
}
}
}
"#default"
{
"#supported"
{
"engine" "orangebox"
"engine" "orangebox_valve"
"engine" "css"
}
"Offsets"
{
"CBaseServer::GetClient"
{
"windows" "6"
"linux" "7"
"linux64" "7"
"mac" "7"
}
"CBaseClient::UpdateAcknowledgedFramecount"
{
"linux" "44"
"linux64" "44"
}
// IClient comes after the IGameEventListener2 vtable pointer in CBaseClient
"CBaseClient::IClient"
{
"windows" "4"
"linux" "4"
"linux64" "8"
"mac" "4"
}
}
}
"#default"
{
"#supported"
{
"engine" "left4dead"
"engine" "left4dead2"
}
"Offsets"
{
"CBaseServer::GetClient"
{
"windows" "6"
"linux" "7"
"mac" "7"
}
}
}
}
@@ -0,0 +1,174 @@
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>
#include <FullUpdate>
Handle g_hCBaseClient_UpdateAcknowledgedFramecount;
Handle g_hGetClient;
Address g_pBaseServer;
int g_iIClientOffset = 4;
int g_iLastFullUpdate[MAXPLAYERS + 1] = { 0, ... };
public Plugin myinfo =
{
name = "FullUpdate",
author = "BotoX, PŠΣ™ SHUFEN, maxime1907",
description = "Serverside cl_fullupdate",
version = FullUpdate_VERSION,
url = "https://github.com/srcdslab/sm-plugin-FullUpdate"
}
public void OnPluginStart()
{
GameData hGameData = new GameData("FullUpdate.games");
if (hGameData == null) {
SetFailState("Couldn't load FullUpdate.games game config!");
return;
}
#if !defined GetClientIClient
g_pBaseServer = hGameData.GetAddress("CBaseServer");
if(g_pBaseServer == Address_Null)
{
delete hGameData;
SetFailState("Couldn't get BaseServer address!");
return;
}
StartPrepSDKCall(SDKCall_Raw);
if (!PrepSDKCall_SetFromConf(hGameData, SDKConf_Virtual, "CBaseServer::GetClient"))
{
delete hGameData;
SetFailState("PrepSDKCall_SetFromConf(hGameData, SDKConf_Virtual, \"CBaseServer::GetClient\" failed!");
return;
}
#if SOURCEMOD_V_MAJOR == 1 && SOURCEMOD_V_MINOR < 13
// SM 1.12 has no SDKType_Address (x86 only): the pointer comes back as plain data
PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain);
#else
PrepSDKCall_SetReturnInfo(SDKType_Address, SDKPass_Plain);
#endif
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
g_hGetClient = EndPrepSDKCall();
#endif
// void CBaseClient::UpdateAcknowledgedFramecount()
StartPrepSDKCall(SDKCall_Raw);
if(!PrepSDKCall_SetFromConf(hGameData, SDKConf_Virtual, "CBaseClient::UpdateAcknowledgedFramecount"))
{
delete hGameData;
SetFailState("PrepSDKCall_SetFromConf(hGameData, SDKConf_Virtual, \"CBaseClient::UpdateAcknowledgedFramecount\" failed!");
return;
}
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
g_hCBaseClient_UpdateAcknowledgedFramecount = EndPrepSDKCall();
int iOffset = hGameData.GetOffset("CBaseClient::IClient");
if (iOffset != -1)
g_iIClientOffset = iOffset;
delete hGameData;
RegConsoleCmd("fullupdate", Command_FullUpdate);
RegConsoleCmd("sm_fullupdate", Command_FullUpdate);
AddCommandListener(Command_cl_fullupdate, "cl_fullupdate");
}
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
CreateNative("ClientFullUpdate", Native_FullUpdate);
RegPluginLibrary("FullUpdate");
return APLRes_Success;
}
public void OnClientConnected(int client)
{
g_iLastFullUpdate[client] = 0;
}
bool FullUpdate(int client)
{
if(g_iLastFullUpdate[client] + 1 > GetTime())
return false;
if (IsFakeClient(client))
return false;
Address pIClient = GetBaseClient(client);
if (!pIClient)
return false;
SDKCall(g_hCBaseClient_UpdateAcknowledgedFramecount, pIClient, -1);
g_iLastFullUpdate[client] = GetTime();
return true;
}
public int Native_FullUpdate(Handle plugin, int numParams)
{
int client = GetNativeCell(1);
if(client > MaxClients || client <= 0)
{
ThrowNativeError(SP_ERROR_NATIVE, "Client is not valid.");
return 0;
}
if(!IsClientInGame(client))
{
ThrowNativeError(SP_ERROR_NATIVE, "Client is not in-game.");
return 0;
}
if(IsFakeClient(client))
{
ThrowNativeError(SP_ERROR_NATIVE, "Client is fake-client.");
return 0;
}
return FullUpdate(client);
}
public Action Command_cl_fullupdate(int client, const char[] command, int args)
{
Command_FullUpdate(client, -1);
return Plugin_Handled;
}
public Action Command_FullUpdate(int client, int args)
{
FullUpdate(client);
return Plugin_Handled;
}
#if !defined GetClientIClient
stock Address GetClientIClient(int client)
{
#if SOURCEMOD_V_MAJOR == 1 && SOURCEMOD_V_MINOR < 13
return view_as<Address>(SDKCall(g_hGetClient, g_pBaseServer, client-1));
#else
// SDKType_Address results come back through a by-ref argument (64-bit Address).
Address pIClient;
SDKCall(g_hGetClient, g_pBaseServer, pIClient, client-1);
return pIClient;
#endif
}
#endif
stock Address GetBaseClient(int client)
{
Address pIClientTmp = GetClientIClient(client);
if(!pIClientTmp)
return Address_Null;
// The IClient vtable comes after the IGameEventListener2 (CBaseClient) one due to multiple inheritance.
return pIClientTmp - view_as<Address>(g_iIClientOffset);
}
@@ -0,0 +1,37 @@
#if defined _FullUpdate_Included
#endinput
#endif
#define _FullUpdate_Included
#define FullUpdate_V_MAJOR "1"
#define FullUpdate_V_MINOR "4"
#define FullUpdate_V_PATCH "1"
#define FullUpdate_VERSION FullUpdate_V_MAJOR..."."...FullUpdate_V_MINOR..."."...FullUpdate_V_PATCH
/**
* Forces a full update (cl_fullupdate) for a client.
*
* @param client Client index
* @return True if update was successful, false otherwise
* @error Invalid client index, client not in game, or client is fake
*/
native bool ClientFullUpdate(int client);
public SharedPlugin __pl_FullUpdate =
{
name = "FullUpdate",
file = "FullUpdate.smx",
#if defined REQUIRE_PLUGIN
required = 1,
#else
required = 0,
#endif
};
#if !defined REQUIRE_PLUGIN
public __pl_FullUpdate_SetNTVOptional()
{
MarkNativeAsOptional("ClientFullUpdate");
}
#endif