Update menu for 1.61 (#360)

This commit is contained in:
Yimura 2022-07-27 14:39:22 +02:00 committed by GitHub
parent 2f92eebb9f
commit e7bfb4a8f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 104 additions and 289 deletions

View File

@ -77,7 +77,7 @@ namespace big
"DLC Intro Bink", "DLC Intro Bink",
}; };
auto transition_state = script_global(1574988); auto transition_state = script_global(1574991);
eTransitionState last_state = eTransitionState::TRANSITION_STATE_EMPTY; eTransitionState last_state = eTransitionState::TRANSITION_STATE_EMPTY;
void looped::hud_transition_state() void looped::hud_transition_state()
{ {

View File

@ -2,7 +2,6 @@
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "gta/enums.hpp" #include "gta/enums.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "script.hpp"
#include "util/entity.hpp" #include "util/entity.hpp"
namespace big namespace big
@ -36,10 +35,10 @@ namespace big
void looped::self_noclip() void looped::self_noclip()
{ {
bool bNoclip = g->self.noclip; const auto bNoclip = g->self.noclip;
Vector3 location = self::pos; const auto location = self::pos;
Entity ent = self::veh != NULL ? self::veh : self::ped; const Entity ent = (self::veh != 0 && g_local_player->m_ped_task_flag & (int)ePedTask::TASK_DRIVING) ? self::veh : self::ped;
// cleanup when changing entities // cleanup when changing entities
if (prev != ent) if (prev != ent)
@ -53,7 +52,6 @@ namespace big
if (bNoclip) if (bNoclip)
{ {
Vector3 vel = { 0.f, 0.f, 0.f }; Vector3 vel = { 0.f, 0.f, 0.f };
float heading = 0.f;
// Left Shift // Left Shift
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
@ -91,7 +89,7 @@ namespace big
ENTITY::FREEZE_ENTITY_POSITION(ent, false); ENTITY::FREEZE_ENTITY_POSITION(ent, false);
Vector3 offset = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ent, vel.x, vel.y, 0.f); const auto offset = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ent, vel.x, vel.y, 0.f);
vel.x = offset.x - location.x; vel.x = offset.x - location.x;
vel.y = offset.y - location.y; vel.y = offset.y - location.y;

View File

@ -5,6 +5,6 @@ namespace big
{ {
void looped::tunables_disable_phone() void looped::tunables_disable_phone()
{ {
*script_global(19937).as<bool*>() = g->tunables.disable_phone; *script_global(20249).as<bool*>() = g->tunables.disable_phone;
} }
} }

View File

@ -7,8 +7,8 @@ namespace big
{ {
if (g->tunables.no_idle_kick) if (g->tunables.no_idle_kick)
{ {
*script_global(1644218).at(1149).as<int*>() = 0; *script_global(1648034).at(1156).as<int*>() = 0;
*script_global(1644218).at(1165).as<int*>() = 0; *script_global(1648034).at(1172).as<int*>() = 0;
} }
} }
} }

View File

@ -6,6 +6,6 @@ namespace big
// allows for spawning unreleased vehicles in online and online vehicles in single player // allows for spawning unreleased vehicles in online and online vehicles in single player
void looped::vehicle_despawn_bypass() void looped::vehicle_despawn_bypass()
{ {
*script_global(4533757).as<bool*>() = true; *script_global(4539659).as<bool*>() = true;
} }
} }

View File

@ -20,12 +20,12 @@ namespace big
if ( if (
auto carmod_shop_thread = gta_util::find_script_thread(hash); auto carmod_shop_thread = gta_util::find_script_thread(hash);
carmod_shop_thread && carmod_shop_thread &&
*script_local(carmod_shop_thread, 726).at(11).as<int*>() != 4 *script_local(carmod_shop_thread, 728).at(11).as<int*>() != 4
) )
{ {
g->vehicle.ls_customs = false; g->vehicle.ls_customs = false;
*script_local(carmod_shop_thread, 726).as<int*>() = 1; // cleanup *script_local(carmod_shop_thread, 728).as<int*>() = 1; // cleanup
} }
} }
@ -55,10 +55,10 @@ namespace big
{ {
if (auto carmod_shop_thread = gta_util::find_script_thread(hash); carmod_shop_thread) if (auto carmod_shop_thread = gta_util::find_script_thread(hash); carmod_shop_thread)
{ {
*script_local(carmod_shop_thread, 726).at(406).as<int*>() = veh; *script_local(carmod_shop_thread, 728).at(406).as<int*>() = veh;
*script_local(carmod_shop_thread, 2110).as<bool*>() = false; // skips cutscene that's invisible *script_local(carmod_shop_thread, 2149).as<bool*>() = false; // skips cutscene that's invisible
*script_local(carmod_shop_thread, 726).at(11).as<int*>() = 4; *script_local(carmod_shop_thread, 728).at(11).as<int*>() = 4;
} }
} }
} }

