Backup act data from NVS

This commit is contained in:
SilicaAndPina 2019-11-11 04:24:12 +13:00
parent d4344ae572
commit d4021ee02b
11 changed files with 59 additions and 14 deletions

View File

@ -225,11 +225,22 @@ void main() {
}
}
//backup nvs
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");
printf("Done, backup at pd0:/data and ux0:/data\n\nPLEASE KEEP THESE FILES SAFE!!!");
if(vshSblAimgrIsTool())
@ -270,10 +281,6 @@ void main() {
ret = silRtcSetCurrentSecureTick(split2,split1);
printf("has ret 0x%x\n",ret);
printf("Updating NetworkTick.. ");
ret = silRtcSetCurrentNetworkTick(0xe256fc7,0x8eba240);
printf("has ret 0x%x\n",ret);
sceRegMgrSetKeyInt("/CONFIG/DATE", "set_automatically", 0);
}

View File

@ -1,4 +1,5 @@
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 silSblPostSsMgrSetCpRtc(unsigned int timestamp);
int silSblPostSsMgrSetCpRtc(unsigned int timestamp);
int silDumpNvsAct(unsigned int filenos);

View File

@ -33,6 +33,7 @@ target_link_libraries(${PROJECT_NAME}
SceRtcForDriver_stub
SceSblPostSsMgrForDriver_stub
SceCpuForDriver_stub
SceSblSsMgrForKernel_stub
taihenForKernel_stub
gcc
-nostdlib

View File

@ -13,4 +13,5 @@ kern_clockset:
- ksilRtcSetCurrentSecureTick
- ksilRtcSetCurrentNetworkTick
- ksilRtcSetCurrentTick
- ksilSblPostSsMgrSetCpRtc
- ksilSblPostSsMgrSetCpRtc
- ksilDumpNvsAct

View File

@ -9,10 +9,21 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <vitasdk.h>
#include <vitasdkkern.h>
#include <taihen.h>
#include "rtc.h"
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 ksilRtcSetCurrentTick(unsigned int timestamp1,unsigned int timestamp2)
{
unsigned int timestamp[2];
@ -48,6 +59,22 @@ int ksilSblPostSsMgrSetCpRtc(unsigned int timestamp)
return ksceSblPostSsMgrSetCpRtc(timestamp);
}
int ksilDumpNvsAct(int fileno)
{
char nvsBuf[0x20];
memset(nvsBuf,0x00,0x520);
int ret = ksceSblNvsReadData(0x520,nvsBuf,0x20);
if(fileno == 1)
{
WriteFile("ux0:/data/act-nvs.dat",nvsBuf,0x20);
}
else
{
WriteFile("pd0:/data/act-nvs.dat",nvsBuf,0x20);
}
return ret;
}
void _start() __attribute__ ((weak, alias ("module_start")));
@ -55,6 +82,8 @@ int module_start(SceSize argc, const void *args)
{
/*
* 1/1/2015 check BTFO'd
*
* Vita checks elsewhere though :'(
*/
tai_module_info_t info;

View File

@ -2,4 +2,6 @@ int ksceRtcSetCurrentTick(unsigned int* timestamp);
int ksceRtcSetCurrentNetworkTick(unsigned int* timestamp);
int ksceRtcSetCurrentSecureTick(unsigned int* timestamp);
int ksceSblPostSsMgrSetCpRtc(unsigned int timestamp);
int ksceSblPostSsMgrSetCpRtc(unsigned int timestamp);
int ksceSblNvsReadData(int offset,void* buffer,int size);

View File

@ -1,4 +1,5 @@
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 ksilSblPostSsMgrSetCpRtc(unsigned int timestamp);
int ksilDumpNvsAct(unsigned int fileno);

View File

@ -14,3 +14,4 @@ user_clockset:
- silRtcSetCurrentTick
- silRtcSetCurrentSecureTick
- silSblPostSsMgrSetCpRtc
- silDumpNvsAct

View File

@ -1,4 +1,5 @@
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 ksilSblPostSsMgrSetCpRtc(unsigned int timestamp);
int ksilDumpNvsAct(unsigned int fileno);

View File

@ -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);

View File

@ -27,6 +27,10 @@ int silSblPostSsMgrSetCpRtc(unsigned int timestamp)
return ksilSblPostSsMgrSetCpRtc(timestamp);
}
int silDumpNvsAct(unsigned int fileno)
{
return ksilDumpNvsAct(fileno);
}
int module_start(SceSize argc, const void *args) {
return SCE_KERNEL_START_SUCCESS;