compiles AND injects

This commit is contained in:
nullifiedcat 2017-07-28 22:19:55 +03:00
parent 905ff7efff
commit 8e6f62c847
9 changed files with 66 additions and 52 deletions

View File

@ -112,7 +112,7 @@ CFLAGS+=$(INCLUDES)
ifdef TEXTMODE
N_SOURCES := hacks/ESP.cpp hacks/SkinChanger.cpp hacks/SpyAlert.cpp hacks/Radar.cpp fidgetspinner.cpp ftrender.cpp hooks/sdl.cpp drawmgr.cpp drawgl.cpp
N_SOURCES := hacks/ESP.cpp hacks/SkinChanger.cpp hacks/SpyAlert.cpp hacks/Radar.cpp fidgetspinner.cpp ftrender.cpp hooks/sdl.cpp drawmgr.cpp drawgl.cpp hooks/PaintTraverse.cpp EffectChams.cpp EffectGlow.cpp
N_SOURCES := $(addprefix $(SRC_DIR)/,$(N_SOURCES))
SOURCES := $(filter-out $(shell find $(SRC_DIR)/gui -name "*.cpp" -print),$(SOURCES))
@ -164,7 +164,7 @@ src/sdk/utlbuffer.o : CFLAGS+=-w
.cpp.o:
@echo Compiling $<
$(CXX) $(CXXFLAGS) -c $< -o $@
@$(CXX) $(CXXFLAGS) -c $< -o $@
.c.o:
@echo Compiling $<

View File