View File

@ -126,50 +126,39 @@ namespace big
TASK_UNK = 1 << 5, TASK_UNK = 1 << 5,
TASK_DRIVING = 1 << 6 TASK_DRIVING = 1 << 6
}; };
enum class eRemoteEvent enum class eRemoteEvent
{ {
Bounty = 1294995624, Bounty = 1294995624, // (137, "FM_TXT_BNTY0", iVar1, PLAYER::GET_PLAYER_NAME(Var2.f_1), "", 5000, Var2.f_6);
CeoBan = -764524031, CeoBan = 1240068495, // mpply_vipgameplaydisabledtimer
CeoKick = 248967238, CeoKick = -1425016400, // BGDISMISSED
CeoMoney = 1890277845, CeoMoney = 547083265, // Goon_Paid_Large
ClearWantedLevel = -91354030, ClearWantedLevel = 1449852136,
Crash = -1386010354, FakeDeposit = -1529596656, // TICK_ATTVAN
FakeDeposit = 677240627, ForceMission = -283041276, // ), Var0.f_2, 1))
ForceMission = 2020588206, ForceMission2 = -1908874529,
GtaBanner = 1572255940, GtaBanner = 145637109, // NETWORK::NETWORK_IS_SCRIPT_ACTIVE("BUSINESS_BATTLES", -1, true, 0) second one
MCTeleport = 962740265, NetworkBail = 1674887089, // NETWORK::NETWORK_BAIL(16, 0, 0); xref func
NetworkBail = 1228916411, PersonalVehicleDestroyed = -1838276770, // PLYVEH_INS_DES1
PersonalVehicleDestroyed = 802133775, RemoteOffradar = -1973627888, // NETWORK::GET_TIME_DIFFERENCE(NETWORK::GET_NETWORK_TIME(), Var0.f_2)
RemoteOffradar = -391633760, RotateCam = -1388926377, // CnCTG_IN_BF
RotateCam = 801199324, SendToCutscene = 2131601101, // (bVar3, bVar4, 125f, 1)
SendToCutscene = 1068259786, SendToCayoPerico = 1361475530, // CELL_HI_INV
SendToCayoPerico = -621279188, SendToLocation = 1214823473, // &Var222, 11);
SendToLocation = 1463943751, SHKick = 1037001637,
SoundSpam = 1132878564, SoundSpam = 1111927333, // CELL_APTINVYACHT
Spectate = -1113591308, Spectate = -2131157870, // SPEC_TCK1
Teleport = 603406648, Teleport = -1390976345, // Mission_Pass_Notify
TransactionError = -1704141512, TransactionError = -768108950, // NETWORK_RECEIVE_PLAYER_JOBSHARE_CASH
VehicleKick = 578856274, VehicleKick = -714268990, // PIM_RFMOC
Unknown1 = -145306724, Kick = 1674887089,
Unknown2 = -581037897, GiveCollectible = -1178972880, // DLC_SUM20_HIDDEN_COLLECTIBLES xref
Unknown3 = 1757755807, ChangeMCRole = 656530441, // _PLAYSTATS_CHANGE_MC_ROLE
Unknown4 = 436475575, DisableRecording = 867047895, // GET_FINAL_RENDERED_CAM_COORD
Unknown5 = 990606644, MCTeleport = -555356783, // NETWORK::NETWORK_HASH_FROM_PLAYER_HANDLE(PLAYER::PLAYER_ID()) == (first one)
Unknown6 = 69874647,
SEC3 = -2113023004, Crash = -1386010354, // SET_NO_LOADING_SCREEN, xref it
SEC6 = 704979198, Crash2 = 1348481963,
SEC7 = -1715193475,
SEC8 = 1258808115,
SEC9 = 2112408256,
SEC10 = 998716537,
SEC11 = 163598572,
SEC12 = -1970125962,
SEC13 = -1056683619,
Spaghettios = -393294520,
ForceMission2 = -1525161016,
SHKick = -786546101
}; };
enum class eSessionType enum class eSessionType

