-
Notifications
You must be signed in to change notification settings - Fork 26
/
AlphaEntityList.cpp
84 lines (70 loc) · 2.41 KB
/
AlphaEntityList.cpp
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
/*
* Alpha Entity List Adjuster
* Copyright (c) 2014 ThirteenAG <[email protected]>
* Copyright (c) 2014 Silent <[email protected]>
* Copyright (c) 2014 LINK/2012 <[email protected]>
* Licensed under the MIT License (http://opensource.org/licenses/MIT)
*/
#include "LimitAdjuster.h"
#include "utility/LinkListAdjuster.hpp"
#include "utility/dummy_object.hpp"
typedef dummy_object<0x8> AlphaObjectInfoVC;
typedef dummy_object<0xC> AlphaObjectInfoSA;
class AlphaEntityListIII : public SimpleAdjuster
{
public:
const char* GetLimitName() { return GetGVM().IsIII() ? "AlphaEntityList" : nullptr; }
void ChangeLimit(int, const std::string& value)
{
injector::WriteMemory(0x527E6B + 1, std::stoi(value), true);
if (*(DWORD*)0x943098 == 0x4CBEBC20)
{
auto CVisibilityPlugins__Shutdown = (void (__cdecl *)()) 0x527EA0;
auto CVisibilityPlugins__Initialise = (void (__cdecl *)()) 0x527E50;
CVisibilityPlugins__Shutdown();
CVisibilityPlugins__Initialise();
}
}
} AlphaEntityListIII;
class AlphaEntityListVC : public SimpleAdjuster
{
public:
const char* GetLimitName() { return GetGVM().IsVC() ? "AlphaEntityList" : nullptr; }
void ChangeLimit(int, const std::string& value)
{
injector::WriteMemory(0x5828DB+1, std::stoi(value), true);
if (*(DWORD*)0x97F30C == 0x4CBEBC20)
{
auto CVisibilityPlugins__Shutdown = (void (__cdecl *)()) 0x582870;
auto CVisibilityPlugins__Initialise = (void (__cdecl *)()) 0x5828A0;
CVisibilityPlugins__Shutdown();
CVisibilityPlugins__Initialise();
}
}
} AlphaEntityListVC;
class AlphaEntityListSA : public LinkListAdjuster<AlphaObjectInfoSA>
{
public:
AlphaEntityListSA()
: LinkListAdjuster(injector::lazy_ptr<0xC88120>().get())
{}
const char* GetLimitName()
{
return IsSA() ? "AlphaEntityList" : nullptr;
}
void ChangeLimit(int, const std::string& value)
{
if(Adjuster::IsUnlimited(value))
{
AddInsertSortedPatch(0x733DF5);
AddInsertSortedPatch(0x7345F2);
}
else
{
// initializer is inlined in in GTA SA, needs to multiply by sizeof(CLinkList<AlphaObjectInfo>::Link)
auto size = std::stoi(value) * 20;
injector::WriteMemory(0x733B05, size, true);
injector::WriteMemory(0x733B55, size, true);
}
}
} AlphaEntityListSA;