@ -234,10 +234,11 @@ void hack::Initialize() {
InitNetVars();
g_pLocalPlayer = new LocalPlayer();
g_pPlayerResource = new TFPlayerResource();
#ifndef TEXTMODE
hooks::panel.Set(g_IPanel);
hooks::panel.HookMethod((void*)PaintTraverse_hook, offsets::PaintTraverse());
hooks::panel.Apply();
#endif
uintptr_t* clientMode = 0;
// Bad way to get clientmode.
// FIXME [MP]?

View File

@ -89,7 +89,6 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
PROF_SECTION(PT_total);
hacks::shared::autojoin::UpdateSearch();
if (vp == panel_top) draw_flag = true;
if (!cathook) return;
@ -126,16 +125,6 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
if (!draw_flag) return;
draw_flag = false;
if (!hack::command_stack().empty()) {
PROF_SECTION(PT_command_stack);
std::lock_guard<std::mutex> guard(hack::command_stack_mutex);
while (!hack::command_stack().empty()) {
logging::Info("executing %s", hack::command_stack().top().c_str());
g_IEngine->ClientCmd_Unrestricted(hack::command_stack().top().c_str());
hack::command_stack().pop();
}
}
if (disable_visuals) return;
if (clean_screenshots && g_IEngine->IsTakingScreenshot()) return;

View File

@ -382,6 +382,18 @@ void FrameStageNotify_hook(void* _this, int stage) {
}
}
}
if (stage == FRAME_START) {
hacks::shared::autojoin::UpdateSearch();
if (!hack::command_stack().empty()) {
PROF_SECTION(PT_command_stack);
std::lock_guard<std::mutex> guard(hack::command_stack_mutex);
while (!hack::command_stack().empty()) {
logging::Info("executing %s", hack::command_stack().top().c_str());
g_IEngine->ClientCmd_Unrestricted(hack::command_stack().top().c_str());
hack::command_stack().pop();
}
}
}
#ifndef TEXTMODE
if (cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) {
#if ENABLE_GUI

View File

@ -77,17 +77,12 @@ void CreateInterfaces() {
g_IEngine = BruteforceInterface<IVEngineClient013>("VEngineClient", sharedobj::engine());
g_AppID = g_IEngine->GetAppID();
g_IEntityList = BruteforceInterface<IClientEntityList>("VClientEntityList", sharedobj::client());
g_IPanel = BruteforceInterface<vgui::IPanel>("VGUI_Panel", sharedobj::vgui2());
g_ISteamClient = BruteforceInterface<ISteamClient>("SteamClient", sharedobj::steamclient(), 17);
g_ISurface = BruteforceInterface<vgui::ISurface>("VGUI_Surface", sharedobj::vguimatsurface());
g_IEventManager2 = BruteforceInterface<IGameEventManager2>("GAMEEVENTSMANAGER", sharedobj::engine(), 2);
g_IGameEventManager = BruteforceInterface<IGameEventManager>("GAMEEVENTSMANAGER", sharedobj::engine(), 1);
g_IBaseClient = BruteforceInterface<IBaseClientDLL>("VClient", sharedobj::client());
g_ITrace = BruteforceInterface<IEngineTrace>("EngineTraceClient", sharedobj::engine());
g_IModelInfo = BruteforceInterface<IVModelInfoClient>("VModelInfoClient", sharedobj::engine());
g_IInputSystem = BruteforceInterface<IInputSystem>("InputSystemVersion", sharedobj::inputsystem());
g_IStudioRender = BruteforceInterface<IStudioRender>("VStudioRender", sharedobj::studiorender());
g_IVDebugOverlay = BruteforceInterface<IVDebugOverlay>("VDebugOverlay", sharedobj::engine());
HSteamPipe sp = g_ISteamClient->CreateSteamPipe();
HSteamUser su = g_ISteamClient->ConnectToGlobalUser(sp);
g_IVModelRender = BruteforceInterface<IVModelRender>("VEngineModel", sharedobj::engine(), 16);
@ -103,20 +98,6 @@ void CreateInterfaces() {
g_GlobalVars = **(reinterpret_cast<CGlobalVarsBase***>((uintptr_t)11 + gSignatures.GetClientSignature("55 89 E5 83 EC ? 8B 45 08 8B 15 ? ? ? ? F3 0F 10")));
g_IPrediction = BruteforceInterface<IPrediction>("VClientPrediction", sharedobj::client());
g_IGameMovement = BruteforceInterface<IGameMovement>("GameMovement", sharedobj::client());
g_IVRenderView = BruteforceInterface<IVRenderView>("VEngineRenderView", sharedobj::engine());
g_IMaterialSystem = BruteforceInterface<IMaterialSystemFixed>("VMaterialSystem", sharedobj::materialsystem());
g_IMaterialSystemHL = (IMaterialSystem*)g_IMaterialSystem;
IF_GAME (IsTF2()) {
g_pScreenSpaceEffects = **(IScreenSpaceEffectManager***)(gSignatures.GetClientSignature("F3 0F 10 83 40 05 00 00 C7 44 24 04 ? ? ? ? 89 34 24 F3 0F 11 44 24 08 E8 ? ? ? ? A1 ? ? ? ? 8B 10 89 04 24 89 74 24 08 C7 44 24 04 ? ? ? ? FF 52 0C A1 ? ? ? ? 8B 10 C7 44 24 04 ? ? ? ? 89 04 24 FF 52 14") + 31);
g_ppScreenSpaceRegistrationHead = *(CScreenSpaceEffectRegistration***)(gSignatures.GetClientSignature("55 89 E5 53 83 EC 14 8B 1D ? ? ? ? 85 DB 74 25 8D B4 26 00 00 00 00 8B 43 04 85 C0 74 10") + 9);
} else IF_GAME (IsTF2C()) {
logging::Info("FATAL: Signatures not defined for TF2C - Screen Space Effects");
g_pScreenSpaceEffects = nullptr;
g_ppScreenSpaceRegistrationHead = nullptr;
} else IF_GAME (IsHL2DM()) {
g_pScreenSpaceEffects = **(IScreenSpaceEffectManager***)(gSignatures.GetClientSignature("FF 52 14 E9 E0 FE FF FF 8D 76 00 A1 ? ? ? ? 8B 5D F4 8B 75 F8 8B 7D FC 8B 10 C7 45 0C ? ? ? ? 89 45 08 8B 42 1C 89 EC 5D FF E0") + 12);
g_ppScreenSpaceRegistrationHead = *(CScreenSpaceEffectRegistration***)(gSignatures.GetClientSignature("E8 ? ? ? ? 8B 10 C7 44 24 04 ? ? ? ? 89 04 24 FF 52 28 85 C0 75 4B 8B 35 ? ? ? ? 85 F6 74 31 90 8B 5E 04 85 DB 74 22 8B 03 89 1C 24") + 27);
}
IF_GAME (IsTF2()) {
//g_IMoveHelper = *(reinterpret_cast<IMoveHelper**>(gSignatures.GetClientSignature("? ? ? ? 8B 10 89 04 24 FF 52 28 0F B7 CF 8B 10 89 4C 24 04 89 04 24 FF 52 1C 8B 13 89 1C 24 89 44 24 04 FF 92 74 05 00 00 8D 95 C8 FE FF FF C7 44 24 08 00 00 00 00")));
}
@ -136,12 +117,6 @@ void CreateInterfaces() {
uintptr_t sig = gSignatures.GetClientSignature("89 1C 24 D9 5D D4 FF 90 3C 01 00 00 89 C7 8B 06 89 34 24 C1 E7 08 FF 90 3C 01 00 00 09 C7 33 3D ? ? ? ? 39 BB 34 0B 00 00 74 0E 89 BB 34 0B 00 00 89 3C 24 E8 ? ? ? ? C7 44 24 04 0F 27 00 00");
g_PredictionRandomSeed = *reinterpret_cast<int**>(sig + (uintptr_t)32);
}
logging::Info("Finding HUD");
{
uintptr_t hud_sig = gSignatures.GetClientSignature("FF 50 08 D9 9D 24 FE FF FF 89 3C 24 E8 ? ? ? ? C7 44 24 04 ? ? ? ? C7 04 24 ? ? ? ? D9 9D 20 FE FF FF E8 ? ? ? ? 85 C0 74 3B 66 0F 6E C3 C7 44 24 10 00 00 00 00 F3 0F 5C 85 20 FE FF FF") + 28;
g_CHUD = *reinterpret_cast<CHud**>(hud_sig);
logging::Info("HUD 0x%08x 0x%08x", hud_sig, g_CHUD);
}
IF_GAME (IsTF2()) {
uintptr_t gcsystem_sig = gSignatures.GetClientSignature("E8 ? ? ? ? C7 44 24 04 04 00 00 00 89 04 24 E8 ? ? ? ? E9 17 FF FF FF") + 1;
typedef TFGCClientSystem*(*func_t)(void);
@ -152,4 +127,31 @@ void CreateInterfaces() {
g_TFGCClientSystem = get_gc();
}
#ifndef TEXTMODE
g_IModelInfo = BruteforceInterface<IVModelInfoClient>("VModelInfoClient", sharedobj::engine());
g_IVDebugOverlay = BruteforceInterface<IVDebugOverlay>("VDebugOverlay", sharedobj::engine());
g_IPanel = BruteforceInterface<vgui::IPanel>("VGUI_Panel", sharedobj::vgui2());
g_ISurface = BruteforceInterface<vgui::ISurface>("VGUI_Surface", sharedobj::vguimatsurface());
g_IStudioRender = BruteforceInterface<IStudioRender>("VStudioRender", sharedobj::studiorender());
g_IMaterialSystem = BruteforceInterface<IMaterialSystemFixed>("VMaterialSystem", sharedobj::materialsystem());
g_IVRenderView = BruteforceInterface<IVRenderView>("VEngineRenderView", sharedobj::engine());
g_IMaterialSystemHL = (IMaterialSystem*)g_IMaterialSystem;
IF_GAME (IsTF2()) {
g_pScreenSpaceEffects = **(IScreenSpaceEffectManager***)(gSignatures.GetClientSignature("F3 0F 10 83 40 05 00 00 C7 44 24 04 ? ? ? ? 89 34 24 F3 0F 11 44 24 08 E8 ? ? ? ? A1 ? ? ? ? 8B 10 89 04 24 89 74 24 08 C7 44 24 04 ? ? ? ? FF 52 0C A1 ? ? ? ? 8B 10 C7 44 24 04 ? ? ? ? 89 04 24 FF 52 14") + 31);
g_ppScreenSpaceRegistrationHead = *(CScreenSpaceEffectRegistration***)(gSignatures.GetClientSignature("55 89 E5 53 83 EC 14 8B 1D ? ? ? ? 85 DB 74 25 8D B4 26 00 00 00 00 8B 43 04 85 C0 74 10") + 9);
} else IF_GAME (IsTF2C()) {
logging::Info("FATAL: Signatures not defined for TF2C - Screen Space Effects");
g_pScreenSpaceEffects = nullptr;
g_ppScreenSpaceRegistrationHead = nullptr;
} else IF_GAME (IsHL2DM()) {
g_pScreenSpaceEffects = **(IScreenSpaceEffectManager***)(gSignatures.GetClientSignature("FF 52 14 E9 E0 FE FF FF 8D 76 00 A1 ? ? ? ? 8B 5D F4 8B 75 F8 8B 7D FC 8B 10 C7 45 0C ? ? ? ? 89 45 08 8B 42 1C 89 EC 5D FF E0") + 12);
g_ppScreenSpaceRegistrationHead = *(CScreenSpaceEffectRegistration***)(gSignatures.GetClientSignature("E8 ? ? ? ? 8B 10 C7 44 24 04 ? ? ? ? 89 04 24 FF 52 28 85 C0 75 4B 8B 35 ? ? ? ? 85 F6 74 31 90 8B 5E 04 85 DB 74 22 8B 03 89 1C 24") + 27);
}
logging::Info("Finding HUD");
{
uintptr_t hud_sig = gSignatures.GetClientSignature("FF 50 08 D9 9D 24 FE FF FF 89 3C 24 E8 ? ? ? ? C7 44 24 04 ? ? ? ? C7 04 24 ? ? ? ? D9 9D 20 FE FF FF E8 ? ? ? ? 85 C0 74 3B 66 0F 6E C3 C7 44 24 10 00 00 00 00 F3 0F 5C 85 20 FE FF FF") + 28;
g_CHUD = *reinterpret_cast<CHud**>(hud_sig);
logging::Info("HUD 0x%08x 0x%08x", hud_sig, g_CHUD);
}
#endif
}

View File

@ -33,10 +33,14 @@ void logging::Info(const char* fmt, ...) {
sprintf(result, "[CAT] %s\n", buffer);
fprintf(logging::handle, "%s", result);
fflush(logging::handle);
#ifndef TEXTMODE
if (g_ICvar) {
if (console_logging.convar_parent && console_logging)
g_ICvar->ConsolePrintf("%s", result);
}
#else
printf("%s", result);
#endif
delete [] buffer;
delete [] result;
}

View File

@ -8,7 +8,7 @@
#ifndef MACROS_HPP_
#define MACROS_HPP_
#if defined(NOGUI) and NOGUI == 1
#if defined(NOGUI) and NOGUI == 1 or defined(TEXTMODE)
#define ENABLE_GUI false
#else
#define ENABLE_GUI true

View File

@ -76,14 +76,16 @@ void LoadAllSharedObjects() {
steamclient().Load();
client().Load();
engine().Load();
vguimatsurface().Load();
vgui2().Load();
vstdlib().Load();
tier0().Load();
inputsystem().Load();
#ifndef TEXTMODE
vguimatsurface().Load();
vgui2().Load();
studiorender().Load();
materialsystem().Load();
libsdl().Load();
#endif
} catch (std::exception& ex) {
logging::Info("Exception: %s", ex.what());
}
@ -101,14 +103,6 @@ SharedObject& engine() {
static SharedObject obj("engine.so", true);
return obj;
}
SharedObject& vguimatsurface() {
static SharedObject obj("vguimatsurface.so", true);
return obj;
}
SharedObject& vgui2() {
static SharedObject obj("vgui2.so", true);
return obj;
}
SharedObject& vstdlib() {
static SharedObject obj("libvstdlib.so", true);
return obj;
@ -121,6 +115,15 @@ SharedObject& inputsystem() {
static SharedObject obj("inputsystem.so", true);
return obj;
}
#ifndef TEXTMODE
SharedObject& vguimatsurface() {
static SharedObject obj("vguimatsurface.so", true);
return obj;
}
SharedObject& vgui2() {
static SharedObject obj("vgui2.so", true);
return obj;
}
SharedObject& studiorender() {
static SharedObject obj("studiorender.so", true);
return obj;
@ -133,5 +136,6 @@ SharedObject& libsdl() {
static SharedObject obj("libSDL2-2.0.so.0", false);
return obj;
}
#endif
}

View File

@ -39,14 +39,16 @@ public:
SharedObject& steamclient();
SharedObject& client();
SharedObject& engine();
SharedObject& vguimatsurface();
SharedObject& vgui2();
SharedObject& vstdlib();
SharedObject& tier0();
SharedObject& inputsystem();
#ifndef TEXTMODE
SharedObject& vguimatsurface();
SharedObject& vgui2();
SharedObject& studiorender();
SharedObject& materialsystem();
SharedObject& libsdl();
#endif
void LoadAllSharedObjects();