-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAddresses.c
108 lines (89 loc) · 3.55 KB
/
Addresses.c
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#include <Windows.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include "Addresses.h"
#include "Main.h"
void updateBoxes()
{
updateEntities();
updatePlayer();
}
/* This will dellocate our entity structs on the heap so that we can add the updated values */
void deallocate()
{
for(int i=0; i<16; i++) {
if(entityArray[i] != NULL) {
free(entityArray[i]);
}
}
}
void updateEntities()
{
if(entityArray[0] != NULL) {
deallocate();
}
uintptr_t p_entityArray;
BOOL rpmEntityArray = ReadProcessMemory(hProcess, (LPCVOID) ENTITY_ARRAY_OFFSET, &p_entityArray, sizeof(int), NULL);
if(rpmEntityArray == FALSE) {
printf("Please try a differernt entity array offset \n");
return;
}
for(int i=0; i<16; i++) {
uintptr_t entityObject;
float x = -1, y = -1, z = -1;
int health = -1, armor = -1, team = -1;
char name[20] = { 0 };
BOOL rpmEntityObject = ReadProcessMemory(hProcess, (LPCVOID) (p_entityArray + (i * 0x4)), &entityObject, sizeof(int), NULL);
ReadProcessMemory(hProcess, (LPCVOID) (entityObject + 0x00EC), &health, sizeof(int), NULL);
ReadProcessMemory(hProcess, (LPCVOID) (entityObject + 0x00F0), &armor, sizeof(int), NULL);
ReadProcessMemory(hProcess, (LPCVOID) (entityObject + 0x030C), &team, sizeof(int), NULL);
ReadProcessMemory(hProcess, (LPCVOID) (entityObject + 0x00205), &name, sizeof(name), NULL);
ReadProcessMemory(hProcess, (LPCVOID) (entityObject + 0x0028), &x, sizeof(float), NULL);
ReadProcessMemory(hProcess, (LPCVOID) (entityObject + 0x002C), &y, sizeof(float), NULL);
ReadProcessMemory(hProcess, (LPCVOID) (entityObject + 0x0030), &z, sizeof(float), NULL);
if(rpmEntityObject == FALSE || name[0] == 0) { // This means we are at the end of the entity array
entityCount = i;
return;
}
Vec3 vector;
vector.x = x;
vector.y = y;
vector.z = z;
struct Entity *aEnt = (struct Entity *) malloc(sizeof(struct Entity));
strcpy(aEnt->name, name);
aEnt->health = health;
aEnt->armor = armor;
aEnt->entityTeam = team;
aEnt->vector = vector;
entityArray[i] = aEnt;
health = -1, armor = -1;
}
entityCount = MAX_ARRAY_LENGTH;
}
void updatePlayer()
{
uintptr_t p_player;
BOOL rpmPlayer = ReadProcessMemory(hProcess, (LPCVOID) PLAYER_OFFSET, &p_player, sizeof(int), NULL);
if(rpmPlayer == FALSE) {
printf("Please try a differernt player offset \n");
return;
}
float x, y, z;
int team;
ReadProcessMemory(hProcess, (LPCVOID) (p_player + 0x00EC), &pData.playerHealth, sizeof(int), NULL);
ReadProcessMemory(hProcess, (LPCVOID) (p_player + 0x00F0), &pData.playerArmor, sizeof(int), NULL);
ReadProcessMemory(hProcess, (LPCVOID) (p_player + 0x00205), &pData.playerName, sizeof(pData.playerName), NULL);
ReadProcessMemory(hProcess, (LPCVOID) (p_player + 0x0028), &x, sizeof(float), NULL);
ReadProcessMemory(hProcess, (LPCVOID) (p_player + 0x002C), &y, sizeof(float), NULL);
ReadProcessMemory(hProcess, (LPCVOID) (p_player + 0x000C), &z, sizeof(float), NULL);
ReadProcessMemory(hProcess, (LPCVOID) (p_player + 0x030C), &team, sizeof(int), NULL);
enum Team playersTeam = team;
pData.team = playersTeam;
ReadProcessMemory(hProcess, (PBYTE*) (0x0057DFD0), &pData.matrix, sizeof(pData.matrix), NULL);
Vec3 vector;
vector.x = x;
vector.y = y;
vector.z = z;
pData.pos = vector;
}