Skip to content

Commit

Permalink
Add cid install checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Princess-of-Sleeping committed Jan 9, 2022
1 parent 3421e38 commit 6e360d1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CEX2DEX-Kernel/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,30 @@ int installConsoleId(const void *cid){
int installDexCid(void){

int res;
char leaf[0x200];

memset(leaf, 0, sizeof(leaf));

res = ksceIdStorageReadLeaf(1, leaf);
if(res < 0){
return res;
}

/*
* 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.
* This is same even FAT/Slim CID to PS TV.
*/
if(ksceSblAimgrIsGenuineDolce() == 0){
if((__builtin_bswap16(*(uint16_t *)(&leaf[0x66])) & 0x200) != 0){ // PS TV Device
return 0x80FF0001;
}

res = installConsoleId(dex_cid);
}else{
if((__builtin_bswap16(*(uint16_t *)(&leaf[0x66])) & 0x200) == 0){ // Not PS TV Device
return 0x80FF0001;
}

res = installConsoleId(dex_cid_for_dolce);
}

Expand Down

0 comments on commit 6e360d1

Please sign in to comment.