forked from waninkoko/mload-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patches.c
370 lines (281 loc) · 7.5 KB
/
patches.c
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
/*
Custom IOS Module (MLOAD)
Copyright (C) 2008 neimod.
Copyright (C) 2010 Hermes.
Copyright (C) 2010 Waninkoko.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "swi.h"
#include "tools.h"
#include "types.h"
/* Macros */
#define Write8(addr, val) \
*(vu8 *)addr = val; \
DCFlushRange((void *)addr, sizeof(u8));
#define Write16(addr, val) \
*(vu16 *)addr = val; \
DCFlushRange((void *)addr, sizeof(u16));
#define Write32(addr, val) \
*(vu32 *)addr = val; \
DCFlushRange((void *)addr, sizeof(u32));
void Patch_DipModule(u32 version)
{
switch (version) {
/** 07/11/08 14:34:26 **/
case 0x48776F72:
/* Unencrypted read limit */
Write32(0x20206640, 0x7ED40000);
break;
/** 07/24/08 20:08:44 **/
case 0x4888E14C:
/* Unencrypted read limit */
Write32(0x2020636C, 0x7ED40000);
break;
/** 11/24/08 15:39:09 **/
/** 06/03/09 07:49:09 **/
case 0x492ACA9D:
case 0x4A262AF5:
/* Unencrypted read limit */
Write32(0x202066E4, 0x7ED40000);
break;
}
}
void Patch_EsModule(u32 version)
{
switch (version) {
/** 06/03/09 03:45:06 **/
case 0x4A25F1C2:
/* Signature check */
Write16(0x13A752E6, 0x2000);
/* Identify check */
Write16(0x20100D4A, 0x2803);
Write16(0x20100DC2, 0x2803);
/* Open content permissions */
Write8(0x20104D7A, 0xE0);
Write8(0x20104D9E, 0xE0);
Write8(0x20104DC2, 0xE0);
/* Read content permissions */
Write16(0x20104EBC, 0x46C0);
Write16(0x20104EC0, 0x46C0);
Write8 (0x20104EC4, 0xE0);
/* Close content permissions */
Write16(0x20104F58, 0x46C0);
Write16(0x20104F5C, 0x46C0);
Write8 (0x20104F60, 0xE0);
/* Set UID check */
Write16(0x2010522A, 0x46C0);
/* Title version check */
Write8(0x201027AC, 0xE0);
/* Title delete check */
Write8(0x20107B22, 0xE0);
break;
/** 06/03/09 03:36:55 **/
case 0x4A25EFD7:
/* Signature check */
Write16(0x13A750A6, 0x2000);
/* Identify check */
Write16(0x20100CC8, 0x2803);
Write16(0x20100D40, 0x2803);
/* Open content permissions */
Write8(0x20104B68, 0xE0);
Write8(0x20104B8C, 0xE0);
/* Read content permissions */
Write16(0x20104C84, 0x46C0);
Write16(0x20104C88, 0x46C0);
Write8 (0x20104C8C, 0xE0);
/* Close content permissions */
Write16(0x20104D20, 0x46C0);
Write16(0x20104D24, 0x46C0);
Write8 (0x20104D28, 0xE0);
/* Set UID check */
Write16(0x20104FF2, 0x46C0);
/* Title version check */
Write8(0x20102724, 0xE0);
/* Title delete check */
Write8(0x20107682, 0xE0);
break;
/** 06/03/09 07:46:02 **/
case 0x4A262A3A:
/* Signature check */
Write16(0x13A75626, 0x2000);
/* Identify check */
Write16(0x20100E74, 0x2803);
Write16(0x20100EEC, 0x2803);
/* Open content permissions */
Write8(0x20105290, 0xE0);
Write8(0x201052D0, 0xE0);
Write8(0x201052F4, 0xE0);
/* Read content permissions */
Write16(0x201053FC, 0x46C0);
Write16(0x20105400, 0x46C0);
Write8 (0x20105404, 0xE0);
/* Close content permissions */
Write16(0x20105498, 0x46C0);
Write16(0x2010549C, 0x46C0);
Write8 (0x201054A0, 0xE0);
/* Set UID check */
Write16(0x2010576A, 0x46C0);
/* Title version check */
Write8(0x20102C74, 0xE0);
/* Title delete check */
Write8(0x2010849A, 0xE0);
/* Decrypt check */
Write8(0x2010650C, 0xE0);
break;
/** 11/24/08 15:36:08 **/
case 0x492AC9E8:
/* Signature check */
Write16(0x13A754FA, 0x2000);
Write16(0x13A756A6, 0x2000);
/* Identify check */
Write16(0x20100DA4, 0x2803);
Write16(0x20100E1C, 0x2803);
/* Open content permissions */
Write8(0x20104D60, 0xE0);
Write8(0x20104DA0, 0xE0);
Write8(0x20104DC4, 0xE0);
/* Read content permissions */
Write16(0x20104ECC, 0x46C0);
Write16(0x20104ED0, 0x46C0);
Write8 (0x20104ED4, 0xE0);
/* Close content permissions */
Write16(0x20104F68, 0x46C0);
Write16(0x20104F6C, 0x46C0);
Write8 (0x20104F70, 0xE0);
/* Set UID check */
Write16(0x2010523A, 0x46C0);
/* Title version check */
Write8(0x20102800, 0xE0);
/* Title delete check */
Write8(0x20107B32, 0xE0);
/* Decrypt check */
Write8(0x20105FD0, 0xE0);
break;
/** 03/03/10 10:40:14 **/
case 0x4B8E90EE:
/* Signature check */
Write16(0x13A75626, 0x2000);
/* Identify check */
Write16(0x20100E74, 0x2803);
Write16(0x20100EEC, 0x2803);
/* Open content permissions */
Write8(0x201052E4, 0xE0);
Write8(0x20105324, 0xE0);
Write8(0x20105348, 0xE0);
/* Read content permissions */
Write16(0x20105450, 0x46C0);
Write16(0x20105454, 0x46C0);
Write8 (0x20105458, 0xE0);
/* Close content permissions */
Write16(0x201054A0, 0x46C0);
Write16(0x201054A4, 0x46C0);
Write8 (0x201054A8, 0xE0);
/* Set UID check */
Write16(0x201057BE, 0x46C0);
/* Title version check */
Write8(0x20102CB8, 0xE0);
/* Title delete check */
Write8(0x20108562, 0xE0);
break;
/** 03/01/10 03:26:03 **/
case 0x4B8B882B:
/* Signature check */
Write16(0x13A752E6, 0x2000);
/* Identify check */
Write16(0x20100D46, 0x2803);
Write16(0x20100DBE, 0x2803);
/* Open content permissions */
Write8(0x20104DF6, 0xE0);
Write8(0x20104E1A, 0xE0);
Write8(0x20104E3E, 0xE0);
/* Read content permissions */
Write16(0x20104F38, 0x46C0);
Write16(0x20104F3C, 0x46C0);
Write8 (0x20104F40, 0xE0);
/* Close content permissions */
Write16(0x20104F88, 0x46C0);
Write16(0x20104F8C, 0x46C0);
Write8 (0x20104F90, 0xE0);
/* Set UID check */
Write16(0x201052A6, 0x46C0);
/* Title version check */
Write8(0x20102818, 0xE0);
/* Title delete check */
Write8(0x20107BAA, 0xE0);
break;
/** 03/01/10 03:18:58 **/
case 0x4B8B8682:
/* Signature check */
Write16(0x13A75266, 0x2000);
/* Identify check */
Write16(0x20100CC4, 0x2803);
Write16(0x20100D3C, 0x2803);
/* Open content permissions */
Write8(0x20104B20, 0xE0);
Write8(0x20104B44, 0xE0);
/* Read content permissions */
Write16(0x20104C3C, 0x46C0);
Write16(0x20104C40, 0x46C0);
Write8 (0x20104C44, 0xE0);
/* Close content permissions */
Write16(0x20104C8C, 0x46C0);
Write16(0x20104C90, 0x46C0);
Write8 (0x20104C94, 0xE0);
/* Set UID check */
Write16(0x20104FAA, 0x46C0);
/* Title version check */
Write8(0x201026CC, 0xE0);
/* Title delete check */
Write8(0x20107642, 0xE0);
break;
}
}
void Patch_FfsModule(u32 version)
{
switch (version) {
/** 12/24/08 13:48:17 **/
case 0x49523DA1:
/* Permissions check */
Write8(0x200012F2, 0xE0);
break;
/** 12/23/09 17:26:21 **/
case 0x49511F3D:
/* Permissions check */
Write8(0x2000347E, 0xE0);
break;
/** 11/24/08 15:36:10 **/
case 0x492AC9EA:
/* Permissions check */
Write8(0x20001306, 0xE0);
break;
}
}
void Patch_IopModule(u32 version)
{
switch (version) {
/** 07/11/08 14:34:29 **/
/** 11/24/08 15:39:12 **/
/** 12/23/08 17:28:32 **/
/** 03/03/10 10:43:18 **/
/** 03/01/10 03:28:58 **/
/** 03/01/10 03:13:17 **/
case 0x48776F75:
case 0x492ACAA0:
case 0x49511FC0:
case 0x4B8E3D46:
case 0x4B8B30CD:
/* SWI handler */
Write32(0xFFFF0028, (u32)SwiVector);
break;
}
}