-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameWorld.cpp
More file actions
78 lines (64 loc) · 2.52 KB
/
GameWorld.cpp
File metadata and controls
78 lines (64 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "GameWorld.h"
intptr_t GameWorld::GetGameWorld(IMemoryInterface* pMemInterface,std::array<intptr_t,2> activeObjects)
{
if (m_gameWorld) {
return m_gameWorld;
}
intptr_t result = GameWorld::GetObjectFromList(pMemInterface, activeObjects[1], activeObjects[0], "GameWorld");
result = Memory::ReadValue<intptr_t>(pMemInterface, result + 0x30);
result = Memory::ReadValue<intptr_t>(pMemInterface, result + 0x18);
m_gameWorld = Memory::ReadValue<intptr_t>(pMemInterface, result + 0x28);
return m_gameWorld;
}
std::array<intptr_t, 2> GameWorld::GetTaggedObjects(IMemoryInterface* pMemInterface)
{
if (m_taggedObjects[0] && m_taggedObjects[1]) {
return m_taggedObjects;
}
m_taggedObjects = Memory::ReadValue<std::array<intptr_t, 2>>(pMemInterface, m_gameObjectManager + 0x8);
return m_taggedObjects;
}
intptr_t GameWorld::GetGameObjectManager(IMemoryInterface* pMemInterface)
{
if (m_gameObjectManager) {
return m_gameObjectManager;
}
m_gameObjectManager = Memory::ReadValue<intptr_t>(pMemInterface, pMemInterface->GetModuleBase() + 0x017FFD28);
return m_gameObjectManager;
}
std::array<intptr_t, 2> GameWorld::GetActiveObjects(IMemoryInterface* pMemInterface)
{
if (m_activeObjects[0] && m_activeObjects[1]) {
return m_activeObjects;
}
m_activeObjects = Memory::ReadValue<std::array<intptr_t, 2>>(pMemInterface, m_gameObjectManager + 0x20);
return m_activeObjects;
}
intptr_t GameWorld::GetObjectFromList(IMemoryInterface* pMemInterface, intptr_t listPointer, intptr_t lastObjectPointer, const char* objectName)
{
char name[256];
intptr_t classNamePointer = 0x0;
BaseObject activeObject = Memory::ReadValue<BaseObject>(pMemInterface, listPointer);
BaseObject lastObject = Memory::ReadValue<BaseObject>(pMemInterface, lastObjectPointer);
if (strcmp("FPS Camera", objectName) == 0) {
int x = 1;
}
if (activeObject.object != 0x0) {
while (activeObject.object != 0 && activeObject.object != lastObject.object) {
classNamePointer = Memory::ReadValue<intptr_t>(pMemInterface, activeObject.object + 0x60);
pMemInterface->ReadRaw(classNamePointer + 0x0, &name, sizeof(name));
if (strcmp(name, objectName) == 0) {
return activeObject.object;
}
activeObject = Memory::ReadValue<BaseObject>(pMemInterface, activeObject.nextObjectLink);
}
}
if (lastObject.object != 0x0) {
classNamePointer = Memory::ReadValue<intptr_t>(pMemInterface, lastObject.object + 0x60);
pMemInterface->ReadRaw(classNamePointer + 0x0, &name, 256);
if (strcmp(name, objectName) == 0) {
return lastObject.object;
}
}
return 0;
}