Skip to content

Commit 6e360d1

Browse files
Add cid install checks
1 parent 3421e38 commit 6e360d1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

CEX2DEX-Kernel/src/main.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,30 @@ int installConsoleId(const void *cid){
166166
int installDexCid(void){
167167

168168
int res;
169+
char leaf[0x200];
170+
171+
memset(leaf, 0, sizeof(leaf));
172+
173+
res = ksceIdStorageReadLeaf(1, leaf);
174+
if(res < 0){
175+
return res;
176+
}
169177

170178
/*
171179
* Brick warning: If you installed PS TV CID to FAT/Slim, Loaded to `display driver` that doesn't fit the device on boot time, resulting in a brick.
172180
* This is same even FAT/Slim CID to PS TV.
173181
*/
174182
if(ksceSblAimgrIsGenuineDolce() == 0){
183+
if((__builtin_bswap16(*(uint16_t *)(&leaf[0x66])) & 0x200) != 0){ // PS TV Device
184+
return 0x80FF0001;
185+
}
186+
175187
res = installConsoleId(dex_cid);
176188
}else{
189+
if((__builtin_bswap16(*(uint16_t *)(&leaf[0x66])) & 0x200) == 0){ // Not PS TV Device
190+
return 0x80FF0001;
191+
}
192+
177193
res = installConsoleId(dex_cid_for_dolce);
178194
}
179195

0 commit comments

Comments
 (0)