Toxic update (#641)
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
#include "shop_controller.hpp"
|
||||
#include "network_session_host.hpp"
|
||||
#include "am_launcher.hpp"
|
||||
#include "creator.hpp"
|
||||
#include "crossmap.hpp"
|
||||
|
||||
#include <script/scrProgram.hpp>
|
||||
@ -98,39 +99,51 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
constexpr auto ALL_SCRIPT_HASH = RAGE_JOAAT("ALL_SCRIPTS");
|
||||
constexpr auto ALL_SCRIPT_HASH = RAGE_JOAAT("ALL_SCRIPTS");
|
||||
|
||||
native_hooks::native_hooks()
|
||||
{
|
||||
add_native_detour(0x812595A0644CE1DE, all_scripts::IS_DLC_PRESENT);
|
||||
add_native_detour(0x5D10B3795F3FC886, all_scripts::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA);
|
||||
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x06843DA7060A026B, carmod_shop::SET_ENTITY_COORDS);
|
||||
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x8E2530AA8ADA980E, carmod_shop::SET_ENTITY_HEADING);
|
||||
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x34E710FF01247C5A, carmod_shop::SET_VEHICLE_LIGHTS);
|
||||
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x767FBC2AC802EF3D, carmod_shop::STAT_GET_INT);
|
||||
add_native_detour(RAGE_JOAAT("freemode"), 0x95914459A87EBA28, freemode::NETWORK_BAIL);
|
||||
add_native_detour(RAGE_JOAAT("freemode"), 0x5E9564D8246B909A, freemode::IS_PLAYER_PLAYING);
|
||||
add_native_detour(RAGE_JOAAT("freemode"), 0xEA1C610A04DB6BBB, freemode::SET_ENTITY_VISIBLE);
|
||||
add_native_detour(RAGE_JOAAT("shop_controller"), 0xDC38CC1E35B6A5D7, shop_controller::SET_WARNING_MESSAGE_WITH_HEADER);
|
||||
add_native_detour(RAGE_JOAAT("maintransition"), 0x6F3D4ED9BEE4E61D, network::NETWORK_SESSION_HOST);
|
||||
add_native_detour(RAGE_JOAAT("am_launcher"), 0xB8BA7F44DF1575E1, am_launcher::START_NEW_SCRIPT_WITH_ARGS);
|
||||
|
||||
for (auto& entry : *g_pointers->m_script_program_table)
|
||||
if (entry.m_program)
|
||||
hook_program(entry.m_program);
|
||||
|
||||
g_native_hooks = this;
|
||||
}
|
||||
|
||||
native_hooks::~native_hooks()
|
||||
{
|
||||
m_native_hooks.clear();
|
||||
g_native_hooks = nullptr;
|
||||
}
|
||||
|
||||
void native_hooks::add_native_detour(rage::scrNativeHash hash, rage::scrNativeHandler detour)
|
||||
native_hooks::native_hooks()
|
||||
{
|
||||
add_native_detour(ALL_SCRIPT_HASH, hash, detour);
|
||||
add_native_detour(0x812595A0644CE1DE, all_scripts::IS_DLC_PRESENT);
|
||||
add_native_detour(0x5D10B3795F3FC886, all_scripts::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA);
|
||||
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x06843DA7060A026B, carmod_shop::SET_ENTITY_COORDS);
|
||||
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x8E2530AA8ADA980E, carmod_shop::SET_ENTITY_HEADING);
|
||||
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x34E710FF01247C5A, carmod_shop::SET_VEHICLE_LIGHTS);
|
||||
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x767FBC2AC802EF3D, carmod_shop::STAT_GET_INT);
|
||||
add_native_detour(RAGE_JOAAT("freemode"), 0x95914459A87EBA28, freemode::NETWORK_BAIL);
|
||||
add_native_detour(RAGE_JOAAT("freemode"), 0x5E9564D8246B909A, freemode::IS_PLAYER_PLAYING);
|
||||
add_native_detour(RAGE_JOAAT("freemode"), 0xEA1C610A04DB6BBB, freemode::SET_ENTITY_VISIBLE);
|
||||
add_native_detour(RAGE_JOAAT("freemode"), 0x231C8F89D0539D8F, freemode::SET_BIGMAP_ACTIVE);
|
||||
add_native_detour(RAGE_JOAAT("freemode"), 0x9029B2F3DA924928, freemode::SET_BLIP_DISPLAY);
|
||||
add_native_detour(RAGE_JOAAT("shop_controller"), 0xDC38CC1E35B6A5D7, shop_controller::SET_WARNING_MESSAGE_WITH_HEADER);
|
||||
add_native_detour(RAGE_JOAAT("maintransition"), 0x6F3D4ED9BEE4E61D, network::NETWORK_SESSION_HOST);
|
||||
add_native_detour(RAGE_JOAAT("am_launcher"), 0xB8BA7F44DF1575E1, am_launcher::START_NEW_SCRIPT_WITH_ARGS);
|
||||
|
||||
add_native_detour(RAGE_JOAAT("fm_race_creator"), 0x2C83A9DA6BFFC4F9, creator::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH);
|
||||
add_native_detour(RAGE_JOAAT("fm_capture_creator"), 0x2C83A9DA6BFFC4F9, creator::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH);
|
||||
add_native_detour(RAGE_JOAAT("fm_deathmatch_creator"), 0x2C83A9DA6BFFC4F9, creator::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH);
|
||||
add_native_detour(RAGE_JOAAT("fm_lts_creator"), 0x2C83A9DA6BFFC4F9, creator::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH);
|
||||
|
||||
add_native_detour(RAGE_JOAAT("fm_race_creator"), 0x9F47B058362C84B5, creator::GET_ENTITY_MODEL);
|
||||
add_native_detour(RAGE_JOAAT("fm_capture_creator"), 0x9F47B058362C84B5, creator::GET_ENTITY_MODEL);
|
||||
add_native_detour(RAGE_JOAAT("fm_deathmatch_creator"), 0x9F47B058362C84B5, creator::GET_ENTITY_MODEL);
|
||||
add_native_detour(RAGE_JOAAT("fm_lts_creator"), 0x9F47B058362C84B5, creator::GET_ENTITY_MODEL);
|
||||
|
||||
for (auto& entry : *g_pointers->m_script_program_table)
|
||||
if (entry.m_program)
|
||||
hook_program(entry.m_program);
|
||||
|
||||
g_native_hooks = this;
|
||||
}
|
||||
|
||||
native_hooks::~native_hooks()
|
||||
{
|
||||
m_native_hooks.clear();
|
||||
g_native_hooks = nullptr;
|
||||
}
|
||||
|
||||
void native_hooks::add_native_detour(rage::scrNativeHash hash, rage::scrNativeHandler detour)
|
||||
{
|
||||
add_native_detour(ALL_SCRIPT_HASH, hash, detour);
|
||||
}
|
||||
|
||||
void native_hooks::add_native_detour(rage::joaat_t script_hash, rage::scrNativeHash hash, rage::scrNativeHandler detour)
|
||||
@ -144,27 +157,27 @@ namespace big
|
||||
m_native_registrations.emplace(script_hash, std::vector<native_detour>({ { hash, detour } }));
|
||||
}
|
||||
|
||||
void native_hooks::hook_program(rage::scrProgram* program)
|
||||
{
|
||||
std::unordered_map<rage::scrNativeHash, rage::scrNativeHandler> native_replacements;
|
||||
const auto script_hash = program->m_name_hash;
|
||||
void native_hooks::hook_program(rage::scrProgram* program)
|
||||
{
|
||||
std::unordered_map<rage::scrNativeHash, rage::scrNativeHandler> native_replacements;
|
||||
const auto script_hash = program->m_name_hash;
|
||||
|
||||
// Functions that need to be detoured for all scripts
|
||||
if (const auto& pair = m_native_registrations.find(ALL_SCRIPT_HASH); pair != m_native_registrations.end())
|
||||
for (const auto& native_hook_reg : pair->second)
|
||||
native_replacements.insert(native_hook_reg);
|
||||
// Functions that need to be detoured for all scripts
|
||||
if (const auto& pair = m_native_registrations.find(ALL_SCRIPT_HASH); pair != m_native_registrations.end())
|
||||
for (const auto& native_hook_reg : pair->second)
|
||||
native_replacements.insert(native_hook_reg);
|
||||
|
||||
// Functions that only need to be detoured for a specific script
|
||||
if (const auto& pair = m_native_registrations.find(script_hash); pair != m_native_registrations.end())
|
||||
for (const auto& native_hook_reg : pair->second)
|
||||
native_replacements.insert(native_hook_reg);
|
||||
// Functions that only need to be detoured for a specific script
|
||||
if (const auto& pair = m_native_registrations.find(script_hash); pair != m_native_registrations.end())
|
||||
for (const auto& native_hook_reg : pair->second)
|
||||
native_replacements.insert(native_hook_reg);
|
||||
|
||||
if (!native_replacements.empty())
|
||||
{
|
||||
m_native_hooks.emplace(
|
||||
if (!native_replacements.empty())
|
||||
{
|
||||
m_native_hooks.emplace(
|
||||
program,
|
||||
std::make_unique<native_hook>(program, native_replacements)
|
||||
);
|
||||
}
|
||||
}
|
||||
std::make_unique<native_hook>(program, native_replacements)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user