Big iface change (#40)
* Update unloading * Use iface:: instead of IFace<T> in most cases exception being Surface (which shouldnt be avaliable outside of draw anyway) * Correct error in linux specific code * Remove deprecated on interface constructor
This commit is contained in:
parent
86139daefe
commit
b78f2c6b51
1
.vscode/settings.json
vendored
Normal file
1
.vscode/settings.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
{}
|
16
.vscode/tasks.json
vendored
Normal file
16
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Build Release",
|
||||
"type": "shell",
|
||||
"command": "./make_release.bat",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -4,5 +4,6 @@ echo creating projects...
|
||||
|
||||
premake5 vs2017
|
||||
premake5 export-compile-commands
|
||||
premake5 cmake
|
||||
|
||||
echo finished.
|
@ -41,7 +41,11 @@ public:
|
||||
#endif
|
||||
|
||||
static void await_shutdown() {
|
||||
while (!doghook_unload_now) std::this_thread::yield();
|
||||
while (!doghook_unload_now) {
|
||||
using namespace std::chrono_literals;
|
||||
std::this_thread::sleep_for(1000ms);
|
||||
std::this_thread::yield();
|
||||
}
|
||||
|
||||
#if doghook_platform_windows()
|
||||
// TODO: the CRT should be able to take care of all our hooks as they are all declared
|
||||
@ -68,21 +72,21 @@ public:
|
||||
|
||||
// Get interfaces here before init_all has a chance to do anything
|
||||
|
||||
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::Client>::set_from_interface("client", "VClient");
|
||||
IFace<sdk::Engine>::set_from_interface("engine", "VEngineClient");
|
||||
IFace<sdk::EntList>::set_from_interface("client", "VClientEntityList");
|
||||
|
||||
if constexpr (doghook_platform::windows())
|
||||
IFace<sdk::Input>().set_from_pointer(**reinterpret_cast<sdk::Input ***>(
|
||||
vfunc::get_func<u8 *>(IFace<sdk::Client>().get(), 15, 0) + 0x2));
|
||||
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 *>(IFace<sdk::Client>().get(), 15, 0) + 0x1));
|
||||
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");
|
||||
IFace<sdk::Cvar>::set_from_interface("vstdlib", "VEngineCvar");
|
||||
|
||||
if constexpr (doghook_platform::windows())
|
||||
IFace<sdk::ClientMode>().set_from_pointer(
|
||||
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()) {
|
||||
@ -94,40 +98,40 @@ public:
|
||||
auto inner_function = static_cast<u8 *>(signature::resolve_callgate(outer_function));
|
||||
assert(outer_function);
|
||||
|
||||
IFace<sdk::ClientMode>().set_from_pointer(*reinterpret_cast<sdk::ClientMode **>(inner_function + 10));
|
||||
assert(IFace<sdk::ClientMode>().get());
|
||||
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");
|
||||
IFace<sdk::PlayerInfoManager>().set_from_interface("server", "PlayerInfoManager");
|
||||
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::Globals>().set_from_pointer(IFace<sdk::PlayerInfoManager>()->globals());
|
||||
#if 0
|
||||
IFace<sdk::PlayerInfoManager>::set_from_interface("server", "PlayerInfoManager");
|
||||
iface::sdk::Globals>::set_from_pointer(IFace<sdk::PlayerInfoManager->globals());
|
||||
auto globals_server_address = (u32)iface::sdk::Globals.get();
|
||||
#endif
|
||||
|
||||
auto globals_server_address = (u32)IFace<sdk::Globals>().get();
|
||||
|
||||
// TODO: this globals_real_address is windows only!
|
||||
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);
|
||||
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::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");
|
||||
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(
|
||||
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::MoveHelper>::set_from_pointer(nullptr);
|
||||
|
||||
IFace<sdk::InputSystem>().set_from_interface("inputsystem", "InputSystemVersion");
|
||||
IFace<sdk::InputSystem>::set_from_interface("inputsystem", "InputSystemVersion");
|
||||
|
||||
inited = true;
|
||||
}
|
||||
@ -165,7 +169,7 @@ public:
|
||||
std::thread{&await_shutdown}.detach();
|
||||
|
||||
// If we are already in game then do the level inits
|
||||
if (IFace<sdk::Engine>()->in_game()) {
|
||||
if (sdk::iface::engine->in_game()) {
|
||||
level_init_pre_entity();
|
||||
level_init_post_entity();
|
||||
}
|
||||
|
@ -35,15 +35,15 @@ static inline auto local_player_prediction(Player *local, UserCmd *cmd) {
|
||||
memset(move_data_buffer, 0, sizeof(move_data_buffer));
|
||||
|
||||
// Setup prediction
|
||||
auto old_cur_time = IFace<Globals>()->curtime;
|
||||
auto old_frame_time = IFace<Globals>()->frametime;
|
||||
auto old_tick_count = IFace<Globals>()->tickcount;
|
||||
auto old_cur_time = iface::globals->curtime;
|
||||
auto old_frame_time = iface::globals->frametime;
|
||||
auto old_tick_count = iface::globals->tickcount;
|
||||
|
||||
IFace<Globals>()->curtime = local->tick_base() * IFace<Globals>()->interval_per_tick;
|
||||
iface::globals->curtime = local->tick_base() * iface::globals->interval_per_tick;
|
||||
|
||||
// If we are already not able to fit enough ticks into a frame account for this!!
|
||||
IFace<Globals>()->frametime = IFace<Globals>()->interval_per_tick;
|
||||
IFace<Globals>()->tickcount = local->tick_base();
|
||||
iface::globals->frametime = iface::globals->interval_per_tick;
|
||||
iface::globals->tickcount = local->tick_base();
|
||||
|
||||
// Set the current usercmd and run prediction
|
||||
if constexpr (doghook_platform::windows())
|
||||
@ -51,9 +51,9 @@ static inline auto local_player_prediction(Player *local, UserCmd *cmd) {
|
||||
else if constexpr (doghook_platform::linux())
|
||||
local->set<UserCmd *, 0x105C>(cmd);
|
||||
|
||||
IFace<Prediction>()->setup_move(local, cmd, IFace<MoveHelper>().get(), move_data_buffer);
|
||||
IFace<GameMovement>()->process_movement(local, move_data_buffer);
|
||||
IFace<Prediction>()->finish_move(local, cmd, move_data_buffer);
|
||||
iface::prediction->setup_move(local, cmd, iface::move_helper, move_data_buffer);
|
||||
iface::game_movement->process_movement(local, move_data_buffer);
|
||||
iface::prediction->finish_move(local, cmd, move_data_buffer);
|
||||
|
||||
if constexpr (doghook_platform::windows())
|
||||
local->set<UserCmd *, 0x107C>(0);
|
||||
@ -61,9 +61,9 @@ static inline auto local_player_prediction(Player *local, UserCmd *cmd) {
|
||||
local->set<UserCmd *, 0x105C>(0);
|
||||
|
||||
// Cleanup from prediction
|
||||
IFace<Globals>()->curtime = old_cur_time;
|
||||
IFace<Globals>()->frametime = old_frame_time;
|
||||
IFace<Globals>()->tickcount = old_tick_count;
|
||||
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!!
|
||||
@ -136,7 +136,7 @@ void level_init() {
|
||||
logging::msg("=> Hooking up!");
|
||||
|
||||
assert(create_move_hook == nullptr);
|
||||
create_move_hook = std::make_unique<hooks::HookFunction<ClientMode, 0>>(IFace<ClientMode>().get(), 21, 22, 22, reinterpret_cast<void *>(&hooked_create_move));
|
||||
create_move_hook = std::make_unique<hooks::HookFunction<ClientMode, 0>>(iface::client_mode, 21, 22, 22, reinterpret_cast<void *>(&hooked_create_move));
|
||||
}
|
||||
|
||||
void level_shutdown() {
|
||||
|
@ -36,7 +36,7 @@ void hooked_paint(EngineVgui *instance, u32 paint_method)
|
||||
|
||||
void init_all() {
|
||||
// hook up
|
||||
engine_vgui_hook = std::make_unique<hooks::HookFunction<EngineVgui, 0>>(IFace<EngineVgui>().get(), 13, 14, 14, reinterpret_cast<void *>(&hooked_paint));
|
||||
engine_vgui_hook = std::make_unique<hooks::HookFunction<EngineVgui, 0>>(iface::engine_vgui, 13, 14, 14, reinterpret_cast<void *>(&hooked_paint));
|
||||
}
|
||||
|
||||
void shutdown_all() {
|
||||
|
@ -23,7 +23,6 @@ u32 hooked_send_datagram(NetChannel *channel, bf_write *datagram)
|
||||
auto in_state = channel->in_reliable_state();
|
||||
auto in_sequence = channel->in_sequence();
|
||||
|
||||
// TODO: Call out to backtrack
|
||||
backtrack::add_latency_to_netchannel(channel);
|
||||
|
||||
auto ret = send_datagram_hook->call_original<u32>(datagram);
|
||||
@ -36,7 +35,7 @@ u32 hooked_send_datagram(NetChannel *channel, bf_write *datagram)
|
||||
|
||||
void level_init() {
|
||||
assert(send_datagram_hook == nullptr);
|
||||
send_datagram_hook = std::make_unique<hooks::HookFunction<NetChannel, 0>>(IFace<Engine>()->net_channel_info(), 46, 47, 47, reinterpret_cast<void *>(&hooked_send_datagram));
|
||||
send_datagram_hook = std::make_unique<hooks::HookFunction<NetChannel, 0>>(iface::engine->net_channel_info(), 46, 47, 47, reinterpret_cast<void *>(&hooked_send_datagram));
|
||||
}
|
||||
|
||||
void level_shutdown() {
|
||||
|
@ -46,7 +46,7 @@ static auto visible_no_entity(const math::Vector &position) {
|
||||
|
||||
ray.init(local_view, position);
|
||||
|
||||
IFace<Trace>()->trace_ray(ray, 0x46004003, &f, &result);
|
||||
iface::trace->trace_ray(ray, 0x46004003, &f, &result);
|
||||
|
||||
return result.fraction == 1.0f;
|
||||
}
|
||||
@ -61,7 +61,7 @@ static auto visible(Entity *e, const math::Vector &position, const int h
|
||||
|
||||
ray.init(local_view, position);
|
||||
|
||||
IFace<Trace>()->trace_ray(ray, 0x46004003, &f, &result);
|
||||
iface::trace->trace_ray(ray, 0x46004003, &f, &result);
|
||||
|
||||
if (doghook_aimbot_pedantic_mode == true) {
|
||||
if (result.entity == e && result.hitbox == hitbox) return true;
|
||||
@ -211,8 +211,8 @@ auto valid_target(Entity *e) {
|
||||
}
|
||||
|
||||
void finished_target(Target t) {
|
||||
IFace<DebugOverlay>()->add_entity_text_overlay(t.e->index(), 1, 0, 255, 255, 255, 255, "finished");
|
||||
IFace<DebugOverlay>()->add_entity_text_overlay(t.e->index(), 2, 0, 255, 255, 255, 255, "%d", t.cmd_delta);
|
||||
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);
|
||||
}
|
||||
@ -232,7 +232,7 @@ auto find_targets() {
|
||||
auto best_box = find_best_box();
|
||||
|
||||
auto find_target_inner = [&best_box](u32 tick, u32 delta) {
|
||||
for (auto e : IFace<EntList>()->get_range()) {
|
||||
for (auto e : iface::ent_list->get_range()) {
|
||||
if (!e->is_valid()) continue;
|
||||
|
||||
if (valid_target(e)) {
|
||||
@ -251,7 +251,7 @@ auto find_targets() {
|
||||
}
|
||||
};
|
||||
|
||||
auto current_tick = IFace<Globals>()->tickcount;
|
||||
auto current_tick = iface::globals->tickcount;
|
||||
|
||||
bool reverse_order = doghook_aimbot_reverse_backtrack_order;
|
||||
|
||||
@ -334,7 +334,7 @@ static auto try_autoshoot(sdk::UserCmd *cmd) {
|
||||
// Only allow autoshoot when we are zoomed and can get headshots
|
||||
if (local_weapon->client_class()->class_id == class_id::CTFSniperRifle) {
|
||||
if ((local_player->cond() & 2)) {
|
||||
auto player_time = local_player->tick_base() * IFace<Globals>()->interval_per_tick;
|
||||
auto player_time = local_player->tick_base() * iface::globals->interval_per_tick;
|
||||
auto time_delta = player_time - local_player->fov_time();
|
||||
|
||||
if (time_delta >= 0.2) autoshoot_allowed = true;
|
||||
@ -369,7 +369,7 @@ void create_move(sdk::UserCmd *cmd) {
|
||||
if (targets.size() > 0 && targets[0].e != nullptr) {
|
||||
auto &target = targets[0];
|
||||
|
||||
IFace<DebugOverlay>()->add_box_overlay(target.v, {-2, -2, -2}, {2, 2, 2}, {0, 0, 0}, 255, 255, 0, 100, 0);
|
||||
iface::overlay->add_box_overlay(target.v, {-2, -2, -2}, {2, 2, 2}, {0, 0, 0}, 255, 255, 0, 100, 0);
|
||||
|
||||
auto delta = target.v - local_view;
|
||||
auto new_angles = delta.to_angle();
|
||||
@ -390,7 +390,7 @@ void create_move(sdk::UserCmd *cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
if (doghook_aimbot_silent == false) IFace<Engine>()->set_view_angles(new_angles);
|
||||
if (doghook_aimbot_silent == false) iface::engine->set_view_angles(new_angles);
|
||||
} else {
|
||||
if (doghook_aimbot_disallow_attack_if_no_target == true) cmd->buttons &= ~1;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ inline static auto fix_movement_for_new_angles(const math::Vector &movement, con
|
||||
math::Matrix3x4 rotate_matrix;
|
||||
|
||||
auto delta_angles = new_angles - old_angles;
|
||||
delta_angles = clamp_angle(delta_angles);
|
||||
delta_angles.x = 0; // We dont care about pitch for this
|
||||
|
||||
rotate_matrix.from_angle(delta_angles);
|
||||
return rotate_matrix.rotate_vector(movement);
|
||||
|
@ -54,7 +54,7 @@ void draw_entity_bone_transforms(Player *p, const math::Matrix3x4 *bone_to_world
|
||||
auto g = 255;
|
||||
auto b = 0;
|
||||
|
||||
IFace<DebugOverlay>()->add_box_overlay(origin, box->min, box->max, angles, r, g, b, 100, 0);
|
||||
iface::overlay->add_box_overlay(origin, box->min, box->max, angles, r, g, b, 100, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,10 +63,13 @@ enum { backtrack_max_anim_layers = 15 };
|
||||
class Record {
|
||||
public:
|
||||
// animation related
|
||||
std::array<AnimationLayer, backtrack_max_anim_layers> animation_layers;
|
||||
#if 0
|
||||
std::array<AnimationLayer, backtrack_max_anim_layers> animation_layers;
|
||||
std::array<float, 15> pose_parameters;
|
||||
float master_cycle;
|
||||
int master_sequence;
|
||||
#endif
|
||||
|
||||
float master_cycle;
|
||||
int master_sequence;
|
||||
|
||||
// state related
|
||||
bool alive;
|
||||
@ -75,12 +78,14 @@ public:
|
||||
bool size_changed;
|
||||
|
||||
// absolute related
|
||||
#if 0
|
||||
math::Vector origin;
|
||||
math::Vector render_origin;
|
||||
math::Vector angles;
|
||||
math::Vector real_angles;
|
||||
math::Vector min_prescaled;
|
||||
math::Vector max_prescaled;
|
||||
#endif
|
||||
|
||||
PlayerHitboxes hitboxes;
|
||||
u32 max_hitboxes;
|
||||
@ -140,7 +145,7 @@ u32 last_incoming_sequence;
|
||||
Convar<float> doghook_backtrack_latency{"doghook_backtrack_latency", 0, 0, 1, nullptr};
|
||||
|
||||
void add_latency_to_netchannel(NetChannel *c) {
|
||||
float current_time = IFace<Globals>()->realtime;
|
||||
float current_time = iface::globals->realtime;
|
||||
for (auto &s : sequences) {
|
||||
if (current_time - s.cur_time > doghook_backtrack_latency) {
|
||||
c->in_reliable_state() = s.in_state;
|
||||
@ -152,14 +157,14 @@ void add_latency_to_netchannel(NetChannel *c) {
|
||||
}
|
||||
|
||||
void update_incoming_sequences() {
|
||||
NetChannel *c = IFace<Engine>()->net_channel_info();
|
||||
NetChannel *c = iface::engine->net_channel_info();
|
||||
|
||||
auto incoming_sequence = c->in_sequence();
|
||||
|
||||
if (incoming_sequence > last_incoming_sequence) {
|
||||
last_incoming_sequence = incoming_sequence;
|
||||
|
||||
sequences.push_front({c->in_reliable_state(), c->out_reliable_state(), c->in_sequence(), c->out_sequence(), IFace<Globals>()->realtime});
|
||||
sequences.push_front({c->in_reliable_state(), c->out_reliable_state(), c->in_sequence(), c->out_sequence(), iface::globals->realtime});
|
||||
}
|
||||
|
||||
if (sequences.size() > 2048)
|
||||
@ -194,19 +199,19 @@ float lerp_time() {
|
||||
}
|
||||
|
||||
bool tick_valid(u32 tick) {
|
||||
auto net_channel = IFace<Engine>()->net_channel_info();
|
||||
auto net_channel = iface::engine->net_channel_info();
|
||||
|
||||
auto lerp = lerp_time();
|
||||
auto lerp_ticks = IFace<Globals>()->time_to_ticks(lerp);
|
||||
auto lerp_ticks = iface::globals->time_to_ticks(lerp);
|
||||
|
||||
auto correct = std::clamp(lerp + doghook_backtrack_latency + latency_outgoing, 0.0f, sv_maxunlag.get_float());
|
||||
|
||||
auto delta_time = correct - IFace<Globals>()->ticks_to_time(IFace<Globals>()->tickcount + 1 + lerp_ticks - tick);
|
||||
auto delta_time = correct - iface::globals->ticks_to_time(iface::globals->tickcount + 1 + lerp_ticks - tick);
|
||||
|
||||
bool valid = std::abs(delta_time) <= 0.2;
|
||||
|
||||
if (!valid) {
|
||||
auto new_tick = IFace<Globals>()->tickcount - IFace<Globals>()->time_to_ticks(correct);
|
||||
auto new_tick = iface::globals->tickcount - iface::globals->time_to_ticks(correct);
|
||||
//logging::msg("[Backtracking] !valid (%d -> %d d: %d)", tick, new_tick, new_tick - tick);
|
||||
}
|
||||
|
||||
@ -217,11 +222,16 @@ bool tick_valid(u32 tick) {
|
||||
static bool restore_player_to_record(sdk::Player *p, const Record &r) {
|
||||
profiler_profile_function();
|
||||
|
||||
p->set_origin(r.origin);
|
||||
// TODO: now that i have figured out how tracerays work against studiomodels
|
||||
// and baseanimatings... Most of these dont matter
|
||||
|
||||
#if 0
|
||||
p->set_origin(r.origin);
|
||||
p->render_origin() = r.render_origin;
|
||||
|
||||
p->set_angles(r.angles);
|
||||
//p->render_angle() = r.angles;
|
||||
#endif
|
||||
|
||||
p->sim_time() = r.simulation_time;
|
||||
p->anim_time() = r.animation_time;
|
||||
@ -229,6 +239,8 @@ static bool restore_player_to_record(sdk::Player *p, const Record &r) {
|
||||
p->cycle() = r.master_cycle;
|
||||
p->sequence() = r.master_sequence;
|
||||
|
||||
#if 0
|
||||
|
||||
auto layer_count = p->anim_layer_count();
|
||||
|
||||
auto layer_max = std::min<u32>(backtrack_max_anim_layers, layer_count);
|
||||
@ -241,6 +253,7 @@ static bool restore_player_to_record(sdk::Player *p, const Record &r) {
|
||||
// Because we changed the animation we need to tell the
|
||||
// animation state about it
|
||||
p->update_client_side_animation();
|
||||
#endif
|
||||
|
||||
// Now we need to tell the cache that these bones are different...
|
||||
|
||||
@ -264,7 +277,7 @@ static bool restore_player_to_record(sdk::Player *p, const Record &r) {
|
||||
|
||||
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);
|
||||
if (bone_cache != nullptr) bone_cache_update_bones(bone_cache, r.hitboxes.bone_to_world, 128, iface::globals->curtime);
|
||||
|
||||
#else
|
||||
// 8B 86 ? ? ? ? 89 04 24 E8 ? ? ? ? 85 C0 89 C3 74 48 -> hitbox_bone_cache_handle_offset
|
||||
@ -280,7 +293,7 @@ static bool restore_player_to_record(sdk::Player *p, const Record &r) {
|
||||
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);
|
||||
if (bone_cache != nullptr) bone_cache_update_bones(bone_cache, r.hitboxes.bone_to_world, 128, iface::globals->curtime);
|
||||
|
||||
#endif
|
||||
|
||||
@ -336,18 +349,18 @@ void create_move_pre_predict(sdk::UserCmd *cmd) {
|
||||
|
||||
update_incoming_sequences();
|
||||
|
||||
current_tick = IFace<Globals>()->tickcount;
|
||||
current_tick = iface::globals->tickcount;
|
||||
|
||||
auto local_player = Player::local();
|
||||
|
||||
// Get the current latency (not useful here but will be later on in the tick)
|
||||
latency_incoming = IFace<Engine>()->net_channel_info()->latency(NetChannel::Flow::incoming);
|
||||
latency_outgoing = IFace<Engine>()->net_channel_info()->latency(NetChannel::Flow::outgoing);
|
||||
latency_incoming = iface::engine->net_channel_info()->latency(NetChannel::Flow::incoming);
|
||||
latency_outgoing = iface::engine->net_channel_info()->latency(NetChannel::Flow::outgoing);
|
||||
total_latency_time = latency_incoming + latency_outgoing;
|
||||
total_latency_ticks = IFace<Globals>()->time_to_ticks(total_latency_time);
|
||||
total_latency_ticks = iface::globals->time_to_ticks(total_latency_time);
|
||||
|
||||
// We want to get from entity 1 to entity 32
|
||||
for (auto entity : IFace<EntList>()->get_range(IFace<Engine>()->max_clients() + 1)) {
|
||||
for (auto entity : iface::ent_list->get_range(iface::engine->max_clients() + 1)) {
|
||||
if (entity == nullptr) continue;
|
||||
|
||||
auto player = entity->to_player();
|
||||
@ -372,10 +385,15 @@ void create_move_pre_predict(sdk::UserCmd *cmd) {
|
||||
|
||||
profiler_profile_scope("update_record");
|
||||
|
||||
// TODO: look above at restore_player_to_tick for information about why this
|
||||
// is commented out.
|
||||
|
||||
// Set absolute origin and angles
|
||||
new_record.origin = player->origin();
|
||||
#if 0
|
||||
new_record.origin = player->origin();
|
||||
new_record.render_origin = player->render_origin();
|
||||
new_record.angles = player->angles();
|
||||
|
||||
new_record.angles = player->angles();
|
||||
|
||||
// TODO: when real angles and corrected angles differ we need to change this
|
||||
new_record.real_angles = player->angles();
|
||||
@ -387,6 +405,8 @@ void create_move_pre_predict(sdk::UserCmd *cmd) {
|
||||
new_record.size_changed = previous_record.min_prescaled != new_record.min_prescaled ||
|
||||
previous_record.max_prescaled != new_record.max_prescaled;
|
||||
|
||||
#endif
|
||||
|
||||
new_record.simulation_time = player->sim_time();
|
||||
new_record.animation_time = player->anim_time();
|
||||
|
||||
@ -396,6 +416,8 @@ void create_move_pre_predict(sdk::UserCmd *cmd) {
|
||||
new_record.master_sequence = player->sequence();
|
||||
new_record.this_tick = current_tick;
|
||||
|
||||
#if 0
|
||||
|
||||
auto layer_count = player->anim_layer_count();
|
||||
#ifdef _DEBUG
|
||||
if (layer_count > backtrack_max_anim_layers)
|
||||
@ -407,6 +429,7 @@ void create_move_pre_predict(sdk::UserCmd *cmd) {
|
||||
for (u32 i = 0; i < layer_max; ++i) {
|
||||
new_record.animation_layers[i] = player->anim_layer(i);
|
||||
}
|
||||
#endif
|
||||
|
||||
new_record.max_hitboxes = player->hitboxes(&new_record.hitboxes, false);
|
||||
}
|
||||
@ -416,19 +439,19 @@ void create_move(sdk::UserCmd *cmd) {
|
||||
#if doghook_platform_debug()
|
||||
profiler_profile_function();
|
||||
|
||||
for (auto entity : IFace<EntList>()->get_range()) {
|
||||
for (auto entity : iface::ent_list->get_range()) {
|
||||
if (!entity->is_valid()) continue;
|
||||
|
||||
auto player = entity->to_player();
|
||||
if (auto player = entity->to_player()) {
|
||||
for (auto &r : record_track(player->index())) {
|
||||
//auto &r = record(player->index(), IFace<Globals>()->tickcount + 1);
|
||||
//auto &r = record(player->index(), iface::Globals->tickcount + 1);
|
||||
|
||||
if (!r.alive) continue;
|
||||
|
||||
if (!tick_valid(r.this_tick)) continue;
|
||||
|
||||
IFace<DebugOverlay>()->add_box_overlay(r.origin, {-2, -2, -2}, {2, 2, 2}, {0, 0, 0}, 0, 255, 0, 100, 0);
|
||||
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
|
||||
auto &hitboxes = r.hitboxes;
|
||||
@ -439,7 +462,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::DebugOverlay->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;
|
||||
@ -449,7 +472,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::DebugOverlay->add_box_overlay(origin, hitboxes.raw_min[i], hitboxes.raw_max[i], angles, r, g, b, 100, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -492,7 +515,7 @@ void RewindState::to_tick(u32 t) {
|
||||
|
||||
auto local_player = Player::local();
|
||||
|
||||
for (auto entity : IFace<EntList>()->get_range(IFace<Engine>()->max_clients() + 1)) {
|
||||
for (auto entity : iface::ent_list->get_range(iface::engine->max_clients() + 1)) {
|
||||
if (!entity->is_valid()) continue;
|
||||
|
||||
if (auto p = entity->to_player()) {
|
||||
|
@ -61,7 +61,7 @@ void paint() {
|
||||
|
||||
show_nodes(profiler::find_root_node(), {0, 100, 0});
|
||||
|
||||
if (!IFace<Engine>()->in_game()) return;
|
||||
if (!iface::engine->in_game()) return;
|
||||
|
||||
auto local_player = Player::local();
|
||||
|
||||
@ -70,7 +70,7 @@ void paint() {
|
||||
auto friendly_color = draw::Color(hex::dword(doghook_esp_friendly.to_string()));
|
||||
auto enemy_color = draw::Color(hex::dword(doghook_esp_enemy.to_string()));
|
||||
|
||||
for (auto e : IFace<EntList>()->get_range()) {
|
||||
for (auto e : iface::ent_list->get_range()) {
|
||||
if (!e->is_valid()) continue;
|
||||
|
||||
if (e->dormant()) continue;
|
||||
|
@ -44,7 +44,7 @@ void create_move(UserCmd *cmd) {
|
||||
if (doghook_lagexploit_doom) {
|
||||
// doesnt really work as intended
|
||||
static auto i = 0;
|
||||
auto server_time = IFace<Globals>()->ticks_to_time(local->tick_base());
|
||||
auto server_time = iface::globals->ticks_to_time(local->tick_base());
|
||||
static auto next_attack = 0.0f;
|
||||
|
||||
if (!next_attack || i == 0 || current_wep_id != last_wep_id) {
|
||||
@ -92,8 +92,8 @@ void create_move(UserCmd *cmd) {
|
||||
|
||||
last_wep_id = current_wep_id;
|
||||
|
||||
if (IFace<InputSystem>()->is_button_down((ButtonCode)(int)doghook_lagexploit_key))
|
||||
if (iface::input_system->is_button_down((ButtonCode)(int)doghook_lagexploit_key))
|
||||
numsequnce = doghook_lagexploit_ticks * (doghook_lagexploit_backup ? 90 : 66);
|
||||
IFace<Engine>()->net_channel_info()->out_sequence() += numsequnce;
|
||||
iface::engine->net_channel_info()->out_sequence() += numsequnce;
|
||||
};
|
||||
}; // namespace lagexploit
|
||||
|
@ -84,7 +84,7 @@ void create_move(sdk::UserCmd *cmd) {
|
||||
}
|
||||
|
||||
void update(float frametime) {
|
||||
if (!IFace<Engine>()->in_game()) return;
|
||||
if (!iface::engine->in_game()) return;
|
||||
}
|
||||
|
||||
} // namespace misc
|
||||
|
10
src/modules/resolver.cc
Normal file
10
src/modules/resolver.cc
Normal file
@ -0,0 +1,10 @@
|
||||
#include <precompiled.hh>
|
||||
|
||||
#include <sdk/sdk.hh>
|
||||
|
||||
using namespace sdk;
|
||||
|
||||
namespace resolver {
|
||||
void create_move(sdk::UserCmd *) {
|
||||
}
|
||||
} // namespace resolver
|
9
src/modules/resolver.hh
Normal file
9
src/modules/resolver.hh
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
namespace sdk {
|
||||
class UserCmd;
|
||||
}
|
||||
|
||||
namespace resolver {
|
||||
void create_move(sdk::UserCmd *cmd);
|
||||
}
|
@ -21,7 +21,7 @@ internal_checker::ClassIDChecker::ClassIDChecker(const char *name, const u32 val
|
||||
}
|
||||
|
||||
static auto find_class_id(const char *name) {
|
||||
for (auto client_class = IFace<Client>()->get_all_classes();
|
||||
for (auto client_class = iface::client->get_all_classes();
|
||||
client_class != nullptr;
|
||||
client_class = client_class->next)
|
||||
if (strcmp(client_class->network_name, name) == 0) return client_class->class_id;
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
create_base(name, help_string, flags);
|
||||
}
|
||||
virtual ~ConCommandBase() {
|
||||
IFace<Cvar>()->unregister_command(this);
|
||||
iface::cvar->unregister_command(this);
|
||||
}
|
||||
|
||||
virtual bool is_command() const { return false; }
|
||||
@ -43,7 +43,7 @@ public:
|
||||
}
|
||||
|
||||
virtual int get_dll_identifier() const {
|
||||
if (dll_identifier == -1) dll_identifier = IFace<Cvar>()->allocate_dll_identifier();
|
||||
if (dll_identifier == -1) dll_identifier = iface::cvar->allocate_dll_identifier();
|
||||
return dll_identifier;
|
||||
}
|
||||
|
||||
@ -62,13 +62,13 @@ public:
|
||||
|
||||
// We might not have Cvar here (global variables)
|
||||
|
||||
if (auto cvar = IFace<Cvar>() && can_init_convars_at_construction_time) {
|
||||
IFace<Cvar>()->register_command(this);
|
||||
if (auto cvar = iface::cvar && can_init_convars_at_construction_time) {
|
||||
iface::cvar->register_command(this);
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool init() {
|
||||
IFace<Cvar>()->register_command(this);
|
||||
iface::cvar->register_command(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ ConvarBase::~ConvarBase() {
|
||||
}
|
||||
|
||||
void ConvarBase::init_all() {
|
||||
assert(IFace<sdk::Cvar>());
|
||||
assert(iface::cvar);
|
||||
|
||||
sdk::can_init_convars_at_construction_time = true;
|
||||
|
||||
@ -350,7 +350,7 @@ void ConvarBase::init_all() {
|
||||
while (c != nullptr) {
|
||||
auto next = c->next;
|
||||
|
||||
IFace<sdk::Cvar>()->register_command(c);
|
||||
iface::cvar->register_command(c);
|
||||
|
||||
c = next;
|
||||
}
|
||||
@ -363,11 +363,11 @@ void ConvarBase::init_all() {
|
||||
// TODO: this needs a better method of keeping in sync with the
|
||||
// Interface declaration in doghook.cc
|
||||
Cvar *get_or_init_cvar() {
|
||||
if (IFace<Cvar>().get() == nullptr) {
|
||||
IFace<Cvar>().set_from_interface("vstdlib", "VEngineCvar");
|
||||
if (iface::cvar.get() == nullptr) {
|
||||
iface::cvar.set_from_interface("vstdlib", "VEngineCvar");
|
||||
}
|
||||
|
||||
return IFace<Cvar>().get();
|
||||
return iface::cvar.get();
|
||||
}
|
||||
|
||||
ConvarWrapper::ConvarWrapper(const char *name) {
|
||||
@ -421,6 +421,6 @@ ConvarWrapper ConvarWrapper::Range::Iterator::operator++() {
|
||||
return ConvarWrapper(const_cast<ConCommandBase *>(current));
|
||||
}
|
||||
|
||||
ConvarWrapper::Range::Iterator ConvarWrapper::Range::begin() const { return Iterator(IFace<Cvar>()->root_node()); }
|
||||
ConvarWrapper::Range::Iterator ConvarWrapper::Range::begin() const { return Iterator(iface::cvar->root_node()); }
|
||||
|
||||
} // namespace sdk
|
||||
|
@ -73,7 +73,7 @@ void init(RenderTarget t) {
|
||||
#endif
|
||||
|
||||
// set up surface interfaces
|
||||
IFace<EngineVgui>().set_from_interface("engine", "VEngineVGui");
|
||||
iface::engine_vgui.set_from_interface("engine", "VEngineVGui");
|
||||
IFace<Surface>().set_from_interface("vguimatsurface", "VGUI_Surface030");
|
||||
|
||||
current_render_target = RenderTarget::surface;
|
||||
@ -117,7 +117,7 @@ void finish() {
|
||||
|
||||
bool world_to_screen(const math::Vector &world, math::Vector &screen) {
|
||||
if (is_surface()) {
|
||||
return !IFace<DebugOverlay>()->screen_position(world, screen);
|
||||
return !iface::overlay->screen_position(world, screen);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -121,6 +121,8 @@ public:
|
||||
virtual void post_render() override {}
|
||||
};
|
||||
|
||||
// TODO: GameSystem could be in a namespace...
|
||||
|
||||
class GameSystem : public CBaseGameSystemPerFrame {
|
||||
GameSystem *next;
|
||||
|
||||
|
@ -62,6 +62,12 @@ public:
|
||||
}
|
||||
|
||||
~HookInstance() {
|
||||
#if doghook_platform_windows()
|
||||
// Check that instance is still alive
|
||||
if (!signature::resolve_library((u32)instance) || !signature::resolve_library(*(u32 *)instance)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
replace_table_pointer(instance, original_table);
|
||||
|
||||
assert(new_table);
|
||||
|
@ -11,6 +11,8 @@ class Interface {
|
||||
static T *value;
|
||||
|
||||
public:
|
||||
Interface() = default;
|
||||
|
||||
// interface name should be the name of the interface
|
||||
// without the version number
|
||||
// e.g. "VClient017" -> "VClient"
|
||||
@ -25,11 +27,15 @@ public:
|
||||
value = new_value;
|
||||
}
|
||||
|
||||
T *& operator-> () {
|
||||
T *operator->() {
|
||||
return get();
|
||||
}
|
||||
|
||||
static T *&get() {
|
||||
return value;
|
||||
}
|
||||
|
||||
T *& get() {
|
||||
operator T *() {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ Netvar::Tree::Tree() {
|
||||
void Netvar::Tree::init() {
|
||||
if (prop_tree.size() > 0) return;
|
||||
|
||||
auto cc = IFace<Client>()->get_all_classes();
|
||||
auto cc = iface::client->get_all_classes();
|
||||
while (cc != nullptr) {
|
||||
const auto new_node = std::make_shared<Node>();
|
||||
new_node->p = nullptr;
|
||||
|
@ -12,7 +12,7 @@
|
||||
using namespace sdk;
|
||||
|
||||
Player *Player::local() {
|
||||
return static_cast<Player *>(IFace<EntList>()->entity(IFace<Engine>()->local_player_index()));
|
||||
return static_cast<Player *>(iface::ent_list->entity(iface::engine->local_player_index()));
|
||||
}
|
||||
|
||||
static auto health = Netvar("DT_BasePlayer", "m_iHealth");
|
||||
@ -119,7 +119,7 @@ int & Player::tick_base() {
|
||||
|
||||
static auto active_weapon_handle = Netvar("DT_BaseCombatCharacter", "m_hActiveWeapon");
|
||||
Weapon * Player::active_weapon() {
|
||||
return static_cast<Weapon *>(IFace<EntList>()->from_handle(::active_weapon_handle.get<EntityHandle>(this)));
|
||||
return static_cast<Weapon *>(iface::ent_list->from_handle(::active_weapon_handle.get<EntityHandle>(this)));
|
||||
}
|
||||
|
||||
static auto sim_time = Netvar("DT_BaseEntity", "m_flSimulationTime");
|
||||
@ -221,7 +221,7 @@ const ModelHandle *Player::model_handle() {
|
||||
}
|
||||
|
||||
const StudioModel *Player::studio_model() {
|
||||
return IFace<ModelInfo>()->studio_model(this->model_handle());
|
||||
return iface::model_info->studio_model(this->model_handle());
|
||||
}
|
||||
|
||||
static auto hitboxes_internal(Player *player, const StudioModel *model, PlayerHitboxes *hitboxes, bool create_pose) {
|
||||
@ -229,7 +229,7 @@ static auto hitboxes_internal(Player *player, const StudioModel *model, PlayerHi
|
||||
|
||||
// #define BONE_USED_BY_ANYTHING 0x0007FF00
|
||||
// #define BONE_USED_BY_HITBOX 0x00000100
|
||||
bool success = player->bone_transforms(bone_to_world, 128, 0x00000100, IFace<Globals>()->curtime);
|
||||
bool success = player->bone_transforms(bone_to_world, 128, 0x00000100, iface::globals->curtime);
|
||||
assert(success);
|
||||
|
||||
std::memcpy(hitboxes->bone_to_world, bone_to_world, 128 * sizeof(math::Matrix3x4));
|
||||
@ -283,7 +283,7 @@ u32 Player::hitboxes(PlayerHitboxes *hitboxes_out, bool create_pose) {
|
||||
|
||||
PlayerInfo Player::info() {
|
||||
PlayerInfo info;
|
||||
auto found = IFace<Engine>()->player_info(index(), &info);
|
||||
auto found = iface::engine->player_info(index(), &info);
|
||||
|
||||
if (!found) {
|
||||
info.user_id = -1;
|
||||
|
@ -5,11 +5,30 @@
|
||||
|
||||
namespace sdk {
|
||||
i32 Globals::time_to_ticks(float time) {
|
||||
return static_cast<i32>((0.5f + (time / IFace<Globals>()->interval_per_tick)));
|
||||
return static_cast<i32>((0.5f + (time / iface::globals->interval_per_tick)));
|
||||
}
|
||||
|
||||
float Globals::ticks_to_time(i32 ticks) {
|
||||
return ticks * IFace<Globals>()->interval_per_tick;
|
||||
return ticks * iface::globals->interval_per_tick;
|
||||
}
|
||||
|
||||
namespace iface {
|
||||
IFace<Client> client;
|
||||
IFace<ClientMode> client_mode;
|
||||
IFace<Globals> globals;
|
||||
IFace<Engine> engine;
|
||||
IFace<EntList> ent_list;
|
||||
IFace<Input> input;
|
||||
IFace<Cvar> cvar;
|
||||
IFace<Trace> trace;
|
||||
IFace<ModelInfo> model_info;
|
||||
IFace<DebugOverlay> overlay;
|
||||
IFace<PlayerInfoManager> info_manager;
|
||||
IFace<MoveHelper> move_helper;
|
||||
IFace<Prediction> prediction;
|
||||
IFace<GameMovement> game_movement;
|
||||
IFace<EngineVgui> engine_vgui;
|
||||
IFace<InputSystem> input_system;
|
||||
} // namespace iface
|
||||
|
||||
} // namespace sdk
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "trace.hh"
|
||||
|
||||
namespace sdk {
|
||||
class Player;
|
||||
|
||||
class UserCmd {
|
||||
public:
|
||||
virtual ~UserCmd(){};
|
||||
@ -515,4 +517,23 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
namespace iface {
|
||||
extern IFace<Client> client;
|
||||
extern IFace<ClientMode> client_mode;
|
||||
extern IFace<Globals> globals;
|
||||
extern IFace<Engine> engine;
|
||||
extern IFace<EntList> ent_list;
|
||||
extern IFace<Input> input;
|
||||
extern IFace<Cvar> cvar;
|
||||
extern IFace<Trace> trace;
|
||||
extern IFace<ModelInfo> model_info;
|
||||
extern IFace<DebugOverlay> overlay;
|
||||
extern IFace<PlayerInfoManager> info_manager;
|
||||
extern IFace<Prediction> prediction;
|
||||
extern IFace<MoveHelper> move_helper;
|
||||
extern IFace<GameMovement> game_movement;
|
||||
extern IFace<EngineVgui> engine_vgui;
|
||||
extern IFace<InputSystem> input_system;
|
||||
} // namespace iface
|
||||
|
||||
} // namespace sdk
|
||||
|
@ -151,6 +151,18 @@ void *signature::resolve_library(const char *name) {
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
void *signature::resolve_library(u32 address) {
|
||||
#if doghook_platform_windows()
|
||||
HMODULE h;
|
||||
if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
||||
(LPCTSTR)address, &h)) {
|
||||
return h;
|
||||
}
|
||||
#else
|
||||
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
void *signature::resolve_import(void *handle, const char *name) {
|
||||
#if doghook_platform_windows()
|
||||
return reinterpret_cast<void *>(GetProcAddress(static_cast<HMODULE>(handle), name));
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
namespace signature {
|
||||
void *resolve_library(const char *name);
|
||||
void *resolve_library(u32 address);
|
||||
void *resolve_import(void *handle, const char *name);
|
||||
|
||||
u8 *find_pattern(const char *module, const char *pattern);
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
bool trace::Filter::should_hit_entity(sdk::Entity *handle_entity, int contents_mask) {
|
||||
auto handle = handle_entity->to_handle();
|
||||
auto real_entity = IFace<sdk::EntList>()->from_handle(handle);
|
||||
auto real_entity = sdk::iface::ent_list->from_handle(handle);
|
||||
|
||||
if (real_entity == nullptr) return false;
|
||||
|
||||
|
@ -8,11 +8,11 @@
|
||||
|
||||
// helpers for calling virtual functions
|
||||
namespace vfunc {
|
||||
inline void ** get_table(void *inst, u32 offset) {
|
||||
inline void **get_table(void *inst, u32 offset) {
|
||||
return *reinterpret_cast<void ***>(reinterpret_cast<u8 *>(inst) + offset);
|
||||
}
|
||||
|
||||
inline const void ** get_table(const void *inst, u32 offset) {
|
||||
inline const void **get_table(const void *inst, u32 offset) {
|
||||
return *reinterpret_cast<const void ***>(
|
||||
reinterpret_cast<u8 *>(
|
||||
const_cast<void *>(inst)) +
|
||||
|
@ -18,7 +18,7 @@ float Weapon::next_secondary_attack() {
|
||||
}
|
||||
|
||||
bool Weapon::can_shoot(u32 tickbase) {
|
||||
return tickbase * IFace<Globals>()->interval_per_tick > next_primary_attack();
|
||||
return tickbase * iface::globals->interval_per_tick > next_primary_attack();
|
||||
}
|
||||
|
||||
auto clip1 = Netvar("DT_BaseCombatWeapon", "LocalWeaponData", "m_iClip1");
|
||||
|
Reference in New Issue
Block a user