Add 3.68/3.69 support.

This commit is contained in:
AtelierWindows\SilicaAndPina 2018-11-29 19:56:20 +13:00
parent 2138a835d2
commit c375df30ab
5 changed files with 144 additions and 27 deletions

View File

@ -6,6 +6,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <inttypes.h> #include <inttypes.h>
typedef struct PsvDebugScreenFont { typedef struct PsvDebugScreenFont {
unsigned char* glyphs, width, height, first, last, size_w, size_h; unsigned char* glyphs, width, height, first, last, size_w, size_h;
} PsvDebugScreenFont; } PsvDebugScreenFont;

View File

@ -179,8 +179,8 @@ int getFileSize(const char *file) {
int knomn_pfs_ids[] = { int knomn_pfs_ids[] = {
0x3E8,
0x12F, 0x12F,
0x3E8,
}; };
int pfsMount(const char *path) { int pfsMount(const char *path) {
@ -195,7 +195,7 @@ int pfsMount(const char *path) {
args.desired_mount_point = NULL; args.desired_mount_point = NULL;
args.klicensee = klicensee; args.klicensee = klicensee;
args.mount_point = g_currentMount; args.mount_point = g_currentMount;
for(int i=0;i<sizeof(knomn_pfs_ids) / sizeof(int); i++){ for(int i=0;i<sizeof(knomn_pfs_ids) / sizeof(int); i++){
args.id = knomn_pfs_ids[i]; args.id = knomn_pfs_ids[i];
@ -269,8 +269,8 @@ start:
memcpy(&titledest, strstr(sfm,"<title-name>") + sizeof("<title-name>") - 1, len); memcpy(&titledest, strstr(sfm,"<title-name>") + sizeof("<title-name>") - 1, len);
titledest[len] = 0; titledest[len] = 0;
char name[1024]; char name[1028];
sprintf(name,"%s (%s)\n",titledest,dir.d_name); sprintf(name,"%.45s (%s)\n",titledest,dir.d_name);
strcpy(title_list[a].path, name); strcpy(title_list[a].path, name);
a += 1; a += 1;
@ -286,7 +286,7 @@ start:
do do
{ {
char buf[256]; char buf[256];
strncpy(buf, "**** TropHax SE ****", sizeof(buf)); strncpy(buf, "**** TropHax StandAlone Edition ****", sizeof(buf));
printf("\e[%i;%iH%s", 1, CENTERX(buf), buf); printf("\e[%i;%iH%s", 1, CENTERX(buf), buf);
strncpy(buf, "Choose a game", sizeof(buf)); strncpy(buf, "Choose a game", sizeof(buf));
printf("\e[%i;%iH%s", 2, CENTERX(buf), buf); printf("\e[%i;%iH%s", 2, CENTERX(buf), buf);
@ -331,8 +331,8 @@ start:
{ {
psvDebugScreenInit(); psvDebugScreenInit();
printf("\n"); printf("\n");
printf("Preforming TrophyPatcher Operations Please wait ..."); printf("Preforming TrophyPatcher Operations Please wait ...\n");
int ret = sceAppMgrUmount("app0:"); int ret = sceAppMgrUmount("app0:");
if(ret < 0){ if(ret < 0){
printf("sceAppMgrUmount() failed. ret = 0x%x\n", ret); printf("sceAppMgrUmount() failed. ret = 0x%x\n", ret);
@ -345,12 +345,21 @@ start:
sprintf(kplugin_path, "ux0:app/%s/module/kernel.skprx", titleid); sprintf(kplugin_path, "ux0:app/%s/module/kernel.skprx", titleid);
sprintf(uplugin_path, "ux0:app/%s/module/user.suprx", titleid); sprintf(uplugin_path, "ux0:app/%s/module/user.suprx", titleid);
printf("kplugin_path: %s\n",kplugin_path);
printf("uplugin_path: %s\n",uplugin_path);
int kernel_modid, user_modid; int kernel_modid, user_modid;
kernel_modid = taiLoadStartKernelModule(kplugin_path, 0, NULL, 0); kernel_modid = taiLoadStartKernelModule(kplugin_path, 0, NULL, 0);
if(kernel_modid < 0){
printf("taiLoadStartKernelModule() failed. ret = 0x%x\n", kernel_modid);
}
user_modid = sceKernelLoadStartModule(uplugin_path, 0, NULL, 0, NULL, NULL); user_modid = sceKernelLoadStartModule(uplugin_path, 0, NULL, 0, NULL, NULL);
if(user_modid < 0){
printf("sceKernelLoadStartModule() failed. ret = 0x%x\n", user_modid);
}
printf("Setting up memory...");
char trophy_path[0x200]; char trophy_path[0x200];
@ -382,14 +391,15 @@ start:
len +=2; len +=2;
memcpy(&commid, strstr(name,"(") + sizeof("(") - 1, len); memcpy(&commid, strstr(name,"(") + sizeof("(") - 1, len);
commid[len] = 0; commid[len] = 0;
printf(" OK\n");
sprintf(trophy_path, "ur0:user/00/trophy/data/%s/", commid); sprintf(trophy_path, "ur0:user/00/trophy/data/%s/", commid);
ret = pfsMount(trophy_path); ret = pfsMount(trophy_path);
if(ret < 0){ if(ret < 0){
printf("pfsMount() failed. ret = 0x%x\n", ret); printf("pfsMount() failed. ret = 0x%x\n", ret);
while(1){}; while(1){};
} }
sprintf(trptitlepath,"%s/TRPTITLE.DAT",g_currentMount); sprintf(trptitlepath,"%s/TRPTITLE.DAT",g_currentMount);
fd = sceIoOpen(trptitlepath,SCE_O_RDONLY, 0777); fd = sceIoOpen(trptitlepath,SCE_O_RDONLY, 0777);
@ -410,24 +420,93 @@ start:
while(1){}; while(1){};
} }
if (strcmp(titleidOfGame,"NPXS10007") == 0)
{ //Try find where trophy.trp is located.
ret = sceAppMgrGameDataMount("pd0:/app/NPXS10007",0,0,g_currentMount); printf("Locating trophy.trp...\n");
if(ret < 0){
printf("sceAppMgrGameDataMount() failed. ret = 0x%x\n", ret); char location[0x1028];
while(1){}; memset(location,0x0,0x1028);
} char checkPath[0x1028];
}
else memset(checkPath,0x00,0x1028);
{ sprintf(checkPath,"ux0:/patch/%s/sce_sys/trophy/%s/TROPHY.TRP",titleidOfGame,commid);
sprintf(path,"ux0:/app/%s",titleidOfGame);
if(getFileSize(checkPath) >=0)
{
sprintf(location,"ux0:/patch");
goto Found;
}
memset(checkPath,0x00,0x1028);
sprintf(checkPath,"grw0:/patch/%s/sce_sys/trophy/%s/TROPHY.TRP",titleidOfGame,commid);
if(getFileSize(checkPath) >=0)
{
sprintf(location,"grw0:/patch");
goto Found;
}
memset(checkPath,0x00,0x1028);
sprintf(checkPath,"ur0:/patch/%s/sce_sys/trophy/%s/TROPHY.TRP",titleidOfGame,commid);
if(getFileSize(checkPath) >=0)
{
sprintf(location,"ur0:/patch");
goto Found;
}
memset(checkPath,0x00,0x1028);
sprintf(checkPath,"ux0:/app/%s/sce_sys/trophy/%s/TROPHY.TRP",titleidOfGame,commid);
if(getFileSize(checkPath) >=0)
{
sprintf(location,"ux0:/app");
goto Found;
}
memset(checkPath,0x00,0x1028);
sprintf(checkPath,"gro0:/app/%s/sce_sys/trophy/%s/TROPHY.TRP",titleidOfGame,commid);
if(getFileSize(checkPath) >=0)
{
sprintf(location,"gro0:/app");
goto Found;
}
memset(checkPath,0x00,0x1028);
sprintf(checkPath,"ur0:/app/%s/sce_sys/trophy/%s/TROPHY.TRP",titleidOfGame,commid);
if(getFileSize(checkPath) >=0)
{
sprintf(location,"ur0:/app");
goto Found;
}
memset(checkPath,0x00,0x1028);
sprintf(checkPath,"pd0:/app/%s/sce_sys/trophy/%s/TROPHY.TRP",titleidOfGame,commid);
if(getFileSize(checkPath) >=0)
{
sprintf(location,"pd0:/app"); //Welcome Park
goto Found;
}
printf("Cound not find %s\n",titleidOfGame);
while(1){};
Found:
printf("Found! - %s is in %s/%s\n",commid,location,titleidOfGame);
sprintf(path,"%s/%s",location,titleidOfGame);
ret = sceAppMgrGameDataMount(path,0,0,g_currentMount); ret = sceAppMgrGameDataMount(path,0,0,g_currentMount);
if(ret < 0){ if(ret < 0){
printf("sceAppMgrGameDataMount() failed. ret = 0x%x\n", ret); printf("sceAppMgrGameDataMount() failed. ret = 0x%x\n", ret);
while(1){}; while(1){};
} }
}
@ -457,11 +536,10 @@ start:
sprintf(path,"ux0:app/%s/sce_sys/trophy/%s",titleid,commid); sprintf(path,"ux0:app/%s/sce_sys/trophy/%s",titleid,commid);
sceIoMkdir(path,0006); sceIoMkdir(path,0006);
sprintf(path,"ux0:app/%s/sce_sys/trophy/%s/TROPHY.TRP",titleid,commid); sprintf(path,"ux0:app/%s/sce_sys/trophy/%s/TROPHY.TRP",titleid,commid);
ret = WriteFile(path,trpfile,size); ret = WriteFile(path,trpfile,size);
if(ret < 0){ if(ret < 0){
printf("WriteFile() failed. ret = 0x%x\n", ret); printf("WriteFile() failed. ret = 0x%x\n", ret);
while(1){};
} }
} }
else else
@ -493,7 +571,6 @@ start:
} }
printf("OK!\n");
//Setup trophys //Setup trophys
printf("Setting up Trophys! Please wait ..."); printf("Setting up Trophys! Please wait ...");
@ -585,6 +662,13 @@ start:
printf("OK!\n"); printf("OK!\n");
printf("All prep done!\n");
sceKernelDelayThread(1000);
psvDebugScreenInit();
//All done!
SceNpTrophyId id = 0; SceNpTrophyId id = 0;
SceNpTrophyId platid; SceNpTrophyId platid;

13
kernel/exports.yml Normal file
View File

@ -0,0 +1,13 @@
SceAppMgrKernel2:
attributes: 0
version:
major: 1
minor: 0
main:
start: module_start
stop: module_stop
modules:
SceAppMgrKernel2Library:
syscall: true
functions:
- sceAppMgrKernelMountById

View File

@ -126,9 +126,15 @@ int module_start(SceSize args, void *argp) {
break; break;
case 0x54E2E984: // 3.67 retail case 0x54E2E984: // 3.67 retail
case 0xC3C538DE: // 3.68 retail
module_get_offset(KERNEL_PID, tai_info.modid, 0, 0x2DE1, (uintptr_t *)&sceAppMgrFindProcessInfoByPid); module_get_offset(KERNEL_PID, tai_info.modid, 0, 0x2DE1, (uintptr_t *)&sceAppMgrFindProcessInfoByPid);
module_get_offset(KERNEL_PID, tai_info.modid, 0, 0x19E6D, (uintptr_t *)&sceAppMgrMountById); module_get_offset(KERNEL_PID, tai_info.modid, 0, 0x19E6D, (uintptr_t *)&sceAppMgrMountById);
break; break;
case 0x321E4852: // 3.69 retail
module_get_offset(KERNEL_PID, tai_info.modid, 0, 0x2DE9, (uintptr_t *)&sceAppMgrFindProcessInfoByPid);
module_get_offset(KERNEL_PID, tai_info.modid, 0, 0x19E95, (uintptr_t *)&sceAppMgrMountById);
break;
} }

13
user/exports.yml Normal file
View File

@ -0,0 +1,13 @@
SceAppMgrUser:
attributes: 0
version:
major: 1
minor: 0
main:
start: module_start
stop: module_stop
modules:
SceAppMgrUserLibrary:
syscall: false
functions:
- sceAppMgrUserMountById