diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-06 16:21:27 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-06 16:21:27 +0100 |
| commit | 3c27e7ce262e612fa75c6e6f090e04041a688861 (patch) | |
| tree | 1c2bfd6accea27904dc9d81a61624905b220a8a0 | |
| parent | Hooks: central vtable install with restore support (diff) | |
| download | hl2h-3c27e7ce262e612fa75c6e6f090e04041a688861.tar.gz hl2h-3c27e7ce262e612fa75c6e6f090e04041a688861.zip | |
Headers: split the shared header by declaration group
hl2h.h becomes an umbrella over core.h (logging, init stage, module snapshots,
interfaces, netvars, CUserCmd, engine constants, vector math), settings.h
(feature ids, feature state, user settings) and features.h (cross-module
declarations). Translation units keep including hl2h.h, so this only moves
declarations.
| -rw-r--r-- | FIX_PLAN.md | 10 | ||||
| -rw-r--r-- | src/core.h | 205 | ||||
| -rw-r--r-- | src/features.h | 136 | ||||
| -rw-r--r-- | src/hl2h.h | 445 | ||||
| -rw-r--r-- | src/settings.h | 117 |
5 files changed, 477 insertions, 436 deletions
diff --git a/FIX_PLAN.md b/FIX_PLAN.md index 3ebbd17..f2dec60 100644 --- a/FIX_PLAN.md +++ b/FIX_PLAN.md | |||
| @@ -796,6 +796,14 @@ installs happen from the setup, game and paint threads. `hooks_restore_all()` | |||
| 796 | puts every interface back, which previously was impossible. Client, CInput, | 796 | puts every interface back, which previously was impossible. Client, CInput, |
| 797 | IVModelRender, IStudioRender and ISurface all go through it now. | 797 | IVModelRender, IStudioRender and ISurface all go through it now. |
| 798 | 798 | ||
| 799 | ### Batch 7 — header split | ||
| 800 | |||
| 801 | `hl2h.h` is now an umbrella over `core.h` (logging, init stage, module | ||
| 802 | snapshots, interfaces, netvars, CUserCmd, engine constants, vector math), | ||
| 803 | `settings.h` (feature ids, feature state, every user setting) and `features.h` | ||
| 804 | (cross-module declarations), plus `overlay.h` and `hooks.h`. Translation units | ||
| 805 | still include `hl2h.h`, so this is a declaration-organisation change only. | ||
| 806 | |||
| 799 | ### Known remaining work | 807 | ### Known remaining work |
| 800 | 808 | ||
| 801 | Deliberately deferred, with reasons: | 809 | Deliberately deferred, with reasons: |
| @@ -808,7 +816,7 @@ Deliberately deferred, with reasons: | |||
| 808 | - **P3-2 declarative settings table** — large rewrite of `config_save`, | 816 | - **P3-2 declarative settings table** — large rewrite of `config_save`, |
| 809 | `config_load`, `config_reset_defaults` and `build_cards`. It can regress | 817 | `config_load`, `config_reset_defaults` and `build_cards`. It can regress |
| 810 | config persistence, so it should follow an in-game pass. | 818 | config persistence, so it should follow an in-game pass. |
| 811 | - **P3-3 `esp.cpp` split**, **P3-5 header split** — | 819 | - **P3-3 `esp.cpp` split** — |
| 812 | behaviour-neutral moves with a large diff; best done after the current build | 820 | behaviour-neutral moves with a large diff; best done after the current build |
| 813 | has been validated in-game so a regression is easy to bisect. | 821 | has been validated in-game so a regression is easy to bisect. |
| 814 | 822 | ||
diff --git a/src/core.h b/src/core.h new file mode 100644 index 0000000..320b62b --- /dev/null +++ b/src/core.h | |||
| @@ -0,0 +1,205 @@ | |||
| 1 | #ifndef HL2H_CORE_H | ||
| 2 | #define HL2H_CORE_H | ||
| 3 | |||
| 4 | #include <cstdint> | ||
| 5 | #include <cstdio> | ||
| 6 | #include <cstring> | ||
| 7 | #include <string> | ||
| 8 | #include <vector> | ||
| 9 | |||
| 10 | #include <dlfcn.h> | ||
| 11 | #include <pthread.h> | ||
| 12 | #include <unistd.h> | ||
| 13 | |||
| 14 | // Shared float-precision constant. More digits than a float can hold are | ||
| 15 | // rounded at compile time and have no runtime cost; a coarse value would only | ||
| 16 | // hurt angular accuracy, never performance. | ||
| 17 | constexpr float PI_F = 3.14159265f; | ||
| 18 | |||
| 19 | // --------------------------------------------------------------------------- | ||
| 20 | // logging | ||
| 21 | // --------------------------------------------------------------------------- | ||
| 22 | |||
| 23 | void logf(const char *fmt, ...); | ||
| 24 | void logd(const char *fmt, ...); // debug-only (HL2H_DEBUG=1) | ||
| 25 | |||
| 26 | // --------------------------------------------------------------------------- | ||
| 27 | // init readiness | ||
| 28 | // --------------------------------------------------------------------------- | ||
| 29 | // | ||
| 30 | // setup_thread runs detached while the game threads are already live, and some | ||
| 31 | // hooks are installed lazily from the game thread. Hooks therefore always stay | ||
| 32 | // installed but pass straight through to the original until setup reaches | ||
| 33 | // INIT_LIVE, so the game can never observe half-initialised state. INIT_FAILED | ||
| 34 | // is terminal: the cheat stays inert instead of half-working. | ||
| 35 | enum { | ||
| 36 | INIT_FAILED = -1, | ||
| 37 | INIT_NONE = 0, | ||
| 38 | INIT_INTERFACES = 1, // modules + interfaces + netvars resolved | ||
| 39 | INIT_READY = 2, // config loaded, ISurface/fonts resolved | ||
| 40 | INIT_LIVE = 3 // hooks may run their bodies | ||
| 41 | }; | ||
| 42 | void init_set_stage(int stage); | ||
| 43 | int init_stage(); // acquire load | ||
| 44 | inline bool init_live() { return init_stage() == INIT_LIVE; } | ||
| 45 | |||
| 46 | // Clone a vtable into a new array, preserving the Itanium ABI header at | ||
| 47 | // [-2]/[-1] (offset-to-top and typeinfo) so RTTI on the hooked object still | ||
| 48 | // works. Returns the slot-0 pointer to install (i.e. the clone + 2). | ||
| 49 | void **vtable_clone(void *iface, size_t slots); | ||
| 50 | |||
| 51 | // --------------------------------------------------------------------------- | ||
| 52 | // on-screen toasts | ||
| 53 | // --------------------------------------------------------------------------- | ||
| 54 | |||
| 55 | enum ToastLevel { TOAST_INFO = 0, TOAST_WARN, TOAST_ERROR }; | ||
| 56 | void toastf(int level, const char *fmt, ...); | ||
| 57 | bool gui_toasts_active(); | ||
| 58 | void gui_draw_toasts(); | ||
| 59 | |||
| 60 | // --------------------------------------------------------------------------- | ||
| 61 | // module discovery | ||
| 62 | // --------------------------------------------------------------------------- | ||
| 63 | |||
| 64 | struct Module { | ||
| 65 | struct Range { | ||
| 66 | uintptr_t lo, hi; | ||
| 67 | bool file; | ||
| 68 | }; | ||
| 69 | std::vector<Range> ranges; | ||
| 70 | std::string path; | ||
| 71 | bool valid() const { return !ranges.empty(); } | ||
| 72 | bool contains(uintptr_t p) const { | ||
| 73 | for (auto &r : ranges) | ||
| 74 | if (p >= r.lo && p < r.hi) | ||
| 75 | return true; | ||
| 76 | return false; | ||
| 77 | } | ||
| 78 | }; | ||
| 79 | // Immutable module snapshots. A reader gets a reference that stays valid for | ||
| 80 | // the whole process: find_modules() publishes a new snapshot instead of | ||
| 81 | // mutating the old one, and retired snapshots are intentionally never freed, so | ||
| 82 | // a concurrent refresh can never invalidate a reference already in use. | ||
| 83 | const Module &mod_client(); | ||
| 84 | const Module &mod_engine(); | ||
| 85 | const Module &mod_server(); | ||
| 86 | |||
| 87 | // True only when the whole byte range [p, p+n) lies inside one known module | ||
| 88 | // range. Use before dereferencing pointers read out of engine memory. | ||
| 89 | bool module_range(uintptr_t p, size_t n); | ||
| 90 | |||
| 91 | // --------------------------------------------------------------------------- | ||
| 92 | // game interfaces | ||
| 93 | // --------------------------------------------------------------------------- | ||
| 94 | |||
| 95 | using CreateInterfaceFn = void *(*)(const char *, int *); | ||
| 96 | |||
| 97 | struct GameInterfaces { | ||
| 98 | void *client = nullptr; | ||
| 99 | void *entitylist = nullptr; | ||
| 100 | void *engine = nullptr; | ||
| 101 | void *modelinfo = nullptr; // IVModelInfoClient006 (model index -> model name) | ||
| 102 | void *engineserver = nullptr; // IVEngineServer021 (edict access, incl. server entities) | ||
| 103 | void *debugoverlay = nullptr; // IVDebugOverlay003 (engine-accurate world->screen) | ||
| 104 | void *enginetrace = nullptr; // EngineTraceClient003 (world vischeck) | ||
| 105 | void *cvar = nullptr; // VEngineCvar004 (mat_fullbright etc.) | ||
| 106 | void *modelrender = nullptr; // VEngineModel016 (chams) | ||
| 107 | void *renderview = nullptr; // VEngineRenderView014 (alpha/color modulation) | ||
| 108 | }; | ||
| 109 | extern GameInterfaces g_iface; | ||
| 110 | |||
| 111 | #define VTABLE(obj) (*(void ***)(obj)) | ||
| 112 | template <typename Fn> inline Fn vfunc(void *obj, size_t idx) { | ||
| 113 | return reinterpret_cast<Fn>(VTABLE(obj)[idx]); | ||
| 114 | } | ||
| 115 | |||
| 116 | // --------------------------------------------------------------------------- | ||
| 117 | // netvars | ||
| 118 | // --------------------------------------------------------------------------- | ||
| 119 | struct NetVars { | ||
| 120 | int flags = -1; | ||
| 121 | int velocity = -1; | ||
| 122 | int movetype = -1; | ||
| 123 | int health = -1; | ||
| 124 | int maxhealth = -1; | ||
| 125 | int teamnum = -1; | ||
| 126 | int origin = -1; | ||
| 127 | int viewoffset = -1; | ||
| 128 | int mins = -1; | ||
| 129 | int maxs = -1; | ||
| 130 | int lifestate = -1; | ||
| 131 | int modelindex = -1; | ||
| 132 | int absvelocity = -1; // client C_BaseEntity::m_vecAbsVelocity (prediction) | ||
| 133 | int activeweapon = -1; // client m_hActiveWeapon handle | ||
| 134 | int owner = -1; // client m_hOwnerEntity handle | ||
| 135 | int weapon_owner = -1; // client m_hOwner handle (C_BaseCombatWeapon) | ||
| 136 | int clr_render = -1; // client m_clrRender (entity render colour) | ||
| 137 | int punch = -1; // client m_vecPunchAngle (aim punch) | ||
| 138 | int default_fov = -1; // client m_iDefaultFOV (camera fov) | ||
| 139 | int dmg_radius = -1; // client C_BaseGrenade::m_DmgRadius | ||
| 140 | int my_weapons = -1; // client m_hMyWeapons[48] array base | ||
| 141 | int ammo = -1; // client m_iAmmo[] array base | ||
| 142 | // ponytail: mins/maxs may be absent from some HL2 netvar tables; esp.cpp falls back to h=72 | ||
| 143 | bool ok() const { return flags >= 0 && velocity >= 0 && movetype >= 0; } | ||
| 144 | // ponytail: m_iMaxHealth isn't a netvar in HL2 SP; esp.cpp falls back to 100. | ||
| 145 | // m_iHealth only ever updates for players — NPCs are detected via m_lifeState. | ||
| 146 | bool esp_ok() const { return ok() && health >= 0 && teamnum >= 0 && origin >= 0 && viewoffset >= 0; } | ||
| 147 | }; | ||
| 148 | extern NetVars g_net; | ||
| 149 | |||
| 150 | // --------------------------------------------------------------------------- | ||
| 151 | // CInput | ||
| 152 | // --------------------------------------------------------------------------- | ||
| 153 | |||
| 154 | extern uintptr_t g_input; | ||
| 155 | |||
| 156 | // --------------------------------------------------------------------------- | ||
| 157 | // console output | ||
| 158 | // --------------------------------------------------------------------------- | ||
| 159 | |||
| 160 | extern void (*g_conmsg)(const char *, ...); | ||
| 161 | |||
| 162 | // --------------------------------------------------------------------------- | ||
| 163 | // CUserCmd | ||
| 164 | // --------------------------------------------------------------------------- | ||
| 165 | |||
| 166 | struct CUserCmd { | ||
| 167 | void *vtable; | ||
| 168 | int command_number; | ||
| 169 | int tick_count; | ||
| 170 | float viewangles[3]; | ||
| 171 | float forwardmove; | ||
| 172 | float sidemove; | ||
| 173 | float upmove; | ||
| 174 | int buttons; | ||
| 175 | uint8_t impulse; | ||
| 176 | int weaponselect; | ||
| 177 | int weaponsubtype; | ||
| 178 | int random_seed; | ||
| 179 | short mousedx; | ||
| 180 | short mousedy; | ||
| 181 | bool hasbeenpredicted; | ||
| 182 | }; | ||
| 183 | |||
| 184 | // --------------------------------------------------------------------------- | ||
| 185 | // engine constants | ||
| 186 | // --------------------------------------------------------------------------- | ||
| 187 | |||
| 188 | enum { IN_ATTACK = 1 << 0, IN_JUMP = 1 << 1, IN_DUCK = 1 << 2, IN_USE = 1 << 5, IN_ATTACK2 = 1 << 11, IN_SPEED = 1 << 17 }; | ||
| 189 | enum { FL_ONGROUND = 1 << 0, FL_DUCKING = 1 << 1, FL_INWATER = 1 << 9 }; | ||
| 190 | enum { MOVETYPE_WALK = 2, MOVETYPE_NOCLIP = 8, MOVETYPE_LADDER = 9 }; | ||
| 191 | |||
| 192 | // --------------------------------------------------------------------------- | ||
| 193 | // vector math | ||
| 194 | // --------------------------------------------------------------------------- | ||
| 195 | |||
| 196 | struct Vector { float x, y, z; }; | ||
| 197 | struct QAngle { float x, y, z; }; | ||
| 198 | // camera state captured each CreateMove (used by ESP / future aimbot) | ||
| 199 | extern Vector g_cam_eye; | ||
| 200 | extern Vector g_cam_view; | ||
| 201 | QAngle vector_angles(const Vector &forward); | ||
| 202 | Vector angle_forward_vector(const QAngle &angles); | ||
| 203 | float getfov(const QAngle &my_view, const QAngle &aim_ang); | ||
| 204 | |||
| 205 | #endif | ||
diff --git a/src/features.h b/src/features.h new file mode 100644 index 0000000..6890aa6 --- /dev/null +++ b/src/features.h | |||
| @@ -0,0 +1,136 @@ | |||
| 1 | #ifndef HL2H_FEATURES_H | ||
| 2 | #define HL2H_FEATURES_H | ||
| 3 | |||
| 4 | #include "core.h" | ||
| 5 | #include "settings.h" | ||
| 6 | |||
| 7 | // --------------------------------------------------------------------------- | ||
| 8 | // combat | ||
| 9 | // --------------------------------------------------------------------------- | ||
| 10 | bool aimbot_apply(CUserCmd *cmd); | ||
| 11 | bool triggerbot_apply(CUserCmd *cmd); | ||
| 12 | bool silent_aim_apply(CUserCmd *cmd); | ||
| 13 | bool melee_weapon_active(void *local_ent); | ||
| 14 | bool gravity_gun_active(void *local_ent); | ||
| 15 | bool melee_aimbot_apply(CUserCmd *cmd, bool gravity); | ||
| 16 | bool spread_control_apply(CUserCmd *cmd, void *local_ent); | ||
| 17 | int spread_best_seed(int pellets); | ||
| 18 | |||
| 19 | // --------------------------------------------------------------------------- | ||
| 20 | // cross-file declarations | ||
| 21 | // --------------------------------------------------------------------------- | ||
| 22 | void note_modified(const CUserCmd *cmd, int flags, const float *vel); | ||
| 23 | CUserCmd *get_usercmd(int seq); | ||
| 24 | void input_clear_mouse_states(); | ||
| 25 | void fix_verified_crc(int seq, uint32_t crc); | ||
| 26 | uint32_t usercmd_checksum(const CUserCmd *c); | ||
| 27 | bool find_input_global(); | ||
| 28 | void resolve_netvars(); | ||
| 29 | bool console_cmd(const char *cmd); | ||
| 30 | bool cvar_set_int(const char *name, int value); | ||
| 31 | void fullbright_update(); | ||
| 32 | void fullbright_invalidate(); | ||
| 33 | void world_tint_update(); | ||
| 34 | void world_tint_invalidate(); | ||
| 35 | void fog_update(); | ||
| 36 | void fog_invalidate(); | ||
| 37 | void skybox_update(); | ||
| 38 | void skybox_invalidate(); | ||
| 39 | void skybox_reload_image(); | ||
| 40 | bool resolve_server_netvars(); | ||
| 41 | int server_entity_health(int idx, int *maxhealth, int *lifestate, void **base_out); | ||
| 42 | // Authoritative server velocity; client-side m_vecVelocity is not networked for | ||
| 43 | // NPCs. Returns false when the server interface or datamap field is missing. | ||
| 44 | bool server_entity_velocity(int idx, Vector *out); | ||
| 45 | bool server_set_velocity_z(int idx, float vz); | ||
| 46 | int server_active_weapon(int idx); | ||
| 47 | int server_npc_relation(int idx, int local_idx); | ||
| 48 | bool server_npc_has_follow_target(int idx); | ||
| 49 | int server_npc_state(int idx); | ||
| 50 | int server_npc_takedamage(int idx); | ||
| 51 | int server_player_armor(int idx); | ||
| 52 | int server_player_ammo(int idx, int type); | ||
| 53 | uint32_t server_player_weapon(int idx, int slot); | ||
| 54 | float server_grenade_detonate(int idx); | ||
| 55 | float server_grenade_radius(int idx); | ||
| 56 | int server_grenade_thrower(int idx); | ||
| 57 | int server_item_juice(int idx); | ||
| 58 | int server_entity_count(); | ||
| 59 | void *server_entity_base(int idx); | ||
| 60 | const char *server_entity_classname(int idx); | ||
| 61 | bool server_trigger_info(int idx, char *map, size_t mapn, Vector &mins, | ||
| 62 | Vector &maxs); | ||
| 63 | int server_npc_turret_flags(int idx); | ||
| 64 | int server_model_index(void *base); | ||
| 65 | void find_modules(); | ||
| 66 | bool module_jump_slot(const char *path, const char *name, uintptr_t *vaddr, | ||
| 67 | uintptr_t *bias); | ||
| 68 | void init_conmsg(); | ||
| 69 | bool feature_active(int feature); // enabled AND bind held (or unbound) | ||
| 70 | bool feature_enabled(int feature); // enabled, regardless of bind | ||
| 71 | bool feature_has_bind(int feature); | ||
| 72 | bool feature_bind_held(int feature); | ||
| 73 | bool esp_option(int opt); | ||
| 74 | bool bhop_autostrafe_enabled(); | ||
| 75 | bool jumpbug_assist_enabled(); | ||
| 76 | bool spread_no_spread_enabled(); | ||
| 77 | bool spread_engine_enabled(); | ||
| 78 | bool aim_punch_enabled(); | ||
| 79 | unsigned aimbot_bone_mask(); | ||
| 80 | int aimbot_smooth_step(); | ||
| 81 | bool aimbot_vischeck_enabled(); | ||
| 82 | int aimbot_fov(); | ||
| 83 | bool aimbot_fov_circle(); | ||
| 84 | void aimbot_reset_lock(); | ||
| 85 | void silentaim_reset_lock(); | ||
| 86 | void *entitylist_get(int idx); | ||
| 87 | bool esp_is_npc_index(int idx); | ||
| 88 | bool esp_is_viewmodel_index(int idx); | ||
| 89 | int esp_npc_relation(int idx); | ||
| 90 | void *world_find_material(const char *name); | ||
| 91 | void chams_init(); | ||
| 92 | void chams_preload(); | ||
| 93 | int engine_get_local_player(); | ||
| 94 | void draw_text_col(int x, int y, const char *s, int r, int g, int b); | ||
| 95 | void draw_text_small_col(int x, int y, const char *s, int r, int g, int b); | ||
| 96 | void esp_draw(); | ||
| 97 | void esp_draw_fov_circle(); // aimbot cone, independent of the ESP toggle | ||
| 98 | void esp_reset_session(); // map change / respawn: clear per-map latches | ||
| 99 | void esp_draw_items(); | ||
| 100 | void esp_draw_projectiles(); | ||
| 101 | void prop_tint_update(); | ||
| 102 | void studio_props_init(); | ||
| 103 | bool world_to_screen(const Vector &w, float &sx, float &sy); | ||
| 104 | void set_silent_restore(const QAngle &angles); | ||
| 105 | bool is_visible(const Vector &eye, const Vector &point, | ||
| 106 | void *self = nullptr, void *target = nullptr); | ||
| 107 | void *trace_entity(const Vector &start, const Vector &end, void *ignore); | ||
| 108 | bool trace_solid_segment(const Vector &start, const Vector &end, void *ignore, | ||
| 109 | Vector &out_end, Vector &out_normal); | ||
| 110 | float ground_distance(const Vector &origin, void *ignore, float max_dist); | ||
| 111 | bool point_ground(const Vector &point, void *ignore); | ||
| 112 | |||
| 113 | // bones.cpp — client-side animated skeleton / hitbox access (see there) | ||
| 114 | bool bones_update(int idx, void *ent); | ||
| 115 | int bones_count(int idx); | ||
| 116 | int bone_find(int idx, const char *name); | ||
| 117 | int bone_parent(int idx, int bone); | ||
| 118 | bool bone_pos(int idx, int bone, Vector &out); | ||
| 119 | bool bone_is_skeleton_core(int idx, int bone); | ||
| 120 | int bone_nearest_core_parent(int idx, int bone); | ||
| 121 | bool bones_is_humanoid(int idx); | ||
| 122 | bool hitbox_center(int idx, const char *hitbox_name, Vector &out); | ||
| 123 | void bones_clear(); | ||
| 124 | bool head_position(int idx, Vector &out); | ||
| 125 | int aim_points(int idx, unsigned group_mask, Vector *out, int max); | ||
| 126 | |||
| 127 | void outer_draw(); | ||
| 128 | void gui_handle_input(); | ||
| 129 | void gui_draw(); | ||
| 130 | bool gui_is_open(); | ||
| 131 | bool gui_bind_capture_active(); | ||
| 132 | QAngle gui_frozen_view(); | ||
| 133 | void gui_config_init(); | ||
| 134 | void gui_config_write(FILE *f); | ||
| 135 | |||
| 136 | #endif | ||
| @@ -1,442 +1,17 @@ | |||
| 1 | #ifndef HL2H_H | 1 | #ifndef HL2H_H |
| 2 | #define HL2H_H | 2 | #define HL2H_H |
| 3 | 3 | ||
| 4 | #include <cstdint> | 4 | // Umbrella header. Declaration groups live in: |
| 5 | #include <cstdio> | 5 | // core.h — logging, init stage, module snapshots, interfaces, netvars, |
| 6 | #include <cstring> | 6 | // CUserCmd, engine constants, vector math |
| 7 | #include <string> | 7 | // settings.h — feature ids, feature state and every user setting |
| 8 | #include <vector> | 8 | // features.h — cross-module function declarations |
| 9 | 9 | // overlay.h — the single ISurface access layer | |
| 10 | #include <dlfcn.h> | 10 | // hooks.h — vtable install/restore |
| 11 | #include <pthread.h> | 11 | #include "core.h" |
| 12 | #include <unistd.h> | 12 | #include "features.h" |
| 13 | |||
| 14 | #include "hooks.h" | 13 | #include "hooks.h" |
| 15 | #include "overlay.h" | 14 | #include "overlay.h" |
| 15 | #include "settings.h" | ||
| 16 | 16 | ||
| 17 | // Shared float-precision constant. More digits than a float can hold are | ||
| 18 | // rounded at compile time and have no runtime cost; a coarse value would only | ||
| 19 | // hurt angular accuracy, never performance. | ||
| 20 | constexpr float PI_F = 3.14159265f; | ||
| 21 | |||
| 22 | // --------------------------------------------------------------------------- | ||
| 23 | // logging | ||
| 24 | // --------------------------------------------------------------------------- | ||
| 25 | |||
| 26 | void logf(const char *fmt, ...); | ||
| 27 | void logd(const char *fmt, ...); // debug-only (HL2H_DEBUG=1) | ||
| 28 | |||
| 29 | // --------------------------------------------------------------------------- | ||
| 30 | // init readiness | ||
| 31 | // --------------------------------------------------------------------------- | ||
| 32 | // | ||
| 33 | // setup_thread runs detached while the game threads are already live, and some | ||
| 34 | // hooks are installed lazily from the game thread. Hooks therefore always stay | ||
| 35 | // installed but pass straight through to the original until setup reaches | ||
| 36 | // INIT_LIVE, so the game can never observe half-initialised state. INIT_FAILED | ||
| 37 | // is terminal: the cheat stays inert instead of half-working. | ||
| 38 | enum { | ||
| 39 | INIT_FAILED = -1, | ||
| 40 | INIT_NONE = 0, | ||
| 41 | INIT_INTERFACES = 1, // modules + interfaces + netvars resolved | ||
| 42 | INIT_READY = 2, // config loaded, ISurface/fonts resolved | ||
| 43 | INIT_LIVE = 3 // hooks may run their bodies | ||
| 44 | }; | ||
| 45 | void init_set_stage(int stage); | ||
| 46 | int init_stage(); // acquire load | ||
| 47 | inline bool init_live() { return init_stage() == INIT_LIVE; } | ||
| 48 | |||
| 49 | // Clone a vtable into a new array, preserving the Itanium ABI header at | ||
| 50 | // [-2]/[-1] (offset-to-top and typeinfo) so RTTI on the hooked object still | ||
| 51 | // works. Returns the slot-0 pointer to install (i.e. the clone + 2). | ||
| 52 | void **vtable_clone(void *iface, size_t slots); | ||
| 53 | |||
| 54 | // --------------------------------------------------------------------------- | ||
| 55 | // on-screen toasts | ||
| 56 | // --------------------------------------------------------------------------- | ||
| 57 | |||
| 58 | enum ToastLevel { TOAST_INFO = 0, TOAST_WARN, TOAST_ERROR }; | ||
| 59 | void toastf(int level, const char *fmt, ...); | ||
| 60 | bool gui_toasts_active(); | ||
| 61 | void gui_draw_toasts(); | ||
| 62 | |||
| 63 | // --------------------------------------------------------------------------- | ||
| 64 | // module discovery | ||
| 65 | // --------------------------------------------------------------------------- | ||
| 66 | |||
| 67 | struct Module { | ||
| 68 | struct Range { | ||
| 69 | uintptr_t lo, hi; | ||
| 70 | bool file; | ||
| 71 | }; | ||
| 72 | std::vector<Range> ranges; | ||
| 73 | std::string path; | ||
| 74 | bool valid() const { return !ranges.empty(); } | ||
| 75 | bool contains(uintptr_t p) const { | ||
| 76 | for (auto &r : ranges) | ||
| 77 | if (p >= r.lo && p < r.hi) | ||
| 78 | return true; | ||
| 79 | return false; | ||
| 80 | } | ||
| 81 | }; | ||
| 82 | // Immutable module snapshots. A reader gets a reference that stays valid for | ||
| 83 | // the whole process: find_modules() publishes a new snapshot instead of | ||
| 84 | // mutating the old one, and retired snapshots are intentionally never freed, so | ||
| 85 | // a concurrent refresh can never invalidate a reference already in use. | ||
| 86 | const Module &mod_client(); | ||
| 87 | const Module &mod_engine(); | ||
| 88 | const Module &mod_server(); | ||
| 89 | |||
| 90 | // True only when the whole byte range [p, p+n) lies inside one known module | ||
| 91 | // range. Use before dereferencing pointers read out of engine memory. | ||
| 92 | bool module_range(uintptr_t p, size_t n); | ||
| 93 | |||
| 94 | // --------------------------------------------------------------------------- | ||
| 95 | // game interfaces | ||
| 96 | // --------------------------------------------------------------------------- | ||
| 97 | |||
| 98 | using CreateInterfaceFn = void *(*)(const char *, int *); | ||
| 99 | |||
| 100 | struct GameInterfaces { | ||
| 101 | void *client = nullptr; | ||
| 102 | void *entitylist = nullptr; | ||
| 103 | void *engine = nullptr; | ||
| 104 | void *modelinfo = nullptr; // IVModelInfoClient006 (model index -> model name) | ||
| 105 | void *engineserver = nullptr; // IVEngineServer021 (edict access, incl. server entities) | ||
| 106 | void *debugoverlay = nullptr; // IVDebugOverlay003 (engine-accurate world->screen) | ||
| 107 | void *enginetrace = nullptr; // EngineTraceClient003 (world vischeck) | ||
| 108 | void *cvar = nullptr; // VEngineCvar004 (mat_fullbright etc.) | ||
| 109 | void *modelrender = nullptr; // VEngineModel016 (chams) | ||
| 110 | void *renderview = nullptr; // VEngineRenderView014 (alpha/color modulation) | ||
| 111 | }; | ||
| 112 | extern GameInterfaces g_iface; | ||
| 113 | |||
| 114 | #define VTABLE(obj) (*(void ***)(obj)) | ||
| 115 | template <typename Fn> inline Fn vfunc(void *obj, size_t idx) { | ||
| 116 | return reinterpret_cast<Fn>(VTABLE(obj)[idx]); | ||
| 117 | } | ||
| 118 | |||
| 119 | // --------------------------------------------------------------------------- | ||
| 120 | // netvars | ||
| 121 | // --------------------------------------------------------------------------- | ||
| 122 | struct NetVars { | ||
| 123 | int flags = -1; | ||
| 124 | int velocity = -1; | ||
| 125 | int movetype = -1; | ||
| 126 | int health = -1; | ||
| 127 | int maxhealth = -1; | ||
| 128 | int teamnum = -1; | ||
| 129 | int origin = -1; | ||
| 130 | int viewoffset = -1; | ||
| 131 | int mins = -1; | ||
| 132 | int maxs = -1; | ||
| 133 | int lifestate = -1; | ||
| 134 | int modelindex = -1; | ||
| 135 | int absvelocity = -1; // client C_BaseEntity::m_vecAbsVelocity (prediction) | ||
| 136 | int activeweapon = -1; // client m_hActiveWeapon handle | ||
| 137 | int owner = -1; // client m_hOwnerEntity handle | ||
| 138 | int weapon_owner = -1; // client m_hOwner handle (C_BaseCombatWeapon) | ||
| 139 | int clr_render = -1; // client m_clrRender (entity render colour) | ||
| 140 | int punch = -1; // client m_vecPunchAngle (aim punch) | ||
| 141 | int default_fov = -1; // client m_iDefaultFOV (camera fov) | ||
| 142 | int dmg_radius = -1; // client C_BaseGrenade::m_DmgRadius | ||
| 143 | int my_weapons = -1; // client m_hMyWeapons[48] array base | ||
| 144 | int ammo = -1; // client m_iAmmo[] array base | ||
| 145 | // ponytail: mins/maxs may be absent from some HL2 netvar tables; esp.cpp falls back to h=72 | ||
| 146 | bool ok() const { return flags >= 0 && velocity >= 0 && movetype >= 0; } | ||
| 147 | // ponytail: m_iMaxHealth isn't a netvar in HL2 SP; esp.cpp falls back to 100. | ||
| 148 | // m_iHealth only ever updates for players — NPCs are detected via m_lifeState. | ||
| 149 | bool esp_ok() const { return ok() && health >= 0 && teamnum >= 0 && origin >= 0 && viewoffset >= 0; } | ||
| 150 | }; | ||
| 151 | extern NetVars g_net; | ||
| 152 | |||
| 153 | // --------------------------------------------------------------------------- | ||
| 154 | // CInput | ||
| 155 | // --------------------------------------------------------------------------- | ||
| 156 | |||
| 157 | extern uintptr_t g_input; | ||
| 158 | |||
| 159 | // --------------------------------------------------------------------------- | ||
| 160 | // console output | ||
| 161 | // --------------------------------------------------------------------------- | ||
| 162 | |||
| 163 | extern void (*g_conmsg)(const char *, ...); | ||
| 164 | |||
| 165 | // --------------------------------------------------------------------------- | ||
| 166 | // CUserCmd | ||
| 167 | // --------------------------------------------------------------------------- | ||
| 168 | |||
| 169 | struct CUserCmd { | ||
| 170 | void *vtable; | ||
| 171 | int command_number; | ||
| 172 | int tick_count; | ||
| 173 | float viewangles[3]; | ||
| 174 | float forwardmove; | ||
| 175 | float sidemove; | ||
| 176 | float upmove; | ||
| 177 | int buttons; | ||
| 178 | uint8_t impulse; | ||
| 179 | int weaponselect; | ||
| 180 | int weaponsubtype; | ||
| 181 | int random_seed; | ||
| 182 | short mousedx; | ||
| 183 | short mousedy; | ||
| 184 | bool hasbeenpredicted; | ||
| 185 | }; | ||
| 186 | |||
| 187 | // --------------------------------------------------------------------------- | ||
| 188 | // engine constants | ||
| 189 | // --------------------------------------------------------------------------- | ||
| 190 | |||
| 191 | enum { IN_ATTACK = 1 << 0, IN_JUMP = 1 << 1, IN_DUCK = 1 << 2, IN_USE = 1 << 5, IN_ATTACK2 = 1 << 11, IN_SPEED = 1 << 17 }; | ||
| 192 | enum { FL_ONGROUND = 1 << 0, FL_DUCKING = 1 << 1, FL_INWATER = 1 << 9 }; | ||
| 193 | enum { MOVETYPE_WALK = 2, MOVETYPE_NOCLIP = 8, MOVETYPE_LADDER = 9 }; | ||
| 194 | |||
| 195 | // --------------------------------------------------------------------------- | ||
| 196 | // vector math | ||
| 197 | // --------------------------------------------------------------------------- | ||
| 198 | |||
| 199 | struct Vector { float x, y, z; }; | ||
| 200 | struct QAngle { float x, y, z; }; | ||
| 201 | // camera state captured each CreateMove (used by ESP / future aimbot) | ||
| 202 | extern Vector g_cam_eye; | ||
| 203 | extern Vector g_cam_view; | ||
| 204 | QAngle vector_angles(const Vector &forward); | ||
| 205 | Vector angle_forward_vector(const QAngle &angles); | ||
| 206 | float getfov(const QAngle &my_view, const QAngle &aim_ang); | ||
| 207 | bool aimbot_apply(CUserCmd *cmd); | ||
| 208 | bool triggerbot_apply(CUserCmd *cmd); | ||
| 209 | bool silent_aim_apply(CUserCmd *cmd); | ||
| 210 | bool melee_weapon_active(void *local_ent); | ||
| 211 | bool gravity_gun_active(void *local_ent); | ||
| 212 | bool melee_aimbot_apply(CUserCmd *cmd, bool gravity); | ||
| 213 | bool spread_control_apply(CUserCmd *cmd, void *local_ent); | ||
| 214 | int spread_best_seed(int pellets); | ||
| 215 | extern int g_spread_pellets; | ||
| 216 | enum FeatureId { | ||
| 217 | FEAT_BHOP = 0, | ||
| 218 | FEAT_ABH = 1, | ||
| 219 | FEAT_ESP = 2, | ||
| 220 | FEAT_AIMBOT = 3, | ||
| 221 | FEAT_TRIGGERBOT = 4, | ||
| 222 | FEAT_SILENTAIM = 5, | ||
| 223 | FEAT_JUMPBUG = 6, | ||
| 224 | FEAT_MELEE = 7, | ||
| 225 | FEAT_SPREAD = 8, | ||
| 226 | FEAT_ITEM_ESP = 9, | ||
| 227 | FEAT_FULLBRIGHT = 10, | ||
| 228 | FEAT_WORLD_TINT = 11, | ||
| 229 | FEAT_FOG = 12, | ||
| 230 | FEAT_SKYBOX = 13, | ||
| 231 | FEAT_PROJECTILES = 14, | ||
| 232 | FEAT_CHAMS = 15, | ||
| 233 | FEAT_COUNT = 16 | ||
| 234 | }; | ||
| 235 | enum EspOption { | ||
| 236 | ESP_OPT_SHOW_NEUTRAL = 0, | ||
| 237 | ESP_OPT_SHOW_HEALTHBAR = 1, | ||
| 238 | ESP_OPT_SHOW_HEALTHNUM = 2, | ||
| 239 | ESP_OPT_SHOW_NAME = 3, | ||
| 240 | ESP_OPT_SHOW_SKELETON = 4, | ||
| 241 | ESP_OPT_SHOW_BOX = 5, | ||
| 242 | ESP_OPT_SHOW_SPEEDGRAPH = 6, | ||
| 243 | ESP_OPT_DAMAGE_TAGS = 7, | ||
| 244 | ESP_OPT_ALERT = 8, | ||
| 245 | ESP_OPT_WEAPON = 9, | ||
| 246 | ESP_OPT_ARROWS = 10, | ||
| 247 | ESP_OPT_COUNT = 11 | ||
| 248 | }; | ||
| 249 | enum AimBone { | ||
| 250 | AIM_BONE_HEAD = 0, | ||
| 251 | AIM_BONE_TORSO, | ||
| 252 | AIM_BONE_LARM, | ||
| 253 | AIM_BONE_RARM, | ||
| 254 | AIM_BONE_LLEG, | ||
| 255 | AIM_BONE_RLEG, | ||
| 256 | AIM_BONE_COUNT | ||
| 257 | }; | ||
| 258 | |||
| 259 | // --------------------------------------------------------------------------- | ||
| 260 | // feature state / settings (owned by menu.cpp alongside config) | ||
| 261 | // --------------------------------------------------------------------------- | ||
| 262 | |||
| 263 | struct FeatureState { | ||
| 264 | bool active; | ||
| 265 | int bind; // SDL scancode, 0 = none (always-on) | ||
| 266 | }; | ||
| 267 | |||
| 268 | extern FeatureState g_bhop, g_abh, g_jumpbug, g_melee, g_spread, g_esp, | ||
| 269 | g_aimbot, g_triggerbot, g_silentaim, g_item_esp, g_fullbright, | ||
| 270 | g_world_tint, g_fog, g_skybox, g_projectiles, g_chams; | ||
| 271 | extern bool g_proj_fuse, g_proj_radius, g_proj_traj; | ||
| 272 | |||
| 273 | // Chams settings per relationship, and separate visible / through-wall | ||
| 274 | // (invisible) material and colour. The viewmodel has a single style. | ||
| 275 | struct ChamsGroup { | ||
| 276 | bool vis_on; | ||
| 277 | int vis_mat; | ||
| 278 | int vis_rgb[4]; // r, g, b, a (0..255) | ||
| 279 | bool inv_on; | ||
| 280 | int inv_mat; | ||
| 281 | int inv_rgb[4]; | ||
| 282 | }; | ||
| 283 | extern ChamsGroup g_chams_hostile, g_chams_neutral, g_chams_friendly; | ||
| 284 | extern bool g_chams_viewmodel; | ||
| 285 | extern int g_chams_vm_mat; | ||
| 286 | extern int g_chams_vm_rgb[4]; | ||
| 287 | extern bool g_tint_world_on, g_tint_sky_on, g_tint_prop_on; | ||
| 288 | extern int g_tint_world_rgb[3], g_tint_sky_rgb[3], g_tint_prop_rgb[3]; | ||
| 289 | extern bool g_fog_skybox, g_fog_disable; | ||
| 290 | extern int g_fog_rgb[3], g_fog_start, g_fog_end; | ||
| 291 | const char *config_file_cstr(const char *name); | ||
| 292 | extern bool g_bhop_autostrafe; | ||
| 293 | extern bool g_jumpbug_assist; | ||
| 294 | extern bool g_spread_no_spread; | ||
| 295 | extern bool g_item_health; | ||
| 296 | extern bool g_item_ammo; | ||
| 297 | extern bool g_item_armor; | ||
| 298 | extern bool g_item_weapons; | ||
| 299 | extern bool g_item_crates; | ||
| 300 | extern bool g_item_distance; | ||
| 301 | extern bool g_item_usable; | ||
| 302 | extern int g_item_max_dist; | ||
| 303 | extern bool g_aim_bones[AIM_BONE_COUNT]; | ||
| 304 | extern int g_aim_smooth; | ||
| 305 | extern bool g_aim_vischeck; | ||
| 306 | extern int g_aim_fov; | ||
| 307 | extern bool g_aim_fov_circle; | ||
| 308 | extern bool g_aim_punch; | ||
| 309 | extern bool g_spread_engine; | ||
| 310 | extern bool g_auto_crouchjump; | ||
| 311 | extern bool g_edge_jump; | ||
| 312 | extern int g_fov_camera; | ||
| 313 | extern int g_fov_viewmodel; | ||
| 314 | extern int g_tonemap; | ||
| 315 | extern int g_esp_col_hostile[3]; | ||
| 316 | extern int g_esp_col_neutral[3]; | ||
| 317 | extern int g_esp_col_friendly[3]; | ||
| 318 | extern bool g_esp_opt[ESP_OPT_COUNT]; | ||
| 319 | |||
| 320 | const char *scancode_name(int sc); | ||
| 321 | void config_save(); | ||
| 322 | void config_reload(); | ||
| 323 | void config_reset_defaults(); | ||
| 324 | const char *config_path_cstr(); | ||
| 325 | |||
| 326 | // --------------------------------------------------------------------------- | ||
| 327 | // cross-file declarations | ||
| 328 | // --------------------------------------------------------------------------- | ||
| 329 | void note_modified(const CUserCmd *cmd, int flags, const float *vel); | ||
| 330 | CUserCmd *get_usercmd(int seq); | ||
| 331 | void input_clear_mouse_states(); | ||
| 332 | void fix_verified_crc(int seq, uint32_t crc); | ||
| 333 | uint32_t usercmd_checksum(const CUserCmd *c); | ||
| 334 | bool find_input_global(); | ||
| 335 | void resolve_netvars(); | ||
| 336 | bool console_cmd(const char *cmd); | ||
| 337 | bool cvar_set_int(const char *name, int value); | ||
| 338 | void fullbright_update(); | ||
| 339 | void fullbright_invalidate(); | ||
| 340 | void world_tint_update(); | ||
| 341 | void world_tint_invalidate(); | ||
| 342 | void fog_update(); | ||
| 343 | void fog_invalidate(); | ||
| 344 | void skybox_update(); | ||
| 345 | void skybox_invalidate(); | ||
| 346 | void skybox_reload_image(); | ||
| 347 | bool resolve_server_netvars(); | ||
| 348 | int server_entity_health(int idx, int *maxhealth, int *lifestate, void **base_out); | ||
| 349 | // Authoritative server velocity; client-side m_vecVelocity is not networked for | ||
| 350 | // NPCs. Returns false when the server interface or datamap field is missing. | ||
| 351 | bool server_entity_velocity(int idx, Vector *out); | ||
| 352 | bool server_set_velocity_z(int idx, float vz); | ||
| 353 | int server_active_weapon(int idx); | ||
| 354 | int server_npc_relation(int idx, int local_idx); | ||
| 355 | bool server_npc_has_follow_target(int idx); | ||
| 356 | int server_npc_state(int idx); | ||
| 357 | int server_npc_takedamage(int idx); | ||
| 358 | int server_player_armor(int idx); | ||
| 359 | int server_player_ammo(int idx, int type); | ||
| 360 | uint32_t server_player_weapon(int idx, int slot); | ||
| 361 | float server_grenade_detonate(int idx); | ||
| 362 | float server_grenade_radius(int idx); | ||
| 363 | int server_grenade_thrower(int idx); | ||
| 364 | int server_item_juice(int idx); | ||
| 365 | int server_entity_count(); | ||
| 366 | void *server_entity_base(int idx); | ||
| 367 | const char *server_entity_classname(int idx); | ||
| 368 | bool server_trigger_info(int idx, char *map, size_t mapn, Vector &mins, | ||
| 369 | Vector &maxs); | ||
| 370 | int server_npc_turret_flags(int idx); | ||
| 371 | int server_model_index(void *base); | ||
| 372 | void find_modules(); | ||
| 373 | bool module_jump_slot(const char *path, const char *name, uintptr_t *vaddr, | ||
| 374 | uintptr_t *bias); | ||
| 375 | void init_conmsg(); | ||
| 376 | bool feature_active(int feature); // enabled AND bind held (or unbound) | ||
| 377 | bool feature_enabled(int feature); // enabled, regardless of bind | ||
| 378 | bool feature_has_bind(int feature); | ||
| 379 | bool feature_bind_held(int feature); | ||
| 380 | bool esp_option(int opt); | ||
| 381 | bool bhop_autostrafe_enabled(); | ||
| 382 | bool jumpbug_assist_enabled(); | ||
| 383 | bool spread_no_spread_enabled(); | ||
| 384 | bool spread_engine_enabled(); | ||
| 385 | bool aim_punch_enabled(); | ||
| 386 | unsigned aimbot_bone_mask(); | ||
| 387 | int aimbot_smooth_step(); | ||
| 388 | bool aimbot_vischeck_enabled(); | ||
| 389 | int aimbot_fov(); | ||
| 390 | bool aimbot_fov_circle(); | ||
| 391 | void aimbot_reset_lock(); | ||
| 392 | void silentaim_reset_lock(); | ||
| 393 | void *entitylist_get(int idx); | ||
| 394 | bool esp_is_npc_index(int idx); | ||
| 395 | bool esp_is_viewmodel_index(int idx); | ||
| 396 | int esp_npc_relation(int idx); | ||
| 397 | void *world_find_material(const char *name); | ||
| 398 | void chams_init(); | ||
| 399 | void chams_preload(); | ||
| 400 | int engine_get_local_player(); | ||
| 401 | void draw_text_col(int x, int y, const char *s, int r, int g, int b); | ||
| 402 | void draw_text_small_col(int x, int y, const char *s, int r, int g, int b); | ||
| 403 | void esp_draw(); | ||
| 404 | void esp_draw_fov_circle(); // aimbot cone, independent of the ESP toggle | ||
| 405 | void esp_reset_session(); // map change / respawn: clear per-map latches | ||
| 406 | void esp_draw_items(); | ||
| 407 | void esp_draw_projectiles(); | ||
| 408 | void prop_tint_update(); | ||
| 409 | void studio_props_init(); | ||
| 410 | bool world_to_screen(const Vector &w, float &sx, float &sy); | ||
| 411 | void set_silent_restore(const QAngle &angles); | ||
| 412 | bool is_visible(const Vector &eye, const Vector &point, | ||
| 413 | void *self = nullptr, void *target = nullptr); | ||
| 414 | void *trace_entity(const Vector &start, const Vector &end, void *ignore); | ||
| 415 | bool trace_solid_segment(const Vector &start, const Vector &end, void *ignore, | ||
| 416 | Vector &out_end, Vector &out_normal); | ||
| 417 | float ground_distance(const Vector &origin, void *ignore, float max_dist); | ||
| 418 | bool point_ground(const Vector &point, void *ignore); | ||
| 419 | |||
| 420 | // bones.cpp — client-side animated skeleton / hitbox access (see there) | ||
| 421 | bool bones_update(int idx, void *ent); | ||
| 422 | int bones_count(int idx); | ||
| 423 | int bone_find(int idx, const char *name); | ||
| 424 | int bone_parent(int idx, int bone); | ||
| 425 | bool bone_pos(int idx, int bone, Vector &out); | ||
| 426 | bool bone_is_skeleton_core(int idx, int bone); | ||
| 427 | int bone_nearest_core_parent(int idx, int bone); | ||
| 428 | bool bones_is_humanoid(int idx); | ||
| 429 | bool hitbox_center(int idx, const char *hitbox_name, Vector &out); | ||
| 430 | void bones_clear(); | ||
| 431 | bool head_position(int idx, Vector &out); | ||
| 432 | int aim_points(int idx, unsigned group_mask, Vector *out, int max); | ||
| 433 | |||
| 434 | void outer_draw(); | ||
| 435 | void gui_handle_input(); | ||
| 436 | void gui_draw(); | ||
| 437 | bool gui_is_open(); | ||
| 438 | bool gui_bind_capture_active(); | ||
| 439 | QAngle gui_frozen_view(); | ||
| 440 | void gui_config_init(); | ||
| 441 | void gui_config_write(FILE *f); | ||
| 442 | #endif | 17 | #endif |
diff --git a/src/settings.h b/src/settings.h new file mode 100644 index 0000000..67c82ae --- /dev/null +++ b/src/settings.h | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | #ifndef HL2H_SETTINGS_H | ||
| 2 | #define HL2H_SETTINGS_H | ||
| 3 | |||
| 4 | #include "core.h" | ||
| 5 | |||
| 6 | enum FeatureId { | ||
| 7 | FEAT_BHOP = 0, | ||
| 8 | FEAT_ABH = 1, | ||
| 9 | FEAT_ESP = 2, | ||
| 10 | FEAT_AIMBOT = 3, | ||
| 11 | FEAT_TRIGGERBOT = 4, | ||
| 12 | FEAT_SILENTAIM = 5, | ||
| 13 | FEAT_JUMPBUG = 6, | ||
| 14 | FEAT_MELEE = 7, | ||
| 15 | FEAT_SPREAD = 8, | ||
| 16 | FEAT_ITEM_ESP = 9, | ||
| 17 | FEAT_FULLBRIGHT = 10, | ||
| 18 | FEAT_WORLD_TINT = 11, | ||
| 19 | FEAT_FOG = 12, | ||
| 20 | FEAT_SKYBOX = 13, | ||
| 21 | FEAT_PROJECTILES = 14, | ||
| 22 | FEAT_CHAMS = 15, | ||
| 23 | FEAT_COUNT = 16 | ||
| 24 | }; | ||
| 25 | enum EspOption { | ||
| 26 | ESP_OPT_SHOW_NEUTRAL = 0, | ||
| 27 | ESP_OPT_SHOW_HEALTHBAR = 1, | ||
| 28 | ESP_OPT_SHOW_HEALTHNUM = 2, | ||
| 29 | ESP_OPT_SHOW_NAME = 3, | ||
| 30 | ESP_OPT_SHOW_SKELETON = 4, | ||
| 31 | ESP_OPT_SHOW_BOX = 5, | ||
| 32 | ESP_OPT_SHOW_SPEEDGRAPH = 6, | ||
| 33 | ESP_OPT_DAMAGE_TAGS = 7, | ||
| 34 | ESP_OPT_ALERT = 8, | ||
| 35 | ESP_OPT_WEAPON = 9, | ||
| 36 | ESP_OPT_ARROWS = 10, | ||
| 37 | ESP_OPT_COUNT = 11 | ||
| 38 | }; | ||
| 39 | enum AimBone { | ||
| 40 | AIM_BONE_HEAD = 0, | ||
| 41 | AIM_BONE_TORSO, | ||
| 42 | AIM_BONE_LARM, | ||
| 43 | AIM_BONE_RARM, | ||
| 44 | AIM_BONE_LLEG, | ||
| 45 | AIM_BONE_RLEG, | ||
| 46 | AIM_BONE_COUNT | ||
| 47 | }; | ||
| 48 | |||
| 49 | // --------------------------------------------------------------------------- | ||
| 50 | // feature state / settings (owned by menu.cpp alongside config) | ||
| 51 | // --------------------------------------------------------------------------- | ||
| 52 | |||
| 53 | struct FeatureState { | ||
| 54 | bool active; | ||
| 55 | int bind; // SDL scancode, 0 = none (always-on) | ||
| 56 | }; | ||
| 57 | |||
| 58 | extern FeatureState g_bhop, g_abh, g_jumpbug, g_melee, g_spread, g_esp, | ||
| 59 | g_aimbot, g_triggerbot, g_silentaim, g_item_esp, g_fullbright, | ||
| 60 | g_world_tint, g_fog, g_skybox, g_projectiles, g_chams; | ||
| 61 | extern bool g_proj_fuse, g_proj_radius, g_proj_traj; | ||
| 62 | |||
| 63 | // Chams settings per relationship, and separate visible / through-wall | ||
| 64 | // (invisible) material and colour. The viewmodel has a single style. | ||
| 65 | struct ChamsGroup { | ||
| 66 | bool vis_on; | ||
| 67 | int vis_mat; | ||
| 68 | int vis_rgb[4]; // r, g, b, a (0..255) | ||
| 69 | bool inv_on; | ||
| 70 | int inv_mat; | ||
| 71 | int inv_rgb[4]; | ||
| 72 | }; | ||
| 73 | extern ChamsGroup g_chams_hostile, g_chams_neutral, g_chams_friendly; | ||
| 74 | extern bool g_chams_viewmodel; | ||
| 75 | extern int g_chams_vm_mat; | ||
| 76 | extern int g_chams_vm_rgb[4]; | ||
| 77 | extern bool g_tint_world_on, g_tint_sky_on, g_tint_prop_on; | ||
| 78 | extern int g_tint_world_rgb[3], g_tint_sky_rgb[3], g_tint_prop_rgb[3]; | ||
| 79 | extern bool g_fog_skybox, g_fog_disable; | ||
| 80 | extern int g_fog_rgb[3], g_fog_start, g_fog_end; | ||
| 81 | extern bool g_bhop_autostrafe; | ||
| 82 | extern bool g_jumpbug_assist; | ||
| 83 | extern bool g_spread_no_spread; | ||
| 84 | extern bool g_item_health; | ||
| 85 | extern bool g_item_ammo; | ||
| 86 | extern bool g_item_armor; | ||
| 87 | extern bool g_item_weapons; | ||
| 88 | extern bool g_item_crates; | ||
| 89 | extern bool g_item_distance; | ||
| 90 | extern bool g_item_usable; | ||
| 91 | extern int g_item_max_dist; | ||
| 92 | extern bool g_aim_bones[AIM_BONE_COUNT]; | ||
| 93 | extern int g_aim_smooth; | ||
| 94 | extern bool g_aim_vischeck; | ||
| 95 | extern int g_aim_fov; | ||
| 96 | extern bool g_aim_fov_circle; | ||
| 97 | extern bool g_aim_punch; | ||
| 98 | extern bool g_spread_engine; | ||
| 99 | extern bool g_auto_crouchjump; | ||
| 100 | extern bool g_edge_jump; | ||
| 101 | extern int g_fov_camera; | ||
| 102 | extern int g_fov_viewmodel; | ||
| 103 | extern int g_tonemap; | ||
| 104 | extern int g_esp_col_hostile[3]; | ||
| 105 | extern int g_esp_col_neutral[3]; | ||
| 106 | extern int g_esp_col_friendly[3]; | ||
| 107 | extern bool g_esp_opt[ESP_OPT_COUNT]; | ||
| 108 | extern int g_spread_pellets; | ||
| 109 | |||
| 110 | const char *scancode_name(int sc); | ||
| 111 | void config_save(); | ||
| 112 | void config_reload(); | ||
| 113 | void config_reset_defaults(); | ||
| 114 | const char *config_path_cstr(); | ||
| 115 | const char *config_file_cstr(const char *name); | ||
| 116 | |||
| 117 | #endif | ||