View File

@ -37,25 +37,28 @@ namespace rage
{ {
public: public:
virtual ~scrThread() = default; // 0 (0x00) virtual ~scrThread() = default; // 0 (0x00)
virtual void reset(std::uint32_t script_hash, void *args, std::uint32_t arg_count) = 0; // 1 (0x08) virtual void reset(std::uint32_t script_hash, void* args, std::uint32_t arg_count) = 0; // 1 (0x08)
virtual eThreadState run() = 0; // 2 (0x10) virtual eThreadState run() = 0; // 2 (0x10)
virtual eThreadState tick(std::uint32_t ops_to_execute) = 0; // 3 (0x18) virtual eThreadState tick(std::uint32_t ops_to_execute) = 0; // 3 (0x18)
virtual void kill() = 0; // 4 (0x20) virtual void kill() = 0; // 4 (0x20)
static scrThread* get() inline static scrThread* get()
{ {
return rage::tlsContext::get()->m_script_thread; return rage::tlsContext::get()->m_script_thread;
} }
public: public:
scrThreadContext m_context; // 0x08 scrThreadContext m_context; // 0x08
void *m_stack; // 0xB0 void* m_stack; // 0xB0
char m_padding[0x10]; // 0xB8 char m_padding[0x4]; // 0xB8
const char *m_exit_message; // 0xC8 uint32_t m_arg_size; // 0xBC
char m_name[0x40]; // 0xD0 uint32_t m_arg_loc; // 0xC0
scriptHandler *m_handler; // 0x110 char m_padding2[0x4]; // 0xC4
scriptHandlerNetComponent *m_net_component; // 0x118 const char* m_exit_message; // 0xC8
char m_pad[0x4];
char m_name[0x40]; // 0xD4
scriptHandler* m_handler; // 0x114
scriptHandlerNetComponent* m_net_component; // 0x11C
}; };
static_assert(sizeof(scrThread) == 0x120);
} }
class GtaThread : public rage::scrThread class GtaThread : public rage::scrThread
@ -75,4 +78,4 @@ public:
char m_padding7[0x0F]; // 0x149 char m_padding7[0x0F]; // 0x149
}; };
static_assert(sizeof(GtaThread) == 0x158); static_assert(sizeof(GtaThread) == 0x160);

View File

@ -9,14 +9,15 @@ namespace rage
public: public:
char m_padding1[0xC8]; // 0x00 char m_padding1[0xC8]; // 0x00
sysMemAllocator* m_allocator; // 0xC8 sysMemAllocator* m_allocator; // 0xC8
char m_padding2[0x758]; // 0xD0 char m_padding2[0x770]; // 0xD0
scrThread* m_script_thread; // 0x828 scrThread* m_script_thread; // 0x840
bool m_is_script_thread_active; // 0x830 bool m_is_script_thread_active; // 0x848
static tlsContext* get() static tlsContext* get()
{ {
return *reinterpret_cast<tlsContext**>(__readgsqword(0x58)); return *reinterpret_cast<tlsContext**>(__readgsqword(0x58));
} }
}; };
static_assert(sizeof(tlsContext) == 0x838);
static_assert(sizeof(tlsContext) == 0x850);
} }

View File

