This commit is contained in:
AtelierWindows\SilicaAndPina 2018-12-05 22:13:07 +13:00
parent 824ff31c39
commit 0ea9193199
9 changed files with 85 additions and 34 deletions

View File

@ -228,8 +228,18 @@ void sceNpTrophySetupDialogParamInit(SceNpTrophySetupDialogParam* param)
int setSecureTick(unsigned long long int psTime) int setSecureTick(unsigned long long int psTime)
{ {
printf("setSecureTick: %llx\n",psTime);
SceRtcTick utcTime = {0};
SceRtcTick localTime = {0};
utcTime.tick = psTime;
sceRtcConvertUtcToLocalTime(&utcTime,&localTime);
psTime = localTime.tick;
printf("setSecureTick: %llx\n",psTime);
printf("Creating splits..\n"); printf("Creating splits..\n");
char hexint[15]; char hexint[15];
memset(hexint,0,15); memset(hexint,0,15);
@ -323,7 +333,7 @@ start:
printf("\e[%i;%iH%s", SCREEN_ROW, CENTERX(buf), buf); printf("\e[%i;%iH%s", SCREEN_ROW, CENTERX(buf), buf);
memset(&pad, 0, sizeof(pad)); memset(&pad, 0, sizeof(pad));
sceCtrlPeekBufferPositive(0, &pad, 1); sceCtrlPeekBufferPositive(0, &pad, 1);
if (pad.buttons == SCE_CTRL_UP) if (pad.buttons == SCE_CTRL_UP)
{ {
if (selection <= size - WINDOW_HEIGHT){ if (selection <= size - WINDOW_HEIGHT){
@ -673,7 +683,7 @@ TrophyMenu:
//set options //set options
strcpy(option_list[0].path, "Unlock a Trophy"); strcpy(option_list[0].path, "Unlock a Trophy");
strcpy(option_list[1].path, "Unlock All Trophys"); strcpy(option_list[1].path, "Unlock All Trophys");
strcpy(option_list[2].path, "Exit"); strcpy(option_list[3].path, "Exit");
while(1) while(1)
{ {
@ -1131,10 +1141,6 @@ selectTrophyMenu:
{ {
dateTime.year ++; dateTime.year ++;
} }
if(dateTime.year < 2015)
{
dateTime.year = 2015;
}
} }
if(selectedPartOfTime == 3) if(selectedPartOfTime == 3)
{ {
@ -1177,12 +1183,8 @@ selectTrophyMenu:
printf("Unlocking trophy %i\n",selection); printf("Unlocking trophy %i\n",selection);
SceNpTrophyId id = selection; SceNpTrophyId id = selection;
SceNpTrophyId platid; SceNpTrophyId platid;
FakeTimes(1);
ret = setSecureTick(fakeTime.tick); ret = setSecureTick(fakeTime.tick);
if(ret < 0){
printf("setSecureTick() failed. ret = 0x%x\n", ret);
sceKernelDelayThread(500000);
goto selectTrophyMenu;
}
ret = sceNpTrophyUnlockTrophy(trophyContext,handle,id,&platid); ret = sceNpTrophyUnlockTrophy(trophyContext,handle,id,&platid);
if(ret < 0){ if(ret < 0){
if(ret == 0x8055160f) if(ret == 0x8055160f)
@ -1206,13 +1208,7 @@ selectTrophyMenu:
} }
sceRtcGetCurrentTick(&fakeTime); FakeTimes(0);
ret = setSecureTick(fakeTime.tick);
if(ret < 0){
printf("setSecureTick() failed. ret = 0x%x\n", ret);
sceKernelDelayThread(500000);
goto selectTrophyMenu;
}
sceKernelDelayThread(500000); sceKernelDelayThread(500000);
goto selectTrophyMenu; goto selectTrophyMenu;
@ -1239,6 +1235,7 @@ selectTrophyMenu:
else if(selection == 1) else if(selection == 1)
{ {
psvDebugScreenClear(); //clear screen psvDebugScreenClear(); //clear screen
SceNpTrophyId id = 0; SceNpTrophyId id = 0;
SceNpTrophyId platid; SceNpTrophyId platid;

View File

@ -5,6 +5,16 @@ typedef struct SceNpOptParam {
SceSize optParamSize; SceSize optParamSize;
} SceNpOptParam; } SceNpOptParam;
//SceNpCommunicationId
/*typedef struct SceNpCommunicationId {
char data[9];
char term;
SceUChar8 num;
char dummy;
} SceNpCommunicationId;
allready in vitasdk?*/
//SceNpCommunicationPassphrase //SceNpCommunicationPassphrase
typedef struct SceNpCommunicationPassphrase { typedef struct SceNpCommunicationPassphrase {
SceUChar8 data[128]; SceUChar8 data[128];

View File

@ -1,3 +1,4 @@
//Defines functions relating to changing timestamps //Defines functions relating to changing timestamps
int SetTrophyTimes(unsigned int timestamp1,unsigned int timestamp2); int SetTrophyTimes(unsigned int timestamp1,unsigned int timestamp2);
int FakeTimes(int value);

View File

@ -26,6 +26,7 @@ target_link_libraries(${PROJECT_NAME}
SceThreadmgrForDriver_stub SceThreadmgrForDriver_stub
SceProcessmgrForDriver_stub SceProcessmgrForDriver_stub
SceRtcForDriver_stub SceRtcForDriver_stub
SceDebugForDriver_stub
#SceNpDrmForDriver_stub #SceNpDrmForDriver_stub
taihenForKernel_stub taihenForKernel_stub
taihenModuleUtils_stub taihenModuleUtils_stub

View File

@ -11,4 +11,5 @@ SceAppMgrKernel2:
syscall: true syscall: true
functions: functions:
- sceAppMgrKernelMountById - sceAppMgrKernelMountById
- kSetTrophyTimes - kSetTrophyTimes
- kFakeTimes

View File

@ -17,11 +17,7 @@
*/ */
#include <psp2kern/kernel/cpu.h> #include <vitasdkkern.h>
#include <psp2kern/kernel/modulemgr.h>
#include <psp2kern/kernel/sysmem.h>
#include <psp2kern/kernel/threadmgr.h>
#include <psp2kern/io/fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -30,6 +26,8 @@
#include "appmgr_kernel.h" #include "appmgr_kernel.h"
#define printf ksceDebugPrintf
int module_get_export_func(SceUID pid, const char *modname, uint32_t libnid, uint32_t funcnid, uintptr_t *func); int module_get_export_func(SceUID pid, const char *modname, uint32_t libnid, uint32_t funcnid, uintptr_t *func);
int module_get_offset(SceUID pid, SceUID modid, int segidx, size_t offset, uintptr_t *addr); int module_get_offset(SceUID pid, SceUID modid, int segidx, size_t offset, uintptr_t *addr);
@ -38,21 +36,48 @@ int (* sceAppMgrMountById)(SceUID pid, void *info, int id, const char *titleid,
int (* _ksceKernelGetModuleInfo)(SceUID pid, SceUID modid, SceKernelModuleInfo *info); int (* _ksceKernelGetModuleInfo)(SceUID pid, SceUID modid, SceKernelModuleInfo *info);
int ksceRtcSetCurrentSecureTick(unsigned int* timestamp); int ksceRtcSetCurrentSecureTick(unsigned int* timestamp);
int ksceRtcGetCurrentSecureTick(unsigned int* timestamp);
static int hook = -1;
static tai_hook_ref_t ref_hook;
tai_module_info_t tai_info; tai_module_info_t tai_info;
int fakeTime[2];
int spoofTime = 0;
int getTimePatched(unsigned int* timestamp)
{
int ret;
ret = TAI_CONTINUE(int, ref_hook,timestamp);
if(spoofTime)
{
printf("[TROPHAXSE] Faking timestamp to %x%x",fakeTime[1],fakeTime[0]);
timestamp[0] = fakeTime[0];
timestamp[1] = fakeTime[1];
}
return ret;
}
int kFakeTimes(int value)
{
spoofTime = value;
return 0;
}
int kSetTrophyTimes(unsigned int timestamp1, unsigned int timestamp2) int kSetTrophyTimes(unsigned int timestamp1, unsigned int timestamp2)
{ {
unsigned int timestamp[2];
timestamp[0] = timestamp1; fakeTime[0] = timestamp1;
timestamp[1] = timestamp2; fakeTime[1] = timestamp2;
return ksceRtcSetCurrentSecureTick(timestamp); return 0;
} }
int _sceAppMgrKernelMountById(SceAppMgrMountIdArgs *args) { int _sceAppMgrKernelMountById(SceAppMgrMountIdArgs *args) {
int res; int res;
@ -119,8 +144,14 @@ int sceAppMgrKernelMountById(SceAppMgrMountIdArgs *args) {
void _start() __attribute__ ((weak, alias("module_start"))); void _start() __attribute__ ((weak, alias("module_start")));
int module_start(SceSize args, void *argp) { int module_start(SceSize args, void *argp) {
printf("TrophaxSE Kernel Module loaded!\n");
hook = taiHookFunctionExportForKernel(KERNEL_PID,
&ref_hook,
"SceRtc",
0x0351D827, // SceRtcForDriver
0x401C0954, // ksceRtcGetCurrentSecureTick
getTimePatched);
printf("[TROPHAXSE] hook: %x\n",hook);
// Get tai module info // Get tai module info
@ -150,12 +181,15 @@ int module_start(SceSize args, void *argp) {
module_get_offset(KERNEL_PID, tai_info.modid, 0, 0x19E95, (uintptr_t *)&sceAppMgrMountById); module_get_offset(KERNEL_PID, tai_info.modid, 0, 0x19E95, (uintptr_t *)&sceAppMgrMountById);
break; break;
} }
return SCE_KERNEL_START_SUCCESS; return SCE_KERNEL_START_SUCCESS;
} }
int module_stop(SceSize args, void *argp) { int module_stop(SceSize args, void *argp) {
if (hook >= 0) taiHookReleaseForKernel(hook, ref_hook);
return SCE_KERNEL_STOP_SUCCESS; return SCE_KERNEL_STOP_SUCCESS;
} }

View File

@ -11,4 +11,5 @@ SceAppMgrUser:
syscall: false syscall: false
functions: functions:
- sceAppMgrUserMountById - sceAppMgrUserMountById
- SetTrophyTimes - SetTrophyTimes
- FakeTimes

View File

@ -1,4 +1,5 @@
#include <appmgr_kernel.h> #include <appmgr_kernel.h>
int sceAppMgrUserMountById(SceAppMgrMountIdArgs *args); int sceAppMgrUserMountById(SceAppMgrMountIdArgs *args);
int kSetTrophyTimes(unsigned int timestamp1, unsigned int timestamp2); int kSetTrophyTimes(unsigned int timestamp1, unsigned int timestamp2);
int kFakeTimes(int value);

View File

@ -27,6 +27,11 @@ int SetTrophyTimes(unsigned int timestamp1,unsigned int timestamp2)
return kSetTrophyTimes(timestamp1,timestamp2); return kSetTrophyTimes(timestamp1,timestamp2);
} }
int FakeTimes(int value)
{
return kFakeTimes(value);
}
int sceAppMgrUserMountById(SceAppMgrMountIdArgs *args) { int sceAppMgrUserMountById(SceAppMgrMountIdArgs *args) {
return sceAppMgrKernelMountById(args); return sceAppMgrKernelMountById(args);
} }