mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-22 20:17:24 +08:00
Added G's Cache to ESP. (#2461)
* Redesigned G's Cache to use Globals that are more reliable (and actually work). Refactored START_NEW_SCRIPT_WITH_ARGS to use a static unordered_set so that it's not constantly constructing it each call, and potentially closes #2462 Added Pickup Pool.
This commit is contained in:
parent
60887cb816
commit
d7015371a2
@ -62,6 +62,8 @@ namespace big::scr_globals
|
||||
|
||||
static inline const script_global property_garage(1945123);
|
||||
static inline const script_global property_names(1312228);
|
||||
|
||||
static inline const script_global pickups(2765084);
|
||||
}
|
||||
|
||||
namespace big::scr_locals
|
||||
|
@ -953,13 +953,15 @@ namespace big
|
||||
bool change_esp_color_from_dist = false;
|
||||
bool scale_health_from_dist = false;
|
||||
bool scale_armor_from_dist = false;
|
||||
bool object_esp = false;
|
||||
bool show_gs_cache_boxes = false;
|
||||
float distance_threshold[2] = {100.f, 200.f};
|
||||
ImU32 enemy_color = 4281479904;
|
||||
ImU32 enemy_near_color = 4283794943;
|
||||
ImU32 default_color = 4285713522;
|
||||
ImU32 friend_color = 4293244509;
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(esp, enabled, global_render_distance, tracer_render_distance, box_render_distance, tracer, tracer_draw_position, box, health, armor, god, distance, name, change_esp_color_from_dist, scale_health_from_dist, scale_armor_from_dist, distance_threshold, enemy_color, enemy_near_color, default_color, friend_color)
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(esp, enabled, global_render_distance, tracer_render_distance, box_render_distance, tracer, tracer_draw_position, box, health, armor, god, distance, name, change_esp_color_from_dist, scale_health_from_dist, scale_armor_from_dist, object_esp, show_gs_cache_boxes, distance_threshold, enemy_color, enemy_near_color, default_color, friend_color)
|
||||
} esp{};
|
||||
|
||||
struct session_browser
|
||||
|
@ -286,6 +286,7 @@ namespace big
|
||||
|
||||
GenericPool** m_ped_pool;
|
||||
GenericPool** m_prop_pool;
|
||||
GenericPool** m_pickup_pool;
|
||||
VehiclePool*** m_vehicle_pool;
|
||||
|
||||
PVOID m_netfilter_handle_message;
|
||||
|
@ -4,14 +4,11 @@ namespace big
|
||||
{
|
||||
namespace am_launcher
|
||||
{
|
||||
inline void START_NEW_SCRIPT_WITH_ARGS(rage::scrNativeCallContext* src)
|
||||
{
|
||||
const char* name = src->get_arg<const char*>(0);
|
||||
uint64_t* args = src->get_arg<uint64_t*>(1);
|
||||
int argc = src->get_arg<int>(2);
|
||||
int stackSize = src->get_arg<int>(3);
|
||||
static const std::unordered_set<Hash> bad_script_hashes = {RAGE_JOAAT("ggsm_arcade"), RAGE_JOAAT("camhedz_arcade"), RAGE_JOAAT("wizard_arcade"), RAGE_JOAAT("puzzle"), RAGE_JOAAT("fm_intro"), RAGE_JOAAT("pilot_school_mp"), RAGE_JOAAT("golf_mp"), RAGE_JOAAT("tennis_network_mp"), RAGE_JOAAT("fm_race_controler"), RAGE_JOAAT("fm_horde_controler"), RAGE_JOAAT("fm_mission_controller"), RAGE_JOAAT("fm_mission_controller_2020"), RAGE_JOAAT("fm_impromptu_dm_controler"), RAGE_JOAAT("fm_deathmatch_controler"), RAGE_JOAAT("fm_bj_race_controler"), RAGE_JOAAT("fm_survival_controller"), RAGE_JOAAT("sctv"), RAGE_JOAAT("am_pi_menu"), RAGE_JOAAT("scroll_arcade_cabinet"), RAGE_JOAAT("grid_arcade_cabinet"), RAGE_JOAAT("degenatron_games"), RAGE_JOAAT("gunslinger_arcade"), RAGE_JOAAT("road_arcade"), RAGE_JOAAT("AM_MP_DRONE")};
|
||||
|
||||
const std::unordered_set<Hash> bad_script_hashes = {RAGE_JOAAT("ggsm_arcade"), RAGE_JOAAT("camhedz_arcade"), RAGE_JOAAT("wizard_arcade"), RAGE_JOAAT("puzzle"), RAGE_JOAAT("fm_intro"), RAGE_JOAAT("pilot_school_mp"), RAGE_JOAAT("golf_mp"), RAGE_JOAAT("tennis_network_mp"), RAGE_JOAAT("fm_race_controler"), RAGE_JOAAT("fm_horde_controler"), RAGE_JOAAT("fm_mission_controller"), RAGE_JOAAT("fm_mission_controller_2020"), RAGE_JOAAT("fm_impromptu_dm_controler"), RAGE_JOAAT("fm_deathmatch_controler"), RAGE_JOAAT("fm_bj_race_controler"), RAGE_JOAAT("fm_survival_controller"), RAGE_JOAAT("sctv"), RAGE_JOAAT("am_pi_menu"), RAGE_JOAAT("scroll_arcade_cabinet"), RAGE_JOAAT("grid_arcade_cabinet"), RAGE_JOAAT("degenatron_games"), RAGE_JOAAT("gunslinger_arcade"), RAGE_JOAAT("road_arcade"), RAGE_JOAAT("AM_MP_DRONE")};
|
||||
static void START_NEW_SCRIPT_WITH_ARGS(rage::scrNativeCallContext* src)
|
||||
{
|
||||
const char* const name = src->get_arg<const char*>(0);
|
||||
|
||||
if (bad_script_hashes.contains(rage::joaat(name)))
|
||||
{
|
||||
@ -19,7 +16,11 @@ namespace big
|
||||
return;
|
||||
}
|
||||
|
||||
src->set_return_value<int>(SYSTEM::START_NEW_SCRIPT_WITH_ARGS(name, (Any*)args, argc, stackSize));
|
||||
};
|
||||
Any* args = src->get_arg<Any*>(1);
|
||||
const int argc = src->get_arg<int>(2);
|
||||
const int stackSize = src->get_arg<int>(3);
|
||||
|
||||
src->set_return_value<int>(SYSTEM::START_NEW_SCRIPT_WITH_ARGS(name, args, argc, stackSize));
|
||||
}
|
||||
}
|
||||
}
|
@ -1246,10 +1246,11 @@ namespace big
|
||||
// Prop Pool
|
||||
{
|
||||
"PRP",
|
||||
"48 8B 0D ? ? ? ? 49 8B D0 E8 ? ? ? ? 39 03 EB 19 41 80 78 ? ? 75 15 48 8B 0D ? ? ? ? 49 8B D0 E8 ? ? ? ? 39 43 04",
|
||||
"48 8B 05 ? ? ? ? 0F B7 50 10 48 8B 05",
|
||||
[](memory::handle ptr)
|
||||
{
|
||||
g_pointers->m_gta.m_prop_pool = ptr.add(3).rip().as<GenericPool**>();
|
||||
g_pointers->m_gta.m_pickup_pool = ptr.add(0xE).rip().as<GenericPool**>();
|
||||
}
|
||||
},
|
||||
// Vehicle Pool
|
||||
|
@ -18,6 +18,11 @@ namespace big::pools
|
||||
return **g_pointers->m_gta.m_prop_pool;
|
||||
}
|
||||
|
||||
inline auto& get_all_pickups()
|
||||
{
|
||||
return **g_pointers->m_gta.m_pickup_pool;
|
||||
}
|
||||
|
||||
inline auto get_all_peds_array()
|
||||
{
|
||||
return get_all_peds().to_array();
|
||||
@ -32,4 +37,9 @@ namespace big::pools
|
||||
{
|
||||
return get_all_props().to_array();
|
||||
}
|
||||
|
||||
inline auto get_all_pickups_array()
|
||||
{
|
||||
return get_all_pickups().to_array();
|
||||
}
|
||||
};
|
@ -6,18 +6,19 @@
|
||||
#include "util/math.hpp"
|
||||
#include "util/misc.hpp"
|
||||
#include "gta/enums.hpp"
|
||||
#include "core/scr_globals.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
static ImColor death_bg = ImColor(0.117f, 0.113f, 0.172f, .75f);
|
||||
static ImColor armor_blue_bg = ImColor(0.36f, 0.71f, 0.89f, .75f);
|
||||
static ImColor armor_blue = ImColor(0.36f, 0.71f, 0.89f, 1.f);
|
||||
static ImColor health_green_bg = ImColor(0.29f, 0.69f, 0.34f, .75f);
|
||||
static ImColor health_green = ImColor(0.29f, 0.69f, 0.34f, 1.f);
|
||||
static ImColor health_yellow_bg = ImColor(0.69f, 0.49f, 0.29f, .75f);
|
||||
static ImColor health_yellow = ImColor(0.69f, 0.49f, 0.29f, 1.f);
|
||||
static ImColor health_red_bg = ImColor(0.69f, 0.29f, 0.29f, .75f);
|
||||
static ImColor health_red = ImColor(0.69f, 0.29f, 0.29f, 1.f);
|
||||
static const ImColor death_bg = ImColor(0.117f, 0.113f, 0.172f, .75f);
|
||||
static const ImColor armor_blue_bg = ImColor(0.36f, 0.71f, 0.89f, .75f);
|
||||
static const ImColor armor_blue = ImColor(0.36f, 0.71f, 0.89f, 1.f);
|
||||
static const ImColor health_green_bg = ImColor(0.29f, 0.69f, 0.34f, .75f);
|
||||
static const ImColor health_green = ImColor(0.29f, 0.69f, 0.34f, 1.f);
|
||||
static const ImColor health_yellow_bg = ImColor(0.69f, 0.49f, 0.29f, .75f);
|
||||
static const ImColor health_yellow = ImColor(0.69f, 0.49f, 0.29f, 1.f);
|
||||
static const ImColor health_red_bg = ImColor(0.69f, 0.29f, 0.29f, .75f);
|
||||
static const ImColor health_red = ImColor(0.69f, 0.29f, 0.29f, 1.f);
|
||||
|
||||
void esp::draw_player(const player_ptr& plyr, ImDrawList* const draw_list)
|
||||
{
|
||||
@ -172,6 +173,40 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
void esp::draw_object(const rage::CDynamicEntity* object, ImDrawList* const draw_list, std::string name)
|
||||
{
|
||||
if (!object || !object->m_navigation)
|
||||
return;
|
||||
|
||||
auto& object_pos = *object->m_navigation->get_position();
|
||||
|
||||
float screen_x, screen_y;
|
||||
|
||||
const float distance = math::calculate_distance_from_game_cam(object_pos);
|
||||
const float multplr = distance > g.esp.global_render_distance[1] ? -1.f : 6.17757f / distance;
|
||||
|
||||
if (multplr == -1.f || g.esp.global_render_distance[0] > distance)
|
||||
return;
|
||||
|
||||
ImVec2 name_pos;
|
||||
|
||||
if (g_pointers->m_gta.m_get_screen_coords_for_world_coords(object_pos.data, &screen_x, &screen_y))
|
||||
{
|
||||
const auto esp_x = (float)*g_pointers->m_gta.m_resolution_x * screen_x;
|
||||
const auto esp_y = (float)*g_pointers->m_gta.m_resolution_y * screen_y;
|
||||
name_pos = {esp_x, esp_y};
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ImU32 esp_color = g.esp.default_color;
|
||||
|
||||
draw_list->AddText(name_pos, esp_color, name.c_str());
|
||||
}
|
||||
|
||||
|
||||
void esp::draw()
|
||||
{
|
||||
if (!g.esp.enabled)
|
||||
@ -182,6 +217,18 @@ namespace big
|
||||
g_player_service->iterate([draw_list](const player_entry& entry) {
|
||||
draw_player(entry.second, draw_list);
|
||||
});
|
||||
|
||||
if (g.esp.object_esp)
|
||||
{
|
||||
if (g.esp.show_gs_cache_boxes && *g_pointers->m_gta.m_script_globals && **g_pointers->m_gta.m_script_globals)
|
||||
{
|
||||
auto gs_cache_box_entity = *scr_globals::pickups.at(605).as<Entity*>();
|
||||
if (gs_cache_box_entity != 0)
|
||||
{
|
||||
draw_object(g_pointers->m_gta.m_handle_to_ptr(gs_cache_box_entity), draw_list, "G's Cache");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "entities/CDynamicEntity.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
@ -8,5 +9,6 @@ namespace big
|
||||
public:
|
||||
static void draw();
|
||||
static void draw_player(const player_ptr& plyr, ImDrawList* const draw_list);
|
||||
static void draw_object(const rage::CDynamicEntity* object, ImDrawList* const draw_list, std::string name);
|
||||
};
|
||||
}
|
@ -38,6 +38,11 @@ namespace big
|
||||
ImGui::Checkbox("SETTINGS_ESP_PLAYER_GOD_MODE"_T.data(), &g.esp.god);
|
||||
ImGui::Checkbox("SETTINGS_ESP_PLAYER_HEALTH"_T.data(), &g.esp.health);
|
||||
ImGui::Checkbox("SETTINGS_ESP_PLAYER_ARMOR"_T.data(), &g.esp.armor);
|
||||
ImGui::Checkbox("SETTINGS_ESP_OBJECT_ESP"_T.data(), &g.esp.object_esp);
|
||||
if (g.esp.object_esp)
|
||||
{
|
||||
ImGui::Checkbox("SETTINGS_ESP_OBJECT_ESP_GS_CACHE"_T.data(), &g.esp.show_gs_cache_boxes);
|
||||
}
|
||||
|
||||
ImGui::Checkbox("SETTINGS_ESP_COLOR_W_DISTANCE"_T.data(), &g.esp.change_esp_color_from_dist);
|
||||
if (g.esp.health)
|
||||
|
Loading…
Reference in New Issue
Block a user