@ -35,9 +35,6 @@ namespace big
// Network Group Override // Network Group Override
m_network_group_override("NGO", g_pointers->m_network_group_override, &hooks::network_group_override), m_network_group_override("NGO", g_pointers->m_network_group_override, &hooks::network_group_override),
// Net Array Handler
m_net_array_handler_hook("NAH", g_pointers->m_net_array_handler, &hooks::net_array_handler),
// Is DLC Present // Is DLC Present
m_is_dlc_present_hook("IDP", g_pointers->m_is_dlc_present, &hooks::is_dlc_present), m_is_dlc_present_hook("IDP", g_pointers->m_is_dlc_present, &hooks::is_dlc_present),
@ -88,8 +85,6 @@ namespace big
m_network_player_mgr_init_hook.enable(); m_network_player_mgr_init_hook.enable();
m_network_player_mgr_shutdown_hook.enable(); m_network_player_mgr_shutdown_hook.enable();
m_net_array_handler_hook.enable();
m_player_has_joined_hook.enable(); m_player_has_joined_hook.enable();
m_player_has_left_hook.enable(); m_player_has_left_hook.enable();
@ -121,8 +116,6 @@ namespace big
m_player_has_joined_hook.disable(); m_player_has_joined_hook.disable();
m_player_has_left_hook.disable(); m_player_has_left_hook.disable();
m_net_array_handler_hook.disable();
m_network_player_mgr_init_hook.disable(); m_network_player_mgr_init_hook.disable();
m_network_player_mgr_shutdown_hook.disable(); m_network_player_mgr_shutdown_hook.disable();

View File

@ -29,8 +29,6 @@ namespace big
static void network_group_override(std::int64_t a1, std::int64_t a2, std::int64_t a3); static void network_group_override(std::int64_t a1, std::int64_t a2, std::int64_t a3);
static bool net_array_handler(__int64 netArrayHandlerBaseMgr, CNetGamePlayer* a2, rage::datBitBuffer* datbitbuffer, unsigned int bytes_to_read, __int16 a5);
static void player_join(CNetworkObjectMgr* _this, CNetGamePlayer* net_player); static void player_join(CNetworkObjectMgr* _this, CNetGamePlayer* net_player);
static void player_leave(CNetworkObjectMgr* _this, CNetGamePlayer* net_player); static void player_leave(CNetworkObjectMgr* _this, CNetGamePlayer* net_player);
@ -93,8 +91,6 @@ namespace big
detour_hook m_network_group_override; detour_hook m_network_group_override;
detour_hook m_net_array_handler_hook;
detour_hook m_player_has_joined_hook; detour_hook m_player_has_joined_hook;
detour_hook m_player_has_left_hook; detour_hook m_player_has_left_hook;

View File

@ -1,23 +0,0 @@
#include "hooking.hpp"
namespace big
{
// in this hook we rebuild how the game reads data from the datBitBuffer
// we specifically recreate what the game uses to "detect" the NET_ARRAY_ERROR
// then if we find such a crash we just return false;
bool hooks::net_array_handler(long long netArrayHandlerBaseMgr, CNetGamePlayer* a2, rage::datBitBuffer* datbitbuffer, unsigned int bytes_to_read, short a5)
{
if (datbitbuffer->m_bitsRead + bytes_to_read > datbitbuffer->m_curBit)
{
if (g->notifications.net_array_error.log)
LOG(WARNING) << "Received NET_ARRAY_ERROR crash from " << a2->get_name();
if (g->notifications.net_array_error.notify)
g_notification_service->push_warning("Protections", fmt::format("Detected NET_ARRAY_ERROR crash from {}", a2->get_name()));
return false;
}
return g_hooking->m_net_array_handler_hook.get_original<decltype(&hooks::net_array_handler)>()(netArrayHandlerBaseMgr, a2, datbitbuffer, bytes_to_read, a5);
}
}

View File

