-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathkstuff-toggle.cpp
More file actions
150 lines (128 loc) · 3 KB
/
kstuff-toggle.cpp
File metadata and controls
150 lines (128 loc) · 3 KB
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
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <ps5/kernel.h>
typedef struct notify_request {
char useless[45];
char message[3075];
} notify_request_t;
extern "C" int sceKernelSendNotificationRequest(int, notify_request_t*, size_t, int);
static void
notify(const char* fmt, ...) {
notify_request_t req;
va_list args;
bzero(&req, sizeof req);
va_start(args, fmt);
vsnprintf(req.message, sizeof req.message, fmt, args);
va_end(args);
sceKernelSendNotificationRequest(0, &req, sizeof req, 0);
}
int
kstuff_toggle(int enable) {
intptr_t sysentvec = 0;
switch(kernel_get_fw_version() & 0xffff0000) {
case 0x1000000:
case 0x1010000:
case 0x1020000:
case 0x1050000:
case 0x1100000:
case 0x1110000:
case 0x1120000:
case 0x1130000:
case 0x1140000:
case 0x2000000:
case 0x2200000:
case 0x2250000:
case 0x2260000:
case 0x2300000:
case 0x2500000:
case 0x2700000:
// probably running byepervisor instead of kstuff
return 0;
case 0x3000000:
case 0x3100000:
case 0x3200000:
case 0x3210000:
sysentvec = KERNEL_ADDRESS_DATA_BASE + 0xca0cd8;
break;
case 0x4000000:
case 0x4020000:
case 0x4030000:
case 0x4500000:
case 0x4510000:
sysentvec = KERNEL_ADDRESS_DATA_BASE + 0xd11bb8;
break;
case 0x5000000:
case 0x5020000:
case 0x5100000:
case 0x5500000:
sysentvec = KERNEL_ADDRESS_DATA_BASE + 0xe00be8;
break;
case 0x6000000:
case 0x6020000:
case 0x6500000:
sysentvec = KERNEL_ADDRESS_DATA_BASE + 0xe210a8;
break;
case 0x7000000:
case 0x7010000:
sysentvec = KERNEL_ADDRESS_DATA_BASE + 0xe21ab8;
break;
case 0x7200000:
case 0x7400000:
case 0x7600000:
case 0x7610000:
sysentvec = KERNEL_ADDRESS_DATA_BASE + 0xe21b78;
break;
case 0x8000000:
case 0x8200000:
case 0x8400000:
case 0x8600000:
sysentvec = KERNEL_ADDRESS_DATA_BASE + 0xe21ca8;
break;
case 0x9000000:
case 0x9050000:
case 0x9200000:
case 0x9400000:
case 0x9600000:
sysentvec = KERNEL_ADDRESS_DATA_BASE + 0xdba648;
break;
case 0x10000000:
case 0x10010000:
case 0x10200000:
case 0x10400000:
case 0x10600000:
sysentvec = KERNEL_ADDRESS_DATA_BASE + 0xdba6d8;
break;
case 0x11000000:
case 0x11200000:
sysentvec = KERNEL_ADDRESS_DATA_BASE + 0xdcbc78;
break;
case 0x11400000:
case 0x11600000:
sysentvec = KERNEL_ADDRESS_DATA_BASE + 0xdcbc98;
break;
case 0x12000000:
case 0x12020000:
case 0x12200000:
case 0x12400000:
case 0x12600000:
sysentvec = KERNEL_ADDRESS_DATA_BASE + 0xdcc978;
break;
default:
notify("Unsupported firmware");
return -1;
}
int is_disabled = kernel_getshort(sysentvec + 14) == 0xffff;
if(enable) {
if(is_disabled) {
kernel_setshort(sysentvec + 14, 0xdeb7);
}
notify("kstuff PS5 sysentvec enabled");
} else {
if(!is_disabled) {
kernel_setshort(sysentvec + 14, 0xffff);
}
notify("kstuff PS5 sysentvec disabled");
}
return 0;
}