-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPatchMW2.cpp
218 lines (191 loc) · 5.16 KB
/
PatchMW2.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#include <xtl.h>
#include <xboxmath.h>
#include <xbox.h>
#include <stdio.h>
#include "Hooking.h"
#include "utility.h"
//#ifdef _DEBUG
//#include <xbdm.h>
//#endif
__declspec(naked) void renderSaveStub(const void * args, int unknown)
{
__asm
{
nop
nop
nop
nop
nop
nop
nop
nop
}
}
__declspec(naked) void physPresetLoaderSaveStub(void ** input)
{
__asm
{
nop
nop
nop
nop
nop
nop
nop
li r3, 0 //Make sure to change something to prevent optimizations
}
}
__declspec(naked) void tracerLoaderSaveStub(void ** input)
{
__asm
{
nop
nop
nop
nop
nop
nop
nop
li r3, 1 //Make sure to change something to prevent optimizations
}
}
__declspec(naked) void modelSurfLoaderSaveStub(void ** input)
{
__asm
{
nop
nop
nop
nop
nop
nop
nop
li r3, 2 //Make sure to change something to prevent optimizations
}
}
__declspec(naked) void weaponVarientDefLoaderSaveStub(void ** input)
{
__asm
{
nop
nop
nop
nop
nop
nop
nop
li r3, 3 //Make sure to change something to prevent optimizations
}
}
__declspec(naked) void lightDefLoaderSaveStub(void ** input)
{
__asm
{
nop
nop
nop
nop
nop
nop
nop
li r3, 4 //Make sure to change something to prevent optimizations
}
}
__declspec(naked) void vehicleLoaderSaveStub(void ** input)
{
__asm
{
nop
nop
nop
nop
nop
nop
nop
li r3, 5 //Make sure to change something to prevent optimizations
}
}
__declspec(naked) void playlistLoaderSaveStub(char * input)
{
__asm
{
nop
nop
nop
nop
nop
nop
nop
li r3, 6 //Make sure to change something to prevent optimizations
}
}
struct MapnameRichPresenceInfo
{
char name[0x20];
int context;
int mapPack;
};
char * VERSION_NAME = "alterIW4 vTU8.2.1 1.4";
float newVersionXOffset = -80.f;
void patchTU8BootXEXOnDev()
{
//No Fall Damage
WriteMemory((LPVOID)0x820D3958, 2, (LPCVOID)&alwaysBranchPatch);
//Force Ping Text on Leaderboard
WriteMemory((LPVOID)0x82116CBC, 4, (LPCVOID)&NOP);
//No BIK Video
//DmSetMemory((LPVOID)0x8236379C, 2, (LPCVOID)&alwaysBranchPatch, (LPDWORD)&outInt);
//External DLC Maps
WriteMemory((LPVOID)0x8229C37C, 4, (LPCVOID)&NOP);
//Allow Negative XP and Prestiging in game
WriteMemory((LPVOID)0x8211D66C, 2, (LPCVOID)&alwaysBranchPatch);
//Any Custom Class Name
WriteMemory((LPVOID)0x8214D464, 2, (LPCVOID)&alwaysBranchPatch);
//Constant Double Tap
WriteMemory((LPVOID)0x820DD878, 4, (LPCVOID)&NOP);
//Version Name
short versionNamePatch1;
int verionNameOffset = (int)VERSION_NAME;
if(verionNameOffset & 0x8000) // If bit 16 is 1
versionNamePatch1 = (((verionNameOffset >> 16) & 0xFFFF) + 1); // lis %r11, dest>>16 + 1
else
versionNamePatch1 = ((verionNameOffset >> 16) & 0xFFFF); // lis %r11, dest>>16
short versionNamePatch2 = (verionNameOffset & 0xFFFF);
WriteMemory((LPVOID)0x8226DB6A, 2, (LPCVOID)&versionNamePatch1);
WriteMemory((LPVOID)0x8226DB76, 2, (LPCVOID)&versionNamePatch2);
//Move version text left
verionNameOffset = (int)&newVersionXOffset;
if(verionNameOffset & 0x8000) // If bit 16 is 1
versionNamePatch1 = (((verionNameOffset >> 16) & 0xFFFF) + 1); // lis %r11, dest>>16 + 1
else
versionNamePatch1 = ((verionNameOffset >> 16) & 0xFFFF); // lis %r11, dest>>16
versionNamePatch2 = (verionNameOffset & 0xFFFF);
WriteMemory((LPVOID)0x8226C906, 2, (LPCVOID)&versionNamePatch1);
WriteMemory((LPVOID)0x8226C91E, 2, (LPCVOID)&versionNamePatch2);
//Remove RSA Checks
WriteMemory((LPVOID)0x82168FB4, 4, (LPCVOID)&returnTrue);
WriteMemory((LPVOID)0x82168FCC, 4, (LPCVOID)&returnTrue);
//Allow any clan tag
WriteMemory((LPVOID)0x82273B50, 2, (LPCVOID)&alwaysBranchPatch);
WriteMemory((LPVOID)0x82273C08, 2, (LPCVOID)&alwaysBranchPatch);
WriteMemory((LPVOID)0x82273D1C, 4, (LPCVOID)&NOP);
WriteMemory((LPVOID)0x82273D10, 4, (LPCVOID)&NOP);
//Remove all MPDATA checks
WriteMemory((LPVOID)0x822CFB34, 2, (LPCVOID)&alwaysBranchPatch);
WriteMemory((LPVOID)0x8222B708, 2, (LPCVOID)&alwaysBranchPatch);
//Setup render loop
hookFunctionStart((PDWORD)0x82285D08, (PDWORD)renderSaveStub, (DWORD)MW2TitleUpdate8InternalLoop);
hookFunctionStart((PDWORD)0x82199B58, (PDWORD)physPresetLoaderSaveStub, (DWORD)Load_PhysPresetAssetHook);
hookFunctionStart((PDWORD)0x8219AF30, (PDWORD)tracerLoaderSaveStub, (DWORD)Load_TracerAssetHook);
hookFunctionStart((PDWORD)0x8219AAA8, (PDWORD)weaponVarientDefLoaderSaveStub, (DWORD)Load_weaponVarientDef_tAssetHook);
hookFunctionStart((PDWORD)0x8219AFC0, (PDWORD)vehicleLoaderSaveStub, (DWORD)Load_VehicleAssetHook);
hookFunctionStart((PDWORD)0x8219A798, (PDWORD)lightDefLoaderSaveStub, (DWORD)Load_lightDefAssetHook);
//hookFunctionStart((PDWORD)0x822775C8, (PDWORD)playlistLoaderSaveStub, (DWORD)Playlist_ParsePlaylistsHook);
//hookFunctionStart((PDWORD)0x82199D08, (PDWORD)modelSurfLoaderSaveStub, (DWORD)Load_ModelSurfAssetHook);
//patchInJump((PDWORD)0x8222D7A8, (DWORD)Com_InitXAssets, false);
//patchInJump((PDWORD)0x822928E0, (DWORD)&StringTable_GetAsset, false);
patchInJump((PDWORD)0x8219C130, (DWORD)&Rawfile_GetAsset, false);
//patchInJump((PDWORD)0x82198E90, (DWORD)&Image_GetIndex, false);
patchInJump((PDWORD)0x822612A0, (DWORD)&Localize_GetString, false);
patchInJump((PDWORD)0x8221AB40, (DWORD)&CM_EntityString, false);
}