@ -66,6 +66,7 @@ namespace big
} }
break; break;
case eRemoteEvent::Crash: case eRemoteEvent::Crash:
case eRemoteEvent::Crash2:
if (g->protections.script_events.crash) if (g->protections.script_events.crash)
{ {
format_string(player_name, "TSE Crash", notify.crash.log, notify.crash.notify); format_string(player_name, "TSE Crash", notify.crash.log, notify.crash.notify);
@ -238,152 +239,6 @@ namespace big
return true; return true;
} }
break; break;
case eRemoteEvent::Unknown1:
if (g->protections.script_events.crash && args[2] >= 32) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::Unknown2:
if (g->protections.script_events.crash && (args[2] >= 62 || args[3] >= 32)) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::Unknown3:
if (g->protections.script_events.crash && args[2] >= 62) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::Unknown4:
case eRemoteEvent::Unknown5:
if (g->protections.script_events.crash && args[2] >= 20) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::Unknown6:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC3:
if (
g->protections.script_events.crash &&
(
(args[2] <= 115831 || args[2] >= 9999449) ||
(args[3] <= -1 || args[3] >= 1) ||
(args[4] <= -1 || args[4] >= 3) ||
(args[5] <= -1 || args[5] >= 101) ||
(args[6] <= -1 || args[6] >= 3) ||
(args[7] <= -1 || args[7] >= 1)
)
) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC6:
if (
g->protections.script_events.crash &&
(
(args[2] <= -1 || args[2] >= 1) ||
(args[3] <= -2 || args[3] >= 0) ||
(args[4] <= 3 || args[4] >= 5) ||
(args[5] <= 172 || args[5] >= 174) ||
(args[6] <= 20 || args[6] >= 510) ||
(args[7] <= 62 || args[7] >= 64) ||
(args[11] <= -1 || args[11] >= 1) ||
(args[12] <= -1 || args[12] >= 1) ||
(args[13] <= -1 || args[13] >= 1)
)
) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC7:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC8:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC9:
if (
g->protections.script_events.crash &&
(
(args[2] <= -1986324736 || args[2] >= 1747413822) ||
(args[2] > -9999999 || args[2] < 77777777) ||
(args[3] <= -1986324736 || args[3] >= 1777712108) ||
(args[3] > -9999999 || args[3] < 77777777) ||
(args[4] <= -1673857408 || args[4] >= 1780088064) ||
(args[4] > -9999999 || args[4] < 77777777) ||
(args[6] <= (0LL - 2588888790LL) || args[6] >= 2100146067)
)
) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC10:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC11:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC12:
if (
g->protections.script_events.crash &&
(
(args[2] <= -1 || args[2] >= 50) ||
(args[3] <= -1 || args[3] >= 50)
)
) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC13:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::Spaghettios:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::ForceMission2: case eRemoteEvent::ForceMission2:
if (g->protections.script_events.force_mission) if (g->protections.script_events.force_mission)
{ {

View File

@ -15,7 +15,7 @@ namespace big
if (g->notifications.transaction_rate_limit.notify) if (g->notifications.transaction_rate_limit.notify)
g_notification_service->push_warning("Transaction Rate Limit", "You're receiving transaction rate limits, whatever you're doing do it less."); g_notification_service->push_warning("Transaction Rate Limit", "You're receiving transaction rate limits, whatever you're doing do it less.");
*script_global(4529830).as<int*>() = 0; *script_global(4535606).as<int*>() = 0;
return; return;
} }

View File

