commit
d04bebd0b2
@ -42,7 +42,7 @@ sudo apt update && sudo apt install git libssl-dev:i386 libc6-dev:i386 gdb libsd
|
||||
|
||||
Arch gcc6 & dependencies installation:
|
||||
```bash
|
||||
sudo pacman -Syu && sudo pacman -S gdb gdb-common glew1.10 glew lib32-glew1.10 rsync --noconfirm && yes | sudo pacman -U https://archive.archlinux.org/packages/g/gcc-multilib/gcc-multilib-6.3.1-2-x86_64.pkg.tar.xz https://archive.archlinux.org/packages/g/gcc-libs-multilib/gcc-libs-multilib-6.3.1-2-x86_64.pkg.tar.xz https://archive.archlinux.org/packages/l/lib32-gcc-libs/lib32-gcc-libs-6.3.1-2-x86_64.pkg.tar.xz
|
||||
sudo pacman -U /var/cache/pacman/pkg/lib32-gcc-libs-6.3.1-2-x86_64.pkg.tar.xz /var/cache/pacman/pkg/gcc-libs-multilib-6.3.1-2-x86_64.pkg.tar.xz /var/cache/pacman/pkg/gcc-multilib-6.3.1-2-x86_64.pkg.tar.xz && sudo cp -r /usr/include/c++/6.3.1/ /tmp/ && sudo pacman -S gdb gdb-common glew1.10 glew lib32-glew1.10 rsync lib62-gcc-libs gcc-libs-multilib gcc-multilib --noconfirm && yes | sudo cp -r /tmp/6.3.1/ /usr/include/c++/
|
||||
```
|
||||
|
||||
If you don't use Ubuntu or Arch (or if Arch script gets outdated), here's the list of what cathook requires:
|
||||
@ -51,13 +51,14 @@ If you don't use Ubuntu or Arch (or if Arch script gets outdated), here's the li
|
||||
* `g++-6`
|
||||
* `gcc-6-multilib`
|
||||
* `g++-6-multilib`
|
||||
* `glew`
|
||||
* `gdb` (for the injection script, you can use different injector if you want)
|
||||
* `libssl-dev:i386`
|
||||
* `libc6-dev:i386`
|
||||
* `libsdl2-dev`
|
||||
* `libglew-dev:i386`
|
||||
* `libfreetype6-dev:i386`
|
||||
* `rsync` (only for copying shaders/fonts to tf2 data directory, `update-data` script)
|
||||
* `rsync` (used for copying shaders/fonts to tf2 data directory, `update-data` script)
|
||||
|
||||
|
||||
Cathook installation script:
|
||||
|
18
arch-gcc-fix
Normal file
18
arch-gcc-fix
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# THIS IS FOR ARCH USERS ONLY
|
||||
# Cathook requires gcc6 to build. Steam requires gcc7 to run. There is no gcc6 and gcc7 package on arch, only a single gcc package that is currently updated to gcc7.
|
||||
# A solution to this would be to simply downgrade to gcc6 to update cathook, then re-upgrade to gcc7 to launch steam.
|
||||
# This will install gcc6, backup the files, then upgrade to gcc7 and place the files back. This way, gcc7 will be installed, but cathook can still use gcc6.
|
||||
#
|
||||
|
||||
# Get gcc6
|
||||
sudo pacman -U /var/cache/pacman/pkg/lib32-gcc-libs-6.3.1-2-x86_64.pkg.tar.xz /var/cache/pacman/pkg/gcc-libs-multilib-6.3.1-2-x86_64.pkg.tar.xz /var/cache/pacman/pkg/gcc-multilib-6.3.1-2-x86_64.pkg.tar.xz
|
||||
# Backup gcc6 to /tmp
|
||||
sudo cp -r /usr/include/c++/6.3.1/ /tmp/
|
||||
# Update back to gcc7
|
||||
sudo pacman -S lib62-gcc-libs gcc-libs-multilib gcc-multilib
|
||||
# Use backup of gcc6 and place back into c++
|
||||
sudo cp -r /tmp/6.3.1/ /usr/include/c++/
|
||||
# Should we remove the tmp folder afterwards..? It'll be deleted on restart regardless.
|
@ -1 +0,0 @@
|
||||
make -j4 GAME=css BUILD_DEBUG=1
|
@ -1 +1 @@
|
||||
Subproject commit e532876ffd707a48389d54ff904dcc40a84f2839
|
||||
Subproject commit 94b3e53b00ac5be465ebe44ea5fe1b1fbc18aa8f
|
@ -50,7 +50,16 @@ struct walkbot_header_s {
|
||||
enum EConnectionFlags {
|
||||
CF_GOOD = (1 << 0),
|
||||
CF_LOW_HEALTH = (1 << 1),
|
||||
CF_LOW_AMMO = (1 << 2)
|
||||
CF_LOW_AMMO = (1 << 2),
|
||||
|
||||
CF_RED = (1 << 3),
|
||||
CF_BLU = (1 << 4),
|
||||
|
||||
CF_CAPPED_1 = (1 << 5),
|
||||
CF_CAPPED_2 = (1 << 6),
|
||||
CF_CAPPED_3 = (1 << 7),
|
||||
CF_CAPPED_4 = (1 << 8),
|
||||
CF_CAPPED_5 = (1 << 9)
|
||||
};
|
||||
|
||||
struct connection_s {
|
||||
@ -269,8 +278,8 @@ bool Load(std::string filename) {
|
||||
{
|
||||
DIR* walkbot_dir = opendir(DATA_PATH "/walkbot");
|
||||
if (!walkbot_dir) {
|
||||
logging::Info("Walkbot directory doesn't exist, creating one!");
|
||||
mkdir(DATA_PATH "/walkbot", S_IRWXU | S_IRWXG);
|
||||
logging::Info("Walkbot directory doesn't exist!");
|
||||
return false;
|
||||
} else closedir(walkbot_dir);
|
||||
}
|
||||
std::string path = format(DATA_PATH "/walkbot/", GetLevelName());
|
||||
|
91
src/hitrate.cpp
Normal file
91
src/hitrate.cpp
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* hitrate.cpp
|
||||
*
|
||||
* Created on: Aug 16, 2017
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "init.hpp"
|
||||
|
||||
namespace hitrate {
|
||||
|
||||
int lastweapon { 0 };
|
||||
int lastammo { 0 };
|
||||
|
||||
int count_shots { 0 };
|
||||
int count_hits { 0 };
|
||||
int count_hits_head { 0 };
|
||||
|
||||
std::vector<std::chrono::time_point<std::chrono::high_resolution_clock>> shots {};
|
||||
|
||||
void OnShot() {
|
||||
++count_shots;
|
||||
}
|
||||
|
||||
void OnHit(bool crit) {
|
||||
count_hits++;
|
||||
if (crit) {
|
||||
count_hits_head++;
|
||||
}
|
||||
}
|
||||
|
||||
CatCommand debug_hitrate("debug_hitrate", "Debug hitrate", []() {
|
||||
int p1 = 0;
|
||||
int p2 = 0;
|
||||
if (count_shots) {
|
||||
p1 = float(count_hits) / float(count_shots) * 100.0f;
|
||||
}
|
||||
if (count_hits) {
|
||||
p1 = float(count_hits_head) / float(count_hits) * 100.0f;
|
||||
}
|
||||
logging::Info("%d / %d (%d%%)", count_hits, count_shots, p1);
|
||||
logging::Info("%d / %d (%d%%)", count_hits_head, count_hits, p2);
|
||||
});
|
||||
|
||||
CatCommand debug_ammo("debug_ammo", "Debug ammo", []() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
logging::Info("%d %d", i, CE_INT(LOCAL_E, netvar.m_iAmmo + i * 4));
|
||||
}
|
||||
});
|
||||
|
||||
void Update() {
|
||||
CachedEntity* weapon = LOCAL_W;
|
||||
if (CE_GOOD(weapon)) {
|
||||
if (LOCAL_W->m_iClassID == CL_CLASS(CTFSniperRifle) || LOCAL_W->m_iClassID == CL_CLASS(CTFSniperRifleDecap)) {
|
||||
// ONLY tracks primary ammo
|
||||
int ammo = CE_INT(LOCAL_E, netvar.m_iAmmo + 4);
|
||||
if (lastweapon) {
|
||||
if (ammo < lastammo) {
|
||||
OnShot();
|
||||
}
|
||||
}
|
||||
lastweapon = weapon->m_IDX;
|
||||
lastammo = ammo;
|
||||
}
|
||||
} else {
|
||||
lastweapon = 0;
|
||||
}
|
||||
}
|
||||
|
||||
class HurtListener : public IGameEventListener {
|
||||
public:
|
||||
virtual void FireGameEvent(KeyValues* event) {
|
||||
if (strcmp("player_hurt", event->GetName())) return;
|
||||
if (g_IEngine->GetPlayerForUserID(event->GetInt("attacker")) == g_IEngine->GetLocalPlayer()) {
|
||||
if (CE_GOOD(LOCAL_W) && (LOCAL_W->m_iClassID == CL_CLASS(CTFSniperRifle) || LOCAL_W->m_iClassID == CL_CLASS(CTFSniperRifleDecap)))
|
||||
OnHit(event->GetBool("crit"));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
HurtListener& listener() {
|
||||
static HurtListener l {};
|
||||
return l;
|
||||
}
|
||||
|
||||
InitRoutine init([]() {
|
||||
g_IGameEventManager->AddListener(&listener(), false);
|
||||
});
|
||||
|
||||
}
|
18
src/hitrate.hpp
Normal file
18
src/hitrate.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* hitrate.hpp
|
||||
*
|
||||
* Created on: Aug 16, 2017
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace hitrate {
|
||||
|
||||
extern int count_shots;
|
||||
extern int count_hits;
|
||||
extern int count_hits_head;
|
||||
|
||||
void Update();
|
||||
|
||||
}
|
@ -10,6 +10,7 @@
|
||||
#include "../chatlog.hpp"
|
||||
#include "../hack.h"
|
||||
#include "ucccccp.hpp"
|
||||
#include "../hitrate.hpp"
|
||||
#include "hookedmethods.h"
|
||||
|
||||
#if ENABLE_VISUALS == 1
|
||||
@ -377,6 +378,8 @@ void FireGameEvent_hook(void* _this, IGameEvent* event) {
|
||||
original(_this, event);
|
||||
}
|
||||
|
||||
static CatVar hitrate_check(CV_SWITCH, "hitrate", "0", "Monitor hitrate");
|
||||
|
||||
void FrameStageNotify_hook(void* _this, int stage) {
|
||||
static IClientEntity *ent;
|
||||
|
||||
@ -394,6 +397,9 @@ void FrameStageNotify_hook(void* _this, int stage) {
|
||||
if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) {
|
||||
angles::Update();
|
||||
hacks::shared::anticheat::CreateMove();
|
||||
if (hitrate_check) {
|
||||
hitrate::Update();
|
||||
}
|
||||
}
|
||||
if (resolver && cathook && !g_Settings.bInvalid && stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) {
|
||||
PROF_SECTION(FSN_resolver);
|
||||
|
@ -150,10 +150,7 @@ void CreateInterfaces() {
|
||||
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");
|
||||
IF_GAME (IsCSS()) {
|
||||
logging::Info("FATAL: Signatures not defined for CSS - HUD");
|
||||
g_CHUD = nullptr;
|
||||
} else {
|
||||
{
|
||||
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);
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "hack.h"
|
||||
#include "hitrate.hpp"
|
||||
|
||||
#ifdef IPC_ENABLED
|
||||
|
||||
@ -171,6 +172,9 @@ void UpdateServerAddress(bool shutdown) {
|
||||
void UpdateTemporaryData() {
|
||||
user_data_s& data = peer->memory->peer_user_data[peer->client_id];
|
||||
data.connected = g_IEngine->IsInGame();
|
||||
data.shots = hitrate::count_shots;
|
||||
data.hits = hitrate::count_hits;
|
||||
data.headshots = hitrate::count_hits_head;
|
||||
if (data.connected) {
|
||||
IClientEntity* player = g_IEntityList->GetClientEntity(g_IEngine->GetLocalPlayer());
|
||||
if (player) {
|
||||
|
@ -67,6 +67,9 @@ struct user_data_s {
|
||||
time_t ts_injected;
|
||||
time_t ts_connected;
|
||||
time_t ts_disconnected;
|
||||
int shots;
|
||||
int hits;
|
||||
int headshots;
|
||||
};
|
||||
|
||||
using peer_t = cat_ipc::Peer<server_data_s, user_data_s>;
|
||||
|
@ -22,6 +22,7 @@ void NetVars::Init() {
|
||||
this->vVelocity = gNetvars.get_offset("DT_BasePlayer", "localdata", "m_vecVelocity[0]");
|
||||
this->movetype = gNetvars.get_offset("DT_BaseEntity", "movetype");
|
||||
this->m_iAmmo = gNetvars.get_offset("DT_BasePlayer", "localdata", "m_iAmmo");
|
||||
this->m_iClip1 = gNetvars.get_offset("DT_BaseCombatWeapon", "LocalWeaponData", "m_iClip1");
|
||||
this->m_Collision = gNetvars.get_offset("DT_BaseEntity", "m_Collision");
|
||||
m_flSimulationTime = gNetvars.get_offset("DT_BaseEntity", "m_flSimulationTime");
|
||||
IF_GAME (IsTF2()) {
|
||||
|
@ -75,6 +75,7 @@ public:
|
||||
offset_t iNextMeleeCrit;
|
||||
offset_t flNextPrimaryAttack;
|
||||
offset_t iNextThinkTick;
|
||||
offset_t m_iClip1;
|
||||
//offset_t flReloadPriorNextFire;
|
||||
//offset_t flObservedCritChance;
|
||||
offset_t nTickBase;
|
||||
|
@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Super l33t code to downloade gcc to v6, update cathook, then re-upgrade to v7
|
||||
# Script was created to automate the problem of downgrading to gcc6 to update cathook, then update to gcc7 to launch steam
|
||||
# This should only be useful for arch users who can not install gcc6 and gcc7 as seperate packages due to either lack of knowledge or technical reasons
|
||||
#
|
||||
|
||||
if [ $EUID == 0 ]; then
|
||||
echo "This script must be ran as root" # Standard root check to not break anything if anything is breakable.
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -e "/var/cache/pacman/pkg/lib32-gcc-libs-6.3.1-2-x86_64.pkg.tar.xz" ] # Check if user even has gcc6
|
||||
then
|
||||
sudo pacman -U /var/cache/pacman/pkg/lib32-gcc-libs-6.3.1-2-x86_64.pkg.tar.xz /var/cache/pacman/pkg/gcc-libs-multilib-6.3.1-2-x86_64.pkg.tar.xz /var/cache/pacman/pkg/gcc-multilib-6.3.1-2-x86_64.pkg.tar.xz # Downgrade to gcc6
|
||||
else
|
||||
echo "Weird, it doesn't appear that you have gcc6 installed." # Exit script if gcc6 isnt found,
|
||||
echo "This would have normally been installed if you ran the" # which is impossible if they
|
||||
echo "arch dependencies script provided by the cathook page." # followed the installation
|
||||
echo "How about you go do that first before running cathook." # guide properly.
|
||||
exit
|
||||
fi
|
||||
|
||||
cd ~/cathook # cd into cathook
|
||||
sudo ./update # run cathook's update script
|
||||
cd - # cd back into what we were in before the previous cd
|
||||
sudo pacman -Syu # update the system (and gcc)
|
Reference in New Issue
Block a user