129 lines
4.3 KiB
C++
129 lines
4.3 KiB
C++
#pragma once
|
|
|
|
#define DECLARE_ORIGINAL(F) inline decltype(&F) F = nullptr;
|
|
|
|
namespace hooks
|
|
{
|
|
enum idx : uint32_t
|
|
{
|
|
HOOK_IDX_INPUT_CREATE_MOVE = 4,
|
|
HOOK_IDX_CLIENT_CREATE_MOVE = 27,
|
|
HOOK_IDX_START_TRACK_PREDICTION_ERRORS = 4,
|
|
HOOK_IDX_FINISH_TRACK_PREDICTION_ERRORS = 5,
|
|
HOOK_IDX_GET_VIEW_ANGLES = 60,
|
|
HOOK_IDX_SET_VIEW_ANGLES = 61,
|
|
HOOK_IDX_WRITE_USER_CMD_DELTA_TO_BUFFER = 6,
|
|
HOOK_IDX_VGUI_PAINT = 24,
|
|
HOOK_IDX_FRAME_STAGE_NOTIFY = 55,
|
|
HOOK_IDX_LOOKUP_FILE = 80,
|
|
HOOK_IDX_GET_PLAYER_INFO = 24,
|
|
};
|
|
|
|
struct data_t
|
|
{
|
|
size_t m_backup_length;
|
|
void* m_target;
|
|
void* m_handler;
|
|
void* m_original;
|
|
};
|
|
|
|
namespace d
|
|
{
|
|
inline data_t get_proc_addr{};
|
|
inline data_t enum_windows{};
|
|
}
|
|
|
|
namespace mgr
|
|
{
|
|
inline c_vfunc_hook base_client{};
|
|
inline c_vfunc_hook engine_client{};
|
|
inline c_vfunc_hook engine_vgui{};
|
|
inline c_vfunc_hook game_movement{};
|
|
inline c_vfunc_hook input{};
|
|
}
|
|
|
|
extern bool initialize_early();
|
|
extern bool initialize();
|
|
extern bool setup_detours_early();
|
|
extern bool setup_detours();
|
|
extern bool setup_detours_api();
|
|
extern bool setup_detours_ac();
|
|
extern bool setup_vmt();
|
|
extern void shutdown();
|
|
|
|
extern bool register_(hooks::data_t& data, bool resolve_jt = false, bool small_fn = false);
|
|
|
|
extern void __fastcall frame_stage_notify(void* this_ptr, int stage);
|
|
extern void __fastcall create_move(void* this_ptr, int seq_nr, float sample_time, bool active);
|
|
extern bool __fastcall write_user_cmd_delta_to_buffer(void* this_ptr, __int64 unused_0, __int64 pBuffer2, __int64 from_, int to);
|
|
extern int __fastcall vgui_paint(void* this_ptr, int mode);
|
|
extern int64_t __fastcall unk0(void* this_ptr);
|
|
extern void __fastcall write_user_cmd(void* buf, respawn::user_cmd_t* to, respawn::user_cmd_t* from);
|
|
extern void __fastcall paint_fn(void* this_ptr, uint8_t* unk0, int64_t unk1);
|
|
extern void __fastcall view_render_start(void* this_ptr);
|
|
extern void __fastcall cl_move(void);
|
|
extern void __fastcall cl_move_send(__int64 a1, __int64 a2, __int64 a3);
|
|
extern bool __fastcall lookup_file(void* this_ptr, const char* name, __int64 a3);
|
|
extern bool __fastcall get_player_info(void* this_ptr, int index, respawn::player_info_t* buffer);
|
|
|
|
namespace api
|
|
{
|
|
extern void* __fastcall add_veh_handler(ulong first, void* handler);
|
|
extern ulong __fastcall remove_veh_handler(void* handle);
|
|
extern ulong __fastcall query_info_thread(
|
|
_handle thread, THREADINFOCLASS info_class,
|
|
void* info_buffer, ulong info_length,
|
|
ulong* return_length
|
|
);
|
|
extern int __fastcall get_thread_context(_handle thread, CONTEXT* ctx);
|
|
extern ulong __fastcall device_ioctl_file(
|
|
_handle file_handle, _handle event, PIO_APC_ROUTINE apc_routine, PVOID apc_ctx,
|
|
PIO_STATUS_BLOCK iosb, ulong ioctl_code, PVOID input_buffer,
|
|
ULONG input_buffer_len, PVOID output_buffer, ULONG output_buffer_len
|
|
);
|
|
|
|
extern int __fastcall translate_message(PMSG msg);
|
|
|
|
extern void __fastcall user_exception_dispatcher(PEXCEPTION_RECORD record, PCONTEXT context);
|
|
}
|
|
|
|
namespace ac
|
|
{
|
|
extern bool __fastcall fetch_suspect_strings(void* a1, void* a2);
|
|
extern bool __fastcall fetch_suspect_system_calls(void* a1, void* a2);
|
|
extern char __fastcall detect_suspect_memory_regions(void* a1);
|
|
}
|
|
|
|
namespace o
|
|
{
|
|
DECLARE_ORIGINAL(frame_stage_notify);
|
|
DECLARE_ORIGINAL(create_move);
|
|
DECLARE_ORIGINAL(write_user_cmd_delta_to_buffer);
|
|
DECLARE_ORIGINAL(vgui_paint);
|
|
DECLARE_ORIGINAL(write_user_cmd);
|
|
DECLARE_ORIGINAL(paint_fn);
|
|
DECLARE_ORIGINAL(view_render_start);
|
|
DECLARE_ORIGINAL(cl_move);
|
|
DECLARE_ORIGINAL(cl_move_send);
|
|
DECLARE_ORIGINAL(lookup_file);
|
|
DECLARE_ORIGINAL(get_player_info);
|
|
|
|
namespace api_
|
|
{
|
|
inline decltype(api::add_veh_handler)* add_veh_handler = nullptr;
|
|
inline decltype(api::remove_veh_handler)* remove_veh_handler = nullptr;
|
|
inline decltype(api::query_info_thread)* query_info_thread = nullptr;
|
|
inline decltype(api::get_thread_context)* get_thread_context = nullptr;
|
|
inline decltype(api::device_ioctl_file)* device_ioctl_file = nullptr;
|
|
inline decltype(api::translate_message)* translate_message = nullptr;
|
|
}
|
|
|
|
namespace ac_
|
|
{
|
|
inline decltype(ac::fetch_suspect_strings)* fetch_suspect_string = nullptr;
|
|
inline decltype(ac::fetch_suspect_system_calls)* fetch_suspect_system_calls = nullptr;
|
|
inline decltype(ac::detect_suspect_memory_regions)* detect_suspect_memory_regions = nullptr;
|
|
}
|
|
}
|
|
}
|