mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-22 20:17:24 +08:00
Refactored Allow All Weapons In Vehicle to force all vehicles to use … (#1730)
* Refactored Allow All Weapons In Vehicle to force all vehicles to use all GROUPs. * Refactored project to not depend on src/gta files that already exist in the GTA-V-Classes project. * feat(cmake): bump GTAV-Classes
This commit is contained in:
parent
ae5cb4d42f
commit
6a30fa348c
@ -3,7 +3,7 @@ include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
gtav_classes
|
||||
GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git
|
||||
GIT_TAG 95dadd6e7ee7bfa15d66bb2c597d13e97c631727
|
||||
GIT_TAG e56523456c42d918bb19814863827a7e6b77ae89
|
||||
GIT_PROGRESS TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
@ -89,6 +89,7 @@ namespace big
|
||||
while (g_running)
|
||||
{
|
||||
looped::vehicle_auto_drive();
|
||||
looped::vehicle_allow_all_weapons();
|
||||
looped::vehicle_boost_behavior();
|
||||
looped::derail_train();
|
||||
looped::drive_train();
|
||||
|
@ -54,7 +54,7 @@ namespace big
|
||||
|
||||
auto thread = gta_util::find_script_thread(RAGE_JOAAT("am_hunt_the_beast"));
|
||||
auto stack = thread->m_stack;
|
||||
auto net_component = thread->m_net_component;
|
||||
auto net_component = (CGameScriptHandlerNetComponent*)thread->m_net_component;
|
||||
auto idx = scr_locals::am_hunt_the_beast::broadcast_idx;
|
||||
|
||||
if (!stack || !net_component || !player->is_valid())
|
||||
@ -112,13 +112,13 @@ namespace big
|
||||
return;
|
||||
|
||||
auto stack = thread->m_stack;
|
||||
auto net_component = thread->m_net_component;
|
||||
auto net_component = (CGameScriptHandlerNetComponent*)thread->m_net_component;
|
||||
auto idx = scr_locals::am_hunt_the_beast::broadcast_idx;
|
||||
|
||||
if (!stack || !net_component)
|
||||
return;
|
||||
|
||||
thread->m_net_component->block_host_migration(true);
|
||||
((CGameScriptHandlerNetComponent*)thread->m_net_component)->block_host_migration(true);
|
||||
thread->m_context.m_state = rage::eThreadState::unk_3;
|
||||
g.m_hunt_the_beast_thread = thread;
|
||||
|
||||
|
@ -46,7 +46,8 @@ namespace big
|
||||
int num_array_handlers{};
|
||||
int received_array_handlers{};
|
||||
|
||||
while (auto handler = g_pointers->m_gta.m_get_host_array_handler_by_index(freemode->m_net_component, num_array_handlers++))
|
||||
while (
|
||||
auto handler = g_pointers->m_gta.m_get_host_array_handler_by_index((CGameScriptHandlerNetComponent*)freemode->m_net_component, num_array_handlers++))
|
||||
if (handler->m_flags & 1)
|
||||
received_array_handlers++;
|
||||
|
||||
|
@ -42,6 +42,7 @@ namespace big
|
||||
static void system_rainbow();
|
||||
|
||||
static void vehicle_auto_drive();
|
||||
static void vehicle_allow_all_weapons();
|
||||
static void vehicle_boost_behavior();
|
||||
static void vehicle_ls_customs();
|
||||
static void vehicle_rainbow_paint();
|
||||
|
@ -12,7 +12,7 @@ namespace big
|
||||
if (g.session.randomize_ceo_colors && *g_pointers->m_gta.m_is_session_started && !STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) == 0)
|
||||
{
|
||||
if (auto freemode = gta_util::find_script_thread(RAGE_JOAAT("freemode"));
|
||||
freemode && freemode->m_net_component && freemode->m_net_component->is_local_player_host())
|
||||
freemode && freemode->m_net_component && ((CGameScriptHandlerNetComponent*)freemode->m_net_component)->is_local_player_host())
|
||||
{
|
||||
for (int i = 0; i < *scr_globals::gsbd.at(818).at(44).as<int*>(); i++)
|
||||
{
|
||||
|
54
src/backend/looped/vehicle/allow_all_weapons.cpp
Normal file
54
src/backend/looped/vehicle/allow_all_weapons.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
|
||||
#include <vehicle/CVehicleModelInfo.hpp>
|
||||
#include <vehicle/CVehicleSeatMetadataMgr.hpp>
|
||||
#include <vehicle/CVehicleDriveByMetadataMgr.hpp>
|
||||
|
||||
#include "gta/weapons.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void looped::vehicle_allow_all_weapons()
|
||||
{
|
||||
CVehicle* vehicle_ptr = (CVehicle*)g_pointers->m_gta.m_handle_to_ptr(self::veh);
|
||||
|
||||
if (vehicle_ptr == nullptr)
|
||||
return;
|
||||
|
||||
rage::atArray<Hash> one_handed_groups =
|
||||
g_pointers->m_gta.m_driveby_metadata_mgr->m_drive_by_weapon_groups->m_drive_by_default->m_driveby_default_one_handed_weapon_group_names;
|
||||
|
||||
if (g.vehicle.unlimited_weapons == false)
|
||||
{
|
||||
if (one_handed_groups.size() != 1)
|
||||
{
|
||||
rage::atArray<Hash> one_handed_groups;
|
||||
one_handed_groups.append(GROUP_PISTOL);
|
||||
g_pointers->m_gta.m_driveby_metadata_mgr->m_drive_by_weapon_groups->m_drive_by_default->m_driveby_default_one_handed_weapon_group_names = one_handed_groups;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CVehicleModelInfo* vehicle_model_info = static_cast<CVehicleModelInfo*>(vehicle_ptr->m_model_info);
|
||||
|
||||
auto num_seats = vehicle_model_info->m_vehicle_layout->m_max_seats;
|
||||
auto seat_info = vehicle_model_info->m_vehicle_layout->m_layout_metadata->m_seat_info;
|
||||
auto defaults = g_pointers->m_gta.m_vehicle_layout_metadata_mgr->m_drive_by_seat_defaults;
|
||||
if (seat_info->m_front_left->m_drive_by_info != defaults->m_driveby_standard_front_left)
|
||||
seat_info->m_front_left->m_drive_by_info = defaults->m_driveby_standard_front_left;
|
||||
if (num_seats > 1 && seat_info->m_front_right->m_drive_by_info != defaults->m_driveby_standard_front_right)
|
||||
seat_info->m_front_right->m_drive_by_info = defaults->m_driveby_standard_front_right;
|
||||
if (num_seats > 2 && seat_info->m_rear_left->m_drive_by_info != defaults->m_driveby_standard_rear_left)
|
||||
seat_info->m_rear_left->m_drive_by_info = defaults->m_driveby_standard_rear_left;
|
||||
if (num_seats > 3 && seat_info->m_rear_right->m_drive_by_info != defaults->m_driveby_standard_rear_right)
|
||||
seat_info->m_rear_right->m_drive_by_info = defaults->m_driveby_standard_rear_right;
|
||||
|
||||
if (g_pointers->m_gta.m_driveby_metadata_mgr->m_drive_by_weapon_groups->m_drive_by_default
|
||||
->m_driveby_default_one_handed_weapon_group_names.size() == 1)
|
||||
{
|
||||
one_handed_groups.append({GROUP_MG, GROUP_RIFLE, GROUP_SHOTGUN, GROUP_HEAVY, GROUP_SNIPER, GROUP_SMG});
|
||||
g_pointers->m_gta.m_driveby_metadata_mgr->m_drive_by_weapon_groups->m_drive_by_default->m_driveby_default_one_handed_weapon_group_names = one_handed_groups;
|
||||
}
|
||||
}
|
||||
}
|
@ -683,13 +683,12 @@ namespace big
|
||||
bool keep_vehicle_clean = false;
|
||||
bool vehinvisibility = false;
|
||||
bool localveh_visibility = false;
|
||||
bool localped_visibility = true;
|
||||
bool keep_on_ground = false;
|
||||
bool no_collision = false;
|
||||
bool unlimited_weapons = false;
|
||||
bool siren_mute = false;
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(vehicle, speedo_meter, fly, rainbow_paint, speed_unit, god_mode, proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_water, proof_mask, auto_drive_destination, auto_drive_style, auto_drive_speed, auto_turn_signals, boost_behavior, drive_on_water, horn_boost, instant_brake, block_homing, seatbelt, turn_signals, vehicle_jump, keep_vehicle_repaired, no_water_collision, disable_engine_auto_start, change_engine_state_immediately, keep_engine_running, keep_vehicle_clean, vehinvisibility, localveh_visibility, localped_visibility, keep_on_ground, no_collision, unlimited_weapons, siren_mute)
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(vehicle, speedo_meter, fly, rainbow_paint, speed_unit, god_mode, proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_water, proof_mask, auto_drive_destination, auto_drive_style, auto_drive_speed, auto_turn_signals, boost_behavior, drive_on_water, horn_boost, instant_brake, block_homing, seatbelt, turn_signals, vehicle_jump, keep_vehicle_repaired, no_water_collision, disable_engine_auto_start, change_engine_state_immediately, keep_engine_running, keep_vehicle_clean, vehinvisibility, localveh_visibility, keep_on_ground, no_collision, unlimited_weapons, siren_mute)
|
||||
} vehicle{};
|
||||
|
||||
struct weapons
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "../pointers.hpp"
|
||||
#include "enums.hpp"
|
||||
#include "node_list.hpp"
|
||||
#include "script/dataList.hpp"
|
||||
|
||||
class CNetGamePlayer;
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
#include "fwddec.hpp"
|
||||
|
||||
#include <base/datBase.hpp>
|
||||
|
||||
namespace rage
|
||||
{
|
||||
template<typename T, typename Base = datBase>
|
||||
class atDNode : public Base
|
||||
{
|
||||
public:
|
||||
T m_data;
|
||||
void* m_unk;
|
||||
atDNode<T, Base>* m_next;
|
||||
};
|
||||
|
||||
template<typename Node>
|
||||
class atDList
|
||||
{
|
||||
public:
|
||||
Node* m_head;
|
||||
Node* m_tail;
|
||||
};
|
||||
}
|
@ -1,19 +1,16 @@
|
||||
#pragma once
|
||||
#include "fwddec.hpp"
|
||||
#include "node_list.hpp"
|
||||
#include "script_id.hpp"
|
||||
#include "script/dataList.hpp"
|
||||
#include "script/scriptIdBase.hpp"
|
||||
#include "script/scriptResource.hpp"
|
||||
#include "script/scriptHandler.hpp"
|
||||
#include "script/scriptHandlerNetComponent.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#pragma pack(push, 1)
|
||||
namespace rage
|
||||
{
|
||||
class scriptResource
|
||||
{
|
||||
public:
|
||||
virtual ~scriptResource() = default;
|
||||
};
|
||||
|
||||
class scriptResourceEntry
|
||||
{
|
||||
public:
|
||||
@ -23,83 +20,6 @@ namespace rage
|
||||
scriptResourceEntry* m_next;// 0x18
|
||||
};
|
||||
|
||||
class scriptHandlerNetComponent
|
||||
{
|
||||
public:
|
||||
virtual ~scriptHandlerNetComponent() = default;
|
||||
|
||||
public:
|
||||
scriptHandler* m_script_handler;// 0x08
|
||||
};
|
||||
|
||||
class scriptHandler
|
||||
{
|
||||
public:
|
||||
class atDScriptObjectNode : public atDNode<scriptHandlerObject*>
|
||||
{
|
||||
};
|
||||
|
||||
public:
|
||||
virtual ~scriptHandler() = default;// 0 (0x00)
|
||||
|
||||
virtual bool _0x08() = 0;// 1 (0x08)
|
||||
|
||||
virtual void _0x10() = 0;// 2 (0x10)
|
||||
|
||||
virtual void cleanup_objects() = 0;// 3 (0x18)
|
||||
|
||||
virtual scriptId* _0x20() = 0;// 4 (0x20)
|
||||
|
||||
virtual scriptId* get_id() = 0;// 5 (0x28)
|
||||
|
||||
// Returns whether the script handler belongs to a networked script.
|
||||
virtual bool is_networked() = 0;// 6 (0x30)
|
||||
|
||||
// Initializes the network component for the script handler.
|
||||
virtual void init_net_component() = 0;// 7 (0x38)
|
||||
|
||||
// Deletes the script handler's network component, if it exists.
|
||||
virtual void reset_net_component() = 0;// 8 (0x40)
|
||||
|
||||
// Destroys the script handler.
|
||||
virtual bool destroy() = 0;// 9 (0x48)
|
||||
|
||||
// Adds the object to the script handler's list of objects.
|
||||
virtual void add_object(scriptHandlerObject*, bool is_network, bool is_network_and_scriptcheck) = 0;// 10 (0x50)
|
||||
|
||||
// Something related to reservations.
|
||||
virtual void _0x58(void*) = 0;// 11 (0x58)
|
||||
|
||||
virtual void register_resource(scriptResource*, void*) = 0;// 12 (0x60)
|
||||
|
||||
virtual void _0x68() = 0;// 13 (0x68)
|
||||
|
||||
virtual void _0x70() = 0;// 14 (0x70)
|
||||
|
||||
virtual void _0x78() = 0;// 15 (0x78)
|
||||
|
||||
virtual void _0x80() = 0;// 16 (0x80)
|
||||
|
||||
virtual void _0x88() = 0;// 17 (0x88)
|
||||
|
||||
virtual void _0x90() = 0;// 18 (0x90)
|
||||
|
||||
virtual void _0x98() = 0;// 19 (0x98)
|
||||
public:
|
||||
void* m_0x08; // 0x08
|
||||
void* m_0x10; // 0x10
|
||||
scrThread* m_script_thread; // 0x18
|
||||
atDList<atDScriptObjectNode> m_objects; // 0x20
|
||||
scriptResource* m_resource_list_head; // 0x30
|
||||
scriptResource* m_resource_list_tail; // 0x38
|
||||
void* m_0x40; // 0x40
|
||||
scriptHandlerNetComponent* m_net_component;// 0x48
|
||||
std::uint32_t m_0x50; // 0x50
|
||||
std::uint32_t m_0x54; // 0x54
|
||||
std::uint32_t m_0x58; // 0x58
|
||||
std::uint32_t m_0x60; // 0x5C
|
||||
};
|
||||
|
||||
class scriptHandlerMgr
|
||||
{
|
||||
public:
|
||||
|
@ -1,99 +0,0 @@
|
||||
#pragma once
|
||||
#include "fwddec.hpp"
|
||||
#include "joaat.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#pragma pack(push, 1)
|
||||
namespace rage
|
||||
{
|
||||
class scriptIdBase
|
||||
{
|
||||
public:
|
||||
virtual ~scriptIdBase() = default;// 0 (0x00)
|
||||
|
||||
// Assumes the script thread's identity.
|
||||
virtual void assume_thread_identity(scrThread*){};// 1 (0x08)
|
||||
|
||||
// Returns whether the hash of the script id is valid.
|
||||
virtual bool is_valid()
|
||||
{
|
||||
return false;
|
||||
};// 2 (0x10)
|
||||
|
||||
// Gets the hash of the script id.
|
||||
virtual joaat_t* get_hash(joaat_t* out)
|
||||
{
|
||||
return 0;
|
||||
};// 3 (0x18)
|
||||
|
||||
// Gets an unknown value from the script id.
|
||||
virtual std::uint32_t* get_hash2(std::uint32_t* out)
|
||||
{
|
||||
return 0;
|
||||
};// 4 (0x20)
|
||||
|
||||
// Gets the name of the script id.
|
||||
virtual const char* get_name()
|
||||
{
|
||||
return nullptr;
|
||||
};// 5 (0x28)
|
||||
|
||||
// Serializes the script id from the buffer.
|
||||
virtual void deserialize(datBitBuffer* buffer){};// 6 (0x30)
|
||||
|
||||
// Serializes the script id to the buffer.
|
||||
virtual void serialize(datBitBuffer* buffer){};// 7 (0x38)
|
||||
|
||||
// Calculates some information with the position hash & instance id.
|
||||
virtual std::uint32_t _0x40()
|
||||
{
|
||||
return 0;
|
||||
};// 8 (0x40)
|
||||
|
||||
// Calls _0x40 and returns it's value added to another value.
|
||||
virtual std::uint32_t _0x48()
|
||||
{
|
||||
return 0;
|
||||
};// 9 (0x48)
|
||||
|
||||
// Logs some information about the script id.
|
||||
virtual void log_information(netLoggingInterface* logger){};// 10 (0x50)
|
||||
|
||||
// Copies the information of other to this object.
|
||||
virtual void copy_data(scriptIdBase* other)
|
||||
{
|
||||
}// 11 (0x58)
|
||||
|
||||
// Returns whether the other script id is equal.
|
||||
virtual bool operator==(scriptIdBase*)
|
||||
{
|
||||
return false;
|
||||
};// 12 (0x60)
|
||||
|
||||
virtual bool _0x68(void*)
|
||||
{
|
||||
return false;
|
||||
};// 13 (0x68)
|
||||
};
|
||||
|
||||
class scriptId : public scriptIdBase
|
||||
{
|
||||
public:
|
||||
joaat_t m_hash; // 0x08
|
||||
char m_name[0x20];// 0x0C
|
||||
};
|
||||
}
|
||||
|
||||
class CGameScriptId : public rage::scriptId
|
||||
{
|
||||
public:
|
||||
char m_padding[0x04]; // 0x2C
|
||||
std::int32_t m_timestamp; // 0x30
|
||||
std::int32_t m_position_hash;// 0x34
|
||||
std::int32_t m_instance_id; // 0x38
|
||||
std::int32_t m_unk; // 0x3C
|
||||
};
|
||||
|
||||
static_assert(sizeof(CGameScriptId) == 0x40);
|
||||
#pragma pack(pop)
|
@ -2,7 +2,7 @@
|
||||
#include "base.hpp"
|
||||
#include "fwddec.hpp"
|
||||
#include "joaat.hpp"
|
||||
#include "script_id.hpp"
|
||||
#include "script/scriptIdBase.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
@ -1,70 +1,11 @@
|
||||
#pragma once
|
||||
#include "fwddec.hpp"
|
||||
#include "joaat.hpp"
|
||||
#include "tls_context.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class CGameScriptHandlerNetComponent;
|
||||
|
||||
namespace rage
|
||||
{
|
||||
enum class eThreadState : std::uint32_t
|
||||
{
|
||||
idle,
|
||||
running,
|
||||
killed,
|
||||
unk_3,
|
||||
unk_4,
|
||||
};
|
||||
|
||||
class scrThreadContext
|
||||
{
|
||||
public:
|
||||
std::uint32_t m_thread_id; // 0x00
|
||||
joaat_t m_script_hash; // 0x04
|
||||
eThreadState m_state; // 0x08
|
||||
std::uint32_t m_instruction_pointer;// 0x0C
|
||||
std::uint32_t m_frame_pointer; // 0x10
|
||||
std::uint32_t m_stack_pointer; // 0x14
|
||||
float m_timer_a; // 0x18
|
||||
float m_timer_b; // 0x1C
|
||||
float m_timer_c; // 0x20
|
||||
char m_padding1[0x2C]; // 0x24
|
||||
std::uint32_t m_stack_size; // 0x50
|
||||
char m_padding2[0x54]; // 0x54
|
||||
};
|
||||
static_assert(sizeof(scrThreadContext) == 0xA8);
|
||||
|
||||
class scrThread
|
||||
{
|
||||
public:
|
||||
virtual ~scrThread() = default;// 0 (0x00)
|
||||
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 tick(std::uint32_t ops_to_execute) = 0; // 3 (0x18)
|
||||
virtual void kill() = 0; // 4 (0x20)
|
||||
|
||||
inline static scrThread* get()
|
||||
{
|
||||
return rage::tlsContext::get()->m_script_thread;
|
||||
}
|
||||
|
||||
public:
|
||||
scrThreadContext m_context; // 0x08
|
||||
void* m_stack; // 0xB0
|
||||
char m_padding[0x4]; // 0xB8
|
||||
uint32_t m_arg_size; // 0xBC
|
||||
uint32_t m_arg_loc; // 0xC0
|
||||
char m_padding2[0x4]; // 0xC4
|
||||
const char* m_exit_message; // 0xC8
|
||||
std::uint32_t m_name_hash; // 0xCC
|
||||
char m_name[0x40]; // 0xD4
|
||||
scriptHandler* m_handler; // 0x114
|
||||
CGameScriptHandlerNetComponent* m_net_component;// 0x11C
|
||||
};
|
||||
}
|
||||
|
||||
class GtaThread : public rage::scrThread
|
||||
{
|
||||
public:
|
||||
|
@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
#include "fwddec.hpp"
|
||||
|
||||
#include <intrin.h>
|
||||
|
||||
namespace rage
|
||||
{
|
||||
class tlsContext
|
||||
{
|
||||
public:
|
||||
char m_padding1[0xB8]; // 0x00
|
||||
sysMemAllocator* m_allocator; // 0xB8
|
||||
char m_padding2[0x788]; // 0xD0
|
||||
scrThread* m_script_thread; // 0x848
|
||||
bool m_is_script_thread_active;// 0x850
|
||||
|
||||
static tlsContext* get()
|
||||
{
|
||||
return *reinterpret_cast<tlsContext**>(__readgsqword(0x58));
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(tlsContext) == 0x858);
|
||||
}
|
@ -21,6 +21,7 @@ enum WeaponGroup : Hash
|
||||
GROUP_PISTOL = RAGE_JOAAT("GROUP_PISTOL"),
|
||||
GROUP_RIFLE = RAGE_JOAAT("GROUP_RIFLE"),
|
||||
GROUP_MG = RAGE_JOAAT("GROUP_MG"),
|
||||
GROUP_SMG = RAGE_JOAAT("GROUP_SMG"),
|
||||
GROUP_SHOTGUN = RAGE_JOAAT("GROUP_SHOTGUN"),
|
||||
GROUP_STUNGUN = RAGE_JOAAT("GROUP_STUNGUN"),
|
||||
GROUP_SNIPER = RAGE_JOAAT("GROUP_SNIPER"),
|
||||
|
@ -9,6 +9,8 @@ class ChatData;
|
||||
class ScInfo;
|
||||
class GenericPool;
|
||||
class VehiclePool;
|
||||
class CVehicleSeatMetadataMgr;
|
||||
class CVehicleDriveByMetadataMgr;
|
||||
|
||||
namespace rage
|
||||
{
|
||||
@ -274,6 +276,9 @@ namespace big
|
||||
PVOID m_send_non_physical_player_data;
|
||||
|
||||
void** m_presence_data{};
|
||||
|
||||
CVehicleSeatMetadataMgr* m_vehicle_layout_metadata_mgr{};
|
||||
CVehicleDriveByMetadataMgr* m_driveby_metadata_mgr{};
|
||||
};
|
||||
#pragma pack(pop)
|
||||
static_assert(sizeof(gta_pointers) % 8 == 0, "Pointers are not properly aligned");
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "gta/script_thread.hpp"
|
||||
#include "gta/tls_context.hpp"
|
||||
#include "script/tlsContext.hpp"
|
||||
#include "pointers.hpp"
|
||||
|
||||
#include <network/CNetworkPlayerMgr.hpp>
|
||||
|
@ -108,8 +108,6 @@ namespace big
|
||||
|
||||
detour_hook_helper::add<hooks::write_vehicle_proximity_migration_data_node>("WVPMDN", g_pointers->m_gta.m_write_vehicle_proximity_migration_data_node);
|
||||
|
||||
detour_hook_helper::add<hooks::allow_weapons_in_vehicle>("AWIV", g_pointers->m_gta.m_allow_weapons_in_vehicle);
|
||||
|
||||
detour_hook_helper::add<hooks::netfilter_handle_message>("NHM", g_pointers->m_gta.m_netfilter_handle_message);
|
||||
|
||||
detour_hook_helper::add<hooks::log_error_message_box>("E0MBH", g_pointers->m_gta.m_error_message_box);
|
||||
|
@ -148,7 +148,6 @@ namespace big
|
||||
|
||||
static void write_vehicle_proximity_migration_data_node(rage::netObject* veh, CVehicleProximityMigrationDataNode* node);
|
||||
|
||||
static bool allow_weapons_in_vehicle(int64_t unk, int weaponinfo_group);
|
||||
static int netfilter_handle_message(__int64 filter, char* message, int flags);
|
||||
|
||||
static void log_error_message_box(rage::joaat_t joaated_error_code, char a2);
|
||||
|
@ -1,16 +0,0 @@
|
||||
#include "hooking.hpp"
|
||||
#include "gta/weapons.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::allow_weapons_in_vehicle(int64_t unk, int weaponinfo_group)
|
||||
{
|
||||
if (g.vehicle.unlimited_weapons)
|
||||
{
|
||||
if (weaponinfo_group == GROUP_THROWN) // Because the thrower can be used without bypassing, we let the game decide the return value, since this function has multiple xrefs, it may be necessary to return 0 at some point
|
||||
return g_hooking->get_original<allow_weapons_in_vehicle>()(unk, weaponinfo_group);
|
||||
return true;
|
||||
}
|
||||
return g_hooking->get_original<allow_weapons_in_vehicle>()(unk, weaponinfo_group);
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
#include "backend/player_command.hpp"
|
||||
#include "core/data/packet_types.hpp"
|
||||
#include "gta/net_game_event.hpp"
|
||||
#include "gta/script_id.hpp"
|
||||
#include "script/scriptIdBase.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "lua/lua_manager.hpp"
|
||||
|
@ -22,7 +22,7 @@ namespace big
|
||||
{
|
||||
old_beast_index = *script_local(beast->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).at(1).at(6).as<int*>();
|
||||
if (beast->m_net_component)
|
||||
participant_id = beast->m_net_component->m_local_participant_index;
|
||||
participant_id = ((CGameScriptHandlerNetComponent*)beast->m_net_component)->m_local_participant_index;
|
||||
}
|
||||
|
||||
bool result = g_hooking->get_original<hooks::received_array_update>()(array, sender, buffer, size, cycle);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "fiber_pool.hpp"
|
||||
#include "gta/enums.hpp"
|
||||
#include "gta/net_game_event.hpp"
|
||||
#include "gta/script_id.hpp"
|
||||
#include "script/scriptIdBase.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "util/math.hpp"
|
||||
#include "util/notify.hpp"
|
||||
|
@ -383,7 +383,7 @@ namespace big
|
||||
{
|
||||
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("freemode")))
|
||||
{
|
||||
if (script->m_net_component && script->m_net_component->m_host && script->m_net_component->m_host->m_net_game_player != player)
|
||||
if (script->m_net_component && ((CGameScriptHandlerNetComponent*)script->m_net_component)->m_host && ((CGameScriptHandlerNetComponent*)script->m_net_component)->m_host->m_net_game_player != player)
|
||||
{
|
||||
g.reactions.trigger_business_raid.process(plyr);
|
||||
}
|
||||
@ -396,7 +396,7 @@ namespace big
|
||||
// TODO: Breaks stuff
|
||||
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("freemode")))
|
||||
{
|
||||
if (script->m_net_component && script->m_net_component->m_host && script->m_net_component->m_host->m_net_game_player != player)
|
||||
if (script->m_net_component && ((CGameScriptHandlerNetComponent*)script->m_net_component)->m_host && ((CGameScriptHandlerNetComponent*)script->m_net_component)->m_host->m_net_game_player != player)
|
||||
{
|
||||
g.reactions.start_script.process(plyr);
|
||||
return true;
|
||||
|
@ -58,7 +58,7 @@ namespace big
|
||||
.as<int*>();
|
||||
|
||||
*script_local(g.m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).at(1).at(6).as<int*>() =
|
||||
g.m_hunt_the_beast_thread->m_net_component->get_participant_index(target);// participant idx
|
||||
((CGameScriptHandlerNetComponent*)g.m_hunt_the_beast_thread->m_net_component)->get_participant_index(target);// participant idx
|
||||
*script_local(g.m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).at(1).at(7).as<Player*>() =
|
||||
target->m_player_id;// beast player idx
|
||||
*script_local(g.m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).at(1).at(2).as<int*>() = INT_MAX;// stopwatch time
|
||||
|
@ -150,7 +150,7 @@ namespace big
|
||||
|
||||
void stack_trace::dump_script_info()
|
||||
{
|
||||
m_dump << "Currently executing script: " << rage::scrThread::get()->m_name << '\n';
|
||||
m_dump << "Currently executing script: " << rage::tlsContext::get()->m_script_thread->m_name << '\n';
|
||||
m_dump << "Thread program counter (could be inaccurate): "
|
||||
<< m_exception_info->ContextRecord->Rdi - m_exception_info->ContextRecord->Rsi << '\n';
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ namespace big
|
||||
g_fiber_pool->queue_job([hash] {
|
||||
scripts::force_host(hash);
|
||||
if (auto script = gta_util::find_script_thread(hash); script && script->m_net_component)
|
||||
script->m_net_component->block_host_migration(true);
|
||||
((CGameScriptHandlerNetComponent*)script->m_net_component)->block_host_migration(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1371,6 +1371,17 @@ namespace big
|
||||
{
|
||||
g_pointers->m_gta.m_get_title_caption_error_message_box = ptr.add(1).rip().as<functions::get_title_caption_error_message_box>();
|
||||
}
|
||||
},
|
||||
// Vehicle Metadata Manager.
|
||||
{
|
||||
"VEHMMGR",
|
||||
"7C B8 48 8B 0D",
|
||||
[](memory::handle ptr)
|
||||
{
|
||||
ptr = ptr.add(5).rip();
|
||||
g_pointers->m_gta.m_driveby_metadata_mgr = ptr.as<CVehicleDriveByMetadataMgr*>();
|
||||
g_pointers->m_gta.m_vehicle_layout_metadata_mgr = ptr.add(0x20).as<CVehicleSeatMetadataMgr*>();
|
||||
}
|
||||
}
|
||||
>(); // don't leave a trailing comma at the end
|
||||
|
||||
|
@ -106,10 +106,10 @@ namespace big
|
||||
populate_ip();
|
||||
|
||||
rage::scrThread* thread = (rage::scrThread*)new uint8_t[sizeof(rage::scrThread)];
|
||||
memcpy(thread, rage::scrThread::get(), sizeof(rage::scrThread));
|
||||
memcpy(thread, rage::tlsContext::get()->m_script_thread, sizeof(rage::scrThread));
|
||||
|
||||
void* stack = new uint64_t[25000];
|
||||
thread->m_stack = stack;
|
||||
thread->m_stack = (rage::scrValue*)stack;
|
||||
thread->m_context.m_stack_size = 25000;
|
||||
thread->m_context.m_stack_pointer = 1;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "common.hpp"
|
||||
#include "gta/script_thread.hpp"
|
||||
#include "gta/tls_context.hpp"
|
||||
#include "script/tlsContext.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include "invoker.hpp"
|
||||
#include "pointers.hpp"
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "gta/joaat.hpp"
|
||||
#include "gta/sysMemAllocator.hpp"
|
||||
#include "gta/tls_context.hpp"
|
||||
#include "script/tlsContext.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "script.hpp"
|
||||
|
@ -167,7 +167,7 @@ namespace big
|
||||
{
|
||||
if (m_thread && m_thread->m_net_component)
|
||||
{
|
||||
for (int i = 0; !m_thread->m_net_component->is_local_player_host(); i++)
|
||||
for (int i = 0; !((CGameScriptHandlerNetComponent*)m_thread->m_net_component)->is_local_player_host(); i++)
|
||||
{
|
||||
if (i > 200)
|
||||
return false;
|
||||
@ -180,7 +180,7 @@ namespace big
|
||||
return false;
|
||||
}
|
||||
|
||||
m_thread->m_net_component->block_host_migration(true);
|
||||
((CGameScriptHandlerNetComponent*)m_thread->m_net_component)->block_host_migration(true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -62,7 +62,7 @@ namespace big::scripts
|
||||
{
|
||||
if (auto launcher = gta_util::find_script_thread(hash); launcher && launcher->m_net_component)
|
||||
{
|
||||
for (int i = 0; !launcher->m_net_component->is_local_player_host(); i++)
|
||||
for (int i = 0; !((CGameScriptHandlerNetComponent*)launcher->m_net_component)->is_local_player_host(); i++)
|
||||
{
|
||||
if (i > 200)
|
||||
return false;
|
||||
@ -100,7 +100,7 @@ namespace big::scripts
|
||||
|
||||
for (auto& [_, plyr] : g_player_service->players())
|
||||
{
|
||||
if (launcher->m_net_component->is_player_a_participant(plyr->get_net_game_player()))
|
||||
if (((CGameScriptHandlerNetComponent*)launcher->m_net_component)->is_player_a_participant(plyr->get_net_game_player()))
|
||||
{
|
||||
if (*script_local(launcher->m_stack, 233).at(plyr->id(), 3).at(2).as<int*>() == state)
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ namespace big
|
||||
components::button("Win Event", [] {
|
||||
if (auto checkpoints = gta_util::find_script_thread(RAGE_JOAAT("am_cp_collection")))
|
||||
*script_local(checkpoints->m_stack, scr_locals::am_cp_collection::player_broadcast_idx)
|
||||
.at(checkpoints->m_net_component->m_local_participant_index, 5)
|
||||
.at(((CGameScriptHandlerNetComponent*)checkpoints->m_net_component)->m_local_participant_index, 5)
|
||||
.at(4)
|
||||
.as<int*>() = 999'999'999;
|
||||
|
||||
|
@ -290,11 +290,11 @@ namespace big
|
||||
g_fiber_pool->queue_job([] {
|
||||
scripts::force_host(RAGE_JOAAT("freemode"));
|
||||
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("freemode")); script && script->m_net_component)
|
||||
script->m_net_component->block_host_migration(true);
|
||||
((CGameScriptHandlerNetComponent*)script->m_net_component)->block_host_migration(true);
|
||||
|
||||
scripts::force_host(RAGE_JOAAT("fmmc_launcher"));
|
||||
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("fmmc_launcher")); script && script->m_net_component)
|
||||
script->m_net_component->block_host_migration(true);
|
||||
((CGameScriptHandlerNetComponent*)script->m_net_component)->block_host_migration(true);
|
||||
});
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
|
Loading…
Reference in New Issue
Block a user