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
|
#include <revolution/os.h>
#include <revolution/dvd.h>
#include <revolution/sc.h>
#include "__os.h"
#include "__dvd.h"
static u8 CheckBuffer[32] ATTRIBUTE_ALIGN(32);
static volatile BOOL lowDone = TRUE;
static volatile u32 lowIntType = 0;
static void lowCallback(u32 intType) {
lowIntType = intType;
lowDone = TRUE;
}
void __DVDShowDeviceErrorMessage(void);
BOOL __DVDCheckDevice(void) {
u32 checkCode = 0x460A0000;
u32 outOfRangeError = 0xFFFFFFFF;
u32 reportKeyError = 0xFFFFFFFF;
OSIOSRev iosRev;
if (OSGetPhysicalMem2Size() == 0x08000000) {
return TRUE;
}
__OSGetIOSRev(&iosRev);
if (iosRev.major < 30 || iosRev.major >= 254) {
return TRUE;
}
if (__OSDeviceCheckCode == 129) {
checkCode = 0x7ED40000;
}
lowDone = FALSE;
DVDLowUnencryptedRead((void*)CheckBuffer, 32, checkCode, lowCallback);\
while (!lowDone) {
}
switch (lowIntType) {
case 2:
break;
case 1:
goto invalid;
break;
default:
goto fatal;
break;
}
lowDone = FALSE;
DVDLowRequestError(lowCallback);
while (!lowDone) {
}
outOfRangeError = DVDLowGetImmBufferReg();
switch (lowIntType) {
case 1: {
if ((DVDLowGetImmBufferReg() & 0xFF000000) != 0) {
goto recover;
break;
}
switch (DVDLowGetImmBufferReg() & 0xFFFFFF) {
case 0x52100:
break;
default:
goto invalid;
break;
}
break;
}
default:
goto fatal;
break;
}
lowDone = FALSE;
DVDLowReportKey((DVDVideoReportKey*)CheckBuffer, 0x40000, 0, lowCallback);
while (!lowDone) {
}
switch (lowIntType) {
case 2:
break;
case 1:
goto invalid;
break;
default:
goto fatal;
break;
}
lowDone = FALSE;
DVDLowRequestError(lowCallback);
while (!lowDone) {
}
reportKeyError = DVDLowGetImmBufferReg();
switch (lowIntType) {
case 1:
if ((DVDLowGetImmBufferReg() & 0xFF000000) != 0) {
goto recover;
break;
}
switch (DVDLowGetImmBufferReg() & 0xFFFFFF) {
case 0x53100:
case 0x52000:
break;
default:
goto invalid;
break;
}
break;
default:
goto fatal;
break;
}
valid:
return TRUE;
invalid:
__DVDShowDeviceErrorMessage();
return FALSE;
recover:
return FALSE;
fatal:
__DVDShowFatalMessage();
return FALSE;
}
const char* const __DVDDeviceErrorMessage[] = {
"\n\n\nエラーコード001。\n"
"不明なデバイスが見つかりました。",
"\n\n\nError #001,\n"
"unauthorized device has been detected.",
"\n\n\nFehler #001:\n"
"Es wurde eine unzul舖sige Komponente\n"
"entdeckt.",
"\n\n\nErreur 001:\n"
"un dispositif non autoris\xE9\x20""a \xE9\x74\xE9\x20""d\xE9\x74""ect\xE9\x2E",
"\n\n\nError 001:\n"
"Se ha detectado un dispositivo no\n"
"autorizado.",
"\n\n\nErrore #001:\n"
"rilevato un dispositivo non autorizzato.",
"\n\n\nFout #001:\n"
"ongeoorloofd onderdeel gevonden."
};
void __DVDShowDeviceErrorMessage(void) {
const char* message;
const char* const* messageList;
GXColor bg = { 0, 0, 0, 0 };
GXColor fg = { 255, 255, 255, 0 };
if (SCGetLanguage() == 0) {
OSSetFontEncode(1);
} else {
OSSetFontEncode(0);
}
messageList = __DVDDeviceErrorMessage;
if (SCGetLanguage() > 6) {
message = messageList[1];
} else {
message = messageList[SCGetLanguage()];
}
OSFatal(fg, bg, message);
}
|