Merge pull request #2 from nullifiedcat/master

Merge cats changes to my branch
This commit is contained in:
julianacan9999 2017-05-01 18:09:26 -05:00 committed by GitHub
commit a5d87f7c8f
33 changed files with 487 additions and 80 deletions

View File

@ -52,6 +52,15 @@
<arguments>1.0-location-matches-false-false-res/bin</arguments>
</matcher>
</filter>
<filter>
<id>1493660654417</id>
<name>res</name>
<type>29</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-true-false-*</arguments>
</matcher>
</filter>
<filter>
<id>1489692029191</id>
<name>src</name>

View File

@ -9,7 +9,7 @@ Ubuntu (and probably Debian) users can run this script:
sudo apt update && sudo apt install build-essential software-properties-common -y && sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt update && sudo apt install gcc-snapshot -y && sudo apt update && sudo apt install libc6-dev gcc-6 g++-6 g++-6-multilib gdb -y && git clone --recursive https://github.com/nullifiedcat/cathook && cd cathook && make -j4
```
**Errors while installing?**
**Errors while installing?**
`/usr/include/c++/5/string:38:28: fatal error: bits/c++config.h: No such file or directory` - You don't have g++6 or g++6 multilib installed correctly

2
TODO
View File

@ -15,7 +15,7 @@ inspect shit
TTS
noise spam
team name spam (pre round team name spam thing)
insta taunt (taunts for like .5 ms and then you can do it again lithium has it)
insta taunt (taunts for like .5 ms and then you can do it again lithium has it)
auto vacc
namesteal
autovote

24
attach
View File

@ -1,35 +1,35 @@
#!/bin/bash
#!/usr/bin/env bash
line=`pidof hl2_linux`
line=$(pidof hl2_linux)
arr=($line)
inst=$1
if [ $# == 0 ]; then
inst=0
if [ $# == 0 ]; then
inst=0
fi
if [ ${#arr[@]} == 0 ]; then
echo tf2 isn\'t running!
exit
echo TF2 isn\'t running!
exit
fi
if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then
echo wrong index!
exit
echo wrong index!
exit
fi
proc=${arr[$inst]}
echo Running instances: ${arr[@]}
echo Attaching to $proc
echo Running instances: "${arr[@]}"
echo Attaching to "$proc"
#sudo ./detach $inst bin/libcathook.so
if grep -q $(realpath bin/libcathook.so) /proc/$proc/maps; then
if grep -q "$(realpath bin/libcathook.so)" /proc/"$proc"/maps; then
echo already loaded
exit
fi
echo loading $(realpath bin/libcathook.so) to $proc
echo loading "$(realpath bin/libcathook.so)" to "$proc"
gdb -n -q -batch \
-ex "attach $proc" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \

View File

@ -1,35 +1,35 @@
#!/bin/bash
#!/usr/bin/env bash
line=`pidof hl2_linux`
line=$(pidof hl2_linux)
arr=($line)
inst=$1
if [ $# == 0 ]; then
inst=0
if [ $# == 0 ]; then
inst=0
fi
if [ ${#arr[@]} == 0 ]; then
echo tf2 isn\'t running!
exit
echo tf2 isn\'t running!
exit
fi
if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then
echo wrong index!
exit
echo wrong index!
exit
fi
proc=${arr[$inst]}
echo Running instances: ${arr[@]}
echo Attaching to $proc
echo Running instances: "${arr[@]}"
echo Attaching to "$proc"
sudo ./detach $inst bin/libcathook.so
if grep -q $(realpath bin/libcathook.so) /proc/$proc/maps; then
if grep -q "$(realpath bin/libcathook.so)" /proc/"$proc"/maps; then
echo already loaded
exit
fi
echo loading $(realpath bin/libcathook.so) to $proc
echo loading "$(realpath bin/libcathook.so)" to "$proc"
gdb -n -q -batch \
-ex "attach $proc" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
@ -38,4 +38,4 @@ gdb -n -q -batch \
-ex 'print (char *) $2' \
-ex "catch syscall exit exit_group" \
-ex "continue" \
-ex "backtrace"
-ex "backtrace"

26
detach
View File

@ -1,37 +1,37 @@
#!/bin/bash
#!/usr/bin/env bash
line=`pidof hl2_linux`
line=$(pidof hl2_linux)
arr=($line)
inst=$1
if [ $# == 0 ]; then
inst=0
if [ $# == 0 ]; then
inst=0
fi
if [ ${#arr[@]} == 0 ]; then
echo tf2 isn\'t running!
exit
echo TF2 isn\'t running!
exit
fi
if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then
echo wrong index!
exit
echo wrong index!
exit
fi
echo Running instances: ${arr[@]}
echo Detaching from ${arr[$1]}
echo Running instances: "${arr[@]}"
echo Detaching from "${arr[$1]}"
if grep -q $(realpath bin/libcathook.so) /proc/${arr[$1]}/maps; then
if grep -q "$(realpath bin/libcathook.so)" /proc/"${arr[$1]}"/maps; then
gdb -n -q -batch \
-ex "attach ${arr[$1]}" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
-ex "set \$dlclose = (int(*)(void*)) dlclose" \
-ex "set \$library = \$dlopen(\"$(realpath bin/libcathook.so)\", 6)" \
-ex "print \$library" \
-ex "sharedlibrary ." \
-ex "sharedlibrary ." \
-ex "call \$dlclose(\$library)" \
-ex "call \$dlclose(\$library)" \
-ex "detach"
echo "Detached"
else
echo "not found!"
echo "not found!"
fi

16
install-resources.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
if [ ! -d "$HOME/.cathook" ]; then
mkdir "$HOME"/.cathook
fi
if [ ! -f "$HOME/.cathook/killsays.txt" ]; then
cp res/killsays.txt "$HOME"/.cathook
fi
if [ ! -f "$HOME/.cathook/spam.txt" ]; then
cp res/spam.txt "$HOME"/.cathook
fi
echo "Default killsay/spam files installed, EDIT THEM!"
xdg-open "$HOME"/.cathook

View File

@ -29,10 +29,10 @@ CXXFLAGS += -DGIT_COMMIT_HASH="\"$(GIT_COMMIT_HASH)\"" -DGIT_COMMIT_DATE="\"$(GI
all:
mkdir -p $(TARGET_DIR)
$(MAKE) $(TARGET)
.cpp.o:
$(CXX) $(CXXFLAGS) -c $< -o $@
%.d: %.cpp
$(CXX) -M $(CXXFLAGS) $< > $@
@ -43,7 +43,7 @@ clean:
find src -type f -name '*.o' -delete
find src -type f -name '*.d' -delete
rm -rf ./bin
ifneq ($(MAKECMDGOALS), clean)
-include $(DEPENDS)
endif

View File

@ -1,4 +1,3 @@
#!/bin/bash
#!/usr/bin/env bash
sudo ./detach $1
sudo ./attach $1
sudo ./detach "$1" && sudo ./attach "$1"

0
res/.gitignore vendored
View File

View File

@ -1,5 +1,5 @@
#!/bin/sh
convert $1.png -depth 8 -format rgba $1.rgba
mv $1.rgba $1
objcopy --input binary --output elf32-i386 --binary-architecture i386 $1 $1.o
mv $1.o bin/$1.o
#!/usr/bin/env bash
convert "$1".png -depth 8 -format rgba "$1".rgba
mv "$1".rgba "$1"
objcopy --input binary --output elf32-i386 --binary-architecture i386 "$1" "$1".o
mv "$1".o bin/"$1".o

3
res/killsays.txt Normal file
View File

@ -0,0 +1,3 @@
REPLACE CONTENTS OF THIS FILE WITH ACUTAL KILLSAYS.
Usable killsay macros:
%team% %class% %killer% %name% %myteam% %myclass% \n

4
res/spam.txt Normal file
View File

@ -0,0 +1,4 @@
cathook - free tf2 cheat!
get cathook: discord.gg/7bu3AFw
GNU/Linux is the best OS!
cathook - more fun than a ball of yarn!

View File

@ -15,15 +15,19 @@ std::unordered_map<int, int> command_number_mod {};
int* g_PredictionRandomSeed = nullptr;
bool CritKeyDown() {
return g_IInputSystem->IsButtonDown(static_cast<ButtonCode_t>((int)hacks::shared::misc::crit_hack));
}
bool AllowAttacking() {
if (!(hacks::shared::misc::crit_hack || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && !hacks::shared::misc::crit_suppress) return true;
if (!(CritKeyDown() || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && !hacks::shared::misc::crit_suppress) return true;
bool crit = IsAttackACrit(g_pUserCmd);
LoadSavedState();
if (hacks::shared::misc::crit_suppress && !(hacks::shared::misc::crit_hack || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee))) {
if (hacks::shared::misc::crit_suppress && !(CritKeyDown() || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee))) {
if (crit && !IsPlayerCritBoosted(LOCAL_E)) {
return false;
}
} else if ((hacks::shared::misc::crit_hack || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && RandomCrits() && WeaponCanCrit() && (g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFKnife)) {
} else if ((CritKeyDown() || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && RandomCrits() && WeaponCanCrit() && (g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFKnife)) {
if (!crit) return false;
}
return true;

View File

@ -24,6 +24,7 @@ struct crithack_saved_state {
void Load(IClientEntity* entity);
};
bool CritKeyDown();
bool AllowAttacking();
bool RandomCrits();
bool WeaponCanCrit();

View File

@ -1,18 +0,0 @@
/*
* cvarspoof.h
*
* Created on: Dec 3, 2016
* Author: nullifiedcat
*/
#ifndef CVARSPOOF_H_
#define CVARSPOOF_H_
// TODO
class SpoofedConVar {
public:
SpoofedConVar(const char* name);
};
#endif /* CVARSPOOF_H_ */

View File

@ -195,7 +195,7 @@ bool CachedEntity::IsVisible() {
matrix3x4_t* CachedEntity::GetBones() {
if (!m_bBonesSetup) {
m_bBonesSetup = RAW_ENT(this)->SetupBones(m_Bones, MAXSTUDIOBONES, 0x100, 0); // gvars->curtime
m_bBonesSetup = RAW_ENT(this)->SetupBones(m_Bones, MAXSTUDIOBONES, 0x100, g_GlobalVars->curtime); // gvars->curtime
}
return m_Bones;
}

View File

@ -458,6 +458,7 @@ static const std::string list_tf2 = R"(
]
"Miscellaneous" [
"Miscellaneous"
"pure_bypass"
"antidisguise"
"no_arms"
"no_hats"

View File

@ -471,7 +471,8 @@ bool ShouldAim(CUserCmd* cmd) {
if (zoomed_only) {
if (g_pLocalPlayer->weapon()->m_iClassID == g_pClassID->CTFSniperRifle ||
g_pLocalPlayer->weapon()->m_iClassID == g_pClassID->CTFSniperRifleDecap) {
return false;
// confused_nigga.jpg
return g_pLocalPlayer->bZoomed;
}
}
if (only_can_shoot) {

View File

@ -23,6 +23,107 @@ static CatVar pop_uber_auto(CV_SWITCH, "autoheal_uber", "1", "AutoUber", "Use ub
static CatVar pop_uber_percent(CV_FLOAT, "autoheal_uber_health", "30", "Pop uber if health% <", "When under a percentage of health, use ubercharge");
static CatVar share_uber(CV_SWITCH, "autoheal_share_uber", "1", "Share ubercharge", "Aimbot will attempt to share uber charge with un-ubered players");
int vaccinator_change_stage = 0;
int vaccinator_change_ticks = 0;
int vaccinator_ideal_resist = 0;
int BulletDangerValue(CachedEntity* patient) {
// Find zoomed in snipers in other team
bool any_zoomed_snipers = false;
for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++) {
CachedEntity* ent = ENTITY(i);
if (!ent->m_bEnemy) continue;
if (g_pPlayerResource->GetClass(ent) != tf_sniper) continue;
if (CE_BYTE(ent, netvar.iLifeState)) continue;
if (!HasCondition(ent, TFCond_Zoomed)) continue;
any_zoomed_snipers = true;
// TODO VisCheck from patient.
if (!IsEntityVisible(ent, head)) continue;
return 2;
}
return any_zoomed_snipers;
}
int FireDangerValue(CachedEntity* patient) {
// Find nearby pyros
for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++) {
CachedEntity* ent = ENTITY(i);
if (!ent->m_bEnemy) continue;
if (g_pPlayerResource->GetClass(ent) != tf_pyro) continue;
if (CE_BYTE(ent, netvar.iLifeState)) continue;
if (patient->m_vecOrigin.DistToSqr(ent->m_vecOrigin) > 300.0f * 300.0f) continue;
IClientEntity* pyro_weapon = g_IEntityList->GetClientEntity(CE_INT(ent, netvar.hActiveWeapon) & 0xFFF);
return (pyro_weapon && pyro_weapon->GetClientClass()->m_ClassID == g_pClassID->CTFFlameThrower) ? 2 : 0;
}
if (HasCondition(patient, TFCond_OnFire)) {
return 1;
}
return 0;
}
int BlastDangerValue(CachedEntity* patient) {
// Find crit rockets/pipes nearby
for (int i = 32; i < HIGHEST_ENTITY; i++) {
CachedEntity* ent = ENTITY(i);
if (CE_BAD(ent)) continue;
if (!ent->m_bEnemy) continue;
if (ent->m_Type != ENTITY_PROJECTILE) continue;
if (patient->m_vecOrigin.DistToSqr(ent->m_vecOrigin) > 420.0f * 420.0f) continue;
// TODO Velocity checking
return ((ent->m_bCritProjectile || (patient->m_iHealth < 80)) ? 2 : 1);
}
return 0;
}
int CurrentResistance() {
if (LOCAL_W->m_iClassID != g_pClassID->CWeaponMedigun) return 0;
return CE_INT(LOCAL_W, netvar.m_nChargeResistType);
}
int OptimalResistance(CachedEntity* patient, bool* shouldPop) {
int bd = BlastDangerValue(patient),
fd = FireDangerValue(patient),
hd = BulletDangerValue(patient);
if (shouldPop) {
if (bd > 1 || fd > 1 || hd > 1) *shouldPop = true;
}
if (!hd && !fd && !bd) return -1;
if (hd >= fd && hd >= bd) return 0;
if (bd >= fd && bd >= hd) return 1;
if (fd >= hd && fd >= bd) return 2;
return -1;
}
void SetResistance(int resistance) {
vaccinator_ideal_resist = resistance;
int cur = CurrentResistance();
if (resistance == cur) return;
if (resistance > cur) vaccinator_change_stage = resistance - cur;
else vaccinator_change_stage = 3 - cur + resistance;
}
void DoResistSwitching() {
if (!vaccinator_change_stage) return;
if (CurrentResistance() == vaccinator_ideal_resist) {
vaccinator_change_ticks = 0;
vaccinator_change_stage = 0;
return;
}
if (g_pUserCmd->buttons & IN_RELOAD) {
vaccinator_change_ticks = 8;
return;
}
else {
if (vaccinator_change_ticks <= 0) {
g_pUserCmd->buttons |= IN_RELOAD;
vaccinator_change_stage--;
vaccinator_change_ticks = 8;
} else {
vaccinator_change_ticks--;
}
}
}
int force_healing_target { 0 };
static CatCommand heal_steamid("autoheal_heal_steamid", "Heals a player with SteamID (ONCE. Use for easy airstuck med setup)", [](const CCommand& args) {
@ -42,6 +143,16 @@ static CatCommand heal_steamid("autoheal_heal_steamid", "Heals a player with Ste
}
});
static CatCommand vaccinator_bullet("vacc_bullet", "Bullet Vaccinator", []() {
SetResistance(0);
});
static CatCommand vaccinator_blast("vacc_blast", "Blast Vaccinator", []() {
SetResistance(1);
});
static CatCommand vaccinator_fire("vacc_fire", "Fire Vaccinator", []() {
SetResistance(2);
});
bool IsPopped() {
CachedEntity* weapon = g_pLocalPlayer->weapon();
if (CE_BAD(weapon) || weapon->m_iClassID != g_pClassID->CWeaponMedigun) return false;
@ -73,7 +184,25 @@ bool ShouldPop() {
return ShouldChargePlayer(LOCAL_E->m_IDX);
}
bool IsVaccinator() {
// DefIDX: 998
return CE_INT(LOCAL_W, netvar.iItemDefinitionIndex) == 998;
}
static CatVar auto_vacc(CV_SWITCH, "auto_vacc", "0", "Auto Vaccinator", "Pick resistance for incoming damage types");
void CreateMove() {
bool pop = false;
if (IsVaccinator() && auto_vacc) {
DoResistSwitching();
int my_opt = OptimalResistance(LOCAL_E, &pop);
if (my_opt >= 0 && my_opt != CurrentResistance()) {
SetResistance(my_opt);
}
if (pop && CurrentResistance() == my_opt) {
g_pUserCmd->buttons |= IN_ATTACK2;
}
}
if (!enabled && !force_healing_target) return;
if (GetWeaponMode(g_pLocalPlayer->entity) != weapon_medigun) return;
if (force_healing_target) {
@ -103,7 +232,15 @@ void CreateMove() {
AimAt(g_pLocalPlayer->v_Eye, out, g_pUserCmd);
if (silent) g_pLocalPlayer->bUseSilentAngles = true;
if (!m_iNewTarget && (g_GlobalVars->tickcount % 300)) g_pUserCmd->buttons |= IN_ATTACK;
if (pop_uber_auto && ShouldPop()) g_pUserCmd->buttons |= IN_ATTACK2;
if (IsVaccinator() && CE_GOOD(target) && auto_vacc) {
int opt = OptimalResistance(target, &pop);
if (!pop && opt != -1) SetResistance(opt);
if (pop && CurrentResistance() == opt) {
g_pUserCmd->buttons |= IN_ATTACK2;
}
} else {
if (pop_uber_auto && ShouldPop()) g_pUserCmd->buttons |= IN_ATTACK2;
}
return;
}

View File

@ -219,7 +219,7 @@ void CreateMove() {
void Draw() {
if (crit_info && CE_GOOD(LOCAL_W)) {
if (crit_hack) {
if (CritKeyDown()) {
AddCenterString("FORCED CRITS!", colors::red);
}
if (TF2) {
@ -319,7 +319,7 @@ void Schema_Reload() {
CatVar debug_info(CV_SWITCH, "debug_info", "0", "Debug info", "Shows some debug info in-game");
CatVar flashlight_spam(CV_SWITCH, "flashlight", "0", "Flashlight spam", "HL2DM flashlight spam");
CatVar crit_info(CV_SWITCH, "crit_info", "0", "Show crit info"); // TODO separate
CatVar crit_hack(CV_SWITCH, "crit_hack", "0", "Crithack");
CatVar crit_hack(CV_KEY, "crit_hack", "0", "Crit Key");
CatVar crit_melee(CV_SWITCH, "crit_melee", "0", "Melee crits");
CatVar crit_suppress(CV_SWITCH, "crit_suppress", "0", "Disable random crits", "Can help saving crit bucket for forced crits");
CatVar anti_afk(CV_SWITCH, "anti_afk", "0", "Anti-AFK", "Sends random commands to prevent being kicked from server");

View File

@ -41,7 +41,7 @@ void EndConVars() {
RegisterCatVars();
RegisterCatCommands();
if (hConVarsFile) {
fprintf(hConVarsFile, "\nexec cat_autoexec\n");
//fprintf(hConVarsFile, "\nexec cat_autoexec\n");
fprintf(hConVarsFile, "cat_killsay_reload\ncat_spam_reload\n");
fclose(hConVarsFile);
}

View File

@ -37,6 +37,31 @@ static CatVar minigun_jump(CV_SWITCH, "minigun_jump", "0", "TF2C minigun jump",
CatVar jointeam(CV_SWITCH, "fb_autoteam", "1", "Joins player team automatically (NYI)");
CatVar joinclass(CV_STRING, "fb_autoclass", "spy", "Class that will be picked after joining a team (NYI)");
namespace engine_prediction {
float o_curtime;
float o_frametime;
void Start() {
o_curtime = g_GlobalVars->curtime;
o_frametime = g_GlobalVars->frametime;
*g_PredictionRandomSeed = MD5_PseudoRandom(g_pUserCmd->command_number) & 0x7FFFFFFF;
g_GlobalVars->curtime = CE_INT(LOCAL_E, netvar.nTickBase) * g_GlobalVars->interval_per_tick;
g_GlobalVars->frametime = g_GlobalVars->interval_per_tick;
g_IGameMovement->StartTrackPredictionErrors((CBasePlayer*)(RAW_ENT(LOCAL_E)));
CMoveData data;
}
void End() {
*g_PredictionRandomSeed = -1;
g_GlobalVars->curtime = o_curtime;
g_GlobalVars->frametime = o_frametime;
}
}
bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
SEGV_BEGIN;

View File

@ -11,12 +11,16 @@
#include "hookedmethods.h"
#include "../gui/GUI.h"
#include "../segvcatch/segvcatch.h"
#include "../copypasted/CSignature.h"
#include "../profiler.h"
CatVar clean_screenshots(CV_SWITCH, "clean_screenshots", "1", "Clean screenshots", "Don't draw visuals while taking a screenshot");
CatVar disable_visuals(CV_SWITCH, "no_visuals", "0", "Disable ALL drawing", "Completely hides cathook");
CatVar no_zoom(CV_SWITCH, "no_zoom", "0", "Disable scope", "Disables black scope overlay");
CatVar info_text(CV_SWITCH, "info", "1", "Show info", "Show cathook version in top left corner");
CatVar pure_bypass(CV_SWITCH, "pure_bypass", "0", "Pure Bypass", "Bypass sv_pure");
void* pure_orig = nullptr;
void** pure_addr = nullptr;
void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
#if DEBUG_SEGV == true
@ -31,7 +35,17 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
textures_loaded = true;
hacks::tf::radar::Init();
}
if (pure_bypass) {
if (!pure_addr) {
pure_addr = *reinterpret_cast<void***>(gSignatures.GetEngineSignature("55 89 E5 83 EC 18 A1 ? ? ? ? 89 04 24 E8 0D FF FF FF A1 ? ? ? ? 85 C0 74 08 89 04 24 E8 ? ? ? ? C9 C3") + 7);
}
if (*pure_addr)
pure_orig = *pure_addr;
*pure_addr = (void*)0;
} else if (pure_orig) {
*pure_addr = pure_orig;
pure_orig = (void*)0;
}
static unsigned long panel_focus = 0;
static unsigned long panel_scope = 0;
static unsigned long panel_top = 0;

View File

@ -46,6 +46,7 @@ IVDebugOverlay* g_IVDebugOverlay = nullptr;
IMaterialSystemFixed* g_IMaterialSystem = nullptr;
IVRenderView* g_IVRenderView = nullptr;
IMaterialSystem* g_IMaterialSystemHL = nullptr;
IMoveHelperServer* g_IMoveHelperServer = nullptr;
template<typename T>
T* BruteforceInterface(std::string name, sharedobj::SharedObject* object, int start) {
@ -103,6 +104,9 @@ void CreateInterfaces() {
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 (TF2) {
//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")));
}
if (TF2) g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 B4 00 00 00 A1 ? ? ? ? 8B 10")));
else if (TF2C) g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 A8 00 00 00 A1 ? ? ? ? 8B 10")));
else if (HL2DM) g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? 8B 10 89 04 24 FF 52 78 A1 ? ? ? ? 8B 10")));

View File

@ -47,6 +47,7 @@ class IVModelRender;
class IVRenderView;
class IMaterialSystemFixed;
class IMaterialSystem;
class IMoveHelperServer;
extern ISteamClient* g_ISteamClient;
extern ISteamFriends* g_ISteamFriends;
@ -73,6 +74,7 @@ extern IMaterialSystemFixed* g_IMaterialSystem;
extern IMaterialSystem* g_IMaterialSystemHL;
extern IVModelRender* g_IVModelRender;
extern IVRenderView* g_IVRenderView;
extern IMoveHelperServer* g_IMoveHelperServer;
template<typename T>
T* BruteforceInterface(std::string name, sharedobj::SharedObject* object, int start = 0);

View File

@ -36,6 +36,7 @@ void NetVars::Init() {
this->bDistributed = gNetvars.get_offset("DT_CurrencyPack", "m_bDistributed");
this->_condition_bits = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_ConditionList", "_condition_bits");
this->m_flStealthNoAttackExpire = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "tfsharedlocaldata", "m_flStealthNoAttackExpire");
this->m_nChargeResistType = gNetvars.get_offset("DT_WeaponMedigun", "m_nChargeResistType");
}
if (TF2 || TF2C) {
this->res_iMaxHealth = gNetvars.get_offset("DT_TFPlayerResource", "m_iMaxHealth");

View File

@ -124,6 +124,7 @@ public:
offset_t m_bReadyToBackstab;
offset_t m_Collision;
offset_t res_iTeam;
offset_t m_nChargeResistType;
};
extern NetVars netvar;

38
src/sconvars.cpp Normal file
View File

@ -0,0 +1,38 @@
/*
* sconvars.cpp
*
* Created on: May 1, 2017
* Author: nullifiedcat
*/
#include "sconvars.hpp"
namespace sconvar {
std::vector<SpoofedConVar*> convars;
SpoofedConVar::SpoofedConVar(ConVar* var) : original(var) {
int flags = var->m_nFlags;
const char* name = var->m_pszName;
char* s_name = strfmt("q_%s", name);
var->m_pszName = s_name;
var->m_nFlags = 0;
ConVar* svar = new ConVar(name, var->m_pszDefaultValue, flags, var->m_pszHelpString, var->m_bHasMin, var->m_fMinVal, var->m_bHasMax, var->m_fMaxVal, var->m_fnChangeCallback);
g_ICvar->RegisterConCommand(svar);
spoof = svar;
}
CatCommand spoof_convar("spoof", "Spoof ConVar", [](const CCommand& args) {
if (args.ArgC() < 2) {
logging::Info("Invalid call");
return;
}
ConVar* var = g_ICvar->FindVar(args.Arg(1));
if (!var) {
logging::Info("Not found");
return;
}
convars.push_back(new SpoofedConVar(var));
});
}

30
src/sconvars.hpp Normal file
View File

@ -0,0 +1,30 @@
/*
* sconvars.hpp
*
* Created on: May 1, 2017
* Author: nullifiedcat
*/
#ifndef SCONVARS_HPP_
#define SCONVARS_HPP_
#include "common.h"
/*
* HECK off F1ssi0N
* I won't make NETWORK HOOKS to deal with this SHIT
*/
namespace sconvar {
class SpoofedConVar {
public:
SpoofedConVar(ConVar* var);
public:
ConVar* original;
ConVar* spoof;
};
}
#endif /* SCONVARS_HPP_ */

View File

@ -51,10 +51,12 @@
#include <steam/steam_api.h>
#include <vgui/Cursor.h>
#include <engine/ivdebugoverlay.h>
#include <iprediction.h>
#include "sdk/in_buttons.h"
#include "sdk/imaterialsystemfixed.h"
#include "sdk/ScreenSpaceEffects.h"
#include "sdk/iinput.h"
#include "sdk/igamemovement.h"
#endif /* SDK_H_ */

131
src/sdk/igamemovement.h Normal file
View File

@ -0,0 +1,131 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//=============================================================================//
#if !defined( IGAMEMOVEMENT_H )
#define IGAMEMOVEMENT_H
#ifdef _WIN32
#pragma once
#endif
class CBasePlayer;
#include "mathlib/vector.h"
#include "interface.h"
//#include "imovehelper.h"
#include "const.h"
//-----------------------------------------------------------------------------
// Name of the class implementing the game movement.
//-----------------------------------------------------------------------------
#define INTERFACENAME_GAMEMOVEMENT "GameMovement001"
//-----------------------------------------------------------------------------
// Forward declarations.
//-----------------------------------------------------------------------------
class IMoveHelper;
//-----------------------------------------------------------------------------
// Purpose: Encapsulated input parameters to player movement.
//-----------------------------------------------------------------------------
class CMoveData
{
public:
bool m_bFirstRunOfFunctions : 1;
bool m_bGameCodeMovedPlayer : 1;
CBaseHandle m_nPlayerHandle; // edict index on server, client entity handle on client
int m_nImpulseCommand; // Impulse command issued.
QAngle m_vecViewAngles; // Command view angles (local space)
QAngle m_vecAbsViewAngles; // Command view angles (world space)
int m_nButtons; // Attack buttons.
int m_nOldButtons; // From host_client->oldbuttons;
float m_flForwardMove;
float m_flSideMove;
float m_flUpMove;
float m_flMaxSpeed;
float m_flClientMaxSpeed;
// Variables from the player edict (sv_player) or entvars on the client.
// These are copied in here before calling and copied out after calling.
Vector m_vecVelocity; // edict::velocity // Current movement direction.
QAngle m_vecAngles; // edict::angles
QAngle m_vecOldAngles;
// Output only
float m_outStepHeight; // how much you climbed this move
Vector m_outWishVel; // This is where you tried
Vector m_outJumpVel; // This is your jump velocity
// Movement constraints (radius 0 means no constraint)
Vector m_vecConstraintCenter;
float m_flConstraintRadius;
float m_flConstraintWidth;
float m_flConstraintSpeedFactor;
void SetAbsOrigin( const Vector &vec );
const Vector &GetAbsOrigin() const;
private:
Vector m_vecAbsOrigin; // edict::origin
};
inline const Vector &CMoveData::GetAbsOrigin() const
{
return m_vecAbsOrigin;
}
#if !defined( CLIENT_DLL ) && defined( _DEBUG )
// We only ever want this code path on the server side in a debug build
// and you have to uncomment the code below and rebuild to have the test operate.
//#define PLAYER_GETTING_STUCK_TESTING
#endif
#if !defined( PLAYER_GETTING_STUCK_TESTING )
// This is implemented with a more exhaustive test in gamemovement.cpp. We check if the origin being requested is
// inside solid, which it never should be
inline void CMoveData::SetAbsOrigin( const Vector &vec )
{
m_vecAbsOrigin = vec;
}
#endif
//-----------------------------------------------------------------------------
// Purpose: The basic player movement interface
//-----------------------------------------------------------------------------
abstract_class IGameMovement
{
public:
virtual ~IGameMovement( void ) {}
// Process the current movement command
virtual void ProcessMovement( CBasePlayer *pPlayer, CMoveData *pMove ) = 0;
virtual void StartTrackPredictionErrors( CBasePlayer *pPlayer ) = 0;
virtual void FinishTrackPredictionErrors( CBasePlayer *pPlayer ) = 0;
virtual void DiffPrint( PRINTF_FORMAT_STRING char const *fmt, ... ) = 0;
// Allows other parts of the engine to find out the normal and ducked player bbox sizes
virtual Vector GetPlayerMins( bool ducked ) const = 0;
virtual Vector GetPlayerMaxs( bool ducked ) const = 0;
virtual Vector GetPlayerViewOffset( bool ducked ) const = 0;
};
#endif // IGAMEMOVEMENT_H

4
update
View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
git pull origin master && \
git submodule update --remote --recursive && \
make clean && \
make -j4
make -j4