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:
gir489
2023-07-16 12:24:40 -04:00
committed by GitHub
parent 8c097f0915
commit 152642cf1b
36 changed files with 108 additions and 339 deletions

View File

@ -1,7 +1,7 @@
#pragma once
#include "../pointers.hpp"
#include "enums.hpp"
#include "node_list.hpp"
#include "script/dataList.hpp"
class CNetGamePlayer;

View File

@ -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;
};
}

View File

@ -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:

View File

@ -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)

View File

@ -2,7 +2,7 @@
#include "base.hpp"
#include "fwddec.hpp"
#include "joaat.hpp"
#include "script_id.hpp"
#include "script/scriptIdBase.hpp"
#include <cstdint>

View File

@ -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:

View File

@ -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);
}

View File

@ -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"),