Merge pull request #14 from nullifiedcat/master

update fork
This commit is contained in:
oneechanhax 2017-08-07 22:49:54 +00:00 committed by GitHub
commit da6df9233c
6 changed files with 86 additions and 1 deletions

46
attach-user Executable file
View File

@ -0,0 +1,46 @@
#!/usr/bin/env bash
user=$USER
if [ "$#" == 1 ]; then
user=$1
fi
proc="0"
for pid in $(pidof hl2_linux)
do
if sudo -H -u $user kill -0 $pid
then
proc=$pid
break
fi
done
if [ "$proc" == "0" ]
then
echo "TF2 for $user is not running"
continue
fi
echo Attaching to "$proc"
FILENAME=$(realpath "bin/libcathook.so")
echo loading "$FILENAME" to "$proc"
sudo killall -19 steam
sudo killall -19 steamwebhelper
sudo gdb -n -q -batch \
-ex "attach $proc" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
-ex "call \$dlopen(\"$FILENAME\", 1)" \
-ex "call dlerror()" \
-ex 'print (char *) $2' \
-ex "detach" \
-ex "quit"
sudo killall -18 steamwebhelper
sudo killall -18 steam

12
src/headshake.cpp Normal file
View File

@ -0,0 +1,12 @@
/*
* headshake.cpp
*
* Created on: Aug 2, 2017
* Author: nullifiedcat
*/
#include <vector>
const std::vector<float> headshake_pitch_deltas = {
-0.2, 0.8, -1.7, 0.8, -0.8, 0.19, -0.99, 1.9
};

12
src/headshake.hpp Normal file
View File

@ -0,0 +1,12 @@
/*
* headshake.hpp
*
* Created on: Aug 2, 2017
* Author: nullifiedcat
*/
#pragma once

View File

@ -156,6 +156,7 @@ powerup_type GetPowerupOnPlayer(CachedEntity* player) {
// A function to tell if a player is using a specific weapon
bool HasWeapon(CachedEntity* ent, int wantedId) {
if (CE_BAD(ent)) return false;
// Create a var to store the handle
int *hWeapons;
// Grab the handle and store it into the var
@ -172,6 +173,7 @@ bool HasWeapon(CachedEntity* ent, int wantedId) {
}
bool HasDarwins(CachedEntity* ent) {
if (CE_BAD(ent)) return false;
// Check if player is sniper
if (CE_INT(ent, netvar.iClass) != tf_sniper) return false;
// Check if player is using darwins, 231 is the id for darwins danger sheild

View File

@ -225,10 +225,21 @@ bool SendNetMsg_hook(void* _this, INetMessage& msg, bool bForceReliable = false,
return false;
}
static CatVar die_if_vac(CV_SWITCH, "die_if_vac", "0", "Die if VAC banned");
void Shutdown_hook(void* _this, const char* reason) {
// This is a INetChannel hook - it SHOULDN'T be static because netchannel changes.
const Shutdown_t original = (Shutdown_t)hooks::netchannel.GetMethod(offsets::Shutdown());
logging::Info("Disconnect: %s", reason);
if (strstr(reason, "VAC banned")) {
if (die_if_vac) {
logging::Info("VAC banned");
*(int*)0 = 0;
exit(1);
}
} else if (strstr(reason, "VAC")) {
logging::Info("VAC error?");
}
#if IPC_ENABLED
ipc::UpdateServerAddress(true);
#endif

View File

@ -86,12 +86,14 @@ void CreateInterfaces() {
HSteamPipe sp = g_ISteamClient->CreateSteamPipe();
HSteamUser su = g_ISteamClient->ConnectToGlobalUser(sp);
g_IVModelRender = BruteforceInterface<IVModelRender>("VEngineModel", sharedobj::engine(), 16);
g_ISteamFriends = nullptr;
IF_GAME (IsTF2()) {
uintptr_t sig_steamapi = gSignatures.GetEngineSignature("55 0F 57 C0 89 E5 83 EC 18 F3 0F 11 05 ? ? ? ? F3 0F 11 05 ? ? ? ? F3 0F 10 05 ? ? ? ? C7 04 24 ? ? ? ? F3 0F 11 05 ? ? ? ? F3 0F 11 05 ? ? ? ? E8 ? ? ? ? C7 44 24 08 ? ? ? ? C7 44 24 04 ? ? ? ? C7 04 24 ? ? ? ? E8 ? ? ? ? C9 C3");
logging::Info("SteamAPI: 0x%08x", sig_steamapi);
void** SteamAPI_engine = *reinterpret_cast<void***>(sig_steamapi + 36);
g_ISteamFriends = (ISteamFriends*)(SteamAPI_engine[1]);//
} else {
}
if (g_ISteamFriends == nullptr) {
// FIXME SIGNATURE
g_ISteamFriends = g_ISteamClient->GetISteamFriends(su, sp, "SteamFriends002");
}