diff --git a/app/main.c b/app/main.c index 7f9329f..41ad882 100644 --- a/app/main.c +++ b/app/main.c @@ -270,7 +270,7 @@ void main() { printf("Finding expiration start date..."); - unsigned char startDate[0x4]; + unsigned int startDate; fd = sceIoOpen("tm0:/activate/act.dat",SCE_O_RDONLY, 0444); if(fd <= -1) { @@ -281,28 +281,25 @@ void main() { sceIoRead(fd,&startDate,0x04); sceIoClose(fd); - printf(" found: 0x%02X%02X%02X%02X\n",startDate[0],startDate[1],startDate[2],startDate[3]); + printf(" found: %x\n",startDate); backup_act(); if(vshSblAimgrIsTool()) //devkit { - unsigned int timestamp = *((unsigned int*)&startDate); - printf("Updating CPRTC to %x\n",timestamp); - ret = silSblPostSsMgrSetCpRtc(timestamp); + printf("Updating CPRTC to %x\n",startDate); + ret = silSblPostSsMgrSetCpRtc(startDate); sceRegMgrSetKeyInt("/CONFIG/DATE", "set_automatically", 0); printf("has ret 0x%x\n",ret); } else if(vshSblAimgrIsDEX()) //testkit { - printf("Calculating PSTime: "); - unsigned int _startDate = *((unsigned int*)&startDate); - - uint64_t timestamp = 0; - timestamp = ((_startDate * 1000) + 62135596800000) * 1000; + + unsigned long long int timestamp = startDate; + timestamp = ((timestamp * 1000) + 62135596800000) * 1000; printf("PSTIME: %llx\n",timestamp); - if(_startDate < 1420070400); + if(startDate <= 0x54A48E00) { printf("Warn: Start Date is Before 1/1/2015\n"); printf("It's impossible to set the time before 1/1/2015.\n");