Compare commits
43 Commits
Author | SHA1 | Date |
---|---|---|
random() | 75bce3b2f2 | |
random() | 81b1f9616a | |
Bluzume | 5201faee52 | |
Bluzume | a03de8541b | |
SilicaAndPina | dfb0bfe6b6 | |
SilicaAndPina | 46b8085c84 | |
Bluzume | 7b0b83c1cc | |
SilicaAndPina | 080b5eb6e4 | |
SilicaAndPina | 3784cff547 | |
SilicaAndPina | 5ea85a0c72 | |
SilicaAndPina | 98bdf68da5 | |
SilicaAndPina | e672dc88cd | |
SilicaAndPina | 4289faebbc | |
SilicaAndPina | 1474b2d6c6 | |
SilicaAndPina | b893d0181a | |
SilicaAndPina | f211760752 | |
SilicaAndPina | f0d0cbddc4 | |
SilicaAndPina | 00a4e0066f | |
SilicaAndPina | 3796643877 | |
SilicaAndPina | 9f9c2bae50 | |
SilicaAndPina | b7e34b465c | |
SilicaAndPina | a75095938c | |
SilicaAndPina | 9d852d4d87 | |
SilicaAndPina | 009663b9ea | |
SilicaAndPina | e84d04554c | |
SilicaAndPina | d4021ee02b | |
SilicaAndPina | d4344ae572 | |
SilicaAndPina | 2014f298b3 | |
SilicaAndPina | 424d485cc6 | |
SilicaAndPina | 425963b98e | |
AtelierWindows | 0506f90f53 | |
SilicaAndPina | 777a9129cc | |
Silica | 5f67a10765 | |
Silica | 6a2d884087 | |
Silica | 2bb6aa81c2 | |
Silica | 18c5fbe40c | |
Silica | 7c837f1547 | |
Silica | 0805111cc0 | |
Silica | 53c30773f4 | |
Silica | f57c684a02 | |
Silica | 384a707e3a | |
Silica | 2295117de3 | |
Silica | b7398acedc |
34
README.md
34
README.md
|
@ -1,2 +1,32 @@
|
|||
# testkit-activator
|
||||
re-activate your testkit vita after it expires
|
||||
# Releases
|
||||
[v1.4](https://bitbucket.org/SilicaAndPina/activate.vpk/downloads/activate-v1.4.vpk) - Icon got Copystriked by Freakler, and added option to NOT backup to pd0 if you dont want to.
|
||||
[v1.3](https://bitbucket.org/SilicaAndPina/activate.vpk/downloads/activate-v1.3.vpk) - Added an option to restore activation data if cannot be found in tm0:/activate
|
||||
[v1.2](https://bitbucket.org/SilicaAndPina/activate.vpk/downloads/activate-v1.2.vpk) - Now backs up from NVS and allows time to be set before 1/1/2015 (but vita checks elsewhere anyway)
|
||||
[v1.1](https://bitbucket.org/SilicaAndPina/activate.vpk/downloads/activate-v1.1.vpk) - Added support for Development Kit Consoles
|
||||
[v1.0](https://bitbucket.org/SilicaAndPina/activate.vpk/downloads/activate.vpk) - Inital Release- Activates testkit's and backs up act.dat / actsig.dat.
|
||||
|
||||
|
||||
# testkit/devkit-activator
|
||||
re-activate your test/dev kit vita after it expires
|
||||
|
||||
only works if you have your activation files still
|
||||
tm0:activate/act.dat & tm0:activate/actsig.dat & 0x520 in NVS.
|
||||
|
||||
I attempted to bypass the 1/1/2015 restriction on setting the srtc but it seems anything before it
|
||||
does *technically* change but is considered an invalid time when being read.
|
||||
(this doesnt matter on devkit, only a minor annoyance on soft resets!)
|
||||
|
||||
upon running activate.vpk your activation data will be backed up to pd0:/data/ and ux0:/data/ its highly recommended to make a copy on your PC as well.
|
||||
|
||||
pd0:data/ because its read-only and it remains even after updating or reinstalling the firmware. basicly it would be difficult to actidently delete them
|
||||
|
||||
oh btw, normal henkaku doesnt work if your system is activated, (it assumes its allready installed)
|
||||
ive made the modifications nessorcary to make it install regardless and hosting it currently at http://vitatricks.xyz/henkek
|
||||
|
||||
thanks zecoaxco for saving me from RE'ing ksceRtcSetCurrentNetworkTick
|
||||
|
||||
|
||||
NOTE: IF YOU USED THIS BEFORE ON 1.1 OR LOWER I HIGHLY RECOMMEND RUNNING IT AGAIN ON 1.2+
|
||||
AS IT BACKS UP THE ACTIVATION TOKEN IN NVS AS WELL NOW. WHICH IS *REQUIRED* FOR A PROPER RESTORE OF ACTIVATION DATA.
|
||||
|
||||
(If you are missing NVS data but still have act.dat and actsig.dat- you can generate the NVS data with [act-gen-nvs](https://bitbucket.org/SilicaAndPina/gen-act-nvs/src/master/))
|
|
@ -16,6 +16,7 @@ add_executable(${PROJECT_NAME}.elf
|
|||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}.elf
|
||||
user_clockset_stub_weak
|
||||
SceDisplay_stub
|
||||
SceCtrl_stub
|
||||
SceVshBridge_stub
|
||||
|
@ -24,7 +25,6 @@ target_link_libraries(${PROJECT_NAME}.elf
|
|||
ScePower_stub
|
||||
SceRegistryMgr_stub
|
||||
taihen_stub
|
||||
user_clockset_stub_weak
|
||||
)
|
||||
|
||||
add_custom_target(${PROJECT_NAME}.vpk ALL
|
||||
|
|
474
app/main.c
474
app/main.c
|
@ -12,8 +12,10 @@
|
|||
|
||||
#define printf psvDebugScreenPrintf
|
||||
|
||||
int ret;
|
||||
SceUID fd;
|
||||
|
||||
int ret = 0x00;
|
||||
SceUID fd = 0x00;
|
||||
int backup_pd0 = 0x00;
|
||||
|
||||
int get_key(void) {
|
||||
static unsigned buttons[] = {
|
||||
|
@ -77,203 +79,287 @@ int getFileSize(const char *file) {
|
|||
return fileSize;
|
||||
}
|
||||
|
||||
int CopyFile(char *src, char *dst)
|
||||
{
|
||||
int size = getFileSize(src);
|
||||
if (size <= -1){
|
||||
printf("getFileSize Failed, ret: 0x%x\n",size);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *buffer = malloc(size);
|
||||
ret = ReadFile(src,buffer,size);
|
||||
if (ret <= -1)
|
||||
{
|
||||
printf("ReadFile failed 0x%x\n",ret);
|
||||
}
|
||||
|
||||
ret = WriteFile(dst,buffer,size);
|
||||
if (ret <= -1){
|
||||
printf("WriteFile failed 0x%x\n",ret);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int restore_act()
|
||||
{
|
||||
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;
|
||||
|
||||
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");
|
||||
get_key();
|
||||
if(is_ux0)
|
||||
{
|
||||
CopyFile("ux0:/data/act.dat","tm0:/activate/act.dat");
|
||||
CopyFile("ux0:/data/actsig.dat","tm0:/activate/actsig.dat");
|
||||
CopyFile("ux0:/data/act.dat","tm0:/activate/act.dat");
|
||||
ret = silRestoreNvsAct(0x1);
|
||||
}
|
||||
else if(is_pd0)
|
||||
{
|
||||
|
||||
CopyFile("pd0:/data/act.dat","tm0:/activate/act.dat");
|
||||
CopyFile("pd0:/data/actsig.dat","tm0:/activate/actsig.dat");
|
||||
CopyFile("pd0:/data/act.dat","tm0:/activate/act.dat");
|
||||
ret = silRestoreNvsAct(0x0);
|
||||
}
|
||||
|
||||
// Check Success
|
||||
if(ret <= -1)
|
||||
{
|
||||
printf("ksceSblNvsWriteData failed 0x%x",ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Activation data restored!");
|
||||
get_key();
|
||||
sceKernelExitProcess(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("No backup data found.\n");
|
||||
printf("if you have a backup of Activation Data please place it in ux0:/data\n\n");
|
||||
printf(" - ux0:/data/act.dat\n");
|
||||
printf(" - ux0:/data/actsig.dat\n");
|
||||
printf(" - ux0:/data/act-nvs.dat\n");
|
||||
|
||||
get_key();
|
||||
sceKernelExitProcess(0);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int backup_act()
|
||||
{
|
||||
printf("Backing up activation files...\n");
|
||||
|
||||
|
||||
|
||||
if(backup_pd0){
|
||||
silIoUmount(0xC00, 0);
|
||||
silIoUmount(0xC00, 1);
|
||||
silIoMount(0xC00, 2);
|
||||
}
|
||||
sceIoMkdir("ux0:/data", 0777);
|
||||
if(backup_pd0)
|
||||
sceIoMkdir("pd0:/data", 0777);
|
||||
|
||||
//backup actdat
|
||||
CopyFile("tm0:/activate/act.dat","ux0:/data/act.dat");
|
||||
if(backup_pd0)
|
||||
CopyFile("tm0:/activate/act.dat","pd0:/data/act.dat");
|
||||
|
||||
//backup actsig
|
||||
CopyFile("tm0:/activate/actsig.dat","ux0:/data/actsig.dat");
|
||||
if(backup_pd0)
|
||||
CopyFile("tm0:/activate/actsig.dat","pd0:/data/actsig.dat");
|
||||
|
||||
if(backup_pd0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
if(backup_pd0)
|
||||
{
|
||||
silIoUmount(0xC00, 0);
|
||||
silIoUmount(0xC00, 1);
|
||||
silIoMount(0xC00, 1);
|
||||
}
|
||||
printf("Done, backup at ");
|
||||
if(backup_pd0)
|
||||
printf("pd0:/data and ");
|
||||
printf("ux0:/data\nPLEASE KEEP THESE FILES SAFE!!!\n\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
psvDebugScreenInit();
|
||||
if(vshSblAimgrIsDEX() == 9)
|
||||
{
|
||||
printf("This is not a testing kit . . . \n");
|
||||
get_key();
|
||||
sceKernelExitProcess(0);
|
||||
}
|
||||
|
||||
char kplugin_path[0x200];
|
||||
memset(kplugin_path,0x00,0x200);
|
||||
|
||||
char uplugin_path[0x200];
|
||||
memset(uplugin_path,0x00,0x200);
|
||||
|
||||
char titleid[12];
|
||||
sceAppMgrUmount("app0:");
|
||||
|
||||
printf("Loading kmodule...");
|
||||
|
||||
sceAppMgrAppParamGetString(0, 12, titleid , 256);
|
||||
sprintf(kplugin_path, "ux0:app/%s/kern_clockset.skprx", titleid);
|
||||
int kernel_modid = 0;
|
||||
kernel_modid = taiLoadStartKernelModule(kplugin_path, 0, NULL, 0);
|
||||
|
||||
|
||||
if(kernel_modid <= 0 && kernel_modid != 0x8002d013 && kernel_modid != 0x8002d004)
|
||||
{
|
||||
printf("Error cannot load kern_clockset.skprx error 0x%x\n",kernel_modid);
|
||||
get_key();
|
||||
sceKernelExitProcess(0);
|
||||
}
|
||||
|
||||
printf("OK\n");
|
||||
|
||||
printf("Loading umodule...");
|
||||
|
||||
sceAppMgrAppParamGetString(0, 12, titleid , 256);
|
||||
sprintf(uplugin_path, "ux0:app/%s/user_clockset.suprx", titleid);
|
||||
int user_modid = 0;
|
||||
user_modid = sceKernelLoadStartModule(uplugin_path, 0, NULL, 0, NULL, NULL);
|
||||
|
||||
|
||||
if(user_modid <= 0)
|
||||
{
|
||||
printf("Error cannot load user_clockset.suprx error 0x%x\n",user_modid);
|
||||
get_key();
|
||||
sceKernelExitProcess(0);
|
||||
}
|
||||
|
||||
printf("OK\n");
|
||||
|
||||
|
||||
psvDebugScreenInit();
|
||||
|
||||
if(vshSblAimgrIsCEX())
|
||||
{
|
||||
printf("This is not a test/dev kit . . . \n");
|
||||
get_key();
|
||||
sceKernelExitProcess(0);
|
||||
}
|
||||
|
||||
char kplugin_path[0x200];
|
||||
memset(kplugin_path,0x00,0x200);
|
||||
|
||||
char uplugin_path[0x200];
|
||||
memset(uplugin_path,0x00,0x200);
|
||||
|
||||
char titleid[12];
|
||||
sceAppMgrUmount("app0:");
|
||||
|
||||
printf("Loading kmodule...");
|
||||
|
||||
sceAppMgrAppParamGetString(0, 12, titleid , 256);
|
||||
sprintf(kplugin_path, "ux0:app/%s/kern_clockset.skprx", titleid);
|
||||
int kernel_modid = 0;
|
||||
kernel_modid = taiLoadStartKernelModule(kplugin_path, 0, NULL, 0);
|
||||
|
||||
|
||||
if(kernel_modid <= 0 && kernel_modid != 0x8002d013 && kernel_modid != 0x8002d004)
|
||||
{
|
||||
printf("Error cannot load kern_clockset.skprx error 0x%x\n",kernel_modid);
|
||||
get_key();
|
||||
sceKernelExitProcess(0);
|
||||
}
|
||||
|
||||
printf("OK\n");
|
||||
|
||||
printf("Loading umodule...");
|
||||
|
||||
sceAppMgrAppParamGetString(0, 12, titleid , 256);
|
||||
sprintf(uplugin_path, "ux0:app/%s/user_clockset.suprx", titleid);
|
||||
int user_modid = 0;
|
||||
user_modid = sceKernelLoadStartModule(uplugin_path, 0, NULL, 0, NULL, NULL);
|
||||
|
||||
|
||||
if(user_modid <= 0)
|
||||
{
|
||||
printf("Error cannot load user_clockset.suprx error 0x%x\n",user_modid);
|
||||
get_key();
|
||||
sceKernelExitProcess(0);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
//Read Exp Date
|
||||
|
||||
printf("Finding expiration start date...");
|
||||
|
||||
unsigned int startDate;
|
||||
fd = sceIoOpen("tm0:/activate/act.dat",SCE_O_RDONLY, 0444);
|
||||
if(fd <= -1)
|
||||
{
|
||||
printf("Failed to read act.dat 0x%x",fd);
|
||||
}
|
||||
|
||||
sceIoLseek(fd,0xC,SCE_SEEK_SET);
|
||||
sceIoRead(fd,&startDate,0x04);
|
||||
sceIoClose(fd);
|
||||
|
||||
printf(" found: %x\n",startDate);
|
||||
printf("\n\nWould you like to backup activation data to pd0:/data\nThis area is Read-Only and is not touched by system updates\nso it would be very hard to accidentally remove it\nX: Yes Backup to pd0:/data\nO: No just backup to ux0:/data\n");
|
||||
|
||||
int button = get_key();
|
||||
if(button == SCE_CTRL_CROSS)
|
||||
backup_pd0 = 1;
|
||||
else
|
||||
backup_pd0 = 0;
|
||||
|
||||
backup_act();
|
||||
|
||||
if(vshSblAimgrIsTool()) //devkit
|
||||
{
|
||||
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
|
||||
{
|
||||
|
||||
unsigned long long int timestamp = startDate;
|
||||
timestamp = ((timestamp * 1000) + 62135596800000) * 1000;
|
||||
printf("PSTIME: %llx\n",timestamp);
|
||||
|
||||
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");
|
||||
printf("However i can cause an overflow when reading to make it *appear* as 1/1/2015\n");
|
||||
printf("doing this will break trophy earning though.\n");
|
||||
printf("\nPress any key to continue\n");
|
||||
|
||||
get_key();
|
||||
timestamp += 0xAFEE8AFE9EEEF1FFull; // a really big number.
|
||||
|
||||
}
|
||||
|
||||
printf("Creating splits..\n");
|
||||
|
||||
unsigned int split1 = timestamp >> 32;
|
||||
unsigned int split2 = timestamp & 0xffffffff;
|
||||
|
||||
|
||||
printf("Split1: %x\n",split1);
|
||||
printf("Split2: %x\n",split2);
|
||||
|
||||
printf("Updating SecureTick.. ");
|
||||
ret = silRtcSetCurrentSecureTick(split2,split1);
|
||||
printf("has ret 0x%x\n",ret);
|
||||
|
||||
sceRegMgrSetKeyInt("/CONFIG/DATE", "set_automatically", 0);
|
||||
}
|
||||
|
||||
|
||||
printf("Finding expiration start date...");
|
||||
|
||||
unsigned char startDate[0x4];
|
||||
fd = sceIoOpen("tm0:/activate/act.dat",SCE_O_RDONLY, 0444);
|
||||
if(fd <= -1)
|
||||
{
|
||||
printf("\ntm0:/activate/act.dat not found, cannot proceed :'( 0x%x\n",ret);
|
||||
get_key();
|
||||
sceKernelExitProcess(0);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
printf("\ntm0:/activate/actsig.dat not found, cannot proceed :'( 0x%x\n",ret);
|
||||
get_key();
|
||||
sceKernelExitProcess(0);
|
||||
}
|
||||
sceIoClose(fd);
|
||||
|
||||
printf(" found: 0x%02X%02X%02X%02X\n",startDate[0],startDate[1],startDate[2],startDate[3]);
|
||||
|
||||
|
||||
printf("Backing up activation files... ");
|
||||
|
||||
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
|
||||
int size = getFileSize("tm0:/activate/act.dat");
|
||||
if (size <= -1){
|
||||
printf("getFileSize Failed, ret: 0x%x\n",size);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *actdat = malloc(size);
|
||||
ret = ReadFile("tm0:/activate/act.dat",actdat,size);
|
||||
if (ret <= -1)
|
||||
{
|
||||
printf("ReadFile act failed 0x%x\n",ret);
|
||||
}
|
||||
|
||||
ret = WriteFile("pd0:/data/act.dat",actdat,size);
|
||||
if (ret <= -1){
|
||||
printf("WriteFile actsig failed 0x%x\n",ret);
|
||||
}
|
||||
ret = WriteFile("ux0:/data/act.dat",actdat,size);
|
||||
if (ret <= -1){
|
||||
printf("WriteFile act failed 0x%x\n",ret);
|
||||
}
|
||||
}
|
||||
|
||||
//backup actsig
|
||||
size = getFileSize("tm0:/activate/actsig.dat");
|
||||
if (size <= -1){
|
||||
printf("getFileSize failed ret: 0x%x\n",size);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *actsig = malloc(size);
|
||||
|
||||
ret = ReadFile("tm0:/activate/actsig.dat",actsig,size);
|
||||
if (ret <= -1){
|
||||
printf("ReadFile actsig failed 0x%x\n",ret);
|
||||
}
|
||||
|
||||
ret = WriteFile("pd0:/data/actsig.dat",actsig,size);
|
||||
if (ret <= -1){
|
||||
printf("WriteFile actsig failed 0x%x\n",ret);
|
||||
}
|
||||
|
||||
ret = WriteFile("ux0:/data/actsig.dat",actsig,size);
|
||||
if (ret <= -1){
|
||||
printf("WriteFile actsig 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");
|
||||
|
||||
printf("Calculating PSTime: ");
|
||||
|
||||
unsigned long long int timestamp;
|
||||
memset(×tamp,0,sizeof(unsigned long long int));
|
||||
timestamp = *((unsigned int*)&startDate);
|
||||
timestamp = ((timestamp * 1000) + 62135596800000) * 1000;
|
||||
|
||||
|
||||
printf("%llx\n",timestamp);
|
||||
|
||||
printf("Creating splits..\n");
|
||||
char hexint[15];
|
||||
memset(hexint,0,15);
|
||||
|
||||
sprintf(hexint,"%llx",timestamp);
|
||||
|
||||
char ts1[7] = {hexint[0],hexint[1],hexint[2],hexint[3],hexint[4],hexint[5],0x00};
|
||||
unsigned long long int split1 = (unsigned int)strtoul(ts1, NULL, 16);
|
||||
printf("Split1: %llx\n",split1);
|
||||
|
||||
|
||||
char ts2[10] = {hexint[6],hexint[7],hexint[8],hexint[9],hexint[10],hexint[11],hexint[12],hexint[13],hexint[14],0x00};
|
||||
unsigned long long int split2 = (unsigned int)strtoul(ts2, NULL, 16);
|
||||
printf("Split2: %llx\n",split2);
|
||||
|
||||
printf("Updating SecureTick.. ");
|
||||
|
||||
ret = silRtcSetCurrentSecureTick(split2,split1);
|
||||
sceRegMgrSetKeyInt("/CONFIG/DATE", "set_automatically", 0);
|
||||
|
||||
printf("has ret 0x%x\n",ret);
|
||||
|
||||
if(ret == 0)
|
||||
{
|
||||
printf("\n\nYour PSVITA Testing Kit has been activated!\n");
|
||||
printf("\n");
|
||||
printf("Deactivate by holding START + SELECT + PS + POWER\n\n");
|
||||
printf("Press any key to reboot console");
|
||||
get_key();
|
||||
scePowerRequestColdReset();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error: 0x%x\n",ret);
|
||||
}
|
||||
|
||||
get_key();
|
||||
if(ret == 0)
|
||||
{
|
||||
printf("\n\nYour PSVITA Test/Dev Kit has been activated!\n");
|
||||
printf("\n");
|
||||
printf("Deactivate by holding START + SELECT + PS + POWER\n\n");
|
||||
printf("Press any key to turn off console");
|
||||
get_key();
|
||||
scePowerRequestStandby();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error: 0x%x\n",ret);
|
||||
}
|
||||
|
||||
get_key();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
int silRtcSetCurrentTick(unsigned int timestamp1, unsigned int timestamp2);
|
||||
int silRtcSetCurrentNetworkTick(unsigned int timestamp1, unsigned int timestamp2);
|
||||
int silRtcSetCurrentSecureTick(unsigned int timestamp1, unsigned int timestamp2);
|
||||
int silRtcSetCurrentSecureTick(unsigned int timestamp1, unsigned int timestamp2);
|
||||
int silSblPostSsMgrSetCpRtc(unsigned int timestamp);
|
||||
int silDumpNvsAct(unsigned int fileno);
|
||||
int silRestoreNvsAct(unsigned int fileno);
|
||||
int silIoMount(int id, int permission);
|
||||
int silIoUmount(int id, int force);
|
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.4 KiB |
1
build.sh
1
build.sh
|
@ -39,7 +39,6 @@ echo "Building app"
|
|||
cd app
|
||||
cmake . && make
|
||||
mv activate.vpk ../built
|
||||
mv eboot.bin ../built
|
||||
|
||||
make clean
|
||||
rm -rf ./CMakeFiles
|
||||
|
|
|
@ -31,8 +31,11 @@ target_link_libraries(${PROJECT_NAME}
|
|||
SceDebugForDriver_stub
|
||||
SceSysmem_stub
|
||||
SceRtcForDriver_stub
|
||||
SceSblPostSsMgrForDriver_stub
|
||||
SceCpuForDriver_stub
|
||||
SceSblSsMgrForKernel_stub
|
||||
taihenForKernel_stub
|
||||
taihenModuleUtils_stub
|
||||
gcc
|
||||
-nostdlib
|
||||
)
|
||||
|
@ -47,5 +50,6 @@ vita_create_stubs(${PROJECT_NAME}-stubs ${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/expo
|
|||
install(DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-stubs/
|
||||
DESTINATION lib
|
||||
FILES_MATCHING PATTERN "*.a"
|
||||
|
||||
)
|
||||
|
||||
|
|
|
@ -12,4 +12,9 @@ kern_clockset:
|
|||
functions:
|
||||
- ksilRtcSetCurrentSecureTick
|
||||
- ksilRtcSetCurrentNetworkTick
|
||||
- ksilRtcSetCurrentTick
|
||||
- ksilRtcSetCurrentTick
|
||||
- ksilSblPostSsMgrSetCpRtc
|
||||
- ksilDumpNvsAct
|
||||
- ksilRestoreNvsAct
|
||||
- ksilIoUmount
|
||||
- ksilIoMount
|
|
@ -1,20 +1,53 @@
|
|||
/*
|
||||
*
|
||||
* SILICAANDPINA
|
||||
*
|
||||
* KERNEL < - > USERLAND SceRtc BRIDGE
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* SILICAANDPINA
|
||||
*
|
||||
* KERNEL < - > USERLAND SceRtc BRIDGE
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <vitasdk.h>
|
||||
#include <vitasdkkern.h>
|
||||
#include <taihen.h>
|
||||
#include "rtc.h"
|
||||
|
||||
int ksilRtcSetCurrentTick(timestamp1,timestamp2)
|
||||
int module_get_export_func(SceUID pid, const char *modname, uint32_t libnid, uint32_t funcnid, uintptr_t *func);
|
||||
void (*sceIoMount)(int id, const char *path, int permission, int a4, int a5, int a6);
|
||||
void (*sceIoUmount)(int id, int a2, int a3, int a4);
|
||||
|
||||
int WriteFile(char *file, void *buf, int size) {
|
||||
SceUID fd = ksceIoOpen(file, SCE_O_RDWR | SCE_O_CREAT, 0777);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
int written = ksceIoWrite(fd, buf, size);
|
||||
|
||||
ksceIoClose(fd);
|
||||
return written;
|
||||
}
|
||||
int ReadFile(char *file, void *buf, int size) {
|
||||
SceUID fd = ksceIoOpen(file,SCE_O_RDONLY, 0777);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
int read = ksceIoRead(fd, buf, size);
|
||||
|
||||
ksceIoClose(fd);
|
||||
return read;
|
||||
}
|
||||
|
||||
int getFileSize(const char *file) {
|
||||
SceUID fd = ksceIoOpen(file, SCE_O_RDONLY, 0);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
int fileSize = ksceIoLseek(fd, 0, SCE_SEEK_END);
|
||||
ksceIoClose(fd);
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
int ksilRtcSetCurrentTick(unsigned int timestamp1,unsigned int timestamp2)
|
||||
{
|
||||
unsigned int timestamp[2];
|
||||
|
||||
|
@ -24,7 +57,7 @@ int ksilRtcSetCurrentTick(timestamp1,timestamp2)
|
|||
return ksceRtcSetCurrentTick(timestamp);
|
||||
}
|
||||
|
||||
int ksilRtcSetCurrentNetworkTick(timestamp1,timestamp2)
|
||||
int ksilRtcSetCurrentNetworkTick(unsigned int timestamp1,unsigned int timestamp2)
|
||||
{
|
||||
unsigned int timestamp[2];
|
||||
|
||||
|
@ -34,7 +67,7 @@ int ksilRtcSetCurrentNetworkTick(timestamp1,timestamp2)
|
|||
return ksceRtcSetCurrentNetworkTick(timestamp);
|
||||
}
|
||||
|
||||
int ksilRtcSetCurrentSecureTick(timestamp1,timestamp2)
|
||||
int ksilRtcSetCurrentSecureTick(unsigned int timestamp1,unsigned int timestamp2)
|
||||
{
|
||||
unsigned int timestamp[2];
|
||||
|
||||
|
@ -44,12 +77,115 @@ int ksilRtcSetCurrentSecureTick(timestamp1,timestamp2)
|
|||
return ksceRtcSetCurrentSecureTick(timestamp);
|
||||
}
|
||||
|
||||
int ksilSblPostSsMgrSetCpRtc(unsigned int timestamp)
|
||||
{
|
||||
return ksceSblPostSsMgrSetCpRtc(timestamp);
|
||||
}
|
||||
|
||||
int ksilDumpNvsAct(int fileno)
|
||||
{
|
||||
char nvsBuf[0x20];
|
||||
char act_magic[0x3] = {0x61, 0x63, 0x74};
|
||||
|
||||
int ret = ksceSblNvsReadData(0x520,nvsBuf,0x20);
|
||||
if(memcmp(nvsBuf,act_magic,0x3) != 0)
|
||||
{
|
||||
return -6325;
|
||||
}
|
||||
|
||||
|
||||
if(fileno == 1)
|
||||
{
|
||||
WriteFile("ux0:/data/act-nvs.dat",nvsBuf,0x20);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteFile("pd0:/data/act-nvs.dat",nvsBuf,0x20);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ksilRestoreNvsAct(int fileno)
|
||||
{
|
||||
char nvsBuf[0x20];
|
||||
int ret;
|
||||
|
||||
if(fileno == 1)
|
||||
{
|
||||
ret = ReadFile("ux0:/data/act-nvs.dat",nvsBuf,0x20);
|
||||
if(ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = ReadFile("pd0:/data/act-nvs.dat",nvsBuf,0x20);
|
||||
if(ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = ksceSblNvsWriteData(0x520,nvsBuf,0x20);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ksilIoUmount(int id, int force){
|
||||
sceIoUmount(id, force, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ksilIoMount(int id, int permission){
|
||||
sceIoMount(id, NULL, permission, 0, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma GCC optimize ("O0")
|
||||
int get_functions() // Bypass vitashell memes
|
||||
{
|
||||
int obfuscateNid = 0xCD4AA9E6;
|
||||
obfuscateNid += 0x3261262; // Equals (ksceIoMount)
|
||||
|
||||
int obfuscateNid2 = 0x1E212AED;
|
||||
obfuscateNid2 += 0x2361613; // Equals (ksceIoUmount)
|
||||
|
||||
int obfuscateLib = 0xF9A13B2;
|
||||
obfuscateLib += 0x31631615; // Equals (SceIofilemgrForDriver)
|
||||
|
||||
|
||||
module_get_export_func(KERNEL_PID, "SceIofilemgr", obfuscateLib, obfuscateNid, (uintptr_t *)&sceIoMount);
|
||||
module_get_export_func(KERNEL_PID, "SceIofilemgr", obfuscateLib, obfuscateNid2, (uintptr_t *)&sceIoUmount);
|
||||
ksceDebugPrintf("sceIoMount:%p\n", sceIoMount);
|
||||
ksceDebugPrintf("sceIoUmount:%p\n", sceIoUmount);
|
||||
return 0;
|
||||
}
|
||||
#pragma GCC optimize ("O3")
|
||||
|
||||
|
||||
void _start() __attribute__ ((weak, alias ("module_start")));
|
||||
int module_start(SceSize argc, const void *args)
|
||||
{
|
||||
return SCE_KERNEL_START_SUCCESS;
|
||||
/*
|
||||
* 1/1/2015 check BTFO'd
|
||||
*
|
||||
* Vita checks elsewhere though :'(
|
||||
*/
|
||||
|
||||
tai_module_info_t info;
|
||||
info.size = sizeof(tai_module_info_t);
|
||||
if (taiGetModuleInfoForKernel(KERNEL_PID, "SceRtc", &info) < 0)
|
||||
{
|
||||
return SCE_KERNEL_START_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t patched_instruction = 0xBF00BF00; //NOP
|
||||
taiInjectDataForKernel(KERNEL_PID, info.modid, 0, 0x93C, &patched_instruction, 0x4); //bcs.w LAB_81000a64 -> NOP (SetCurrentSecureTick)
|
||||
taiInjectDataForKernel(KERNEL_PID, info.modid, 0, 0xA94, &patched_instruction, 0x4); //bcs.w LAB_81000bbc -> NOP (SetCurrentNetworkTick)
|
||||
get_functions();
|
||||
|
||||
return SCE_KERNEL_START_SUCCESS;
|
||||
}
|
||||
|
||||
int module_stop(SceSize argc, const void *args)
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
int ksceRtcSetCurrentTick(unsigned int* timestamp);
|
||||
int ksceRtcSetCurrentNetworkTick(unsigned int* timestamp);
|
||||
int ksceRtcSetCurrentSecureTick(unsigned int* timestamp);
|
||||
|
||||
int ksceSblPostSsMgrSetCpRtc(unsigned int timestamp);
|
||||
|
||||
int ksceSblNvsReadData(int offset,void* buffer,int size);
|
||||
int ksceSblNvsWriteData(int offset,void* buffer,int size);
|
|
@ -0,0 +1,8 @@
|
|||
int ksilRtcSetCurrentTick(unsigned int timestamp1, unsigned int timestamp2);
|
||||
int ksilRtcSetCurrentNetworkTick(unsigned int timestamp1, unsigned int timestamp2);
|
||||
int ksilRtcSetCurrentSecureTick(unsigned int timestamp1, unsigned int timestamp2);
|
||||
int ksilSblPostSsMgrSetCpRtc(unsigned int timestamp);
|
||||
int ksilDumpNvsAct(unsigned int fileno);
|
||||
int ksilRestoreNvsAct(unsigned int fileno);
|
||||
int ksilIoMount(int id, int permission);
|
||||
int ksilIoUmount(int id, int force);
|
|
@ -13,3 +13,8 @@ user_clockset:
|
|||
- silRtcSetCurrentNetworkTick
|
||||
- silRtcSetCurrentTick
|
||||
- silRtcSetCurrentSecureTick
|
||||
- silSblPostSsMgrSetCpRtc
|
||||
- silDumpNvsAct
|
||||
- silRestoreNvsAct
|
||||
- silIoUmount
|
||||
- silIoMount
|
|
@ -0,0 +1,8 @@
|
|||
int ksilRtcSetCurrentTick(unsigned int timestamp1, unsigned int timestamp2);
|
||||
int ksilRtcSetCurrentNetworkTick(unsigned int timestamp1, unsigned int timestamp2);
|
||||
int ksilRtcSetCurrentSecureTick(unsigned int timestamp1, unsigned int timestamp2);
|
||||
int ksilSblPostSsMgrSetCpRtc(unsigned int timestamp);
|
||||
int ksilDumpNvsAct(unsigned int fileno);
|
||||
int ksilRestoreNvsAct(unsigned int fileno);
|
||||
int ksilIoMount(int id, int permission);
|
||||
int ksilIoUmount(int id, int force);
|
|
@ -1,3 +0,0 @@
|
|||
int ksilRtcSetCurrentTick(unsigned int timestamp1, unsigned int timestamp2);
|
||||
int ksilRtcSetCurrentNetworkTick(unsigned int timestamp1, unsigned int timestamp2);
|
||||
int ksilRtcSetCurrentSecureTick(unsigned int timestamp1, unsigned int timestamp2);
|
|
@ -5,24 +5,46 @@
|
|||
#include <psp2/kernel/modulemgr.h>
|
||||
#include <taihen.h>
|
||||
#include <vitasdk.h>
|
||||
#include "rtcUserBridge.h"
|
||||
#include "rtcKernelBridge.h"
|
||||
|
||||
int silRtcSetCurrentTick(timestamp1,timestamp2)
|
||||
int silRtcSetCurrentTick(unsigned int timestamp1, unsigned int timestamp2)
|
||||
{
|
||||
return ksilRtcSetCurrentTick(timestamp1,timestamp2);
|
||||
}
|
||||
|
||||
int silRtcSetCurrentNetworkTick(timestamp1,timestamp2)
|
||||
int silRtcSetCurrentNetworkTick(unsigned int timestamp1, unsigned int timestamp2)
|
||||
{
|
||||
return ksilRtcSetCurrentNetworkTick(timestamp1,timestamp2);
|
||||
}
|
||||
|
||||
int silRtcSetCurrentSecureTick(timestamp1,timestamp2)
|
||||
int silRtcSetCurrentSecureTick(unsigned int timestamp1, unsigned int timestamp2)
|
||||
{
|
||||
return ksilRtcSetCurrentSecureTick(timestamp1,timestamp2);
|
||||
}
|
||||
|
||||
int silSblPostSsMgrSetCpRtc(unsigned int timestamp)
|
||||
{
|
||||
return ksilSblPostSsMgrSetCpRtc(timestamp);
|
||||
}
|
||||
|
||||
int silDumpNvsAct(unsigned int fileno)
|
||||
{
|
||||
return ksilDumpNvsAct(fileno);
|
||||
}
|
||||
int silRestoreNvsAct(unsigned int fileno)
|
||||
{
|
||||
return ksilRestoreNvsAct(fileno);
|
||||
}
|
||||
int silIoMount(int id, int permission)
|
||||
{
|
||||
return ksilIoMount(id, permission);
|
||||
}
|
||||
int silIoUmount(int id, int force)
|
||||
{
|
||||
return ksilIoUmount(id, force);
|
||||
}
|
||||
|
||||
void _start() __attribute__ ((weak, alias ("module_start")));
|
||||
int module_start(SceSize argc, const void *args) {
|
||||
return SCE_KERNEL_START_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue