is there anyone knows how to allocate cbaseusercmd.buttons_pb? Ana clc CRC? i am crashing and dont know how to alocate this little shitty shit.
SIGNATURES:
// signatures;
// AimPunchServices*, QAngle* out. Scale is inside the callee. Info RVA 8571120 (0x082C8F0).
inline const char *GetAimPunch = CSX_SIG("48 89 5C 24 10 57 48 83 EC 40 48 8B FA 48 8B D9 48 8D 54 24 50");
inline const char *CreateSubtickMove = CSX_SIG("E8 ? ? ? ? 48 8B D0 49 8D 4E ? E8 ? ? ? ? 4C 8B C8 4C 8D 43 ? 49 8B D1 48 8B CE E8 ? ? ? ? 48 8B D8 48 85 C0 0F 84");
inline const char *RepeatedPtrFieldClear = CSX_SIG("40 56 48 83 EC 20 48 63 41 08 48 8B F1 85 C0 7E 48 48 89 5C 24 38 33 DB 48 89 6C 24 40 48 8B E8 48 89 7C 24 48 48 8B 79 10 0F 1F 80 00 00 00 00 48 8B 4C DF 08 48 8B "
"01 FF 50 18 48 FF C3 48 3B DD 7C ED 48 8B 7C 24 48 48 8B 6C 24 40 48 8B 5C 24 38 C7 46 08 00 00 00 00 48 83 C4 20 5E C3 CC 44 0F B6 02");
inline const char *RepeatedPtrFieldAdd = CSX_SIG("48 89 5C 24 ? 57 48 83 EC ? 48 8B D9 48 8B FA 48 8B 49 ? 48 85 C9 74 ? 8B 01");
// Movement callsite. E8 at +16 (0x10) is the CSubtickMoveStep factory (alloc 56 / 0x38).
inline const char *SubtickStepAcquireSite = CSX_SIG("48 8B 54 CA 08 8D 41 01 89 47 08 EB 16 48 8B 0F E8 ? ? ? ? 48 8B D0 48 8B CF");
// serialize_move_crc at client.dll + 0x122c2e0 (verified 2026-09-25)
// Signature: void __fastcall serialize_move_crc(void **crc, std::uintptr_t msg, std::uintptr_t arena)
inline const char *SerializeMoveCrc = CSX_SIG("48 89 5C 24 20 57 48 83 EC 30 49 8B C0 48 8B DA 48 8B F9 48 8B 09 F6 C1 03");
// string_copy / memcpy at client.dll + 0xcf220 (verified 2026-09-25)
// Signature: void *__fastcall memcpy(void *dest, const void *src, size_t n)
inline const char *StringCopy = CSX_SIG("48 89 5C 24 10 48 89 6C 24 18 48 89 74 24 20 57 48 83 EC 20 65 48 8B 04 25 58 00 00 00");
FNS:
/**
* =========================================================================================
* Input Functions (ButtonStateAlloc, SerializeMoveCrc, StringCopy)
* Each accessor resolves and caches its own address statically.
* =========================================================================================
*/
// =========================================================================================
// Input Functions (ButtonStateAlloc, SerializeMoveCrc, StringCopy)
// =========================================================================================
// ButtonStateAlloc: Allocates CInButtonState protobuf from arena
// Signature: CreateSubtickMove (E8 call chain, 3rd CALL)
// Pattern: E8 ? ? ? ? ... E8 ? ? ? ? ... E8 ? ? ? ? 48 8B D8 48 85 C0 0F 84
// Target: 3rd CALL rel32 at offset +30, disp at +31, len 5
// Proto: void *(__fastcall *)(std::uintptr_t arena)
// =========================================================================================
[[nodiscard]] void *CClient::allocateButtonState(std::uintptr_t arena) const noexcept
{
using ButtonStateAllocFn = void *(__fastcall *)(std::uintptr_t arena);
static ButtonStateAllocFn fn = nullptr;
auto *client = CClient::getInstance();
if (!client || !client->module || !client->module->base())
return nullptr;
const auto addr = client->module->find_pattern(offsets::cl::sig::CreateSubtickMove);
if (addr && !fn)
{
const auto callSite = addr + 30;
fn = reinterpret_cast<ButtonStateAllocFn>(utilities::memory::tva::from_call_rel32(callSite));
}
if (!fn)
return nullptr;
return fn(arena);
}
void CClient::serializeMoveCrc(void **crc, std::uintptr_t msg, std::uintptr_t arena) const noexcept
{
using SerializeMoveCrcFn = void(__fastcall *)(void **crc, std::uintptr_t msg, std::uintptr_t arena);
static SerializeMoveCrcFn fn = nullptr;
if (!fn)
{
auto *client = CClient::getInstance();
if (!client || !client->module || !client->module->base())
return;
const auto addr = client->module->find_pattern(offsets::cl::sig::SerializeMoveCrc);
if (addr)
fn = reinterpret_cast<SerializeMoveCrcFn>(addr);
}
if (fn)
fn(crc, msg, arena);
}
void CClient::stringCopy(std::uintptr_t dst, std::uintptr_t src, int len) const noexcept
{
using StringCopyFn = void(__fastcall *)(std::uintptr_t dst, std::uintptr_t src, int len);
static StringCopyFn fn = nullptr;
if (!fn)
{
auto *client = CClient::getInstance();
if (!client || !client->module || !client->module->base())
return;
const auto addr = client->module->find_pattern(offsets::cl::sig::StringCopy);
if (addr)
fn = reinterpret_cast<StringCopyFn>(addr);
}
if (fn)
fn(dst, src, len);
}
C++:
#include "input.hpp"
#include "log/logger.hpp"
#include "sdk/entity/entitites/player.hpp"
#include "sdk/globals/globals.hpp"
#include "sdk/modules/client/client.hpp"
#include "sdk/modules/client/user_cmd.hpp"
#include <cstdint>
#include <cstring>
namespace features
{
CInputSystem *g_inputSystem = nullptr;
constexpr std::uintptr_t kProtoMessageImplOffset = 0x10;
bool CInputSystem::initialize() noexcept
{
static CInputSystem instance;
if (!g_inputSystem)
g_inputSystem = &instance;
if (g_inputSystem->IsInitialized())
return true;
if (!g_client || !g_client->initialized())
{
g_logger->log(ELogLevel::ERR, _XOR_("[InputSystem] Client not initialized"));
return false;
}
g_inputSystem->m_bInitialized = true;
g_logger->log(ELogLevel::INFO, _XOR_("[InputSystem] Initialized"));
return true;
}
bool CInputSystem::shutdown() noexcept
{
if (!g_inputSystem || !g_inputSystem->IsInitialized())
return true;
g_inputSystem->m_bInitialized = false;
g_inputSystem = nullptr;
return true;
}
void CInputSystem::apply(CUserCmd *cmd) noexcept
{
if (!m_bInitialized || !cmd)
return;
writeButtons(cmd);
writeSubtickDeltas(cmd);
}
void CInputSystem::writeButtons(CUserCmd *cmd) noexcept
{
if (!cmd || !g_client)
return;
auto *base = cmd->Base();
if (!base)
return;
auto *btns = base->buttons_pb;
if (!btns)
return;
base->m_pb.SetRawBits(0x2u);
auto *nativeBtns = cmd->Buttons();
if (nativeBtns)
{
btns->buttonstate1 = nativeBtns->Value();
btns->buttonstate2 = nativeBtns->m_nValueChanged;
btns->buttonstate3 = nativeBtns->m_nValueScroll;
}
}
void CInputSystem::writeSubtickDeltas(CUserCmd *cmd) noexcept
{
if (!cmd)
return;
auto *base = cmd->Base();
if (!base)
return;
auto *pawn = g_client ? g_client->GetLocalPlayerPawn() : nullptr;
if (!pawn)
return;
auto *move = pawn->m_pMovementServices();
if (!move)
return;
const float lastForward = move->m_flCmdForwardMove();
const float lastLeft = move->m_flCmdLeftMove();
CSubtickMoveStep *step = nullptr;
const int count = base->GetSubtickCount();
for (int i = count - 1; i >= 0; --i)
{
auto *it = base->SubtickAt(i);
if (it && it->button == 0)
{
step = it;
break;
}
}
if (!step)
{
step = base->CreateSubtick();
if (!step)
return;
step->SetButton(0, false, 0.f);
}
step->SetAnalogDeltas(cmd->ForwardMove() - lastForward, cmd->SideMove() - lastLeft);
}
} // namespace features
