Compare commits

..

7 Commits

Author SHA1 Message Date
F1ssi0N
8ae6f1eaf6
Create LICENSE 2018-12-06 08:48:24 +00:00
F1ssi0N
a802837d79
Update config.yml 2018-12-06 08:39:56 +00:00
F1ssi0N
d6e3a52d72
Update README.md 2018-12-06 08:34:48 +00:00
F1ssi0N
1e4c7ea826
Delete CODEOWNERS 2018-12-06 08:32:37 +00:00
Fi
25b9843bf7 Update class_id.hh 2018-10-08 13:20:07 +01:00
F1ssi0N
c80385298d Cleanup bad code by yours truly 2018-10-08 13:20:07 +01:00
Fi
7bac826c8a
Use find_my_visual_studio to find msbuild (#43) 2018-10-07 09:49:08 +01:00
21 changed files with 153 additions and 120 deletions

View File

@ -10,7 +10,7 @@ jobs:
command: |
dpkg --add-architecture i386
apt-get update -qq
apt-get install -y build-essential g++ g++-multilib clang-5.0 cmake git wget ssh patchelf libgl1-mesa-dev libglu1-mesa-dev libxfixes-dev:i386 libx11-dev:i386
apt-get install -y build-essential g++ g++-multilib clang-6.0 cmake git wget ssh patchelf libgl1-mesa-dev libglu1-mesa-dev libxfixes-dev:i386 libx11-dev:i386
- checkout
- run: git submodule sync
- run: git submodule update --init --recursive
@ -23,8 +23,8 @@ jobs:
name: Build
command: |
cd premake
ln -s /usr/bin/clang-5.0 /usr/bin/clang
ln -s /usr/bin/clang++-5.0 /usr/bin/clang++
ln -s /usr/bin/clang-6.0 /usr/bin/clang
ln -s /usr/bin/clang++-6.0 /usr/bin/clang++
make -j2
- store_artifacts:
path: ~/doghook/bin/Debug/libdoghook.so

2
.github/CODEOWNERS vendored
View File

@ -1,2 +0,0 @@
# default codeowners
* @josh33901 @marc3842h

29
LICENSE Normal file
View File

@ -0,0 +1,29 @@
BSD 3-Clause License
Copyright (c) 2018, Emily Hudson
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,7 +1,7 @@
| CircleCI | VSTS |
| -------- | ---- |
| [![CircleCI branch](https://img.shields.io/circleci/token/65513b65cff06cd33ff288f738c951bb7b095191/project/github/josh33901/doghook/master.svg)](https://circleci.com/gh/josh33901/doghook) | [![Visual Studio Team services](https://img.shields.io/vso/build/f1ssi0n/a9fe704a-46e4-44b2-b9ed-1ab56526f533/2.svg)](https://f1ssi0n.visualstudio.com/doghook) |
| [![CircleCI branch](https://img.shields.io/circleci/project/github/emily33901/doghook/master.svg)](https://circleci.com/gh/emily33901/doghook) | [![Visual Studio Team services](https://img.shields.io/vso/build/f1ssi0n/a9fe704a-46e4-44b2-b9ed-1ab56526f533/2.svg)](https://f1ssi0n.visualstudio.com/doghook) |
# Doghook

View File

@ -10,7 +10,7 @@ for /F "tokens=*" %%a in ('find_my_visual_studio.exe msbuild_exe') do set msbuil
echo msbuild is located at %msbuild_folder%
"%msbuild_folder%\\msbuild" /property:GenerateFullPaths=true /t:build premake\workspace.sln /p:Configuration=Debug /verbosity:minimal
"%msbuild_folder%\\msbuild" /property:GenerateFullPaths=true /t:build premake\doghook.sln /p:Configuration=Debug /verbosity:minimal
echo done.

View File

@ -7,7 +7,7 @@ call create_projects
for /F "tokens=*" %%a in ('find_my_visual_studio.exe msbuild_exe') do set msbuild_folder=%%a
echo msbuild is located at %msbuild_folder%
"%msbuild_folder%\\msbuild" /property:GenerateFullPaths=true /t:build premake\workspace.sln /p:Configuration=Release /verbosity:minimal
"%msbuild_folder%\\msbuild" /property:GenerateFullPaths=true /t:build premake\doghook.sln /p:Configuration=Release /verbosity:minimal
echo done.

View File

@ -81,21 +81,33 @@ public:
IFace<sdk::Client>::set_from_interface("client", "VClient");
IFace<sdk::Engine>::set_from_interface("engine", "VEngineClient");
IFace<sdk::EntList>::set_from_interface("client", "VClientEntityList");
IFace<sdk::Cvar>::set_from_interface("vstdlib", "VEngineCvar");
IFace<sdk::ModelInfo>::set_from_interface("engine", "VModelInfoClient");
IFace<sdk::Trace>::set_from_interface("engine", "EngineTraceClient");
IFace<sdk::DebugOverlay>::set_from_interface("engine", "VDebugOverlay");
IFace<sdk::GameMovement>::set_from_interface("client", "GameMovement");
IFace<sdk::Prediction>::set_from_interface("client", "VClientPrediction");
IFace<sdk::InputSystem>::set_from_interface("inputsystem", "InputSystemVersion");
if constexpr (doghook_platform::windows())
if constexpr (doghook_platform::windows()) {
IFace<sdk::Input>::set_from_pointer(**reinterpret_cast<sdk::Input ***>(
vfunc::get_func<u8 *>(sdk::iface::client, 15, 0) + 0x2));
else if constexpr (doghook_platform::linux())
IFace<sdk::Input>::set_from_pointer(**reinterpret_cast<sdk::Input ***>(
vfunc::get_func<u8 *>(sdk::iface::client, 15, 0) + 0x1));
IFace<sdk::Cvar>::set_from_interface("vstdlib", "VEngineCvar");
if constexpr (doghook_platform::windows())
IFace<sdk::ClientMode>::set_from_pointer(
*signature::find_pattern<sdk::ClientMode **>(
"client", "B9 ? ? ? ? A3 ? ? ? ? E8 ? ? ? ? 68 ? ? ? ? E8 ? ? ? ? 83 C4 04 C7 05", 1));
else if constexpr (doghook_platform::linux()) {
auto globals_real_address = (u32)*signature::find_pattern<sdk::Globals **>("engine", "A1 ? ? ? ? 8B 11 68", 8);
IFace<sdk::Globals>::set_from_pointer((sdk::Globals *)globals_real_address);
IFace<sdk::MoveHelper>::set_from_pointer(
*signature::find_pattern<sdk::MoveHelper **>(
"client", "8B 0D ? ? ? ? 8B 01 FF 50 28 56", 2));
} else if constexpr (doghook_platform::linux()) {
IFace<sdk::Input>::set_from_pointer(**reinterpret_cast<sdk::Input ***>(
vfunc::get_func<u8 *>(sdk::iface::client, 15, 0) + 0x1));
// ClientMode is a magic static. So getting a sig for it is difficult (conflicts with all other magic statics)
// So we are going to do some multistage shit in order to retrieve it
auto outer_function = signature::find_pattern<void *>("client", "55 89 E5 83 EC 18 E8 ? ? ? ? A3 ? ? ? ? E8", 6);
@ -106,11 +118,13 @@ public:
IFace<sdk::ClientMode>::set_from_pointer(*reinterpret_cast<sdk::ClientMode **>(inner_function + 10));
assert(sdk::iface::client_mode);
}
IFace<sdk::ModelInfo>::set_from_interface("engine", "VModelInfoClient");
IFace<sdk::Trace>::set_from_interface("engine", "EngineTraceClient");
IFace<sdk::DebugOverlay>::set_from_interface("engine", "VDebugOverlay");
auto globals_real_address = (u32) * *signature::find_pattern<sdk::Globals ***>("client", "8B 15 ? ? ? ? F3 0F 10 88 D0 08 00 00", 2);
IFace<sdk::Globals>::set_from_pointer((sdk::Globals *)globals_real_address);
IFace<sdk::MoveHelper>::set_from_pointer(nullptr);
}
#if 0
IFace<sdk::PlayerInfoManager>::set_from_interface("server", "PlayerInfoManager");
@ -118,27 +132,6 @@ public:
auto globals_server_address = (u32)iface::sdk::Globals.get();
#endif
if constexpr (doghook_platform::windows()) {
auto globals_real_address = (u32)*signature::find_pattern<sdk::Globals **>("engine", "A1 ? ? ? ? 8B 11 68", 8);
IFace<sdk::Globals>::set_from_pointer((sdk::Globals *)globals_real_address);
} else if constexpr (doghook_platform::linux()) {
auto globals_real_address = (u32) * *signature::find_pattern<sdk::Globals ***>("client", "8B 15 ? ? ? ? F3 0F 10 88 D0 08 00 00", 2);
IFace<sdk::Globals>::set_from_pointer((sdk::Globals *)globals_real_address);
}
IFace<sdk::GameMovement>::set_from_interface("client", "GameMovement");
IFace<sdk::Prediction>::set_from_interface("client", "VClientPrediction");
if constexpr (doghook_platform::windows())
IFace<sdk::MoveHelper>::set_from_pointer(
*signature::find_pattern<sdk::MoveHelper **>(
"client", "8B 0D ? ? ? ? 8B 01 FF 50 28 56", 2));
else if constexpr (doghook_platform::linux())
IFace<sdk::MoveHelper>::set_from_pointer(nullptr);
IFace<sdk::InputSystem>::set_from_interface("inputsystem", "InputSystemVersion");
inited = true;
}

View File

@ -64,10 +64,6 @@ static inline auto local_player_prediction(Player *local, UserCmd *cmd) {
iface::globals->curtime = old_cur_time;
iface::globals->frametime = old_frame_time;
iface::globals->tickcount = old_tick_count;
// TODO: if you do this then make sure to change the fov time calculation
// in aimbot::try_autoshoot!!
//local->tick_base() += 1;
}
std::unique_ptr<hooks::HookFunction<ClientMode, 0>> create_move_hook;
@ -85,8 +81,7 @@ bool hooked_create_move(void *instance, float sample_framerate, UserCmd *user_cm
__asm mov ebp_address, ebp;
send_packet_ptr = reinterpret_cast<bool *>(***(uptr ***)ebp_address - 1);
#else
// kotm's method
uintptr_t **fp;
uptr **fp;
__asm__("mov %%ebp, %0"
: "=r"(fp));
send_packet_ptr = reinterpret_cast<bool *>(**fp - 8);

View File

@ -145,24 +145,26 @@ static auto find_best_box() {
}
static Convar<bool> doghook_aimbot_enable_backtrack{"doghook_aimbot_enable_backtrack", true, nullptr};
static Convar<bool> doghook_aimbot_reverse_backtrack_order{"doghook_aimbot_reverse_backtrack_order", true, nullptr};
static Convar<bool> doghook_aimbot_reverse_backtrack_order{"doghook_aimbot_reverse_backtrack_order", false, nullptr};
auto visible_target_inner(Player *player, std::pair<int, bool> best_box, u32 tick, math::Vector &pos) {
PlayerHitboxes hitboxes;
u32 hitboxes_count;
auto [best_hitbox, only_use_best] = best_box;
hitboxes_count = backtrack::hitboxes_for_player(player, tick, hitboxes);
// check best hitbox first
if (visible(player, hitboxes.centre[best_box.first], best_box.first)) {
pos = hitboxes.centre[best_box.first];
if (visible(player, hitboxes.centre[best_hitbox], best_hitbox)) {
pos = hitboxes.centre[best_hitbox];
return true;
} else if (multipoint(player, best_box.first, hitboxes.centre[best_box.first], hitboxes.min[best_box.first], hitboxes.max[best_box.first], pos)) {
} else if (multipoint(player, best_hitbox, hitboxes.centre[best_hitbox], hitboxes.min[best_hitbox], hitboxes.max[best_hitbox], pos)) {
return true;
}
// .second is whether we should only check the best box
if (!best_box.second) {
if (!only_use_best) {
for (u32 i = 0; i < hitboxes_count; i++) {
if (visible(player, hitboxes.centre[i], i)) {
pos = hitboxes.centre[i];
@ -171,7 +173,7 @@ auto visible_target_inner(Player *player, std::pair<int, bool> best_box, u32 tic
}
#if 0
// Perform multiboxing after confirming that we do not have any other options
// TODO: Perform multiboxing after confirming that we do not have any other options
for (u32 i = 0; i < hitboxes_count; i++) {
if (multipoint(player, i, hitboxes.centre[i], hitboxes.min[i], hitboxes.max[i], pos)) {
return true;
@ -204,9 +206,6 @@ auto valid_target(Entity *e) {
}
void finished_target(Target t) {
// iface::overlay->add_entity_text_overlay(t.e->index(), 1, 0, 255, 255, 255, 255, "finished");
// iface::overlay->add_entity_text_overlay(t.e->index(), 2, 0, 255, 255, 255, 255, "%d", t.cmd_delta);
targets.push_back(t);
}
@ -228,17 +227,17 @@ auto find_targets() {
for (auto e : iface::ent_list->get_range()) {
if (!e->is_valid()) continue;
if (valid_target(e)) {
auto pos = math::Vector::invalid();
if (!valid_target(e)) continue;
if (auto p = e->to_player()) {
if (visible_player(p, best_box, tick, pos)) {
finished_target(Target{e, pos, delta});
auto pos = math::Vector::invalid();
// TODO: only do this when we want to do speedy targets!
//break;
}
}
if (auto p = e->to_player()) {
if (!visible_player(p, best_box, tick, pos)) continue;
finished_target(Target{e, pos, delta});
// TODO: only do this when we want to do speedy targets!
//break;
}
}
};
@ -248,25 +247,23 @@ auto find_targets() {
bool reverse_order = doghook_aimbot_reverse_backtrack_order;
// Easy out
if (!reverse_order || !doghook_aimbot_enable_backtrack) {
if (!doghook_aimbot_enable_backtrack) {
find_target_inner(current_tick, 0);
if (targets.size() > 0) {
sort_targets();
return;
}
if (targets.size() > 0) sort_targets();
return;
}
if (!doghook_aimbot_enable_backtrack) return;
// Change
const auto delta_delta = reverse_order ? -1 : 1;
auto delta = reverse_order ? backtrack::max_ticks : 1;
u32 new_tick;
// Starting position
auto delta = reverse_order ? backtrack::max_ticks : 1;
backtrack::RewindState rewind;
do {
new_tick = current_tick - delta;
u32 new_tick = current_tick - delta;
if (backtrack::tick_valid(new_tick)) {
rewind.to_tick(new_tick);
@ -349,7 +346,7 @@ static Convar<bool> doghook_aimbot_disallow_attack_if_no_target = Convar<bool>{"
void create_move(sdk::UserCmd *cmd) {
profiler_profile_function();
if (local_weapon == nullptr || !can_find_targets) return;
if (!can_find_targets) return;
find_targets();

View File

@ -141,8 +141,9 @@ Convar<float> doghook_backtrack_latency{"doghook_backtrack_latency", 0, 0, 1, nu
// Sequence record
struct sequence {
u32 in_state;
u32 out_state;
u32 in_state;
u32 out_state;
u32 in_sequence;
u32 out_sequence;
float cur_time;
@ -274,16 +275,8 @@ static bool restore_player_to_record(sdk::Player *p, const Record &r) {
// This offset already seems to account for the + 4 needed...
static auto hitbox_bone_cache_handle_offset = *signature::find_pattern<u32 *>("client", "FF B6 ? ? ? ? E8 ? ? ? ? 8B F8 83 C4 04 85 FF 74 47", 2);
auto hitbox_bone_cache_handle = p->get<u32>(hitbox_bone_cache_handle_offset);
if (hitbox_bone_cache_handle == 0) return true;
static auto studio_get_bone_cache = signature::find_pattern<GetBoneCacheFn>("client", "55 8B EC 83 EC 20 56 6A 01 68 ? ? ? ? 68", 0);
BoneCache * bone_cache = studio_get_bone_cache(hitbox_bone_cache_handle);
static auto bone_cache_update_bones = signature::find_pattern<BoneCache_UpdateBonesFn>("client", "55 8B EC 83 EC 08 56 8B F1 33 D2", 0);
if (bone_cache != nullptr) bone_cache_update_bones(bone_cache, r.hitboxes.bone_to_world, 128, iface::globals->curtime);
static auto studio_get_bone_cache = signature::find_pattern<GetBoneCacheFn>("client", "55 8B EC 83 EC 20 56 6A 01 68 ? ? ? ? 68", 0);
static auto bone_cache_update_bones = signature::find_pattern<BoneCache_UpdateBonesFn>("client", "55 8B EC 83 EC 08 56 8B F1 33 D2", 0);
#else
// 8B 86 ? ? ? ? 89 04 24 E8 ? ? ? ? 85 C0 89 C3 74 48 -> hitbox_bone_cache_handle_offset
@ -291,18 +284,17 @@ static bool restore_player_to_record(sdk::Player *p, const Record &r) {
// 55 89 E5 57 31 FF 56 53 83 EC 1C 8B 5D 08 0F B7 53 10 -> UpdateBoneCache
static auto hitbox_bone_cache_handle_offset = *signature::find_pattern<u32 *>("client", "8B 86 ? ? ? ? 89 04 24 E8 ? ? ? ? 85 C0 89 C3 74 48", 2);
static auto studio_get_bone_cache = signature::find_pattern<GetBoneCacheFn>("client", "55 89 E5 56 53 BB ? ? ? ? 83 EC 50 C7 45 D8", 0);
static auto bone_cache_update_bones = signature::find_pattern<BoneCache_UpdateBonesFn>("client", "55 89 E5 57 31 FF 56 53 83 EC 1C 8B 5D 08 0F B7 53 10", 0);
#endif
auto hitbox_bone_cache_handle = p->get<u32>(hitbox_bone_cache_handle_offset);
if (hitbox_bone_cache_handle == 0) return true;
static auto studio_get_bone_cache = signature::find_pattern<GetBoneCacheFn>("client", "55 89 E5 56 53 BB ? ? ? ? 83 EC 50 C7 45 D8", 0);
BoneCache * bone_cache = studio_get_bone_cache(hitbox_bone_cache_handle);
BoneCache *bone_cache = studio_get_bone_cache(hitbox_bone_cache_handle);
static auto bone_cache_update_bones = signature::find_pattern<BoneCache_UpdateBonesFn>("client", "55 89 E5 57 31 FF 56 53 83 EC 1C 8B 5D 08 0F B7 53 10", 0);
if (bone_cache != nullptr) bone_cache_update_bones(bone_cache, r.hitboxes.bone_to_world, 128, iface::globals->curtime);
#endif
return true;
}
@ -460,7 +452,7 @@ void create_move(sdk::UserCmd *cmd) {
iface::overlay->add_box_overlay(r.hitboxes.origin[0], {-2, -2, -2}, {2, 2, 2}, {0, 0, 0}, 0, 255, 0, 100, 0);
#if 0
#if 0 && _DEBUG
auto &hitboxes = r.hitboxes;
for (u32 i = 0; i < r.max_hitboxes; i++) {
@ -469,7 +461,7 @@ void create_move(sdk::UserCmd *cmd) {
auto g = (int)(255.0f * hullcolor[j].y);
auto b = (int)(255.0f * hullcolor[j].z);
iface::DebugOverlay->add_box_overlay(hitboxes.origin[i], hitboxes.raw_min[i], hitboxes.raw_max[i], hitboxes.rotation[i], r, g, b, 100, 0);
iface::overlay->add_box_overlay(hitboxes.origin[i], hitboxes.raw_min[i], hitboxes.raw_max[i], hitboxes.rotation[i], r, g, b, 100, 0);
//math::Vector origin;
//math::Vector angles;
@ -479,7 +471,7 @@ void create_move(sdk::UserCmd *cmd) {
//g = 255;
//b = 0;
//iface::DebugOverlay->add_box_overlay(origin, hitboxes.raw_min[i], hitboxes.raw_max[i], angles, r, g, b, 100, 0);
//iface::overlay->add_box_overlay(origin, hitboxes.raw_min[i], hitboxes.raw_max[i], angles, r, g, b, 100, 0);
}
#endif
}

View File

@ -60,14 +60,14 @@ Netvar local_angles{"DT_BasePlayer", "pl", "deadflag"};
void init_all() {
for (auto c : sdk::ConvarWrapper::get_range()) {
auto flags = c.flags();
flags &= ~FCVAR_CHEAT;
flags &= ~FCVAR_DEVELOPMENTONLY;
flags &= ~FCVAR_PROTECTED;
flags &= ~FCVAR_SPONLY;
flags &= ~FCVAR_CHEAT;
flags &= ~FCVAR_REPLICATED;
flags &= ~FCVAR_NOT_CONNECTED;
flags &= ~FCVAR_HIDDEN;
flags &= ~(FCVAR_CHEAT |
FCVAR_DEVELOPMENTONLY |
FCVAR_PROTECTED |
FCVAR_SPONLY |
FCVAR_CHEAT |
FCVAR_REPLICATED |
FCVAR_NOT_CONNECTED |
FCVAR_HIDDEN);
c.set_flags(flags);
}

View File

@ -26,6 +26,9 @@ public:
// For debug builds we want to be able to check our classids are correct and issue warnings if they are not correct
// So that we can update the value for next time.
// This macro is required as inline variables have multiple constructors / destructors per compilation unit.
// Since this calls relies on consctruction and destruction we can only create the checkers in 1 compilation unit.
#if defined(_DEBUG) && defined(PLACE_CHECKER)
#define ID(name, value) \
enum { name = value }; \
@ -40,10 +43,13 @@ public:
#endif
// Put ids here
ID(CFuncAreaPortalWindow, 55);
ID(CFuncRespawnRoomVisualizer, 64);
ID(CTFFlareGun, 208);
ID(CTFMedigunShield, 230);
ID(CTFPlayer, 246);
ID(CTFRevolver, 285);
ID(CTFSniperRifle, 306);
ID(CTFFlareGun, 208);
#undef ID

View File

@ -8,7 +8,7 @@
#include "log.hh"
#include "sdk.hh"
// implementation of a source convar
// implementation of a source engine convar
namespace sdk {
// Helper to prevent crashes if Cvar isnt initied properly yet

View File

@ -16,6 +16,8 @@
// Convar types into their own templated class so that you can static_cast
// to it once you know what you are dealing with.
// TODO: there is no reason why there should be any virtual functions here!
namespace sdk {
class ConCommandBase;
class IConVar;

View File

@ -121,7 +121,7 @@ public:
virtual void post_render() override {}
};
// TODO: GameSystem could be in a namespace...
// TODO: GameSystem could be in a namespace (not directly required for the rtti hack)...
class GameSystem : public CBaseGameSystemPerFrame {
GameSystem *next;

View File

@ -178,8 +178,8 @@ public:
}
// Call the original function
// Only pass the return value as a template param as the args
// will be automatically infered from what you pass to the function
// Only pass the return value as a template param.
// as the arg will be automatically infered from what you pass to the function
template <typename ret, typename... Args>
auto call_original(Args... args) {
#if doghook_platform_linux()

View File

@ -160,5 +160,5 @@ enum player_controls {
};
// TODO: mb add enumerated key array
// ToDo: make seperate convar type for keys
// TODO: make seperate convar type for keys
} // namespace sdk

View File

@ -43,24 +43,25 @@ uptr Netvar::Tree::find_offset(std::vector<const char *> t) {
auto nodes = &prop_tree;
for (auto &name : t) {
auto old_nodes = nodes;
auto end = nodes->end();
for (auto it = nodes->begin(); it != end; ++it) {
auto p = *it;
if (strcmp(name, p.first) == 0) {
nodes = &p.second->children;
if (p.second->p != nullptr)
total += p.second->p->offset;
auto [node_name, child_node] = p;
if (strcmp(name, node_name) == 0) {
nodes = &child_node->children;
if (child_node->p != nullptr)
total += child_node->p->offset;
break;
}
}
if (nodes == old_nodes) {
// TODO:
//logging::msg("[Netvar] Unable to find '%s'", name);
// logging::msg("[Netvar] Unable to find '%s'", name);
}
}

View File

@ -9,7 +9,6 @@ namespace sdk {
class Netvar {
class Tree {
struct Node;
using TreeNode = std::vector<std::pair<const char *, std::shared_ptr<Node>>>;

View File

@ -515,6 +515,7 @@ public:
}
};
// Wrappers around the IFace<type> system: iface::<type>
namespace iface {
extern IFace<Client> client;
extern IFace<ClientMode> client_mode;
@ -532,6 +533,24 @@ extern IFace<MoveHelper> move_helper;
extern IFace<GameMovement> game_movement;
extern IFace<EngineVgui> engine_vgui;
extern IFace<InputSystem> input_system;
// TODO: update to use type aliases instead of extern vars
// using client = IFace<Client>;
// using client_mode = IFace<ClientMode>;
// using cvar = IFace<Cvar>;
// using engine = IFace<Engine>;
// using engine_vgui = IFace<EngineVgui>;
// using ent_list = IFace<EntList>;
// using game_movement = IFace<GameMovement>;
// using globals = IFace<Globals>;
// using info_manager = IFace<PlayerInfoManager>;
// using input = IFace<Input>;
// using input_system = IFace<InputSystem>;
// using model_info = IFace<ModelInfo>;
// using move_helper = IFace<MoveHelper>;
// using overlay = IFace<DebugOverlay>;
// using prediction = IFace<Prediction>;
// using trace = IFace<Trace>;
} // namespace iface
} // namespace sdk

View File

@ -4,6 +4,8 @@
#include "sdk.hh"
#include "class_id.hh"
bool trace::Filter::should_hit_entity(sdk::Entity *handle_entity, int contents_mask) {
auto handle = handle_entity->to_handle();
auto real_entity = sdk::iface::ent_list->from_handle(handle);
@ -14,9 +16,9 @@ bool trace::Filter::should_hit_entity(sdk::Entity *handle_entity, int contents_m
// ignore "bad" entities
switch (client_class->class_id) {
case 64: // CFuncRespawnRoomVisualizer
case 230: // CTFMedigunShield
case 55: // CFuncAreaPortalWindow
case sdk::class_id::CFuncRespawnRoomVisualizer:
case sdk::class_id::CTFMedigunShield:
case sdk::class_id::CFuncAreaPortalWindow:
return false;
}