mirror of
https://github.com/YimMenu/RDR-Classes.git
synced 2024-12-22 14:37:30 +08:00
ScrProgram, CNetObjectMgr, and More (#17)
* template(copied from gta) * untested * gethost * CNetObjectMgr
This commit is contained in:
parent
99bae26b37
commit
722e327633
37
base/pgBase.hpp
Normal file
37
base/pgBase.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
namespace rage
|
||||
{
|
||||
|
||||
class pgBase
|
||||
{
|
||||
public:
|
||||
virtual ~pgBase() = default;
|
||||
virtual int ReturnZero() = 0;
|
||||
virtual void Error() = 0;
|
||||
|
||||
void *unk_0000; // 0x0000
|
||||
}; // Size: 0x0008
|
||||
static_assert(sizeof(pgBase) == 0x10);
|
||||
|
||||
class pgBaseMetaDataType
|
||||
{
|
||||
public:
|
||||
virtual ~pgBaseMetaDataType() = default;
|
||||
virtual void Lookup(uint32_t hash) = 0;
|
||||
}; // Size: 0x0008
|
||||
|
||||
class pgBaseMetaDataDebugNameType : public pgBaseMetaDataType
|
||||
{
|
||||
public:
|
||||
virtual ~pgBaseMetaDataDebugNameType() = default;
|
||||
char pad_0000[64];
|
||||
}; // Size: 0x0072
|
||||
|
||||
class pgBaseRefCounted : public pgBase
|
||||
{
|
||||
public:
|
||||
virtual ~pgBaseRefCounted() = default;
|
||||
}; // Size: 0x0008
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
#include "base/fwExtensibleBase.hpp"
|
||||
#include "base/fwRefAwareBase.hpp"
|
||||
#include "base/fwRefAwareBaseImpl.hpp"
|
||||
#include "base/pgBase.hpp"
|
||||
#include "entity/fwEntity.hpp"
|
||||
#include "network/CNetGamePlayer.hpp"
|
||||
#include "network/CNetworkPlayerMgr.hpp"
|
||||
@ -52,4 +53,5 @@
|
||||
#include "script/scriptHandlerNetComponent.hpp"
|
||||
#include "script/scriptId.hpp"
|
||||
#include "script/scriptIdBase.hpp"
|
||||
#include "script/scrProgram.hpp"
|
||||
#include "script/types.hpp"
|
||||
|
31
network/CNetObjectMgr.hpp
Normal file
31
network/CNetObjectMgr.hpp
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include "CNetGamePlayer.hpp"
|
||||
#include "netObject.hpp"
|
||||
#include "rage/datBitBuffer.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#pragma pack(push, 8)
|
||||
class CNetworkObjectMgr
|
||||
{
|
||||
public:
|
||||
virtual ~CNetworkObjectMgr() = default;
|
||||
virtual void _0x8() = 0;
|
||||
virtual void Initialize() = 0; // 0x10
|
||||
virtual void Shutdown() = 0;
|
||||
virtual void Update(bool) = 0;
|
||||
virtual void AddEntity(void *, void *) = 0;
|
||||
virtual void UnregisterNetworkObject_(void *unk, bool force) = 0;
|
||||
virtual void UnregisterNetworkObject(rage::netObject *object, int reason, bool force1, bool force2) = 0;
|
||||
virtual void ChangeOwner(rage::netObject *object, CNetGamePlayer *player, int migrationType, bool unk) = 0;
|
||||
virtual void HandleJoiningPlayer(CNetGamePlayer *player) = 0;
|
||||
virtual void HandleLeavingPlayer(CNetGamePlayer *player) = 0;
|
||||
virtual void _0x50(CNetGamePlayer *player) = 0;
|
||||
virtual void _0x58() = 0;
|
||||
virtual void _0x60() = 0;
|
||||
virtual int _0x68() = 0;
|
||||
virtual void PackCloneCreate(rage::netObject *object, CNetGamePlayer *player, rage::datBitBuffer *buffer) = 0;
|
||||
virtual bool PackCloneRemove(rage::netObject *object, CNetGamePlayer *player, bool) = 0;
|
||||
virtual void PackCloneSync(rage::netObject *object, CNetGamePlayer *player) = 0;
|
||||
};
|
||||
#pragma pack(pop)
|
87
script/scrProgram.hpp
Normal file
87
script/scrProgram.hpp
Normal file
@ -0,0 +1,87 @@
|
||||
#pragma once
|
||||
#include "base/pgBase.hpp"
|
||||
#include "scrNativeHandler.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace rage
|
||||
{
|
||||
class scrProgram : public pgBase
|
||||
{
|
||||
public:
|
||||
std::uint8_t **m_CodeBlocks; // 0x10
|
||||
std::uint32_t m_Hash; // 0x18
|
||||
std::uint32_t m_CodeSize; // 0x1C
|
||||
std::uint32_t m_ArgCount; // 0x20
|
||||
std::uint32_t m_LocalCount; // 0x24
|
||||
std::uint32_t m_GlobalCount; // 0x28
|
||||
std::uint32_t m_NativeCount; // 0x2C
|
||||
void *m_LocalData; // 0x30
|
||||
void **m_GlobalData; // 0x38
|
||||
scrNativeHandler *m_NativeEntrypoints; // 0x40
|
||||
std::uint32_t m_ProcCount; // 0x48
|
||||
char pad_004C[4]; // 0x4C
|
||||
const char **m_ProcNames; // 0x50
|
||||
std::uint32_t m_NameHash; // 0x58
|
||||
std::uint32_t m_RefCount; // 0x5C
|
||||
const char *m_Name; // 0x60
|
||||
const char **m_StringsData; // 0x68
|
||||
std::uint32_t m_StringsCount; // 0x70
|
||||
char m_Breakpoints[0x0C]; // 0x74 This is an atMap, which we don't have the
|
||||
// class for ATM.
|
||||
|
||||
bool is_valid() const { return m_CodeSize != 0; }
|
||||
|
||||
std::uint32_t GetNumCodePages() const { return (m_CodeSize + 0x3FFF) >> 14; }
|
||||
|
||||
std::uint32_t GetCodePageSize(std::uint32_t page) const {
|
||||
auto num = GetNumCodePages();
|
||||
if (page < num) {
|
||||
if (page == num - 1)
|
||||
return m_CodeSize & 0x3FFF;
|
||||
return 0x4000;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::uint32_t GetFullCodeSize() const {
|
||||
auto numPages = GetNumCodePages();
|
||||
if (!numPages)
|
||||
return 0;
|
||||
if (numPages == 1)
|
||||
--numPages;
|
||||
|
||||
return (numPages * 0x4000) + (m_CodeSize & 0x3FFF);
|
||||
}
|
||||
|
||||
std::uint8_t *GetCodePage(std::uint32_t page) const {
|
||||
return m_CodeBlocks[page];
|
||||
}
|
||||
|
||||
std::uint8_t *GetCodeAddress(std::uint32_t index) const {
|
||||
if (index < m_CodeSize)
|
||||
return &m_CodeBlocks[index >> 14][index & 0x3FFF];
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char *GetString(std::uint32_t index) const {
|
||||
if (index < m_StringsCount)
|
||||
return &m_StringsData[index >> 14][index & 0x3FFF];
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
scrNativeHandler *GetAddressOfNativeEntrypoint(scrNativeHandler entrypoint) {
|
||||
for (std::uint32_t i = 0; i < m_NativeCount; ++i) {
|
||||
if (m_NativeEntrypoints[i] == entrypoint) {
|
||||
return m_NativeEntrypoints + i;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(scrProgram) == 0x80);
|
||||
}
|
@ -28,12 +28,21 @@ namespace rage
|
||||
|
||||
public:
|
||||
scriptHandler* m_ScriptHandler; // 0x08
|
||||
char m_Pad[0x28]; // 0x10
|
||||
char m_Pad[0x20]; // 0x10
|
||||
CScriptParticipant *m_Host; // 0x30
|
||||
std::uint8_t m_LocalParticipantId; // 0x38
|
||||
void* m_Pad2[4]; // 0x40
|
||||
CScriptParticipant* m_Participants[32]; // 0x60
|
||||
int m_Pad3[3]; // 0x160
|
||||
std::uint8_t m_NumParticipants; // 0x168
|
||||
|
||||
inline CNetGamePlayer* GetHost()
|
||||
{
|
||||
if(!m_Host)
|
||||
return nullptr;
|
||||
|
||||
return m_Host->m_net_game_player;
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(rage::scriptHandlerNetComponent) == 0x170);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user