no message
This commit is contained in:
parent
f0d0cbddc4
commit
f211760752
115
app/main.c
115
app/main.c
|
@ -102,11 +102,13 @@ int CopyFile(char *src, char *dst)
|
|||
|
||||
int restore_act()
|
||||
{
|
||||
printf("Activation Data not Found! 0x%x\nChecking for backup...",ret);
|
||||
int is_ux0 = getFileSize("ux0:/data/act.dat") > 0;
|
||||
int is_pd0 = getFileSize("pd0:/data/act.dat") > 0;
|
||||
printf("Activation Data not Found!\nChecking for backup...");
|
||||
int is_ux0 = getFileSize("ux0:/data/act.dat") >= 0;
|
||||
int is_pd0 = getFileSize("pd0:/data/act.dat") >= 0;
|
||||
|
||||
if( is_ux0 || is_pd0 )
|
||||
sceIoMkdir("tm0:/activate", 0777);
|
||||
|
||||
if( (is_ux0) || (is_pd0) )
|
||||
{
|
||||
printf("Activation Data backup found!\n");
|
||||
printf("Press any key to restore (existing activation data will be overwritten)\n");
|
||||
|
@ -126,6 +128,7 @@ int restore_act()
|
|||
CopyFile("pd0:/data/act.dat","tm0:/activate/act.dat");
|
||||
ret = silRestoreNvsAct(0x0);
|
||||
}
|
||||
|
||||
// Check Success
|
||||
if(ret <= -1)
|
||||
{
|
||||
|
@ -152,13 +155,53 @@ int restore_act()
|
|||
return ret;
|
||||
}
|
||||
|
||||
int backup_act()
|
||||
{
|
||||
printf("Backing up activation files...\n");
|
||||
|
||||
uint32_t buf[3];
|
||||
buf[0] = 0x00;
|
||||
buf[1] = 0x00;
|
||||
buf[2] = 0x00;
|
||||
|
||||
vshIoUmount(0xC00, 0, 0, 0);
|
||||
vshIoUmount(0xC00, 1, 0, 0);
|
||||
_vshIoMount(0xC00, 0, 2, buf);
|
||||
|
||||
sceIoMkdir("ux0:/data", 0777);
|
||||
sceIoMkdir("pd0:/data", 0777);
|
||||
|
||||
//backup actdat
|
||||
CopyFile("tm0:/activate/act.dat","ux0:/data/act.dat");
|
||||
CopyFile("tm0:/activate/act.dat","pd0:/data/act.dat");
|
||||
|
||||
//backup actsig
|
||||
CopyFile("tm0:/activate/actsig.dat","ux0:/data/actsig.dat");
|
||||
CopyFile("tm0:/activate/actsig.dat","pd0:/data/actsig.dat");
|
||||
|
||||
|
||||
ret = silDumpNvsAct(0x0);
|
||||
if (ret <= -1){
|
||||
printf("ksceSblNvsReadData failed 0x%x\n",ret);
|
||||
}
|
||||
ret = silDumpNvsAct(0x1);
|
||||
if (ret <= -1){
|
||||
printf("ksceSblNvsReadData failed 0x%x\n",ret);
|
||||
}
|
||||
|
||||
|
||||
vshIoUmount(0xC00, 0, 0, 0);
|
||||
vshIoUmount(0xC00, 1, 0, 0);
|
||||
_vshIoMount(0xC00, 0, 1, buf);
|
||||
|
||||
printf("Done, backup at pd0:/data and ux0:/data\n\nPLEASE KEEP THESE FILES SAFE!!!");
|
||||
return ret;
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
psvDebugScreenInit();
|
||||
|
||||
|
||||
if(vshSblAimgrIsCEX())
|
||||
{
|
||||
printf("This is not a test/dev kit . . . \n");
|
||||
|
@ -209,62 +252,36 @@ void main() {
|
|||
|
||||
printf("OK\n");
|
||||
|
||||
//Check act data exists
|
||||
|
||||
ret = getFileSize("tm0:/activate/act.dat");
|
||||
if(ret <= -1)
|
||||
{
|
||||
restore_act();
|
||||
}
|
||||
|
||||
ret = getFileSize("tm0:/activate/actsig.dat");
|
||||
if(ret <= -1)
|
||||
{
|
||||
restore_act();
|
||||
}
|
||||
|
||||
printf("Finding expiration start date...");
|
||||
|
||||
unsigned char startDate[0x4];
|
||||
fd = sceIoOpen("tm0:/activate/act.dat",SCE_O_RDONLY, 0444);
|
||||
if(fd <= -1)
|
||||
{
|
||||
restore_act();
|
||||
printf("Failed to read act.dat 0x%x",fd);
|
||||
}
|
||||
|
||||
sceIoLseek(fd,0xC,SCE_SEEK_SET);
|
||||
sceIoRead(fd,&startDate,0x04);
|
||||
sceIoClose(fd);
|
||||
|
||||
fd = sceIoOpen("tm0:/activate/actsig.dat",SCE_O_RDONLY, 0444);
|
||||
if(fd <= -1)
|
||||
{
|
||||
restore_act();
|
||||
}
|
||||
sceIoClose(fd);
|
||||
|
||||
printf(" found: 0x%02X%02X%02X%02X\n",startDate[0],startDate[1],startDate[2],startDate[3]);
|
||||
printf("Backing up activation files...\n");
|
||||
|
||||
uint32_t buf[3];
|
||||
buf[0] = 0x00;
|
||||
buf[1] = 0x00;
|
||||
buf[2] = 0x00;
|
||||
|
||||
vshIoUmount(0xC00, 0, 0, 0);
|
||||
vshIoUmount(0xC00, 1, 0, 0);
|
||||
_vshIoMount(0xC00, 0, 2, buf);
|
||||
|
||||
//backup actdat
|
||||
CopyFile("tm0:/activate/act.dat","ux0:/data/act.dat");
|
||||
CopyFile("tm0:/activate/act.dat","pd0:/data/act.dat");
|
||||
|
||||
//backup actsig
|
||||
CopyFile("tm0:/activate/actsig.dat","ux0:/data/actsig.dat");
|
||||
CopyFile("tm0:/activate/actsig.dat","pd0:/data/actsig.dat");
|
||||
|
||||
|
||||
ret = silDumpNvsAct(0x0);
|
||||
if (ret <= -1){
|
||||
printf("ksceSblNvsReadData failed 0x%x\n",ret);
|
||||
}
|
||||
ret = silDumpNvsAct(0x1);
|
||||
if (ret <= -1){
|
||||
printf("ksceSblNvsReadData failed 0x%x\n",ret);
|
||||
}
|
||||
|
||||
vshIoUmount(0xC00, 0, 0, 0);
|
||||
vshIoUmount(0xC00, 1, 0, 0);
|
||||
_vshIoMount(0xC00, 0, 1, buf);
|
||||
|
||||
printf("Done, backup at pd0:/data and ux0:/data\n\nPLEASE KEEP THESE FILES SAFE!!!");
|
||||
|
||||
backup_act();
|
||||
|
||||
if(vshSblAimgrIsTool())
|
||||
{
|
||||
|
@ -279,7 +296,6 @@ void main() {
|
|||
printf("Calculating PSTime: ");
|
||||
unsigned int _startDate = *((unsigned int*)&startDate);
|
||||
|
||||
|
||||
uint64_t timestamp = 0;
|
||||
timestamp = ((_startDate * 1000) + 62135596800000) * 1000;
|
||||
printf("PSTIME: %llx\n",timestamp);
|
||||
|
@ -294,12 +310,9 @@ void main() {
|
|||
|
||||
get_key();
|
||||
timestamp = 0xFFEEDDCCBBAA9988ull;
|
||||
//printf("NEW PSTIME: %llx\n",timestamp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
printf("Creating splits..\n");
|
||||
|
||||
unsigned int split1 = timestamp >> 32;
|
||||
|
|
Loading…
Reference in New Issue