Skip to content

Commit 3f74fb1

Browse files
committed
limit_adjuster_gta3vcsa v1.2
1 parent 3dcec79 commit 3f74fb1

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

limit_adjuster_gta3vcsa/dllmain.cpp

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "stdafx.h"
22
#include "CPatch.h"
33
#include <stdio.h>
4+
#include <stdint.h>
45
#include <string>
56
#include <Windows.h>
67
#include "CIniReader\IniReader.h"
@@ -17,8 +18,10 @@ using namespace std;
1718
#define GTA_SA_1_1 0x0
1819
#define GTA_SA_STEAM 0x1
1920

20-
21-
21+
void asm_patch();
22+
int limit;
23+
uint16_t* aX;
24+
uint16_t* aY;
2225

2326
int Thread()
2427
{
@@ -85,6 +88,22 @@ int Thread()
8588
CPatch::SetInt(0x551282+0x1, iniReader.ReadInteger("SALIMITS", "PedIntelligence", 140));
8689
CPatch::SetChar(0x5512BB+0x1, iniReader.ReadInteger("SALIMITS", "PedAttractors", 64));
8790
CPatch::SetInt(0x54F3A0 + 0x1, iniReader.ReadInteger("SALIMITS", "StaticMatrices", 900));
91+
92+
limit = iniReader.ReadInteger("SALIMITS", "OutsideWorldWaterBlocks", 70);
93+
94+
aX = new uint16_t[limit];
95+
aY = new uint16_t[limit];
96+
97+
CPatch::RedirectJump(0x6E6CE9, asm_patch);
98+
99+
CPatch::SetPointer(0x6E6CEE + 0x4, aX);
100+
CPatch::SetPointer(0x6EF6E0 + 0x4, aX);
101+
CPatch::SetPointer(0x6EFE82 + 0x4, aX);
102+
103+
CPatch::SetPointer(0x6E6CF6 + 0x4, aY);
104+
CPatch::SetPointer(0x6EF6E8 + 0x4, aY);
105+
CPatch::SetPointer(0x6EFE95 + 0x4, aY);
106+
CPatch::SetPointer(0x6EFEAF + 0x4, aY);
88107
break;
89108

90109
case GTA_SA_1_1:
@@ -107,4 +126,16 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved)
107126
Thread();
108127
}
109128
return TRUE;
129+
}
130+
131+
132+
void __declspec(naked)asm_patch()
133+
{
134+
__asm cmp eax, limit
135+
__asm jge _Full
136+
__asm push 0x6E6CEE
137+
__asm ret
138+
_Full :
139+
__asm push 0x6E6D04
140+
__asm ret
110141
}

0 commit comments

Comments
 (0)