-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathFName.h
56 lines (49 loc) · 1.56 KB
/
FName.h
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
// make sure your uworld is the same as the repo
class FName
{
public:
int ComparisonIndex;
std::string ToString()
{
const int NAME_SIZE = 2048;
auto NamePoolChunk = DotMem::Read<uint64_t>(va_text + (0x123FAFC0 + 8 * (ComparisonIndex >> 16) + 16)) + 2 * ((unsigned short)ComparisonIndex);
auto Pool = DotMem::Read<uint16_t>(NamePoolChunk);
if (Pool < 64)
{
auto Index = DotMem::Read<int>(NamePoolChunk + 2);
NamePoolChunk = DotMem::Read<uint64_t>(va_text + (0x124AE500 + 8 * (Index >> 16) + 16)) + 2 * ((unsigned short)Index);
Pool = DotMem::Read<uint16_t>(NamePoolChunk);
}
auto NameLength = min(Pool >> 6, NAME_SIZE);
char NameBuffer[NAME_SIZE + 1] = {0};
Driver::ReadPhysical(PVOID(NamePoolChunk + 2), NameBuffer, NameLength);
DecryptFName(NameBuffer, NameLength);
return std::string(NameBuffer);
}
private:
static void DecryptFName(char *buffer, int length)
{
int v0; // ebx
char *v1; // rdi
int v2; // ecx
int v3; // edx
int v4; // eax
unsigned int v5; // edx
char result; // al
v2 = 0;
v3 = 28;
if (length)
{
v0 = length;
v1 = buffer;
do
{
v4 = v2++;
v5 = (v4 | 0xB000) + v3;
result = v5 ^ ~*v1;
v3 = v5 >> 2;
*v1++ = result;
} while (v2 < v0);
}
}
};