@ -30,6 +30,8 @@ namespace big
main_batch.add("PF", "48 8B 05 ? ? ? ? 48 8B 48 08 48 85 C9 74 52 8B 81", [this](memory::handle ptr) main_batch.add("PF", "48 8B 05 ? ? ? ? 48 8B 48 08 48 85 C9 74 52 8B 81", [this](memory::handle ptr)
{ {
m_ped_factory = ptr.add(3).rip().as<CPedFactory**>(); m_ped_factory = ptr.add(3).rip().as<CPedFactory**>();
LOG(G3LOG_DEBUG) << "CPedFactory => [" << HEX_TO_UPPER(m_ped_factory) << "]";
}); });
// Network Player Manager // Network Player Manager
@ -68,6 +70,8 @@ namespace big
main_batch.add("SG", "48 8D 15 ? ? ? ? 4C 8B C0 E8 ? ? ? ? 48 85 FF 48 89 1D", [this](memory::handle ptr) main_batch.add("SG", "48 8D 15 ? ? ? ? 4C 8B C0 E8 ? ? ? ? 48 85 FF 48 89 1D", [this](memory::handle ptr)
{ {
m_script_globals = ptr.add(3).rip().as<std::int64_t**>(); m_script_globals = ptr.add(3).rip().as<std::int64_t**>();
LOG(G3LOG_DEBUG) << "ScriptGlobals => [" << HEX_TO_UPPER(m_script_globals) << "]";
}); });
// Game Script Handle Manager // Game Script Handle Manager
@ -206,7 +210,9 @@ namespace big
// Replay Interface // Replay Interface
main_batch.add("RI", "0F B7 44 24 ? 66 89 44 4E", [this](memory::handle ptr) main_batch.add("RI", "0F B7 44 24 ? 66 89 44 4E", [this](memory::handle ptr)
{ {
m_replay_interface = ptr.add(0x1F).rip().as<decltype(m_replay_interface)>(); m_replay_interface = ptr.add(0x1F).rip().as<rage::CReplayInterface**>();
LOG(G3LOG_DEBUG) << "rage::CReplayInterface => [" << HEX_TO_UPPER(m_replay_interface) << "]";
}); });
// Pointer to Handle // Pointer to Handle
@ -264,9 +270,11 @@ namespace big
}); });
// FriendRegistry // FriendRegistry
main_batch.add("FR", "3B 0D ? ? ? ? 73 13 48 63 C9", [this](memory::handle ptr) main_batch.add("FR", "3B 0D ? ? ? ? 73 17", [this](memory::handle ptr)
{ {
m_friend_registry = ptr.add(2).rip().as<FriendRegistry*>(); m_friend_registry = ptr.add(2).rip().as<FriendRegistry*>();
LOG(G3LOG_DEBUG) << "FriendRegistry => [" << HEX_TO_UPPER(m_friend_registry) << "]";
}); });
// GET_SCREEN_COORDS_FROM_WORLD_COORDS // GET_SCREEN_COORDS_FROM_WORLD_COORDS
@ -287,12 +295,6 @@ namespace big
m_give_pickup_rewards = ptr.sub(0x28).as<decltype(m_give_pickup_rewards)>(); m_give_pickup_rewards = ptr.sub(0x28).as<decltype(m_give_pickup_rewards)>();
}); });
// Net Array Handler - Version mismatch patch
main_batch.add("NAH", "44 8B E0 89 45 F4 48 8B 03 48 8B CB FF 90", [this](memory::handle ptr)
{
m_net_array_handler = ptr.sub(0x3C).as<PVOID>();
});
// Network Group Override // Network Group Override
main_batch.add("NGO", "44 89 81 ? ? ? ? 89 91 ? ? ? ? C6 05", [this](memory::handle ptr) main_batch.add("NGO", "44 89 81 ? ? ? ? 89 91 ? ? ? ? C6 05", [this](memory::handle ptr)
{ {
@ -306,19 +308,19 @@ namespace big
}); });
// Get Network Event Data // Get Network Event Data
main_batch.add("GNED", "E9 ? ? ? ? E9 ? ? ? ? E9 ? ? ? ? E9 ? ? ? ? E9 ? ? ? ? CC FF 50 28", [this](memory::handle ptr) main_batch.add("GNED", "53 43 52 49 50 54 5F 4E 45 54 57 4F 52 4B", [this](memory::handle ptr)
{ {
m_get_network_event_data = ptr.as<PVOID>(); m_get_network_event_data = *ptr.sub(0x38).as<void**>();
}); });
// Received clone sync & Get sync tree for type & Get net object for player & Get sync type info & Get net object // Received clone sync & Get sync tree for type & Get net object for player & Get sync type info & Get net object
main_batch.add("RCS/GSTFT/GNOFP/GNO/GSTI", "4C 8B F2 41 0F B7 D1 45 0F B7 E1", [this](memory::handle ptr) main_batch.add("RCS/GSTFT/GNOFP/GNO/GSTI", "4C 8B FA 41 0F B7 D1", [this](memory::handle ptr)
{ {
m_received_clone_sync = ptr.sub(0x1D).as<decltype(m_received_clone_sync)>(); m_received_clone_sync = ptr.sub(0x1D).as<decltype(m_received_clone_sync)>();
m_get_sync_tree_for_type = ptr.add(0x14).rip().as<decltype(m_get_sync_tree_for_type)>(); // 0F B7 CA 83 F9 07 .as() m_get_sync_tree_for_type = ptr.add(0x14).rip().as<decltype(m_get_sync_tree_for_type)>(); // 0F B7 CA 83 F9 07 .as()
m_get_net_object_for_player = ptr.add(0x4C).rip().as<decltype(m_get_net_object_for_player)>(); // 41 80 78 ? FF 74 2D 41 0F B6 40 .as() m_get_net_object_for_player = ptr.add(0x60).rip().as<decltype(m_get_net_object_for_player)>(); // 41 80 78 ? FF 74 2D 41 0F B6 40 .as()
m_get_net_object = ptr.add(0x62).rip().as<decltype(m_get_net_object)>(); // E8 ? ? ? ? 0F B7 53 7C .add(1).rip().as() m_get_net_object = ptr.add(0x76).rip().as<decltype(m_get_net_object)>(); // E8 ? ? ? ? 0F B7 53 7C .add(1).rip().as()
m_get_sync_type_info = ptr.add(0x78).rip().as<decltype(m_get_sync_type_info)>(); // 44 0F B7 C1 4C 8D 0D .as() m_get_sync_type_info = ptr.add(0x8C).rip().as<decltype(m_get_sync_type_info)>(); // 44 0F B7 C1 4C 8D 0D .as()
}); });
// Model Hash Table // Model Hash Table
@ -326,6 +328,8 @@ namespace big
{ {
m_model_table = ptr.add(3).rip().as<HashTable<CBaseModelInfo*>*>(); m_model_table = ptr.add(3).rip().as<HashTable<CBaseModelInfo*>*>();
LOG(G3LOG_DEBUG) << "HashTable => [" << HEX_TO_UPPER(m_model_table) << "]";
// sample code to iterator models // sample code to iterator models
/*for (int i = 0; i < m_model_table->m_size; ++i) /*for (int i = 0; i < m_model_table->m_size; ++i)
{ {

View File

@ -62,7 +62,6 @@ namespace big
PVOID m_network_player_mgr_init; PVOID m_network_player_mgr_init;
PVOID m_network_player_mgr_shutdown; PVOID m_network_player_mgr_shutdown;
PVOID m_net_array_handler;
PVOID m_player_has_joined{}; PVOID m_player_has_joined{};
PVOID m_player_has_left{}; PVOID m_player_has_left{};

View File

@ -4,18 +4,13 @@
namespace big::globals namespace big::globals
{ {
inline Vehicle get_personal_vehicle()
{
return *script_global(2810701).at(298).as<Vehicle*>();
}
inline void clear_wanted_player(Player target) inline void clear_wanted_player(Player target)
{ {
constexpr size_t arg_count = 3; constexpr size_t arg_count = 3;
int64_t args[arg_count] = { int64_t args[arg_count] = {
static_cast<int64_t>(eRemoteEvent::ClearWantedLevel), static_cast<int64_t>(eRemoteEvent::ClearWantedLevel),
self::id, self::id,
*script_global(1893551).at(target, 599).at(510).as<int*>() *script_global(1892703).at(target, 599).at(510).as<int*>()
}; };
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << target); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << target);

View File

@ -12,9 +12,9 @@
namespace big::mobile namespace big::mobile
{ {
inline auto player_global = script_global(2689224); inline auto player_global = script_global(2689235);
inline auto mechanic_global = script_global(2810701); inline auto mechanic_global = script_global(2815059);
inline auto vehicle_global = script_global(1585853); inline auto vehicle_global = script_global(1585857);
namespace util namespace util
{ {
@ -37,8 +37,8 @@ namespace big::mobile
{ {
inline void off_radar(bool toggle) inline void off_radar(bool toggle)
{ {
*player_global.at(PLAYER::GET_PLAYER_INDEX(), 451).at(207).as<int*>() = toggle; *player_global.at(PLAYER::GET_PLAYER_INDEX(), 453).at(208).as<int*>() = toggle;
*script_global(2703660).at(56).as<int*>() = NETWORK::GET_NETWORK_TIME() + 1; *script_global(2703735).at(56).as<int*>() = NETWORK::GET_NETWORK_TIME() + 1;
} }
} }
@ -84,6 +84,11 @@ namespace big::mobile
namespace mechanic namespace mechanic
{ {
inline Vehicle get_personal_vehicle()
{
return *mechanic_global.at(298).as<Vehicle*>();
}
inline void summon_vehicle_by_index(int veh_idx) inline void summon_vehicle_by_index(int veh_idx)
{ {
if (*mechanic_global.at(958).as<int*>() != -1) if (*mechanic_global.at(958).as<int*>() != -1)
@ -107,14 +112,14 @@ namespace big::mobile
GtaThread* freemode_thread = gta_util::find_script_thread(RAGE_JOAAT("freemode")); GtaThread* freemode_thread = gta_util::find_script_thread(RAGE_JOAAT("freemode"));
if (freemode_thread) if (freemode_thread)
*script_local(freemode_thread, 18196).at(176).as<int*>() = 0; // spawn vehicle instantly *script_local(freemode_thread, 18399).at(176).as<int*>() = 0; // spawn vehicle instantly
// blocking call till vehicle is delivered // blocking call till vehicle is delivered
notify::busy_spinner("Delivering vehicle...", mechanic_global.at(958).as<int*>(), -1); notify::busy_spinner("Delivering vehicle...", mechanic_global.at(958).as<int*>(), -1);
if (g->clone_pv.spawn_inside) if (g->clone_pv.spawn_inside)
{ {
big::vehicle::bring(globals::get_personal_vehicle(), self::pos, true); big::vehicle::bring(get_personal_vehicle(), self::pos, true);
} }
} }
} }

View File

@ -11,7 +11,7 @@ namespace big::session
if (session.id == eSessionType::LEAVE_ONLINE) if (session.id == eSessionType::LEAVE_ONLINE)
*script_global(1574589).at(2).as<int*>() = -1; *script_global(1574589).at(2).as<int*>() = -1;
else else
*script_global(1575012).as<int*>() = (int)session.id; *script_global(1575015).as<int*>() = (int)session.id;
*script_global(1574589).as<int*>() = 1; *script_global(1574589).as<int*>() = 1;
script::get_current()->yield(200ms); script::get_current()->yield(200ms);

View File

@ -12,11 +12,11 @@
namespace big::vehicle namespace big::vehicle
{ {
inline auto spawn_global = script_global(2725269); inline auto spawn_global = script_global(2725439);
inline void go_into_personal_vehicle() inline void go_into_personal_vehicle()
{ {
*script_global(2671447).at(8).as<int*>() = 1; *script_global(2671449).at(8).as<int*>() = 1;
} }
inline float mps_to_speed(float mps, SpeedUnit speed_unit) inline float mps_to_speed(float mps, SpeedUnit speed_unit)

View File

@ -1,6 +1,7 @@
#include "views/view.hpp" #include "views/view.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "util/globals.hpp" #include "util/globals.hpp"
#include "util/mobile.hpp"
#include "util/teleport.hpp" #include "util/teleport.hpp"
#include "util/vehicle.hpp" #include "util/vehicle.hpp"
@ -34,14 +35,14 @@ namespace big
components::button("Bring Personal Vehicle", [] components::button("Bring Personal Vehicle", []
{ {
Vehicle veh = globals::get_personal_vehicle(); Vehicle veh = mobile::mechanic::get_personal_vehicle();
vehicle::bring(veh, self::pos); vehicle::bring(veh, self::pos);
}); });
components::button("Teleport to Personal Vehicle", [] components::button("Teleport to Personal Vehicle", []
{ {
Vehicle veh = globals::get_personal_vehicle(); Vehicle veh = mobile::mechanic::get_personal_vehicle();
teleport::into_vehicle(veh); teleport::into_vehicle(veh);
}); });

View File

@ -1,6 +1,5 @@
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "gui/handling/handling_tabs.hpp" #include "gui/handling/handling_tabs.hpp"
#include "script.hpp"
#include "util/vehicle.hpp" #include "util/vehicle.hpp"
#include "views/view.hpp" #include "views/view.hpp"
#include "util/mobile.hpp" #include "util/mobile.hpp"
@ -24,12 +23,12 @@ namespace big
ImGui::Separator(); ImGui::Separator();
components::button("Teleport in PV", [] { components::button("Teleport in PV", [] {
Vehicle veh = globals::get_personal_vehicle(); Vehicle veh = mobile::mechanic::get_personal_vehicle();
teleport::into_vehicle(veh); teleport::into_vehicle(veh);
}); });
ImGui::SameLine(); ImGui::SameLine();
components::button("Bring PV", [] { components::button("Bring PV", [] {
Vehicle veh = globals::get_personal_vehicle(); Vehicle veh = mobile::mechanic::get_personal_vehicle();
vehicle::bring(veh, self::pos, true); vehicle::bring(veh, self::pos, true);
}); });
ImGui::SameLine(); ImGui::SameLine();

2
vendor/GTAV-Classes vendored

@ -1 +1 @@
Subproject commit ebe115994c379391a96c818f957ac61939dee457 Subproject commit d3cb0c38a4763ee585afb8e65745e4049ec6ca16