chore: Renamed ptr_to_handle & some small refactoring (#632)

This commit is contained in:
Aure7138 2022-11-23 06:12:40 +08:00 committed by GitHub
parent 64b47779e8
commit d0b523873d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 18 deletions

View File

@ -22,8 +22,8 @@ namespace big::functions
using increment_stat_event = bool(*)(uint64_t net_event_struct, int64_t sender, int64_t a3);
using ptr_to_handle = Entity(*)(void* entity);
using get_script_handle_t = uint64_t(*)(int64_t);
using ptr_to_handle = Entity(*)(void*);
using handle_to_ptr = void*(*)(Entity);
using multiplayer_chat_filter = int(__int64 chat_type, const char* input, const char** output);
using write_player_game_state_data_node = bool(*)(rage::netObject* plr, CPlayerGameStateDataNode* node);

View File

@ -224,16 +224,16 @@ namespace big
m_replay_interface = ptr.add(0x1F).rip().as<rage::CReplayInterface**>();
});
// Pointer to Handle
// Ptr To Handle
main_batch.add("PTH", "48 8B F9 48 83 C1 10 33 DB", [this](memory::handle ptr)
{
m_ptr_to_handle = ptr.sub(0x15).as<decltype(m_ptr_to_handle)>();
});
// Get Script Handle
// Handle To Ptr
main_batch.add("GSH", "83 F9 FF 74 31 4C 8B 0D", [this](memory::handle ptr)
{
m_get_script_handle = ptr.as<functions::get_script_handle_t>();
m_handle_to_ptr = ptr.as<decltype(m_handle_to_ptr)>();
});
// Blame Explode
@ -576,16 +576,10 @@ namespace big
if (auto pat = mem_region.scan("41 80 78 28 ? 0F 85 F5 01 00 00"))
{
m_bypass_max_count_of_active_sticky_bombs = pat.add(4).as<uint8_t*>();
// declare it right now even though we write the same value
// so that it get cleaned up in the dctor
memory::byte_patch::make(m_bypass_max_count_of_active_sticky_bombs, *m_bypass_max_count_of_active_sticky_bombs);
m_bypass_max_count_of_active_sticky_bombs = memory::byte_patch::make(pat.add(4).as<uint8_t*>(), { 99 }).get();
if (g->weapons.bypass_c4_limit)
{
*m_bypass_max_count_of_active_sticky_bombs = 99;
}
m_bypass_max_count_of_active_sticky_bombs->apply();
}
/**

View File

@ -30,7 +30,7 @@ namespace big
rage::CReplayInterface** m_replay_interface{};
functions::ptr_to_handle m_ptr_to_handle{};
functions::get_script_handle_t m_get_script_handle{};
functions::handle_to_ptr m_handle_to_ptr{};
rage::scrNativeRegistrationTable* m_native_registration_table{};
functions::get_native_handler m_get_native_handler{};
functions::fix_vectors m_fix_vectors{};
@ -122,7 +122,7 @@ namespace big
functions::start_get_session_by_gamer_handle m_start_get_session_by_gamer_handle;
functions::join_session_by_info m_join_session_by_info;
uint8_t* m_bypass_max_count_of_active_sticky_bombs;
memory::byte_patch* m_bypass_max_count_of_active_sticky_bombs;
functions::reset_network_complaints m_reset_network_complaints{};

View File

@ -296,7 +296,7 @@ namespace big
const auto vehicle_rotation = ENTITY::GET_ENTITY_ROTATION(vehicle, 0);
bool has_collision = ENTITY::GET_ENTITY_COLLISION_DISABLED(object);
bool is_visible = ENTITY::IS_ENTITY_VISIBLE(object);
CObject* cobject = (CObject*)g_pointers->m_get_script_handle(vehicle);
CObject* cobject = (CObject*)g_pointers->m_handle_to_ptr(vehicle);
bool is_invincible = misc::has_bit_set(&(int&)cobject->m_damage_bits, 8);
Vector3 rotation;
@ -423,7 +423,7 @@ namespace big
vehicle_json[pearlescent_color_key] = pearlescent_color;
bool has_collision = ENTITY::GET_ENTITY_COLLISION_DISABLED(vehicle);
bool is_visible = ENTITY::IS_ENTITY_VISIBLE(vehicle);
CVehicle* cvehicle = (CVehicle*)g_pointers->m_get_script_handle(vehicle);
CVehicle* cvehicle = (CVehicle*)g_pointers->m_handle_to_ptr(vehicle);
bool is_invincible = misc::has_bit_set(&(int&)cvehicle->m_damage_bits, 8);
vehicle_json[has_collision_key] = !has_collision;
vehicle_json[is_visible_key] = is_visible;

View File

@ -22,7 +22,10 @@ namespace big
if (ImGui::Checkbox("Bypass C4 Limit", &g->weapons.bypass_c4_limit))
{
*g_pointers->m_bypass_max_count_of_active_sticky_bombs = g->weapons.bypass_c4_limit ? 99 : 4;
if (g->weapons.bypass_c4_limit)
g_pointers->m_bypass_max_count_of_active_sticky_bombs->apply();
else
g_pointers->m_bypass_max_count_of_active_sticky_bombs->restore();
}
eAmmoSpecialType selected_ammo = g->weapons.ammo_special.type;