Update code
This commit is contained in:
parent
080b5eb6e4
commit
7b0b83c1cc
|
@ -16,6 +16,7 @@ add_executable(${PROJECT_NAME}.elf
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}.elf
|
target_link_libraries(${PROJECT_NAME}.elf
|
||||||
|
user_clockset_stub_weak
|
||||||
SceDisplay_stub
|
SceDisplay_stub
|
||||||
SceCtrl_stub
|
SceCtrl_stub
|
||||||
SceVshBridge_stub
|
SceVshBridge_stub
|
||||||
|
@ -24,7 +25,6 @@ target_link_libraries(${PROJECT_NAME}.elf
|
||||||
ScePower_stub
|
ScePower_stub
|
||||||
SceRegistryMgr_stub
|
SceRegistryMgr_stub
|
||||||
taihen_stub
|
taihen_stub
|
||||||
user_clockset_stub_weak
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(${PROJECT_NAME}.vpk ALL
|
add_custom_target(${PROJECT_NAME}.vpk ALL
|
||||||
|
|
62
app/main.c
62
app/main.c
|
@ -12,8 +12,10 @@
|
||||||
|
|
||||||
#define printf psvDebugScreenPrintf
|
#define printf psvDebugScreenPrintf
|
||||||
|
|
||||||
int ret;
|
|
||||||
SceUID fd;
|
int ret = 0x00;
|
||||||
|
SceUID fd = 0x00;
|
||||||
|
int backup_pd0 = 0x00;
|
||||||
|
|
||||||
int get_key(void) {
|
int get_key(void) {
|
||||||
static unsigned buttons[] = {
|
static unsigned buttons[] = {
|
||||||
|
@ -155,46 +157,53 @@ int restore_act()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int backup_act()
|
int backup_act()
|
||||||
{
|
{
|
||||||
printf("Backing up activation files...\n");
|
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);
|
|
||||||
|
|
||||||
|
if(backup_pd0){
|
||||||
|
silIoUmount(0xC00, 0);
|
||||||
|
silIoMount(0xC00, 2);
|
||||||
|
}
|
||||||
sceIoMkdir("ux0:/data", 0777);
|
sceIoMkdir("ux0:/data", 0777);
|
||||||
sceIoMkdir("pd0:/data", 0777);
|
if(backup_pd0)
|
||||||
|
sceIoMkdir("pd0:/data", 0777);
|
||||||
|
|
||||||
//backup actdat
|
//backup actdat
|
||||||
CopyFile("tm0:/activate/act.dat","ux0:/data/act.dat");
|
CopyFile("tm0:/activate/act.dat","ux0:/data/act.dat");
|
||||||
CopyFile("tm0:/activate/act.dat","pd0:/data/act.dat");
|
if(backup_pd0)
|
||||||
|
CopyFile("tm0:/activate/act.dat","pd0:/data/act.dat");
|
||||||
|
|
||||||
//backup actsig
|
//backup actsig
|
||||||
CopyFile("tm0:/activate/actsig.dat","ux0:/data/actsig.dat");
|
CopyFile("tm0:/activate/actsig.dat","ux0:/data/actsig.dat");
|
||||||
CopyFile("tm0:/activate/actsig.dat","pd0:/data/actsig.dat");
|
if(backup_pd0)
|
||||||
|
CopyFile("tm0:/activate/actsig.dat","pd0:/data/actsig.dat");
|
||||||
|
|
||||||
|
if(backup_pd0)
|
||||||
ret = silDumpNvsAct(0x0);
|
{
|
||||||
if (ret <= -1){
|
ret = silDumpNvsAct(0x0);
|
||||||
printf("ksceSblNvsReadData failed 0x%x\n",ret);
|
if (ret <= -1){
|
||||||
|
printf("ksceSblNvsReadData failed 0x%x\n",ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ret = silDumpNvsAct(0x1);
|
ret = silDumpNvsAct(0x1);
|
||||||
if (ret <= -1){
|
if (ret <= -1){
|
||||||
printf("ksceSblNvsReadData failed 0x%x\n",ret);
|
printf("ksceSblNvsReadData failed 0x%x\n",ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(backup_pd0)
|
||||||
vshIoUmount(0xC00, 0, 0, 0);
|
{
|
||||||
vshIoUmount(0xC00, 1, 0, 0);
|
silIoUmount(0xC00, 0);
|
||||||
_vshIoMount(0xC00, 0, 1, buf);
|
silIoMount(0xC00, 1);
|
||||||
|
}
|
||||||
printf("Done, backup at pd0:/data and ux0:/data\nPLEASE KEEP THESE FILES SAFE!!!\n\n");
|
printf("Done, backup at ");
|
||||||
|
if(backup_pd0)
|
||||||
|
printf("pd0:/data and ");
|
||||||
|
printf("ux0:/data\nPLEASE KEEP THESE FILES SAFE!!!\n\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,6 +291,13 @@ void main() {
|
||||||
sceIoClose(fd);
|
sceIoClose(fd);
|
||||||
|
|
||||||
printf(" found: %x\n",startDate);
|
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();
|
backup_act();
|
||||||
|
|
||||||
|
@ -308,7 +324,7 @@ void main() {
|
||||||
printf("\nPress any key to continue\n");
|
printf("\nPress any key to continue\n");
|
||||||
|
|
||||||
get_key();
|
get_key();
|
||||||
timestamp = 0xFFEEDDCCBBAA9988ull;
|
timestamp += 0xAFEE8AFE9EEEF1FFull; // a really big number.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,3 +4,5 @@ int silRtcSetCurrentSecureTick(unsigned int timestamp1, unsigned int timestamp2)
|
||||||
int silSblPostSsMgrSetCpRtc(unsigned int timestamp);
|
int silSblPostSsMgrSetCpRtc(unsigned int timestamp);
|
||||||
int silDumpNvsAct(unsigned int fileno);
|
int silDumpNvsAct(unsigned int fileno);
|
||||||
int silRestoreNvsAct(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 |
|
@ -35,6 +35,7 @@ target_link_libraries(${PROJECT_NAME}
|
||||||
SceCpuForDriver_stub
|
SceCpuForDriver_stub
|
||||||
SceSblSsMgrForKernel_stub
|
SceSblSsMgrForKernel_stub
|
||||||
taihenForKernel_stub
|
taihenForKernel_stub
|
||||||
|
taihenModuleUtils_stub
|
||||||
gcc
|
gcc
|
||||||
-nostdlib
|
-nostdlib
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,3 +16,5 @@ kern_clockset:
|
||||||
- ksilSblPostSsMgrSetCpRtc
|
- ksilSblPostSsMgrSetCpRtc
|
||||||
- ksilDumpNvsAct
|
- ksilDumpNvsAct
|
||||||
- ksilRestoreNvsAct
|
- ksilRestoreNvsAct
|
||||||
|
- ksilIoUmount
|
||||||
|
- ksilIoMount
|
|
@ -13,6 +13,10 @@
|
||||||
#include <taihen.h>
|
#include <taihen.h>
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
|
|
||||||
|
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) {
|
int WriteFile(char *file, void *buf, int size) {
|
||||||
SceUID fd = ksceIoOpen(file, SCE_O_RDWR | SCE_O_CREAT, 0777);
|
SceUID fd = ksceIoOpen(file, SCE_O_RDWR | SCE_O_CREAT, 0777);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
|
@ -128,6 +132,37 @@ int ksilRestoreNvsAct(int fileno)
|
||||||
return ret;
|
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")));
|
void _start() __attribute__ ((weak, alias ("module_start")));
|
||||||
int module_start(SceSize argc, const void *args)
|
int module_start(SceSize argc, const void *args)
|
||||||
|
@ -148,6 +183,7 @@ int module_start(SceSize argc, const void *args)
|
||||||
uint32_t patched_instruction = 0xBF00BF00; //NOP
|
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, 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)
|
taiInjectDataForKernel(KERNEL_PID, info.modid, 0, 0xA94, &patched_instruction, 0x4); //bcs.w LAB_81000bbc -> NOP (SetCurrentNetworkTick)
|
||||||
|
get_functions();
|
||||||
|
|
||||||
return SCE_KERNEL_START_SUCCESS;
|
return SCE_KERNEL_START_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,3 +4,5 @@ int ksilRtcSetCurrentSecureTick(unsigned int timestamp1, unsigned int timestamp2
|
||||||
int ksilSblPostSsMgrSetCpRtc(unsigned int timestamp);
|
int ksilSblPostSsMgrSetCpRtc(unsigned int timestamp);
|
||||||
int ksilDumpNvsAct(unsigned int fileno);
|
int ksilDumpNvsAct(unsigned int fileno);
|
||||||
int ksilRestoreNvsAct(unsigned int fileno);
|
int ksilRestoreNvsAct(unsigned int fileno);
|
||||||
|
int ksilIoMount(int id, int permission);
|
||||||
|
int ksilIoUmount(int id, int force);
|
|
@ -16,3 +16,5 @@ user_clockset:
|
||||||
- silSblPostSsMgrSetCpRtc
|
- silSblPostSsMgrSetCpRtc
|
||||||
- silDumpNvsAct
|
- silDumpNvsAct
|
||||||
- silRestoreNvsAct
|
- silRestoreNvsAct
|
||||||
|
- silIoUmount
|
||||||
|
- silIoMount
|
|
@ -4,3 +4,5 @@ int ksilRtcSetCurrentSecureTick(unsigned int timestamp1, unsigned int timestamp2
|
||||||
int ksilSblPostSsMgrSetCpRtc(unsigned int timestamp);
|
int ksilSblPostSsMgrSetCpRtc(unsigned int timestamp);
|
||||||
int ksilDumpNvsAct(unsigned int fileno);
|
int ksilDumpNvsAct(unsigned int fileno);
|
||||||
int ksilRestoreNvsAct(unsigned int fileno);
|
int ksilRestoreNvsAct(unsigned int fileno);
|
||||||
|
int ksilIoMount(int id, int permission);
|
||||||
|
int ksilIoUmount(int id, int force);
|
|
@ -35,6 +35,15 @@ int silRestoreNvsAct(unsigned int fileno)
|
||||||
{
|
{
|
||||||
return ksilRestoreNvsAct(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")));
|
void _start() __attribute__ ((weak, alias ("module_start")));
|
||||||
int module_start(SceSize argc, const void *args) {
|
int module_start(SceSize argc, const void *args) {
|
||||||
return SCE_KERNEL_START_SUCCESS;
|
return SCE_KERNEL_START_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue