Add Devkit Support

This commit is contained in:
AtelierWindows 2019-08-10 22:42:14 +12:00
parent 777a9129cc
commit 0506f90f53
10 changed files with 87 additions and 46 deletions

View File

@ -83,9 +83,11 @@ int getFileSize(const char *file) {
void main() {
psvDebugScreenInit();
if(vshSblAimgrIsDEX() == 0)
if(vshSblAimgrIsCEX())
{
printf("This is not a testing kit . . . \n");
printf("This is not a test/dev kit . . . \n");
get_key();
sceKernelExitProcess(0);
}
@ -229,46 +231,58 @@ void main() {
printf("Done, backup at pd0:/data and ux0:/data\n");
printf("Calculating PSTime: ");
unsigned long long int timestamp;
memset(&timestamp,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(vshSblAimgrIsTool())
{
unsigned int timestamp = *((unsigned int*)&startDate);
printf("Updating CPRTC to %x\n",timestamp);
ret = silSblPostSsMgrSetCpRtc(timestamp);
sceRegMgrSetKeyInt("/CONFIG/DATE", "set_automatically", 0);
printf("has ret 0x%x\n",ret);
}
else if(vshSblAimgrIsDEX())
{
printf("Calculating PSTime: ");
unsigned long long int timestamp;
memset(&timestamp,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\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 reboot console");
printf("Press any key to turn off console");
get_key();
scePowerRequestColdReset();
scePowerRequestSuspend();
}
else
{

View File

@ -1,3 +1,4 @@
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);

View File

@ -31,6 +31,7 @@ target_link_libraries(${PROJECT_NAME}
SceDebugForDriver_stub
SceSysmem_stub
SceRtcForDriver_stub
SceSblPostSsMgrForDriver_stub
SceCpuForDriver_stub
taihenForKernel_stub
gcc
@ -47,5 +48,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"
)

View File

@ -12,4 +12,5 @@ kern_clockset:
functions:
- ksilRtcSetCurrentSecureTick
- ksilRtcSetCurrentNetworkTick
- ksilRtcSetCurrentTick
- ksilRtcSetCurrentTick
- ksilSblPostSsMgrSetCpRtc

View File

@ -6,15 +6,14 @@
*
*/
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <vitasdk.h>
#include <taihen.h>
#include "rtc.h"
int ksilRtcSetCurrentTick(timestamp1,timestamp2)
int ksilRtcSetCurrentTick(unsigned int timestamp1,unsigned int timestamp2)
{
unsigned int timestamp[2];
@ -24,7 +23,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 +33,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,6 +43,11 @@ int ksilRtcSetCurrentSecureTick(timestamp1,timestamp2)
return ksceRtcSetCurrentSecureTick(timestamp);
}
int ksilSblPostSsMgrSetCpRtc(unsigned int timestamp)
{
return ksceSblPostSsMgrSetCpRtc(timestamp);
}
void _start() __attribute__ ((weak, alias ("module_start")));

5
kern/rtc.h Normal file
View File

@ -0,0 +1,5 @@
int ksceRtcSetCurrentTick(unsigned int* timestamp);
int ksceRtcSetCurrentNetworkTick(unsigned int* timestamp);
int ksceRtcSetCurrentSecureTick(unsigned int* timestamp);
int ksceSblPostSsMgrSetCpRtc(unsigned int timestamp);

4
kern/rtcKernelBridge.h Normal file
View File

@ -0,0 +1,4 @@
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);

View File

@ -13,3 +13,4 @@ user_clockset:
- silRtcSetCurrentNetworkTick
- silRtcSetCurrentTick
- silRtcSetCurrentSecureTick
- silSblPostSsMgrSetCpRtc

4
user/rtcKernelBridge.h Normal file
View File

@ -0,0 +1,4 @@
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);

View File

@ -5,23 +5,28 @@
#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 module_start(SceSize argc, const void *args) {
return SCE_KERNEL_START_SUCCESS;