-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsysconhk.c
77 lines (64 loc) · 1.28 KB
/
sysconhk.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
#include <pspkernel.h>
#include <pspctrl.h>
#include "sysconhk.h"
extern void syscon_ctrl(sceSysconPacket *packet);
void syscon_put_dword(u8 *ptr,u32 value)
{
ptr[0] = value;
ptr[1] = value>>8;
ptr[2] = value>>16;
ptr[3] = value>>24;
}
u32 syscon_get_dword(u8 *ptr)
{
return ptr[0] | (ptr[1]<<8) | (ptr[2]<<16)| (ptr[3]<<24);
}
void syscon_make_checksum(void *data)
{
int i;
u8 sum;
u8 *ptr = (u8 *)data;
int size = ptr[1];
sum = 0;
for(i=0;i<size;i++)
sum += *ptr++;
*ptr = sum^0xff;
}
static void syscon_debug_callback0(sceSysconPacket *packet)
{
while(1);
}
static void syscon_transmit_callback(sceSysconPacket *packet)
{
}
static void syscon_receive_callback(sceSysconPacket *packet)
{
switch(packet->tx_cmd)
{
case 0x07:
syscon_ctrl(packet);
break;
case 0x08:
syscon_ctrl(packet);
break;
}
}
static void syscon_debug_callback3(sceSysconPacket *packet)
{
while(1);
}
static sceSysconDebugHandlers syscon_debug_callbacks =
{
syscon_debug_callback0,
syscon_transmit_callback,
syscon_receive_callback,
syscon_debug_callback3
};
void install_syscon_hook(void)
{
sceSysconSetDebugHandlers(&syscon_debug_callbacks);
}
void uninstall_syscon_hook(void)
{
sceSysconSetDebugHandlers(NULL);
}