Skip to content

Commit 0e9a180

Browse files
committed
Merge pull request #7 from thelink2012/name-fix
Changed some limits names
2 parents 670d2b6 + cfaabb9 commit 0e9a180

File tree

7 files changed

+42
-23
lines changed

7 files changed

+42
-23
lines changed

doc/limit_adjuster_gta3vcsa.ini

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ NodeRoute = 64
1616
TaskAllocator = 16
1717
PedIntelligence = 140
1818
PedAttractors = 64
19-
StaticMatrices = 90000
19+
MatrixList = 90000
2020
OutsideWorldWaterBlocks = 500
21-
AlphaEntityListSize = 25000
21+
AlphaEntityList = 1250
2222
InVisibleEntityPtrs = 5000
2323
VisibleEntityPtrs = 5000
24-
StreamingObjectInstancesListSize = 90000
24+
StreamingObjectInstancesList = 7500
2525
TimeModels = 1500
2626

2727
[VCLIMITS]
@@ -35,7 +35,7 @@ Objects = 3500
3535
Dummys = 9500
3636
AudioScriptObj = 192
3737
ColModel = 10500
38-
AlphaEntityListSize = 25000
38+
AlphaEntityList = 1250
3939
InVisibleEntityPtrs = 5000
4040
VisibleEntityPtrs = 5000
4141
TimeModels = 1500
@@ -48,7 +48,10 @@ Vehicles = 110
4848
Buildings = 35500
4949
Objects = 9500
5050
Dummys = 22802
51-
AlphaEntityListSize = 25000
51+
AlphaEntityList = 1250
5252
InVisibleEntityPtrs = 5000
5353
VisibleEntityPtrs = 5000
5454
TimeModels = 1500
55+
56+
[OPTIONS]
57+
DebugTextKey = 0x74 ; F5 -- Use an VKEY (see http://msdn.microsoft.com/pt-br/library/windows/desktop/dd375731(v=vs.85).aspx)

src/AlphaEntityList.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class AlphaEntityListIII : public SimpleAdjuster
1010
{
1111
public:
12-
const char* GetLimitName() { return GetGVM().IsIII() ? "AlphaEntityListSize" : nullptr; }
12+
const char* GetLimitName() { return GetGVM().IsIII() ? "AlphaEntityList" : nullptr; }
1313
void ChangeLimit(int, const std::string& value)
1414
{
1515
injector::WriteMemory(0x527E6B + 1, std::stoi(value), true);
@@ -28,7 +28,7 @@ class AlphaEntityListIII : public SimpleAdjuster
2828
class AlphaEntityListVC : public SimpleAdjuster
2929
{
3030
public:
31-
const char* GetLimitName() { return GetGVM().IsVC() ? "AlphaEntityListSize" : nullptr; }
31+
const char* GetLimitName() { return GetGVM().IsVC() ? "AlphaEntityList" : nullptr; }
3232
void ChangeLimit(int, const std::string& value)
3333
{
3434
injector::WriteMemory(0x5828DB+1, std::stoi(value), true);
@@ -48,12 +48,13 @@ class AlphaEntityListVC : public SimpleAdjuster
4848
class AlphaEntityListSA : public SimpleAdjuster
4949
{
5050
public:
51-
const char* GetLimitName() { return GetGVM().IsSA() ? "AlphaEntityListSize" : nullptr; }
51+
const char* GetLimitName() { return GetGVM().IsSA() ? "AlphaEntityList" : nullptr; }
5252

5353
void ChangeLimit(int, const std::string& value)
5454
{
55-
injector::WriteMemory(0x733B05, std::stoi(value), true);
56-
injector::WriteMemory(0x733B55, std::stoi(value), true);
55+
auto size = std::stoi(value) * 20;
56+
injector::WriteMemory(0x733B05, size, true);
57+
injector::WriteMemory(0x733B55, size, true);
5758
}
5859

5960
// TODO GetUsage

src/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ set(SOURCE_FILES
44
dllmain.cpp
55
Pools.cpp
66
WaterBlocks.cpp
7-
StaticMatrices.cpp
7+
MatrixList.cpp
88
AlphaEntityList.cpp
99
InVisibleEntityPtrs.cpp
10-
StreamingObjectInstancesListSize.cpp
11-
TimeModelInfo.cpp
10+
StreamingObjectInstancesList.cpp
11+
TimeModels.cpp
1212

1313
LimitAdjuster.h
1414
utility/PoolAdjuster.hpp
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ struct StaticMatrices : public SimpleAdjuster
1515
// Limit Name
1616
const char* GetLimitName()
1717
{
18-
return (GetGVM().IsSA()? "StaticMatrices" : nullptr); // Name is wrong, should be Matrices, or MatrixArray, or something
19-
// Can we change it or...?
18+
return (IsSA()? "MatrixList" : nullptr);
2019
}
2120

2221
// Sets the limit
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ struct StreamingObjectInstancesListSize : public SimpleAdjuster
1515
// Limit Name
1616
const char* GetLimitName()
1717
{
18-
return (GetGVM().IsSA()? "StreamingObjectInstancesListSize" : nullptr);
18+
return (GetGVM().IsSA()? "StreamingObjectInstancesList" : nullptr);
1919
}
2020

2121
// Sets the limit
2222
void ChangeLimit(int, const std::string& value)
2323
{
24-
injector::WriteMemory(0x5B8E55, std::stoi(value), true);
25-
injector::WriteMemory(0x5B8EB0, std::stoi(value), true);
24+
auto size = std::stoi(value) * 12;
25+
injector::WriteMemory(0x5B8E55, size, true);
26+
injector::WriteMemory(0x5B8EB0, size, true);
2627
}
2728

2829
// TODO GetUsage

src/dllmain.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct LimitHandler
1616
Adjuster* adjuster; // Adjuster to handle the key
1717
};
1818

19+
static int vkDebugText = VK_F5; // 0x74
1920
int AdjustLimits();
2021
void AdjustLimits(const std::map<std::string, std::string>&);
2122
void PatchDrawer();
@@ -63,6 +64,22 @@ int AdjustLimits()
6364
else if(Adjuster::IsVC()) secname = "VCLIMITS";
6465
else if(Adjuster::IsIII()) secname = "GTA3LIMITS";
6566

67+
// Configurable options such as debug text key
68+
for(auto& pair : ini["OPTIONS"])
69+
{
70+
try {
71+
72+
if(!pair.first.compare("DebugTextKey"))
73+
vkDebugText = std::stoi(pair.second, nullptr, 0);
74+
75+
} catch(const std::logic_error& ex) {
76+
char buf[512];
77+
sprintf(buf, "Invalid value on option %s\n%s\n", pair.first.c_str(), ex.what());
78+
MessageBoxA(0, buf, "Limit Adjuster", MB_ICONERROR);
79+
}
80+
}
81+
82+
// Parse section in search of limits
6683
if(secname)
6784
{
6885
// Find the section we should read
@@ -141,8 +158,6 @@ void AdjustLimits(const std::map<std::string, std::string>& section)
141158

142159

143160

144-
145-
146161
/*
147162
* -------- Limits Drawing on HUD --------
148163
*/
@@ -243,11 +258,11 @@ void DrawLimit(const char* name, const char* usage)
243258
bool TestShouldDraw()
244259
{
245260
static bool should_draw = false; // Should draw flag
246-
static bool prevF5 = false; // Prev state of the F5 key
247-
static bool currF5 = false; // Curr state of the F5 key
261+
static bool prevF5 = false; // Prev state of the debug text key
262+
static bool currF5 = false; // Curr state of the debug text key
248263

249264
// Update key states and find if hot key pressed
250-
currF5 = (GetKeyState(VK_F5) & 0x8000) != 0;
265+
currF5 = (GetKeyState(vkDebugText) & 0x8000) != 0;
251266
if(currF5 && !prevF5) // Hotkey pressed?!?
252267
{
253268
if(!should_draw)

0 commit comments

Comments
 (0)