From 2fb16690c5e530186a26a1de15874e0f47a95351 Mon Sep 17 00:00:00 2001 From: BenCat07 Date: Wed, 28 Feb 2018 18:40:58 +0100 Subject: [PATCH 1/4] res --- check-data | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/check-data b/check-data index eafb525f..ca4414a1 100755 --- a/check-data +++ b/check-data @@ -7,4 +7,13 @@ if ! [ -d "$1" ]; then sudo chmod -R 777 "$1" fi -rsync -avh --progress "data/" "$1" \ No newline at end of file +rsync -avh --progress "data/" "$1" + +if ! [ -d "$1/res" ]; then + echo "Creating cathook data directory at $1/res" + sudo mkdir -p "$1/res" + sudo chown -R $USER "$1/res" + sudo chmod -R 777 "$1/res" +fi + +rsync -avh --progress "res/" "$1/res" From 6bcbe84b239b8b0e97a7d9a3e6530018a6f1bb87 Mon Sep 17 00:00:00 2001 From: BenCat07 Date: Wed, 28 Feb 2018 18:42:42 +0100 Subject: [PATCH 2/4] enable --- include/macros.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/include/macros.hpp b/include/macros.hpp index 95a9def3..28ae6788 100644 --- a/include/macros.hpp +++ b/include/macros.hpp @@ -27,6 +27,5 @@ constexpr int c_strcmp(char const *lhs, char const *rhs) #define DATA_PATH "/opt/cathook" #endif -#define FEATURE_EMOJI_ESP_DISABLED #define FEATURE_RADAR_DISABLED #define FEATURE_FIDGET_SPINNER_DISABLED From fad69ac0b6b14f8b0ef7acd20a3f070f693f0976 Mon Sep 17 00:00:00 2001 From: BenCat07 Date: Wed, 28 Feb 2018 18:43:13 +0100 Subject: [PATCH 3/4] emoji.cpp --- src/hacks/ESP.cpp | 104 ++++++++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 44 deletions(-) diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index 45453648..1a83dc95 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -34,6 +34,7 @@ CatVar emoji_esp_scaling(CV_SWITCH, "esp_emoji_scaling", "1", "Emoji ESP Scaling"); CatVar emoji_min_size(CV_INT, "esp_emoji_min_size", "20", "Emoji ESP min size", "Minimum size for an emoji when you use auto scaling"); +hitbox_cache::CachedHitbox *hitboxcache[32][18]{}; #endif // Other esp options CatEnum show_health_enum({ "None", "Text", "Healthbar", "Both" }); @@ -288,6 +289,9 @@ void Draw() for (auto &i : entities_need_repaint) { ProcessEntityPT(ENTITY(i)); +#ifndef FEATURE_EMOJI_ESP_DISABLED + emoji(ENTITY(i)); +#endif } } @@ -317,7 +321,6 @@ void CreateMove() { // I still dont understand the purpose of prof_section and surrounding in // brackets PROF_SECTION(CM_ESP_EntityLoop); - // Loop through entities for (int i = 0; i < limit; i++) { @@ -325,6 +328,11 @@ void CreateMove() CachedEntity *ent = ENTITY(i); ProcessEntity(ent); + if (i <= g_IEngine->GetMaxClients()) + { + for (int j = 0; j < 18; ++j) + hitboxcache[i][j] = ent->hitboxes.GetHitbox(j); + } // Dont know what this check is for if (data[i].string_count) { @@ -347,6 +355,54 @@ void CreateMove() } } +void _FASTCALL emoji(CachedEntity *ent) +{ + // Check to prevent crashes + if (CE_BAD(ent)) + return; + // Emoji esp + if (emoji_esp) + { + if (ent->m_Type == ENTITY_PLAYER) + { + static glez_texture_t textur = + glez_texture_load_png_rgba("/opt/cathook/data/res/atlas.png"); + auto hit = hitboxcache[ent->m_IDX][0]; + Vector hbm, hbx; + if (draw::WorldToScreen(hit->min, hbm) && + draw::WorldToScreen(hit->max, hbx)) + { + Vector head_scr; + if (draw::WorldToScreen(hit->center, head_scr)) + { + float size = emoji_esp_scaling ? fabs(hbm.y - hbx.y) + : float(emoji_esp_size); + if (emoji_esp_scaling && (size < float(emoji_min_size))) + { + size = float(emoji_min_size); + } + glez_rgba_t white = glez_rgba(255, 255, 255, 255); + if (!textur) + textur = glez_texture_load_png_rgba( + "/opt/cathook/data/res/atlas.png"); + if (textur) + { + if (emoji_esp == 1) + glez_rect_textured(head_scr.x - size / 2, + head_scr.y - size / 2, size, + size, white, textur, 4 * 64, + 3 * 64, 64, 64); + else if (emoji_esp == 2) + glez_rect_textured(head_scr.x - size / 2, + head_scr.y - size / 2, size, + size, white, textur, 5 * 64, + 3 * 64, 64, 64); + } + } + } + } + } +} // Used when processing entitys with cached data from createmove in draw void _FASTCALL ProcessEntityPT(CachedEntity *ent) { @@ -516,45 +572,6 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) } } } -#ifndef FEATURE_EMOJI_ESP_DISABLED - // Emoji esp - if (emoji_esp) - { - if (ent->m_Type == ENTITY_PLAYER) - { - // Positions in the atlas for the textures - static textures::AtlasTexture joy_texture( - 64 * 4, textures::atlas_height - 64 * 4, 64, 64); - static textures::AtlasTexture thinking_texture( - 64 * 5, textures::atlas_height - 64 * 4, 64, 64); - - auto hb = ent->hitboxes.GetHitbox(0); - Vector hbm, hbx; - if (draw::WorldToScreen(hb->min, hbm) && - draw::WorldToScreen(hb->max, hbx)) - { - Vector head_scr; - if (draw::WorldToScreen(hb->center, head_scr)) - { - float size = emoji_esp_scaling ? fabs(hbm.y - hbx.y) - : float(emoji_esp_size); - if (emoji_esp_scaling && (size < float(emoji_min_size))) - { - size = float(emoji_min_size); - } - textures::AtlasTexture *tx = nullptr; - if (int(emoji_esp) == 1) - tx = &joy_texture; - if (int(emoji_esp) == 2) - tx = &thinking_texture; - if (tx) - tx->Draw(head_scr.x - size / 2, head_scr.y - size / 2, - colors::white, size, size); - } - } - } - } -#endif // Box esp if (box_esp) { @@ -689,12 +706,11 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) break; case 3: { // ABOVE - draw_point = - Vector(min_x, - min_y - + draw_point = Vector( + min_x, min_y - data.at(ent->m_IDX).string_count * /*((int)fonts::font_main->height)*/ 14, - 0); + 0); } break; case 4: From fc9aacc3f339870835e49848e8952fe732a56d5b Mon Sep 17 00:00:00 2001 From: BenCat07 Date: Wed, 28 Feb 2018 18:43:55 +0100 Subject: [PATCH 4/4] emoji.hpp --- include/hacks/ESP.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/hacks/ESP.hpp b/include/hacks/ESP.hpp index 1c75127e..e134434d 100644 --- a/include/hacks/ESP.hpp +++ b/include/hacks/ESP.hpp @@ -40,6 +40,7 @@ public: // extern std::array data; +extern hitbox_cache::CachedHitbox *hitboxcache[32][18]; void CreateMove(); void Draw(); @@ -47,6 +48,7 @@ void Draw(); // Entity Processing void __attribute__((fastcall)) ProcessEntity(CachedEntity *ent); void __attribute__((fastcall)) ProcessEntityPT(CachedEntity *ent); +void __attribute__((fastcall)) emoji(CachedEntity *ent); // helper funcs void __attribute__((fastcall)) DrawBox(CachedEntity *ent, const rgba_t &clr);