-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
data_manager.hpp
data_manager.cpp
usage
Код:
#pragma once
#include "../../valve/sdk.hpp"
namespace csgo::feature
{
struct DataRecord
{
QAngle m_aimPunchAngle = { };
};
class DataManager : public core::Singleton< DataManager >
{
public:
auto RunCommand( C_BasePlayer* base_player ) -> void;
auto FrameStageNotify( ClientFrameStage_t stage ) -> void;
private:
DataRecord m_data_history[ 128 ] = { };
};
}
Код:
#include "data_manager.hpp"
#include "../../valve/object/player.hpp"
#include "../../valve/object/weapon.hpp"
namespace csgo::feature
{
auto DataManager::RunCommand( C_BasePlayer* base_player ) -> void
{
auto player = C_CSPlayer::GetLocalPlayer();
if( player && player == base_player )
{
auto command = player->m_nTickBase();
auto data = &m_data_history[ command % 128 ];
data->m_aimPunchAngle = player->m_aimPunchAngle();
}
}
auto DataManager::FrameStageNotify( ClientFrameStage_t stage ) -> void
{
if( stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START )
{
auto player = C_CSPlayer::GetLocalPlayer();
if( player )
{
auto command = player->m_nTickBase();
auto data = &m_data_history[ command % 128 ];
player->m_aimPunchAngle() = data->m_aimPunchAngle;
}
}
}
}
Код:
auto __fastcall RunCommand( void* ecx, void*, C_BasePlayer* player, CUserCmd* ucmd, IMoveHelper* helper )
{
auto& data_manager = csgo::feature::DataManager::Instance();
using fn = void( __thiscall* )( void*, C_BasePlayer*, CUserCmd*, IMoveHelper* );
csgo::m_prediction_swap->get< fn >( 19 )( ecx, player, ucmd, helper );
data_manager->RunCommand( player );
}
auto __fastcall FrameStageNotify( void* ecx, void*, ClientFrameStage_t curStage )
{
auto& data_manager = csgo::feature::DataManager::Instance();
using fn = void( __thiscall* )( void*, ClientFrameStage_t );
csgo::m_base_client_swap->get< fn >( 36 )( ecx, curStage );
data_manager->FrameStageNotify( curStage );
}