This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Call cl_fullupdate using function from engine_client.so

* Seems bit safer than removing FCVAR_CHEAT from cl_fullupdate.
  • Loading branch information...
luk1337 committed Jan 5, 2017
1 parent 097ce2e commit f31491ab6bb86e7d4f245ac449d2eac965426221
Showing with 30 additions and 6 deletions.
  1. +2 −1 src/AimTux.cpp
  2. +3 −0 src/SDK/definitions.h
  3. +12 −0 src/hooker.cpp
  4. +7 −0 src/hooker.h
  5. +1 −4 src/skinchanger.cpp
  6. +5 −1 src/skinchanger.h
@@ -21,9 +21,10 @@ int __attribute__((constructor)) aimtux_init()
Hooker::HookRankReveal();
Hooker::HookSendClanTag();
Hooker::HookSendPacket();
Hooker::HookPrediction();
Hooker::HookIsReadyCallback();
Hooker::HookSurfaceDrawing();
Hooker::HookPrediction();
Hooker::HookForceFullUpdate();
Hooker::HookSwapWindow();
Hooker::HookPollEvent();
@@ -26,6 +26,9 @@ typedef ILauncherMgr* (*ILauncherMgrCreateFn) (void);
typedef void (*StartDrawingFn) (void*);
typedef void (*FinishDrawingFn) (void*);
typedef void* (*GetClientStateFn) (void);
typedef void (*ForceFullUpdateFn) (void*);
struct WeaponInfo_t {
float m_flWeaponArmorRatio;
float m_flPenetration;
@@ -61,6 +61,9 @@ RecvVarProxyFn fnSequenceProxyFn;
StartDrawingFn StartDrawing;
FinishDrawingFn FinishDrawing;
ForceFullUpdateFn ForceFullUpdate;
GetClientStateFn GetClientState;
std::unordered_map<const char*, uintptr_t> GetProcessLibraries()
{
std::unordered_map<const char*, uintptr_t> modules;
@@ -215,6 +218,15 @@ void Hooker::HookSurfaceDrawing()
FinishDrawing = reinterpret_cast<FinishDrawingFn>(finish_func_address);
}
void Hooker::HookForceFullUpdate()
{
uintptr_t forcefullupdate_func_address = FindPattern(GetLibraryAddress("engine_client.so"), 0xFFFFFFFFF, (unsigned char*) FORCEFULLUPDATE_SIGNATURE, FORCEFULLUPDATE_MASK);
ForceFullUpdate = reinterpret_cast<ForceFullUpdateFn>(forcefullupdate_func_address);
uintptr_t getclientstate_func_address = FindPattern(GetLibraryAddress("engine_client.so"), 0xFFFFFFFFF, (unsigned char*) GETCLIENTSTATE_SIGNATURE, GETCLIENTSTATE_MASK);
GetClientState = reinterpret_cast<GetClientStateFn>(getclientstate_func_address);
}
void Hooker::HookSwapWindow()
{
uintptr_t swapwindow_fn = reinterpret_cast<uintptr_t>(dlsym(RTLD_NEXT, "SDL_GL_SwapWindow"));
@@ -42,6 +42,12 @@
#define CMATSYSTEMSURFACE_FINISHDRAWING_SIGNATURE "\x55\x31\xFF\x48\x89"
#define CMATSYSTEMSURFACE_FINISHDRAWING_MASK "xxxxx"
#define FORCEFULLUPDATE_SIGNATURE "\x55\x48\x89\xE5\x48\x89\x5D\xF0\x48\x89\xFB\x4C\x89\x65\xF8\x48\x83\xEC\x10\x49\x89\xF4\x83"
#define FORCEFULLUPDATE_MASK "xxxxxxxxxxxxxxxxxxxxxxx"
#define GETCLIENTSTATE_SIGNATURE "\x55\x48\x8D\x3D\x68\x01\xDC"
#define GETCLIENTSTATE_MASK "xxxxxxx"
#include <unordered_map>
#include <sys/mman.h>
#include <link.h>
@@ -67,6 +73,7 @@ namespace Hooker
void HookPrediction();
void HookIsReadyCallback();
void HookSurfaceDrawing();
void HookForceFullUpdate();
void HookSwapWindow();
void HookPollEvent();
void HookSDLInput();
@@ -182,10 +182,7 @@ void SkinChanger::FrameStageNotify(ClientFrameStage_t stage)
if (SkinChanger::ForceFullUpdate)
{
cvar->FindVar("cl_fullupdate")->nFlags &= ~FCVAR_CHEAT;
engine->ExecuteClientCmd("cl_fullupdate");
cvar->FindVar("cl_fullupdate")->nFlags |= FCVAR_CHEAT;
::ForceFullUpdate(GetClientState());
SkinChanger::ForceFullUpdate = false;
}
}
@@ -4,7 +4,11 @@
#include "interfaces.h"
#include "settings.h"
namespace SkinChanger {
extern ForceFullUpdateFn ForceFullUpdate;
extern GetClientStateFn GetClientState;
namespace SkinChanger
{
extern bool ForceFullUpdate;
void FrameStageNotify(ClientFrameStage_t stage);

0 comments on commit f31491a

Please sign in to comment.