Skip to content

Commit e140912

Browse files
committed
Updating DLL, Patcher and Documentation to v1.6. Minor re-structuring in the Repository.
1 parent 0b19d85 commit e140912

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2014
-697
lines changed

DLL/CheatFunctions.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ typedef enum RESOURCE_ID {
1111
EXPORT
1212
} RESOURCE_ID;
1313

14-
extern char(__thiscall *const CheatAddResource)(void* playerData, __int32 resourceID, float resourceAmount, __int8 unk);
15-
extern void(__cdecl *const CheatSpawnUnit)(void* playerData, char* protoUnitName);
14+
extern char(__thiscall * const CheatAddResource)(void* playerData, __int32 resourceID, float resourceAmount, __int8 unk);
15+
extern void(__cdecl * const CheatSpawnUnit)(void* playerData, char* protoUnitName);

DLL/Civs.asm

+11-7
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ code_cave_begin 00461BD8h
282282
mov eax,[eax]
283283
284284
bb_check:
285-
invoke TableIDExists,5,eax
285+
invoke TableIDExists,BIGBUTTON_CIVS,eax
286286
test eax,eax
287287
je bb_back
288288
@@ -291,7 +291,7 @@ code_cave_begin 00461BD8h
291291
test eax,eax
292292
je_rel32 00695955_1
293293
mov eax,[eax+08h]
294-
invoke TableIDExists,6,eax
294+
invoke TableIDExists,NO_BIGBUTTON_BLDS,eax
295295
test eax,eax
296296
je_rel32 00695955_2
297297
@@ -347,12 +347,17 @@ code_cave_end 0052B587h
347347

348348
; Native Civs Patch #4
349349
code_cave_begin 00453D5Eh
350-
mov edx,eax
350+
cmp dword ptr ds:[esp+4], 0
351+
je npatch4_check
352+
cmp eax, dword ptr ds:[00C6FB5Ch]
353+
je npatch4_end
354+
355+
npatch4_check:
351356
invoke TableIDExists, NATIVE, eax
352357
test eax, eax
353358
jne npatch4_end
354-
cmp dword ptr ds:[esp+4], 0
355-
jmp_rel32 00453D63
359+
xor al,al
360+
retn 4
356361
357362
npatch4_end:
358363
mov al, 1
@@ -431,7 +436,6 @@ PatchNativeCivs proc
431436
invoke PatchAddress, hProcess, loc_0052B588, 0052B588h, 1
432437

433438
patch_code_cave 00453D5Eh, 00453D62h
434-
invoke PatchAddress, hProcess, loc_00453D63, 00453D63h, 1
435439

436440
patch_code_cave 004904B5h, 004904BAh
437441
invoke PatchAddress, hProcess, loc_00679E66, 00679E66h, 1
@@ -487,7 +491,7 @@ code_cave_begin 008DABA3h
487491
invoke getCivIDs, NATIVE
488492
mov ecx, dword ptr ds:[00C66234h]
489493
mov ecx, [ecx+140h]
490-
invoke getCivIDs, 5
494+
invoke getCivIDs, BIGBUTTON_CIVS
491495
mov edx, dword ptr ds:[00C66234h]
492496
jmp_rel32 008DABA9
493497
code_cave_end 008DABA8h

DLL/Limits.asm

+9
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,13 @@ PatchTeamLimit proc
199199
ret
200200
PatchTeamLimit endp
201201

202+
; Fame Restriction Removal
203+
; Allows using the 'Fame' resource for ProtoActions, like AutoGather or ModifyGather
204+
205+
public stdcall PatchFameRestriction
206+
PatchFameRestriction proc
207+
invoke PatchAddress, hProcess, 0051B026h, 00BD62F8h, 0
208+
ret
209+
PatchFameRestriction endp
210+
202211
end

DLL/Patch.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "UHC.h"
33

44
extern "C" BOOL __stdcall TableIDExists(DWORD dwTable, int id) {
5-
if (dwTable < GROUP_COUNT)
5+
if (dwTable >= TABLE_COUNT)
66
return FALSE;
77

88
UHCRefTable& table = pUHCInfo->Tables[dwTable];

DLL/UHC.cpp

+32
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,26 @@ UHCInfo::UHCInfo() {
181181
}
182182
}
183183

184+
else if (!lstrcmpiA(key.Name, "farmingRadius")) {
185+
Enable |= ENABLE_FARM_RADIUS;
186+
187+
size_t i = 0;
188+
189+
while (i + 2 < key.Values.GetNumElements()) {
190+
UHCFarmRadius aux;
191+
aux.RefIndex = atoi(key.Values[i]);
192+
aux.X = (float) atof(key.Values[++i]);
193+
aux.Z = (float) atof(key.Values[++i]);
194+
FarmRadiusInfo.PushBack(aux);
195+
}
196+
197+
}
198+
199+
else if (!lstrcmpiA(key.Name, "tacticSwitching")) {
200+
Enable |= ENABLE_TACTIC_SWITCHING;
201+
SetRefTable(Tables[TacticSwitching], key);
202+
}
203+
184204
else if (lstrcmpiA(key.Name, "basePop") == 0 && key.Values.GetNumElements() == 1) {
185205
Enable |= ENABLE_POP_LIMIT;
186206
BasePop = atoi(key.Values[0]);
@@ -213,6 +233,9 @@ UHCInfo::UHCInfo() {
213233

214234
else if (lstrcmpiA(key.Name, "enableAllTeams") == 0)
215235
Enable |= ENABLE_TEAM_LIMIT;
236+
237+
else if (lstrcmpiA(key.Name, "removeFameRestriction") == 0)
238+
Enable |= REMOVE_FAME_RESTRICTION;
216239
}
217240
}
218241

