11static void _printf3(
const char *format, ...);
16static void _printf3(
const char *format, ...){
22int SendMechaCommand(
int command,
const void *input,
unsigned short int length,
void *output)
26 _printf3(
"mecha command:%02x param:", (
unsigned char)command);
27 for (i = 0; i < length; i++) {
28 _printf3(
" %02x", ((
unsigned char *)input)[i]);
32 return sceCdApplySCmd((
unsigned char)command, (
void *)input, length, output);
36int mechacon_auth_80(
int cnum)
38 unsigned char ret[16], parameter[16];
42 if (SendMechaCommand(0x80, parameter, 1, ret) == 0) {
54int mechacon_auth_81(
int cnum)
56 unsigned char ret[16], parameter[16];
60 if (SendMechaCommand(0x81, parameter, 1, ret) == 0) {
72int mechacon_auth_82(
const void *buffer,
const void *buffer2)
74 unsigned char ret[16], parameters[16];
77 for (i = 0; i < 8; i++) {
78 parameters[i] = ((
unsigned char *)buffer)[i];
79 parameters[8 + i] = ((
unsigned char *)buffer2)[i];
82 if (SendMechaCommand(0x82, parameters, 16, ret) == 0) {
94int mechacon_auth_83(
const void *buffer)
96 unsigned char ret[16], parameters[16];
98 memcpy(parameters, buffer, 8);
100 if (SendMechaCommand(0x83, parameters, 8, ret) == 0) {
112int mechacon_auth_84(
void *buffer,
void *buffer2)
114 unsigned char ret[16];
116 if (SendMechaCommand(0x84, NULL, 0, ret) == 0) {
124 memcpy(buffer, &ret[1], 8);
125 memcpy(buffer2, &ret[9], 4);
131int mechacon_auth_85(
void *buffer,
void *buffer2)
133 unsigned char ret[16];
135 if (SendMechaCommand(0x85, NULL, 0, ret) == 0) {
143 memcpy(buffer, &ret[1], 4);
144 memcpy(buffer2, &ret[5], 8);
150int mechacon_auth_86(
void *buffer,
void *buffer2)
152 unsigned char ret[16], parameters[16];
155 for (i = 0; i < 8; i++) {
156 parameters[i] = ((
unsigned char *)buffer)[i];
157 parameters[8 + i] = ((
unsigned char *)buffer2)[i];
160 if (SendMechaCommand(0x86, parameters, 16, ret) != 0) {
172int mechacon_auth_87(
void *buffer)
174 unsigned char ret[16], parameters[16];
176 memcpy(parameters, buffer, 8);
178 if (SendMechaCommand(0x87, parameters, 8, ret) == 0) {
190int mechacon_auth_88(
void)
192 unsigned char ret[16];
194 if (SendMechaCommand(0x88, NULL, 0, ret) == 0) {
206int write_HD_start(
unsigned char mode,
int cnum,
int arg2,
unsigned short int HeaderLength)
208 unsigned char ret[16], parameters[16];
210 parameters[0] = mode;
211 parameters[1] = (
unsigned char)HeaderLength;
212 parameters[2] = (
unsigned char)(HeaderLength >> 8);
213 parameters[3] = cnum;
214 parameters[4] = arg2;
216 if (SendMechaCommand(0x90, parameters, 5, ret) == 0) {
228int write_data(
const void *buffer,
unsigned short int length)
230 unsigned char ret[16], input[16];
236 memcpy(input, buffer, length);
238 if (SendMechaCommand(0x8D, input, length, ret) == 0) {
250int pol_cal_cmplt(
void)
252 unsigned char ret[16];
255 if (SendMechaCommand(0x8F, NULL, 0, ret) == 0) {
258 }
while (ret[0] == 1);
268int func_00001c98(
unsigned short int size)
270 unsigned char params[16], ret[16];
272 params[0] = (
unsigned char)size;
273 params[1] = (
unsigned char)(size >> 8);
275 if (SendMechaCommand(0x93, params, 2, ret) == 0) {
287int get_BIT_length(
unsigned short int *BitLength)
289 unsigned char ret[16];
291 if (SendMechaCommand(0x91, NULL, 0, ret) == 0) {
299 *BitLength = ret[1] + ((int)ret[2] << 8);
305int func_00001b00(
void *data,
unsigned short int length)
307 unsigned char ret[16];
313 if (SendMechaCommand(0x8E, NULL, 0, ret) == 0) {
319 memcpy(data, ret, length);
325int mechacon_set_block_size(
unsigned short int size)
327 unsigned char ret[16], parameters[16];
329 parameters[0] = (
unsigned char)size;
330 parameters[1] = (
unsigned char)(size >> 8);
332 if (SendMechaCommand(0x92, parameters, 2, ret) == 0) {
344int _PreEncryptKbit1(
void *kbit1)
346 unsigned char ret[16];
348 if (SendMechaCommand(0x94, NULL, 0, ret) == 0) {
356 memcpy(kbit1, &ret[1], 8);
362int _PreEncryptKbit2(
void *kbit2)
364 unsigned char ret[16];
366 if (SendMechaCommand(0x95, NULL, 0, ret) == 0) {
374 memcpy(kbit2, &ret[1], 8);
380int _PreEncryptKc1(
void *kc1)
382 unsigned char ret[16];
384 if (SendMechaCommand(0x96, NULL, 0, ret) == 0) {
392 memcpy(kc1, &ret[1], 8);
398int _PreEncryptKc2(
void *kc2)
400 unsigned char ret[16];
402 if (SendMechaCommand(0x97, NULL, 0, ret) == 0) {
410 memcpy(kc2, &ret[1], 8);
416int func_00001ed8(
void *icvps2)
418 unsigned char ret[16];
420 if (SendMechaCommand(0x98, NULL, 0, ret) == 0) {
428 memcpy(icvps2, &ret[1], 8);
int sceCdApplySCmd(u8 cmdNum, const void *inBuff, u16 inBuffSize, void *outBuff)