@@ -309,6 +332,12 @@ void APIENTRY UHCMain() {
309332
if (enable & ENABLE_FARM_ANIM)
310333
PatchFarmAnim();
311334

335+
if (enable & ENABLE_FARM_RADIUS)
336+
PatchFarmRadius();
337+
338+
if (enable & ENABLE_TACTIC_SWITCHING)
339+
PatchTacticSwitching();
340+
312341
if (enable & ENABLE_PATCH_MARKET)
313342
PatchMarketUnits();
314343

@@ -339,6 +368,9 @@ void APIENTRY UHCMain() {
339368
if (enable & ENABLE_REGISTRY_PATH)
340369
PatchRegistryPath();
341370

371+
if (enable & REMOVE_FAME_RESTRICTION)
372+
PatchFameRestriction();
373+
342374
// Load .upl plugins
343375
pUHCInfo->LoadPlugins();
344376
}

DLL/UHC.h

+14-1
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ struct UHCRefTable {
99
DWORD *RefIDs;
1010
};
1111

12-
#define TABLE_COUNT 7
12+
#define TABLE_COUNT 8
1313

1414
enum UHCTableName {
1515
Farm,
1616
RectFarm,
1717
Market,
1818
Asian,
1919
Native,
20+
TacticSwitching,
2021
BigButtonCivs,
2122
NoBigButtonBlds
2223
};
@@ -63,6 +64,11 @@ struct UHCCheat {
6364
LPVOID FunctionPtr;
6465
};
6566

67+
struct UHCFarmRadius {
68+
DWORD RefIndex;
69+
float X, Z;
70+
};
71+
6672
#define ENABLE_AI_LIMIT 0x1
6773
#define ENABLE_CHEAT 0x2
6874
#define ENABLE_DECK_LIMIT 0x4
@@ -76,6 +82,9 @@ struct UHCCheat {
7682
#define ENABLE_NATIVE_CIVS 0x400
7783
#define ENABLE_ASIAN_CIVS 0x800
7884
#define ENABLE_BIGBUTTON 0x1000
85+
#define ENABLE_FARM_RADIUS 0x2000
86+
#define ENABLE_TACTIC_SWITCHING 0x4000
87+
#define REMOVE_FAME_RESTRICTION 0x8000
7988

8089
class UHCInfo {
8190
public:
@@ -87,6 +96,7 @@ class UHCInfo {
8796
TArray<LPWSTR> Personalities;
8897
TArray<LPWSTR> AsianCivNames;
8998
TArray<LPWSTR> NativeCivNames;
99+
TArray<UHCFarmRadius> FarmRadiusInfo;
90100

91101
UHCInfo();
92102
~UHCInfo();
@@ -126,6 +136,9 @@ extern "C" {
126136
void __stdcall PatchAsianCivs();
127137
void __stdcall PatchNativeCivs();
128138
void __stdcall PatchBigButton();
139+
void __stdcall PatchFarmRadius();
140+
void __stdcall PatchTacticSwitching();
141+
void __stdcall PatchFameRestriction();
129142

130143
//void __stdcall PatchDumpSyscall();
131144
}

DLL/UHC.inc

+14-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ RECTFARM = 1
77
MARKET = 2
88
ASIAN = 3
99
NATIVE = 4
10+
TACTIC_SWITCHING = 5
11+
BIGBUTTON_CIVS = 6
12+
NO_BIGBUTTON_BLDS = 7
1013

1114
UHCRefTable struct
1215
RefCount dd ?
@@ -27,7 +30,15 @@ UHCCheat ends
2730

2831
UHCCheatPtr typedef ptr UHCCheat
2932

30-
TABLE_COUNT = 7
33+
UHCFarmRadius struct
34+
RefIndex dd ?
35+
X dd ?
36+
Z dd ?
37+
UHCFarmRadius ends
38+
39+
UHCFarmRadiusPtr typedef ptr UHCFarmRadius
40+
41+
TABLE_COUNT = 8
3142
GROUP_COUNT = 8
3243

3344
UHCInfo struct
@@ -45,6 +56,8 @@ UHCInfo struct
4556
AsianCivNames dd ?
4657
NativeCivCount dd ?
4758
NativeCivNames dd ?
59+
FarmRadiusInfoCount dd ?
60+
FarmRadiusInfo UHCFarmRadiusPtr ?
4861
UHCInfo ends
4962

5063
UHCInfoPtr typedef ptr UHCInfo

DLL/UHC.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
8181
<LinkIncremental>false</LinkIncremental>
82-
<OutDir>D:\Program Files (x86)\SteamLibrary\steamapps\common\Age Of Empires 3\bin</OutDir>
82+
<OutDir>C:\Program Files (x86)\SteamLibrary\steamapps\common\Age Of Empires 3\bin</OutDir>
8383
</PropertyGroup>
8484
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
8585
<LinkIncremental>false</LinkIncremental>

DLL/UHC.vcxproj.filters

-105
This file was deleted.

DLL/UHC.vcxproj.user

-4
This file was deleted.

0 commit comments

Comments
 (0)