diff --git a/popsloader/Makefile b/popsloader/Makefile index 2f77878..8762725 100644 --- a/popsloader/Makefile +++ b/popsloader/Makefile @@ -42,85 +42,85 @@ all: @cp -f proheaparea/proheaparea.prx dist/modules make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_302=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/302 + @cp -f popcorn/popcorn.prx dist/modules/302/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_303=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/303 + @cp -f popcorn/popcorn.prx dist/modules/303/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_310=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/310 + @cp -f popcorn/popcorn.prx dist/modules/310/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_311=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/311 + @cp -f popcorn/popcorn.prx dist/modules/311/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_330=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/330 + @cp -f popcorn/popcorn.prx dist/modules/330/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_340=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/340 + @cp -f popcorn/popcorn.prx dist/modules/340/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_350=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/350 + @cp -f popcorn/popcorn.prx dist/modules/350/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_351=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/351 + @cp -f popcorn/popcorn.prx dist/modules/351/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_352=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/352 + @cp -f popcorn/popcorn.prx dist/modules/352/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_371=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/371 + @cp -f popcorn/popcorn.prx dist/modules/371/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_372=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/372 + @cp -f popcorn/popcorn.prx dist/modules/372/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_380=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/380 + @cp -f popcorn/popcorn.prx dist/modules/380/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_390=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/390 + @cp -f popcorn/popcorn.prx dist/modules/390/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_393=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/393 + @cp -f popcorn/popcorn.prx dist/modules/393/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_396=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/396 + @cp -f popcorn/popcorn.prx dist/modules/396/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_401=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/401 + @cp -f popcorn/popcorn.prx dist/modules/401/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_500=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/500 + @cp -f popcorn/popcorn.prx dist/modules/500/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_501=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/501 + @cp -f popcorn/popcorn.prx dist/modules/501/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_503=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/503 + @cp -f popcorn/popcorn.prx dist/modules/503/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_550=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/550 + @cp -f popcorn/popcorn.prx dist/modules/550/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_551=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/551 + @cp -f popcorn/popcorn.prx dist/modules/551/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_600=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/600 + @cp -f popcorn/popcorn.prx dist/modules/600/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_610=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/610 + @cp -f popcorn/popcorn.prx dist/modules/610/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_620=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/620 + @cp -f popcorn/popcorn.prx dist/modules/620/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_635=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/635 + @cp -f popcorn/popcorn.prx dist/modules/635/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_639=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/639 + @cp -f popcorn/popcorn.prx dist/modules/639/ make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_660=1 -C popcorn - @cp -f popcorn/popcorn.prx dist/modules/660 + @cp -f popcorn/popcorn.prx dist/modules/660/ clean: make clean -C proheaparea diff --git a/popsloader/common/conf.c b/popsloader/common/conf.c index b7e613f..2ff2559 100644 --- a/popsloader/common/conf.c +++ b/popsloader/common/conf.c @@ -40,40 +40,118 @@ typedef struct _CONFIG { struct popsloader_config g_conf; -static char disc_id[16]; +char __disc_id[16]; static int config_offset = -1; -#define MAX_FAIL 100 - +#if 0 static int get_disc_id() { void* (*sceKernelGetGameInfo_k)(); - int failed = 0; -retry: - memset(disc_id, 0, sizeof(disc_id)); + memset(__disc_id, 0, sizeof(__disc_id)); sceKernelGetGameInfo_k = (void *)sctrlHENFindFunction("sceSystemMemoryManager", "SysMemForKernel", 0xCD617A94); if(sceKernelGetGameInfo_k != NULL) { char *info_buff = sceKernelGetGameInfo_k(); - memcpy(disc_id, info_buff + 0x44, 9); - } - - if (*disc_id == '\0' && failed < MAX_FAIL) { - sceKernelDelayThread(10000); - failed++; - goto retry; + memcpy(__disc_id, info_buff + 0x44, 9); } return 0; } +#endif +/// +static unsigned int read32(const void *p){ + const unsigned char *x=(const unsigned char*)p; + return x[0]|(x[1]<<8)|(x[2]<<16)|(x[3]<<24); +} +static unsigned short read16(const void *p){ + const unsigned char *x=(const unsigned char*)p; + return x[0]|(x[1]<<8); +} +static char head[16]; +//#define Z(S) (S),strlen(S) +static int get_disc_id() +{ + void* (*sceKernelGetGameInfo_k)(); + //SceUID f=sceIoOpen("ms0:/pops.log", PSP_O_WRONLY | PSP_O_CREAT | PSP_O_APPEND, 0777); + + memset(__disc_id, 0, sizeof(__disc_id)); + sceKernelGetGameInfo_k = (void *)sctrlHENFindFunction("sceSystemMemoryManager", "SysMemForKernel", 0xCD617A94); + + if(sceKernelGetGameInfo_k != NULL) { + char *info_buff = sceKernelGetGameInfo_k(); + memcpy(__disc_id, info_buff + 0x44, 9); //seems not working + + // in this point, sceKernelGetGameInfo() doesn't grub Disc ID. + // instead, I'm going to parse EBOOT.PBP's PARAM.SFO + // *** This clause can be used under any term (CC0). [popsdeco] + if(!*__disc_id){ + //sceIoWrite(f,Z("Entering Fallback mode.\n")); + //sceIoWrite(f,info_buff,0x100); + SceUID fd=sceIoOpen(info_buff + 0x74,PSP_O_RDONLY,0777); + sceIoRead(fd,head,16); + if(memcmp(head,"\0PBP",4)){ //||read32(head+4)!=0x00010000){ //rare case? 0x00010001 + sceIoClose(fd); + //sceIoWrite(f,Z("PBP magic error.\n")); + goto end;//return 0; + } + int param_offset=read32(head+8); + int param_size=read32(head+12)-param_offset; + SceUID uid=sceKernelAllocPartitionMemory(2,"EBOOTReader",PSP_SMEM_Low,param_size,NULL); + if(uid<0){ + sceIoClose(fd); + //sceIoWrite(f,Z("malloc failed.\n")); + goto end;//return 0; + } + char *p=sceKernelGetBlockHeadAddr(uid);//malloc(param_size); + //char p[0x400]; + sceIoLseek(fd,param_offset,SEEK_SET); + sceIoRead(fd,p,param_size); + sceIoClose(fd); + if(memcmp(p,"\0PSF",4)||read32(p+4)!=0x00000101){ + //free(p); + sceKernelFreePartitionMemory(uid); + //sceIoWrite(f,Z("PSF magic error.\n")); + goto end;//return 0; + } + int label_offset=read32(p+8); + int data_offset=read32(p+12); + int nlabel=read32(p+16); + int i=0; + for(;i= 0)? PSP_O_RDWR : PSP_O_WRONLY | PSP_O_CREAT | PSP_O_APPEND, 0777); @@ -82,11 +160,14 @@ int save_config(void) } memset(&cnf, 0, sizeof(cnf)); - memcpy(cnf.disc_id, disc_id, 12); + memcpy(cnf.disc_id, __disc_id, 12); cnf.version = g_conf.pops_fw_version; if(config_offset >= 0) { sceIoLseek(fd, config_offset * sizeof(CONFIG), PSP_SEEK_SET); + }else{ + SceIoStat st; + if(sceIoGetstat(path,&st)>=0)config_offset=st.st_size>>4; } sceIoWrite(fd, &cnf, sizeof(cnf)); @@ -104,6 +185,13 @@ static int _load_config(void) int offset = 0; sprintf(path, "%s%s", is_ef0() ? "ef" : "ms", CFG_PATH); + { + SceIoStat stat; + if(sceIoGetstat(path,&stat)>=0 && (stat.st_size&0xf)){ + sceIoRemove(path); //need to remove v1 conf + return -1; + } + } fd = sceIoOpen(path, PSP_O_RDONLY, 0777); if(fd < 0) { @@ -111,19 +199,19 @@ static int _load_config(void) } while((size = sceIoRead(fd, config, sizeof(CONFIG) * 32)) > 0) { - int cnt = size / sizeof(CONFIG); + int cnt = size / sizeof(CONFIG); if(cnt > 0) { int i; for(i=0; ient_top; + int entLen = pMod->ent_size; + int i = 0; + + while(i < entLen) { + int count; + int total; + unsigned int *vars; + entry = (struct SceLibraryEntryTable *) (entTab + i); + + if( (entry->libname == szLib) || (entry->libname && strcmp(entry->libname, szLib) == 0)) { + total = entry->stubcount + entry->vstubcount; + vars = entry->entrytable; + + if(total > 0) { + for(count = 0; count < total ; count++) { + if (vars[count] == nid) + { + return (void *)(vars[count+total]); + } + } + } + } + + i += (entry->len * 4); + } + return NULL; +} + +void* search_module_stub(SceModule2 *pMod, const char *szLib, u32 nid) +{ + void *entTab = pMod ->stub_top; + int entLen = pMod->stub_size; + struct SceLibraryStubTable *current; + int i = 0 ,j; + + while( i < entLen ) { + current = (struct SceLibraryStubTable *)(entTab + i); + if(strcmp(current->libname, szLib ) == 0) { + for(j=0;j< current->stubcount ;j++) { + if( current->nidtable[j] == nid ) { + return (void *)((u32)(current->stubtable) + 8*j ); + } + } + + break; + } + i += (current->len * 4); + } + + return NULL; +} + + +int (*StartModuleEx)(int , SceSize , void *, int *, SceKernelSMOption *); +int (*pro_func)(int , SceSize , void *, int *, SceKernelSMOption *); + +int hook_start_module(int modid, SceSize argsize, void *argp, int *modstatus, SceKernelSMOption *opt) +{ + int ret; + SceModule2 *mod = (SceModule2*) sceKernelFindModuleByUID(modid); + + if( strcmp(mod->modname, "sceMediaSync") == 0 ) { + sceKernelStartModule(modid, argsize, argp, modstatus, opt); + + int dummy = sceKernelLoadModule("flash0:/kd/idmanager.prx", 0, NULL); + mod = (SceModule2*) sceKernelFindModuleByUID(dummy); + strcpy( (char *)mod->modname , "PROPopcornManager"); + modid = dummy; + ClearCaches(); + } + + ret = pro_func( modid, argsize, argp, modstatus, opt); +// printf(" ret = 0x%08X \n", ret); + + if(ret >= 0 ) { + return ret; + } + + if( StartModuleEx ) { + return StartModuleEx( modid, argsize, argp, modstatus, opt); + } + + return -1; +} + +#if 1 +//ndef POPCORN +//void *sctrlSetStartModuleExtra( int (* func)()); +void* (*sctrlSetStartModuleExtra_k)( int (* func)()); + +void sctrlSetCustomStartModule_hook(int (*func)(int modid, SceSize argsize, void *argp, int *modstatus, SceKernelSMOption *opt)) +{ + pro_func = func; + StartModuleEx = sctrlSetStartModuleExtra_k( hook_start_module ); +} +#endif + +//patch for popsloader v3 +#if 0 +int strcmp_patch(const char *s1, const char *s2) +{ + int ret = strcmp(s1,s2); + if( ret == 0 && strcmp( s2, "pops") == 0) { + if( sceKernelFindModuleByName("popscore") != NULL) + ret = -1; + } + + return ret; +} +#endif + +u32 sceKernelQuerySystemCall(void *a0); +u32 sctrlKernelQuerySystemCall_patch(void *addr) +{ + u32 k1 = pspSdkSetK1(0); + u32 ret = sceKernelQuerySystemCall(addr); + pspSdkSetK1(k1); + return ret; +} + +//patch for popsloader v1 +int sctrlKernelLoadExecVSHWithApitype_patch(int apitype, const char *file, struct SceKernelLoadExecVSHParam *param) +{ + while( sceKernelFindModuleByName("sceKernelLibrary") == NULL) { + sceKernelDelayThread(100*1000); + } + + int ret = 0; + if( sceKernelFindModuleByName("Idchange_Driver") != NULL ) { + ret = sctrlKernelLoadExecVSHWithApitype( apitype, file, param ); + } + + return ret; +} + +int sceKernelApplyPspRelSectionPatched(SceModule2 *mod) +{ +// u32 text_addr = mod->text_addr; + char *modinfo=mod->modname; + void *addr; + + if (strcmp(modinfo, "Idchange_Driver") == 0 && sceKernelFindModuleByName("popscore") != NULL ) { + + //module_start + //addr = search_module_export( mod , NULL , 0xD632ACDB ); + addr = (void *)mod->entry_addr; + MAKE_DUMMY_FUNCTION_RETURN_1((u32)addr); + ClearCaches(); + } +#if 0 //popscore.prx resolves me_fw on its own. + else if( strcmp(modinfo, "popscore") == 0 ) { + + //sctrlSetCustomStartModule + addr = search_module_stub( mod , "SystemCtrlForKernel" , 0x259B51CE ); + REDIRECT_FUNCTION((u32)addr, sctrlSetCustomStartModule_hook ); + + //sctrlKernelQuerySystemCall + addr = search_module_stub( mod , "SystemCtrlForKernel" , 0x56CEAF00 ); + + if( addr ) { + REDIRECT_FUNCTION((u32)addr, sctrlKernelQuerySystemCall_patch ); + } + + ClearCaches(); + } +#endif +#if 0 //popsloader.prx resolves me_fw on its own. + else if( strcmp(modinfo, "popsloader") == 0 ) { + + //strcmp + addr = search_module_stub( mod , "SysclibForKernel" , 0xC0AB8932 ); + REDIRECT_FUNCTION((u32)addr, strcmp_patch ); + + //sctrlKernelLoadExecVSHWithApitype + addr = search_module_stub( mod , "SystemCtrlForKernel" , 0x2D10FB28 ); + REDIRECT_FUNCTION((u32)addr, sctrlKernelLoadExecVSHWithApitype_patch ); + ClearCaches(); + } +#endif +#if 0 //popcorn.prx resolves me_fw on its own. + else if( strcmp( modinfo, "PROPopcornManager") == 0) { + + //sctrlKernelQuerySystemCall + addr = search_module_stub( mod , "SystemCtrlForKernel" , 0x56CEAF00 ); + if( addr ) { + REDIRECT_FUNCTION((u32)addr, sctrlKernelQuerySystemCall_patch ); + ClearCaches(); + } + } +#endif +#if 0 + if( g_previous ) { + return g_previous( mod ); + } +#endif + return 0; +} + +u32 me_fw; +void SetME(){ //must be called in module_start, only once + //me_fw = 0; + + //codestation's method + //me_fw = sctrlHENFindFunction("SystemControl", "VersionSpoofer", 0x5B18622C)==0; + + //neur0ner's method + sctrlSetStartModuleExtra_k=(void*)sctrlHENFindFunction("SystemControl", "SystemCtrlForKernel", 0x221400A6); + me_fw = sctrlSetStartModuleExtra_k!=0; + + //Anyway I don't know anything about TN's pops. +} diff --git a/popsloader/common/popsloader.h b/popsloader/common/popsloader.h index 8caa995..04f104f 100644 --- a/popsloader/common/popsloader.h +++ b/popsloader/common/popsloader.h @@ -1,7 +1,7 @@ #ifndef POPSLOADER_H #define POPSLOADER_H -#define POPSLOADER_VERSION_STR "New popsloader v3" +#define POPSLOADER_VERSION_STR "Popsloader PRO/ME mod v4i" struct popsloader_config { u32 pops_fw_version; diff --git a/popsloader/core/Makefile b/popsloader/core/Makefile index 0cdeb7b..536bac0 100644 --- a/popsloader/core/Makefile +++ b/popsloader/core/Makefile @@ -1,47 +1,47 @@ -TARGET = popscore -OBJS = main.o resolve_nid.o resolve_nid_impose.o impose_patch.o replace_module.o ../common/libs.o ../common/conf.o - -OBJS += nid_660_to_620.o \ - nid_660_to_635.o \ - nid_635_to_620.o \ - nid_635_to_660.o \ - nid_620_to_635.o \ - nid_620_to_660.o \ - nid_500_to_620.o \ - nid_500_to_635.o \ - nid_500_to_660.o \ - nid_400_to_620.o \ - nid_400_to_635.o \ - nid_400_to_660.o \ - nid_373_to_620.o \ - nid_373_to_635.o \ - nid_373_to_660.o \ - nid_393_to_620.o \ - nid_393_to_635.o \ - nid_393_to_660.o \ - nid_impose_400_to_620.o \ - nid_impose_400_to_635.o \ - nid_impose_400_to_660.o - -#PRO_HOME = d:/PSP/635PRO - -CFLAGS = -Os -G0 -Wall -I../common -I$(PRO_HOME)/include -I$(PRO_HOME)/Common - -ifeq ($(DEBUG), 1) -CFLAGS += -DDEBUG=1 -OBJS += $(PRO_HOME)/Common/utils.o $(PRO_HOME)/Common/printk.o -else -OBJS += ../common/utils.o ../common/vsnprintf.o -endif - -LDFLAGS = -mno-crt0 -nostartfiles -L. -L $(PRO_HOME)/libs -LIBS = -lpspsystemctrl_kernel -lpspkubridge -PSP_FW_VERSION=620 -PRX_EXPORTS = exports.exp - -BUILD_PRX=1 -USE_KERNEL_LIBS=1 -USE_KERNEL_LIBC=1 - -PSPSDK = $(shell psp-config --pspsdk-path) -include $(PSPSDK)/lib/build.mak +TARGET = popscore +OBJS = main.o resolve_nid.o resolve_nid_impose.o impose_patch.o replace_module.o ../common/libs.o ../common/conf.o + +OBJS += nid_660_to_620.o \ + nid_660_to_635.o \ + nid_635_to_620.o \ + nid_635_to_660.o \ + nid_620_to_635.o \ + nid_620_to_660.o \ + nid_500_to_620.o \ + nid_500_to_635.o \ + nid_500_to_660.o \ + nid_400_to_620.o \ + nid_400_to_635.o \ + nid_400_to_660.o \ + nid_373_to_620.o \ + nid_373_to_635.o \ + nid_373_to_660.o \ + nid_393_to_620.o \ + nid_393_to_635.o \ + nid_393_to_660.o \ + nid_impose_400_to_620.o \ + nid_impose_400_to_635.o \ + nid_impose_400_to_660.o + +#PRO_HOME = d:/PSP/635PRO + +CFLAGS = -O2 -G0 -Wall -I../common -I$(PRO_HOME)/include -I$(PRO_HOME)/Common +DEBUG=0 +ifeq ($(DEBUG), 1) +CFLAGS += -DDEBUG=1 +OBJS += $(PRO_HOME)/Common/utils.o $(PRO_HOME)/Common/printk.o +else +OBJS += ../common/utils.o ../common/vsnprintf.o +endif + +LDFLAGS = -mno-crt0 -nostartfiles -L. -L $(PRO_HOME)/libs +LIBS = -lpspsystemctrl_kernel -lpspkubridge +PSP_FW_VERSION=620 +PRX_EXPORTS = exports.exp + +BUILD_PRX=1 +USE_KERNEL_LIBS=1 +USE_KERNEL_LIBC=1 + +PSPSDK = $(shell psp-config --pspsdk-path) +include $(PSPSDK)/lib/build.mak diff --git a/popsloader/core/NID635.csv b/popsloader/core/NID635.csv new file mode 100644 index 0000000..34511e4 --- /dev/null +++ b/popsloader/core/NID635.csv @@ -0,0 +1,108 @@ +NIDs required to port Popsloader on 6.35 to 6.60 (nid_***_to_660.c). +Aug 19th: now it is completed! + +How to make 660.c: +just copy ..._to_635.c to ..._to_660.c then replace 2nd element of each array using this list. + +FW_635,FW_660, #contributer +0x458A70B5,0x07C586A1, #PROCFW dumped from nid_660_to_635.c +0x25A760F0,0x310802A9, #PROCFW +0x2CFE3B22,0x8AE776AF, #PROCFW +0xF0E0AB7A,0xB4F00CB5, #PROCFW +0x3DE3C6DF,0xC90B0992, #PROCFW +0x52B54B93,0xF12A62F7, #PROCFW +0xF2FEAFD5,0xFDC97D28, #PROCFW +0xEE67E450,0x9D33A110, #PROCFW +0xE6BF3960,0x3FF74DF1, #PROCFW +0xFFB9B760,0x939E4270, #PROCFW +0xFCD765C9,0xC3474C2A, #PROCFW +0xFF530D9F,0x4E267E02, #PROCFW +0x99037763,0xE7B3ABF4, #PROCFW +0x44F17A7A,0x0F067E16, #PROCFW +0x3BD9E51B,0x133DB99A, #PROCFW +0x027F21C6,0x28B97035, #PROCFW +0xEBC850AC,0x5557F4E2, #PROCFW +0x3FE74F52,0xB497314D, #PROCFW +0x4C4DF719,0xDC3BECFF, #PROCFW +0x86FFE348,0x0AE8E549, #PROCFW +0xD74D9041,0x38527743, #PROCFW +0x9E80B4E2,0x41B0337B, #PROCFW +0xB70793D7,0x457FEBA9, #PROCFW +0xD1999F94,0x4634C9DC, #PROCFW +0xE2606FCB,0x48F1C4AD, #PROCFW +0x9984A972,0x4B4CCE80, #PROCFW +0x789597AB,0x8B1DD83A, #PROCFW +0x8E9E76AE,0xB1751B06, #PROCFW +0x3A98CABB,0xC36775AD, #PROCFW +0x741110C5,0x48448373, #PROCFW +0xC4931159,0x9BC5E33B, #PROCFW +0xA02BB1D3,0xDAB6E612, #PROCFW +0xFEEC36F7,0x4B9554EB, #PROCFW +0x670F15ED,0x5D28A52B, #PROCFW +0xD8A53104,0xAFE6C9EF, #PROCFW +0x2444EC4D,0xD8633888, #PROCFW +0x3DABE438,0x03F16FD4, #PROCFW +0x3E4B1B28,0xE38CA615, #PROCFW +0x8930B3A9,0xE97E9718, #PROCFW +0xADE4B1F4,0xB2BEADB8, #PROCFW +0xAA085C2A,0x48005974, #PROCFW +0xB2EF6B19,0x376399B6, #PROCFW +0xDEFAD580,0x6C86AF22, #PROCFW +0x773BA62B,0x05C9C803, #PROCFW +0x2F9A534A,0x0B3E6FD3, #PROCFW +0x830FC570,0x7CAB5A3D, #PROCFW +0x208F4820,0x9F205D3E, #j416dy's list +0x64FA9D42,0xC4C21CAB, #ABCang http://pastebin.com/eRZk21Fp +0x035BD7AA,0xBE03D832, #ABCang +0x45596E3F,0x0143E8A8, #ABCang +0x0CFD5A8A,0xDB97C70E, #ABCang +0xEF1B48C6,0x7CFD2733, #SnyFbSx http://pastebin.com/Y8NVuPDV +0x071C387D,0x7ED29E40, #neur0n + +list for impose.prx (nid_impose_400_to_660.c) +0x09DF9219,0x22A114DC, #j416dy's list +0x8CE2AB86,0x1F08547A, #j416dy's list +0xEF9C9627,0xB57D0DEC, #j416dy's list +0x5B15473C,0xF8346777, #j416dy's list +0x18654FC0,0x2BA616AF, #j416dy's list +0x33AB5BDB,0x1809B9FC, #j416dy's list +0x5D8CE0B2,0xDF53E160, #j416dy's list +0x73CA5F45,0x3552AB11, #j416dy's list +0x01F6B0D5,0x996881D2, #j416dy's list +0xD4EF6579,0x33B620AF, #j416dy's list +0xA70E2B3C,0x117C3E2C, #j416dy's list +0xDE18E7C0,0xFA651CE1, #j416dy's list +0xF36E1F37,0x88C79735, #j416dy's list +0x2CBFA597,0x31AEA94C, #j416dy's list +0x57F6311D,0x2509FF3B, #j416dy's list +0xF8C9FAF5,0x872F4ECE, #j416dy's list +0x062CFDDC,0x5C1333B7, #j416dy's list +0xAB842949,0x7A9EA6DE, #j416dy's list +0x81DCA5A5,0x8C873AA7, #j416dy's list +0x8F2559DE,0xFA4A25A7, #j416dy's list +0x4C1F35A1,0x8AEC8EE9, #j416dy's list +0x73587D56,0x0B83352B, #j416dy's list +0xA971659D,0x8C728BB4, #j416dy's list +0xB05CD4A2,0x370DDC12, #j416dy's list +0x38FB84B5,0x301063CC, #j416dy's list +0x0682085A,0xEFCFD0C5, #j416dy's list +0xDF998667,0x3E17FE8D, #ABCang http://pastebin.com/MdXp41FQ +0x0287B1C2,0x9012B140, #http://pastebin.com/mpXjhgQ5 +0xF3B8D574,0xDFF30673, #http://pastebin.com/mpXjhgQ5 +0xD26B6CCE,0xE4456BC3, #VirtuousFlame +0xA349B88E,0x49D77D65, #http://pastebin.com/mpXjhgQ5 +0xAEF5B913,0x5FD4764A, #http://pastebin.com/mpXjhgQ5 +0xA81437D0,0x9980519F, #http://pastebin.com/mpXjhgQ5 +0x55C9A620,0xD743A608, #http://pastebin.com/mpXjhgQ5 +0xBA1A6A86,0x4F471457, #http://pastebin.com/mpXjhgQ5 +0x5476A667,0x49C70163, #http://pastebin.com/mpXjhgQ5 +0x693B0D7F,0xF4A3E396, #http://pastebin.com/mpXjhgQ5 +0xA1671F90,0xFC742751, #http://pastebin.com/mpXjhgQ5 +0x7F17123E,0xDBA46704, #http://pastebin.com/mpXjhgQ5 +0x9DAE67BC,0xED631526, #VirtuousFlame +0x1C67572C,0x253B69B6, #VirtuousFlame +0x0DD3C1B4,0x77832653, #VirtuousFlame +0x92DA9CEF,0xB41E2430, #http://pastebin.com/n4t0pkM8 +0x359F6F5C,0x4023E1A7, #VirtuousFlame +0xD06AA711,0xFFA8B183, #VirtuousFlame +0x2213275D,0xA18A4A8B, #VirtuousFlame diff --git a/popsloader/core/NID635.pl b/popsloader/core/NID635.pl new file mode 100755 index 0000000..5fc2cc9 --- /dev/null +++ b/popsloader/core/NID635.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl -- +use strict; +use warnings; + +open(my $file,"<","nid_660_to_635.c"); +my @file=<$file>; +close($file); + +foreach my $line(@file){ + #print $line; + if($line=~/ { (0x[0-9a-fA-F]{8}), (0x[0-9a-fA-F]{8}), },/){ + print "$2,$1, #PROCFW\n"; + } +} diff --git a/popsloader/core/NIDcheck.pl b/popsloader/core/NIDcheck.pl new file mode 100755 index 0000000..1897b1b --- /dev/null +++ b/popsloader/core/NIDcheck.pl @@ -0,0 +1,41 @@ +#!/usr/bin/perl -- +use strict; +use warnings; + +if(!$ARGV[0]){exit;} + + +open(my $db,"<","NID635.csv"); +my @db=<$db>; +close($db); +my %db=(); +foreach my $line(@db){ + chomp($line); + if($line=~/^(0x[0-9a-fA-F]*),(0x[0-9a-fA-F]*),/){ + if($db{$2}){print "duplicate $2\n";} + else{$db{$2}=$1;} + } +} + +open(my $file,"<",$ARGV[0]); +my @file=<$file>; +close($file); + +#open($file,">",$ARGV[0]); +foreach my $line(@file){ + #print $line; + if($line=~/ { (0x[0-9a-fA-F]{8}), (0x[0-9a-fA-F]{8}), },/){ + if($1 eq $2){ + print $2." doesn't need patch\n"; + }elsif($db{$2}){ + print $2." is 6.60\n"; + #print $2.",".$db{$2}.", #j416dy's list\n"; + #print $file " { $1, $db{$2}, },\n"; + }else{ + print $2." is NOT 6.60\n";goto fallback; + } + }else{ + fallback: + #print $file $line; + } +} diff --git a/popsloader/core/NIDdump.pl b/popsloader/core/NIDdump.pl new file mode 100755 index 0000000..43c5be4 --- /dev/null +++ b/popsloader/core/NIDdump.pl @@ -0,0 +1,25 @@ +#!/usr/bin/perl -- +use strict; +use warnings; +use Net::HTTP; +my $http=Net::HTTP->new(Host=>"data.j416.info",KeepAlive=>1) || die $@; +my $i=0; +for(;$i<31;$i++){ + $http->write_request(GET=>"/nid/index.cgi?n=$i"); + my($code,$mess,%h)=$http->read_response_headers(); + my($body,$buf,$n);$body=""; + do{ + $n=$http->read_entity_body($buf,2048); + $body.=$buf; + }while($n); + $body=~s/\r//g; + $body=~s/\n//g; + my @lines=split(/<\/tr>/,$body); + foreach my $line(@lines){ + #print $line."\n"; + if($line =~ m|.*(0x[0-9a-fA-F]{8})(0x[0-9a-fA-F]*)(0x[0-9a-fA-F]*)(0x[0-9a-fA-F]*)(0x[0-9a-fA-F]*)$|){ + #print join(",",$1,$2,$3,$4,$5).",\n"; + print join(",",$4,$5).",\n"; + } + } +} diff --git a/popsloader/core/NIDfix.pl b/popsloader/core/NIDfix.pl new file mode 100755 index 0000000..e73665a --- /dev/null +++ b/popsloader/core/NIDfix.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl -- +use strict; +use warnings; + +if(!$ARGV[0]){exit;} + + +open(my $db,"<","NID635.csv"); +my @db=<$db>; +close($db); +my %db=(); +foreach my $line(@db){ + chomp($line); + if($line=~/^(0x[0-9a-fA-F]*),(0x[0-9a-fA-F]*),/){ + if($db{$1}){print "duplicate $1\n";} + else{$db{$1}=$2;} + } +} + +open(my $file,"<",$ARGV[0]); +my @file=<$file>; +close($file); + +open($file,">",$ARGV[0]); +foreach my $line(@file){ + #print $line; + if($line=~/ { (0x[0-9a-fA-F]{8}), (0x[0-9a-fA-F]{8}), },/){ + if($db{$2}){ + print $2." translated into ".$db{$2}."\n"; + #print $2.",".$db{$2}.", #j416dy's list\n"; + print $file " { $1, $db{$2}, },\n"; + }else{ + print $2." cannot translate\n";goto fallback; + } + }else{ + fallback: + print $file $line; + } +} diff --git a/popsloader/core/NIDfix635.pl b/popsloader/core/NIDfix635.pl new file mode 100755 index 0000000..0ee02d6 --- /dev/null +++ b/popsloader/core/NIDfix635.pl @@ -0,0 +1,38 @@ +#!/usr/bin/perl -- +use strict; +use warnings; + +if(!$ARGV[0]){exit;} + + +open(my $db,"<","NID635.csv"); +my @db=<$db>; +close($db); +my %db=(); +foreach my $line(@db){ + chomp($line); + if($line=~/^(0x[0-9a-fA-F]*),(0x[0-9a-fA-F]*),/){ + $db{$1}=$2; + } +} + +open(my $file,"<",$ARGV[0]); +my @file=<$file>; +close($file); + +open($file,">",$ARGV[0]); +foreach my $line(@file){ + #print $line; + if($line=~/ { (0x[0-9a-fA-F]{8}), (0x[0-9a-fA-F]{8}), },/){ + if($db{$1}){ + print $1." translated into ".$db{$1}."\n"; + print $file " { $1, $db{$1}, },\n"; + }else{ + print $1." cannot translate\n";#goto fallback; + print $file " { $1, $1, },\n"; + } + }else{ + fallback: + print $file $line; + } +} diff --git a/popsloader/core/impose_patch.c b/popsloader/core/impose_patch.c index cfd0cee..b8bb9ef 100644 --- a/popsloader/core/impose_patch.c +++ b/popsloader/core/impose_patch.c @@ -31,7 +31,7 @@ #include "systemctrl.h" #include "main.h" -static u32 g_sceImposeGetParamOld_nid[] = { +static u32 g_sceImposeGetParamOld_NID[] = { 0x4B02F047, 0x531C9778, 0x6F502C0A, @@ -104,25 +104,23 @@ static int _sceImposeGetParamOld(int param) void patch_sceImposeGetParam(void) { SceModule2 *mod; - u32 sceImposeGetParam_nid = -1; + u32 sceImposeGetParam_NID = -1; int i; - if(psp_fw_version == FW_660) { - sceImposeGetParam_nid = 0xDC3BECFF; + if(psp_fw_version == FW_620) { + sceImposeGetParam_NID = 0xC94AC8E2; } else if(psp_fw_version == FW_635 || psp_fw_version == FW_639) { - sceImposeGetParam_nid = 0x4C4DF719; - } else if(psp_fw_version == FW_620) { - sceImposeGetParam_nid = 0xC94AC8E2; + sceImposeGetParam_NID = 0x4C4DF719; + } else if(psp_fw_version == FW_660 || psp_fw_version == FW_661) { + sceImposeGetParam_NID = 0xDC3BECFF; } else { - printk("%s: PANIC: unknown psp_fw_version 0x%08X\n", __func__, psp_fw_version); - printk_sync(); asm("break"); } - sceImposeGetParamNew = (void*)sctrlHENFindFunction("sceImpose_Driver", "sceImpose_driver", sceImposeGetParam_nid); + sceImposeGetParamNew = (void*)sctrlHENFindFunction("sceImpose_Driver", "sceImpose_driver", sceImposeGetParam_NID); mod = (SceModule2*)sceKernelFindModuleByName("scePops_Manager"); - for(i=0; imodname, "sceImpose_Driver")) { - u32 sceKernelGetModel_nid = -1; - - if(psp_fw_version == FW_660) { - sceKernelGetModel_nid = 0x07C586A1; - } else if (psp_fw_version >= FW_635 && psp_fw_version <= FW_639) { - sceKernelGetModel_nid = 0x458A70B5; - } else if (psp_fw_version == FW_620) { - sceKernelGetModel_nid = 0x864EBFD7; - } else { - asm("break"); - } + u32 sceKernelGetModel_nid; + sceKernelGetModel_nid = + psp_fw_version == FW_620 ? 0x864EBFD7/*0x864EBDF7*/ : + (psp_fw_version == FW_660 || psp_fw_version == FW_661) ? 0x07C586A1 : + 0x458A70B5; hook_import_bynid((SceModule*)mod, "IoFileMgrForKernel", 0x109F50BC, _sceIoOpen, 0); hook_import_bynid((SceModule*)mod, "SysMemForKernel", sceKernelGetModel_nid, _sceKernelGetModel, 0); } @@ -135,17 +131,23 @@ int module_start(SceSize args, void* argp) psp_fw_version = sceKernelDevkitVersion(); psp_model = sceKernelGetModel(); - printk_init("ms0:/core.txt"); +#ifdef DEBUG + sceIoRemove("ms0:/__popscore.txt"); +#endif + printk_init("ms0:/__popscore.txt"); mount_memory_stick(); if(-1 == load_config() || g_conf.pops_fw_version == 0) { return 1; } + SetME(); pops_fw_version = g_conf.pops_fw_version; setup_nid_resolver(); setup_nid_resolver_impose(); - sctrlSetCustomStartModule(&custom_start_module); + me_fw? + sctrlSetCustomStartModule_hook(&custom_start_module): + sctrlSetCustomStartModule(&custom_start_module); g_previous = sctrlHENSetStartModuleHandler(&popsloader_patch_chain); (void)thid; diff --git a/popsloader/core/main.h b/popsloader/core/main.h index dc41520..005bbf7 100644 --- a/popsloader/core/main.h +++ b/popsloader/core/main.h @@ -65,10 +65,10 @@ extern resolver_config nid_fix_620_to_635[]; extern u32 nid_fix_620_to_635_size; extern resolver_config nid_fix_620_to_660[]; extern u32 nid_fix_620_to_660_size; -extern resolver_config nid_fix_500_to_635[]; -extern u32 nid_fix_500_to_635_size; extern resolver_config nid_fix_500_to_620[]; extern u32 nid_fix_500_to_620_size; +extern resolver_config nid_fix_500_to_635[]; +extern u32 nid_fix_500_to_635_size; extern resolver_config nid_fix_500_to_660[]; extern u32 nid_fix_500_to_660_size; extern resolver_config nid_fix_400_to_620[]; diff --git a/popsloader/core/replace_module.c b/popsloader/core/replace_module.c index b84779f..e95b78b 100644 --- a/popsloader/core/replace_module.c +++ b/popsloader/core/replace_module.c @@ -94,7 +94,9 @@ const char *get_module_prefix(void) { static char buf[80]; - if(pops_fw_version == FW_660) { + if(pops_fw_version == FW_661) { + sprintf(buf, "%s%s%s/", is_ef0() ? "ef" : "ms", MODULE_PATH, "661"); + } else if(pops_fw_version == FW_660) { sprintf(buf, "%s%s%s/", is_ef0() ? "ef" : "ms", MODULE_PATH, "660"); } else if(pops_fw_version == FW_639) { sprintf(buf, "%s%s%s/", is_ef0() ? "ef" : "ms", MODULE_PATH, "639"); @@ -163,14 +165,10 @@ static SceUID _sceKernelLoadModule(const char *path, int flags, SceKernelLMOptio char newpath[128]; if(is_pops(path)) { - if(pops_fw_version == FW_635 || pops_fw_version == FW_639 || pops_fw_version == FW_660) { + if(pops_fw_version == FW_635 || pops_fw_version == FW_639 || pops_fw_version == FW_660 || pops_fw_version == FW_661) { sprintf(newpath, "%spops_%02dg.prx", get_module_prefix(), (int)(psp_model + 1)); - - // try 09g driver on 11g - if((pops_fw_version == FW_635||pops_fw_version == FW_639) && psp_model == PSP_11000) { + if((pops_fw_version == FW_635||pops_fw_version == FW_639) && psp_model == PSP_11000) //11g, try 09g driver sprintf(newpath, "%spops_%02dg.prx", get_module_prefix(), 9); - } - path = newpath; } else if(pops_fw_version == FW_620 || pops_fw_version == FW_610 || pops_fw_version == FW_600) { if(psp_model == PSP_1000 || psp_model == PSP_2000 || psp_model == PSP_3000) { @@ -178,14 +176,12 @@ static SceUID _sceKernelLoadModule(const char *path, int flags, SceKernelLMOptio } else if(psp_model == PSP_4000 || psp_model == PSP_GO) { sprintf(newpath, "%spops_%02dg.prx", get_module_prefix(), (int)(psp_model + 1)); } else { - // 07/09/11G, try 04g driver + // 07g / 09g / 11g, try 04g driver sprintf(newpath, "%spops_%02dg.prx", get_module_prefix(), 4); } - // try 04g driver on 6.00 05g - if(pops_fw_version == FW_600 && psp_model == PSP_GO) { + if(pops_fw_version == FW_600 && psp_model == PSP_GO) //05g on 6.00, try 04g driver sprintf(newpath, "%spops_%02dg.prx", get_module_prefix(), 4); - } path = newpath; } else if(pops_fw_version <= FW_551) { @@ -330,9 +326,9 @@ static int replace_module(int modid, SceSize argsize, void *argp, int *modstatus u32 load_module_nid = -1; // use host nid, because fix_nid already fixed the load_module_nid into host one - if(psp_fw_version == FW_660) { + if(psp_fw_version == FW_660 || psp_fw_version == FW_661){ load_module_nid = 0x939E4270; - } else if(psp_fw_version == FW_635 || psp_fw_version == FW_639) { + }else if(psp_fw_version == FW_635 || psp_fw_version == FW_639) { load_module_nid = 0xFFB9B760; } else if(psp_fw_version == FW_620) { load_module_nid = 0xE3CCC6EA; diff --git a/popsloader/core/resolve_nid.c b/popsloader/core/resolve_nid.c index 86fd7b3..0de0cc3 100644 --- a/popsloader/core/resolve_nid.c +++ b/popsloader/core/resolve_nid.c @@ -99,7 +99,7 @@ void setup_nid_resolver(void) } } - if(psp_fw_version == FW_660) { + if(psp_fw_version == FW_660 || psp_fw_version == FW_661) { if(pops_fw_version >= FW_635 && pops_fw_version <= FW_639) { nid_fix_size = nid_fix_635_to_660_size; nid_fix = nid_fix_635_to_660; diff --git a/popsloader/core/resolve_nid_impose.c b/popsloader/core/resolve_nid_impose.c index 9584be7..008c61f 100644 --- a/popsloader/core/resolve_nid_impose.c +++ b/popsloader/core/resolve_nid_impose.c @@ -45,7 +45,7 @@ void setup_nid_resolver_impose(void) nid_impose_fix = nid_impose_fix_400_to_635; } - if(psp_fw_version == FW_660) { + if(psp_fw_version == FW_660 || psp_fw_version == FW_661) { nid_impose_fix_size = nid_impose_fix_400_to_660_size; nid_impose_fix = nid_impose_fix_400_to_660; } diff --git a/popsloader/history.txt b/popsloader/history.txt new file mode 100644 index 0000000..2b5e663 --- /dev/null +++ b/popsloader/history.txt @@ -0,0 +1,88 @@ +Popsloader PRO/ME mod. + +v3 (110721) +Derived from official v2. +Workaround for neur0n's sceKernelGetGameInfo()+0x44. +Using open(sceKernelGetGameInfo()+0x74,O_RDONLY,0777); + +v3a (110721) +Fixed save_config(). + +v3b (110722) +Fixed "Original from flash" feature. + +v3c (110722) +Fixed a bug in popsloader_patch_chain(). +Removed debug line. + +v4 (110723) +Integrated pops_bridge into popsloader.prx. +6.x pops are supported on ME. + +v4a beta (110724) +All pops are supported on ME. +Instead, popcorn.prx now works in release/debug hybrid mode. + +v4b alpha1 (110808) +1. Removed sceLoaderCore patch. +2. Changed remove timing of ms0:/__popcorn.txt. Now you should be able to see it. +(You need to paste it if you want to report bugs) +3. sctrlSetStartModuleExtra() (ME's original function) is now resolved via sctrlHENFindFunction(), rather than systemctrl.S. + +v4b alpha2 (110817) +Integrated http://code.google.com/p/popsloader/source 2d9f6175ddde to support 6.60 pops. + +v4b alpha2+1 (110817) +1. 5.00+ pops are working on 6.60ME. Unfortunately impose.prx (used in 4.01- pops) patch is incomplete. +2. Now that popscore.prx is compiled using DEBUG=1, you need to paste ms0:/core.txt to report bugs. + +v4b alpha2+2 (110817) +1. Changed debug text name to ms0:/__popscore.txt. Also it is removed in every launching. +2. Fixed sceKernelGetModel NID for 6.60. +3. Fixed fatal bug that PSP-3000+ on 6.20PRO couldn't use 4.01- pops at all. + +v4b alpha2+3 (110818) +Added impose.prx patch. Still 3 NIDs are missing though. +Anyway 4.01 pops seems to be working fully. + +v4b alpha3 (110819) +Now that impose.prx patch is complete, popsloader supports all pops fully on 6.60ME. + +v4b alpha4 (110821) +PSPgo will use pops_04g.prx on 6.00 (I don't know if this is correct) +Integrated http://code.google.com/p/procfw/source df2af4ebe25c. Popsloader should support 6.60PRO PSP-E1000 (when released). + +v4c (110822) +Attached popsloader.md5sum (and popsloader_updater.md5sum). +Make sure your pops md5 is correct before reporting bugs. +Now popscore.prx / popcorn.prx is compiled in release mode (no longer emits debug log) +*** I don't know why this time popcorn.prx is working in release mode. Tested only on 6.60ME. Be careful. *** + +v4d (110824) +Forgot to close EBOOT file handle when get_disc_id() failed. +Integrated http://code.google.com/p/popsloader/source 54abc82880ed. Now more stable. +(Actually some of NID wasn't resolved for 6.60.) + +v4e (110827) +Recompiled all modules using -O2. +Suspend recover bug fixed for 3.7x if you use PRO (?) +94235f09107f wasn't merged because: +1. official v3 cannot get DISC ID yet, at least on PSP-2000[C]. +2. changing load_config() timing will crash ME mode. + +v4f (110903) +Integrated http://code.google.com/p/popsloader/source 6043b4ffdfed. + +v4f1 (110912) +Popcorn patching in v4f was incomplete (lol). + +v4g (120410) +Fixed analog stick bug on ME (thx neur0ner). + +v4h (150202) +Supported 6.61 PRO/ME (thx qwikrazor87). +Dropped 6.61 pops, for it has the same compatibility with 6.60. + +v4i (150218) +Integrated https://code.google.com/p/procfw/source 608f7aded65c. + diff --git a/popsloader/loader/Makefile b/popsloader/loader/Makefile index e1b2f77..2d9d63e 100644 --- a/popsloader/loader/Makefile +++ b/popsloader/loader/Makefile @@ -1,22 +1,25 @@ -TARGET = popsloader -OBJS = main.o ui.o ../common/utils.o ../common/vsnprintf.o ../common/conf.o - -#PRO_HOME = d:/PSP/635PRO - -CFLAGS = -Os -G0 -Wall -I../common -I$(PRO_HOME)/include -I$(PRO_HOME)/Common - -ifeq ($(DEBUG), 1) -CFLAGS += -DDEBUG=1 -endif - -LDFLAGS = -mno-crt0 -nostartfiles -L. -L $(PRO_HOME)/libs -LIBS = -lpspsystemctrl_kernel -lpspkubridge -lpsppower_driver -PSP_FW_VERSION=620 -PRX_EXPORTS = exports.exp - -BUILD_PRX=1 -USE_KERNEL_LIBS=1 -USE_KERNEL_LIBC=1 - -PSPSDK = $(shell psp-config --pspsdk-path) -include $(PSPSDK)/lib/build.mak +TARGET = popsloader +OBJS = main.o ui.o ../common/conf.o + +#PRO_HOME = d:/PSP/635PRO + +CFLAGS = -O2 -G0 -Wall -I../common -I$(PRO_HOME)/include -I$(PRO_HOME)/Common +DEBUG=0 +ifeq ($(DEBUG), 1) +CFLAGS += -DDEBUG=1 +OBJS += $(PRO_HOME)/Common/utils.o $(PRO_HOME)/Common/printk.o +else +OBJS += ../common/utils.o ../common/vsnprintf.o +endif + +LDFLAGS = -mno-crt0 -nostartfiles -L. -L $(PRO_HOME)/libs +LIBS = -lpspsystemctrl_kernel -lpspkubridge -lpsppower_driver +PSP_FW_VERSION=620 +PRX_EXPORTS = exports.exp + +BUILD_PRX=1 +USE_KERNEL_LIBS=1 +USE_KERNEL_LIBC=1 + +PSPSDK = $(shell psp-config --pspsdk-path) +include $(PSPSDK)/lib/build.mak diff --git a/popsloader/loader/main.c b/popsloader/loader/main.c index 348ca4a..fb5f662 100644 --- a/popsloader/loader/main.c +++ b/popsloader/loader/main.c @@ -40,6 +40,8 @@ void *module_buffer = NULL; u32 module_size = 0; STMOD_HANDLER g_previous = NULL; +#include "../common/me_fw.h" + int is_ef0(void) { return psp_model == PSP_GO && sctrlKernelBootFrom() == 0x50 ? 1 : 0; @@ -151,8 +153,9 @@ int launch_pops(char *path) param.argp = (char *) path; param.key = mode; - ret = sctrlKernelLoadExecVSHWithApitype(apitype, path, ¶m); - + ret = me_fw? + sctrlKernelLoadExecVSHWithApitype_patch(apitype, path, ¶m): + sctrlKernelLoadExecVSHWithApitype(apitype, path, ¶m); return ret; } @@ -181,16 +184,9 @@ static void loadexec_pops(void) int launch_thread(SceSize args, void *argp) { - int status; - printk("%s: started\n", __func__); - load_config(); - - if(g_conf.pops_fw_version != 0) { - loadexec_pops(); - } - - sceKernelStopUnloadSelfModule(0, NULL, &status, NULL); + //load_config(); + loadexec_pops(); return 0; } @@ -198,8 +194,7 @@ int launch_thread(SceSize args, void *argp) int ui_thread(SceSize args, void *argp) { printk("%s: started\n", __func__); - - load_config(); + //load_config(); get_pops_fw_version(&g_conf.pops_fw_version); save_config(); loadexec_pops(); @@ -234,11 +229,39 @@ int popsloader_patch_chain(SceModule2 *mod) { printk("%s: %s\n", __func__, mod->modname); + if(me_fw)sceKernelApplyPspRelSectionPatched(mod); + +if(!sceKernelFindModuleByName("popscore")){ if(0 == strcmp(mod->modname, "pops")) { + load_config(); MAKE_DUMMY_FUNCTION_RETURN_1(mod->entry_addr); sync_cache(); create_thread(1); } +} + + if(g_previous) + return g_previous(mod); + + return 0; +} + +int popsloader_patch_chain0(SceModule2 *mod) +{ + printk("%s: %s\n", __func__, mod->modname); + + if(me_fw)sceKernelApplyPspRelSectionPatched(mod); + +if(!sceKernelFindModuleByName("popscore")){ + if(0 == strcmp(mod->modname, "pops")) { + load_config(); + if(g_conf.pops_fw_version){ + MAKE_DUMMY_FUNCTION_RETURN_1(mod->entry_addr); + sync_cache(); + create_thread(0); + } + } +} if(g_previous) return g_previous(mod); @@ -261,15 +284,30 @@ int module_start(SceSize args, void* argp) psp_fw_version = sceKernelDevkitVersion(); psp_model = sceKernelGetModel(); - printk_init(); +#ifdef DEBUG + sceIoRemove("ms0:/__popsloader.txt"); +#endif + printk_init("ms0:/__popsloader.txt"); mount_memory_stick(); + SetME(); + //load_config(); //in this point, sceKernelGetGameInfo() doesn't grub EBOOT name. + sceCtrlReadBufferPositive(&ctrl_data, 1); if(ctrl_data.Buttons & PSP_CTRL_RTRIGGER) { g_previous = sctrlHENSetStartModuleHandler(&popsloader_patch_chain); - } else { - create_thread(0); + } else { //if(g_conf.pops_fw_version != 0) { + //create_thread(0); + g_previous = sctrlHENSetStartModuleHandler(&popsloader_patch_chain0); + } + + if(0){//me_fw){ + SceModule2 *mod = (SceModule2*)sceKernelFindModuleByName("sceLoaderCore"); + u32 text_addr=mod->text_addr; + + _sw(0x1000FFCB, text_addr + 0x00006EE4 ); + ClearCaches(); } return 0; diff --git a/popsloader/loader/main.h b/popsloader/loader/main.h index a7bc613..582b621 100644 --- a/popsloader/loader/main.h +++ b/popsloader/loader/main.h @@ -18,13 +18,25 @@ #ifndef MAIN_H #define MAIN_H +#define USE_PRINTK 1 +//#undef USE_PRINTK + +#ifdef USE_PRINTK +#include "printk.h" +#else #ifdef DEBUG #define printk pspDebugScreenPrintf -#define printk_init pspDebugScreenInit + +static inline void printk_init() +{ + pspDebugScreenInit(); +} + #else #define printk(...) #define printk_init(...) #endif +#endif extern u32 psp_fw_version; extern u32 psp_model; diff --git a/popsloader/loader/ui.c b/popsloader/loader/ui.c index 7b8faa1..f6b3090 100644 --- a/popsloader/loader/ui.c +++ b/popsloader/loader/ui.c @@ -119,14 +119,18 @@ static void set_color(u32 color) pspDebugScreenSetTextColor(color); } +extern u32 me_fw; +extern char __disc_id[16]; void menu_draw(struct Menu *menu) { int i; - set_screen_xy((MAX_SCREEN_X - strlen(menu->banner)) / 2, 2); + set_screen_xy((MAX_SCREEN_X - strlen(menu->banner)) / 2, 1); printf("%s\n", menu->banner); - set_screen_xy((MAX_SCREEN_X - strlen(POPSLOADER_VERSION_STR)) / 2, 3); - printf("%s\n", POPSLOADER_VERSION_STR); + set_screen_xy((MAX_SCREEN_X - strlen(POPSLOADER_VERSION_STR) - 8 - (me_fw?2:3)) / 2, 2); + printf("%s (%s Mode)\n", POPSLOADER_VERSION_STR, me_fw?"ME":"PRO"); + set_screen_xy((MAX_SCREEN_X - strlen(__disc_id) - 9) / 2, 3); + printf("Disc ID: %s\n", __disc_id); for(i=0; isize; ++i) { set_screen_xy((MAX_SCREEN_X - strlen(menu->items[i].name)) / 2, 5 + i); diff --git a/popsloader/make.sh b/popsloader/make.sh new file mode 100755 index 0000000..db8faf4 --- /dev/null +++ b/popsloader/make.sh @@ -0,0 +1,5 @@ +#!/bin/sh +#mkdir dist/modules/{302,303,310,311,330,340,350,351,352,371,372,380,390,393,396,401,500,501,503,550,551,600,610,620,635,639,660} +export PRO_HOME=/work/mercurial/procfw/src +make clean +make diff --git a/popsloader/md5sum.txt b/popsloader/md5sum.txt new file mode 100644 index 0000000..1fb492b --- /dev/null +++ b/popsloader/md5sum.txt @@ -0,0 +1,5 @@ +popsloader_updater.md5sum: updater's md5sum +popsloader.md5sum: pops modules' md5sum (and layout) + +You can execute "md5sum --check popsloader.md5sum" in ms0:/seplugins/popsloader/modules/ to check if your pops are OK. +If your md5 is wrong, bug report won't be accepted. Please be careful. diff --git a/popsloader/modules/README.txt b/popsloader/modules/README.txt index afc7201..8b104a7 100644 --- a/popsloader/modules/README.txt +++ b/popsloader/modules/README.txt @@ -218,23 +218,8 @@ The structure of popsloader direcotry must be like this: │   │   ├── pops_02g.prx │   │   ├── pops_03g.prx │   │   ├── pops_04g.prx -│   │   ├── pops_05g.prx -│   │   ├── pops_07g.prx -│   │   ├── pops_09g.prx -│   │   └── popsman.prx -│   ├── 660 -│   │   ├── common_util.prx -│   │   ├── libpspvmc.prx -│   │   ├── pafmini.prx -│   │   ├── popcorn.prx -│   │   ├── pops_01g.prx -│   │   ├── pops_02g.prx -│   │   ├── pops_03g.prx -│   │   ├── pops_04g.prx -│   │   ├── pops_05g.prx │   │   ├── pops_07g.prx │   │   ├── pops_09g.prx -│   │   ├── pops_11g.prx │   │   └── popsman.prx │   ├── impose.rsc │   ├── impose.prx diff --git a/popsloader/popcorn/Makefile b/popsloader/popcorn/Makefile index c42c590..18c5546 100644 --- a/popsloader/popcorn/Makefile +++ b/popsloader/popcorn/Makefile @@ -1,168 +1,174 @@ -all: - $(PRO_HOME)/contrib/pspgz.py popcorn.prx $(PRO_HOME)/contrib/SystemControl.hdr popcorn.prx PROPopcornManager 0x1007 - -TARGET = popcorn - -OBJS = main.o icon.o popcorn_patch_offset.o imports.o $(PRO_HOME)/Stargate/analog_patch.o -OBJS += $(PRO_HOME)/Common/utils.o $(PRO_HOME)/Common/strsafe.o $(PRO_HOME)/Common/libs.o - -CFLAGS = -Os -G0 -Wall -I. -I$(PRO_HOME)/Common -I$(PRO_HOME)/include - -ifeq ($(DEBUG), 1) -CFLAGS += -DDEBUG=1 -OBJS += $(PRO_HOME)/Common/printk.o -else -endif - -ifeq ($(CONFIG_302), 1) -CFLAGS += -DCONFIG_302=1 -PSP_FW_VERSION = 302 -endif - -ifeq ($(CONFIG_303), 1) -CFLAGS += -DCONFIG_303=1 -PSP_FW_VERSION = 303 -endif - -ifeq ($(CONFIG_310), 1) -CFLAGS += -DCONFIG_310=1 -PSP_FW_VERSION = 310 -endif - -ifeq ($(CONFIG_311), 1) -CFLAGS += -DCONFIG_311=1 -PSP_FW_VERSION = 311 -endif - -ifeq ($(CONFIG_330), 1) -CFLAGS += -DCONFIG_330=1 -PSP_FW_VERSION = 330 -endif - -ifeq ($(CONFIG_340), 1) -CFLAGS += -DCONFIG_340=1 -PSP_FW_VERSION = 340 -endif - -ifeq ($(CONFIG_350), 1) -CFLAGS += -DCONFIG_350=1 -PSP_FW_VERSION = 350 -endif - -ifeq ($(CONFIG_351), 1) -CFLAGS += -DCONFIG_351=1 -PSP_FW_VERSION = 351 -endif - -ifeq ($(CONFIG_352), 1) -CFLAGS += -DCONFIG_352=1 -PSP_FW_VERSION = 352 -endif - -ifeq ($(CONFIG_371), 1) -CFLAGS += -DCONFIG_371=1 -PSP_FW_VERSION = 371 -endif - -ifeq ($(CONFIG_372), 1) -CFLAGS += -DCONFIG_372=1 -PSP_FW_VERSION = 372 -endif - -ifeq ($(CONFIG_380), 1) -CFLAGS += -DCONFIG_380=1 -PSP_FW_VERSION = 380 -endif - -ifeq ($(CONFIG_390), 1) -CFLAGS += -DCONFIG_390=1 -PSP_FW_VERSION = 390 -endif - -ifeq ($(CONFIG_393), 1) -CFLAGS += -DCONFIG_393=1 -PSP_FW_VERSION = 393 -endif - -ifeq ($(CONFIG_396), 1) -CFLAGS += -DCONFIG_395=1 -PSP_FW_VERSION = 395 -endif - -ifeq ($(CONFIG_396), 1) -CFLAGS += -DCONFIG_396=1 -PSP_FW_VERSION = 396 -endif - -ifeq ($(CONFIG_401), 1) -CFLAGS += -DCONFIG_401=1 -PSP_FW_VERSION = 401 -endif - -ifeq ($(CONFIG_500), 1) -CFLAGS += -DCONFIG_500=1 -PSP_FW_VERSION = 500 -endif - -ifeq ($(CONFIG_501), 1) -CFLAGS += -DCONFIG_501=1 -PSP_FW_VERSION = 501 -endif - -ifeq ($(CONFIG_503), 1) -CFLAGS += -DCONFIG_503=1 -PSP_FW_VERSION = 503 -endif - -ifeq ($(CONFIG_550), 1) -CFLAGS += -DCONFIG_550=1 -PSP_FW_VERSION = 550 -endif - -ifeq ($(CONFIG_551), 1) -CFLAGS += -DCONFIG_551=1 -PSP_FW_VERSION = 551 -endif - -ifeq ($(CONFIG_600), 1) -CFLAGS += -DCONFIG_600=1 -PSP_FW_VERSION = 600 -endif - -ifeq ($(CONFIG_610), 1) -CFLAGS += -DCONFIG_610=1 -PSP_FW_VERSION = 610 -endif - -ifeq ($(CONFIG_620), 1) -CFLAGS += -DCONFIG_620=1 -PSP_FW_VERSION = 620 -endif - -ifeq ($(CONFIG_635), 1) -CFLAGS += -DCONFIG_635=1 -PSP_FW_VERSION = 635 -endif - -ifeq ($(CONFIG_639), 1) -CFLAGS += -DCONFIG_639=1 -PSP_FW_VERSION = 639 -endif - -ifeq ($(CONFIG_660), 1) -CFLAGS += -DCONFIG_660=1 -PSP_FW_VERSION = 660 -endif - -LDFLAGS = -mno-crt0 -nostartfiles -L. -L$(PRO_HOME)/libs -LIBS += -lpspmodulemgr_kernel -lpspsystemctrl_kernel -lpspkubridge -LIBS += -lpspsemaphore - -BUILD_PRX=1 -PRX_EXPORTS = exports.exp - -USE_KERNEL_LIBS=1 -USE_KERNEL_LIBC=1 - -PSPSDK = $(shell psp-config --pspsdk-path) -include $(PSPSDK)/lib/build.mak +all: + $(PRO_HOME)/contrib/pspgz.py popcorn.prx $(PRO_HOME)/contrib/SystemControl.hdr popcorn.prx PROPopcornManager 0x1007 + +TARGET = popcorn + +OBJS = main.o icon.o popcorn_patch_offset.o imports.o $(PRO_HOME)/Stargate/analog_patch.o +OBJS += $(PRO_HOME)/Common/strsafe.o ../common/libs.o + +CFLAGS = -O3 -G0 -Wall -I. -I$(PRO_HOME)/Common -I$(PRO_HOME)/include +DEBUG=0 +ifeq ($(DEBUG), 1) +CFLAGS += -DDEBUG=1 +OBJS += $(PRO_HOME)/Common/utils.o $(PRO_HOME)/Common/printk.o +else +OBJS += ../common/utils.o ../common/vsnprintf.o +endif + +ifeq ($(CONFIG_302), 1) +CFLAGS += -DCONFIG_302=1 +PSP_FW_VERSION = 302 +endif + +ifeq ($(CONFIG_303), 1) +CFLAGS += -DCONFIG_303=1 +PSP_FW_VERSION = 303 +endif + +ifeq ($(CONFIG_310), 1) +CFLAGS += -DCONFIG_310=1 +PSP_FW_VERSION = 310 +endif + +ifeq ($(CONFIG_311), 1) +CFLAGS += -DCONFIG_311=1 +PSP_FW_VERSION = 311 +endif + +ifeq ($(CONFIG_330), 1) +CFLAGS += -DCONFIG_330=1 +PSP_FW_VERSION = 330 +endif + +ifeq ($(CONFIG_340), 1) +CFLAGS += -DCONFIG_340=1 +PSP_FW_VERSION = 340 +endif + +ifeq ($(CONFIG_350), 1) +CFLAGS += -DCONFIG_350=1 +PSP_FW_VERSION = 350 +endif + +ifeq ($(CONFIG_351), 1) +CFLAGS += -DCONFIG_351=1 +PSP_FW_VERSION = 351 +endif + +ifeq ($(CONFIG_352), 1) +CFLAGS += -DCONFIG_352=1 +PSP_FW_VERSION = 352 +endif + +ifeq ($(CONFIG_371), 1) +CFLAGS += -DCONFIG_371=1 +PSP_FW_VERSION = 371 +endif + +ifeq ($(CONFIG_372), 1) +CFLAGS += -DCONFIG_372=1 +PSP_FW_VERSION = 372 +endif + +ifeq ($(CONFIG_380), 1) +CFLAGS += -DCONFIG_380=1 +PSP_FW_VERSION = 380 +endif + +ifeq ($(CONFIG_390), 1) +CFLAGS += -DCONFIG_390=1 +PSP_FW_VERSION = 390 +endif + +ifeq ($(CONFIG_393), 1) +CFLAGS += -DCONFIG_393=1 +PSP_FW_VERSION = 393 +endif + +ifeq ($(CONFIG_396), 1) +CFLAGS += -DCONFIG_395=1 +PSP_FW_VERSION = 395 +endif + +ifeq ($(CONFIG_396), 1) +CFLAGS += -DCONFIG_396=1 +PSP_FW_VERSION = 396 +endif + +ifeq ($(CONFIG_401), 1) +CFLAGS += -DCONFIG_401=1 +PSP_FW_VERSION = 401 +endif + +ifeq ($(CONFIG_500), 1) +CFLAGS += -DCONFIG_500=1 +PSP_FW_VERSION = 500 +endif + +ifeq ($(CONFIG_501), 1) +CFLAGS += -DCONFIG_501=1 +PSP_FW_VERSION = 501 +endif + +ifeq ($(CONFIG_503), 1) +CFLAGS += -DCONFIG_503=1 +PSP_FW_VERSION = 503 +endif + +ifeq ($(CONFIG_550), 1) +CFLAGS += -DCONFIG_550=1 +PSP_FW_VERSION = 550 +endif + +ifeq ($(CONFIG_551), 1) +CFLAGS += -DCONFIG_551=1 +PSP_FW_VERSION = 551 +endif + +ifeq ($(CONFIG_600), 1) +CFLAGS += -DCONFIG_600=1 +PSP_FW_VERSION = 600 +endif + +ifeq ($(CONFIG_610), 1) +CFLAGS += -DCONFIG_610=1 +PSP_FW_VERSION = 610 +endif + +ifeq ($(CONFIG_620), 1) +CFLAGS += -DCONFIG_620=1 +PSP_FW_VERSION = 620 +endif + +ifeq ($(CONFIG_635), 1) +CFLAGS += -DCONFIG_635=1 +PSP_FW_VERSION = 635 +endif + +ifeq ($(CONFIG_639), 1) +CFLAGS += -DCONFIG_639=1 +PSP_FW_VERSION = 639 +endif + +ifeq ($(CONFIG_660), 1) +CFLAGS += -DCONFIG_660=1 +PSP_FW_VERSION = 660 +endif + +ifeq ($(CONFIG_661), 1) +CFLAGS += -DCONFIG_661=1 +PSP_FW_VERSION = 661 +endif + +LDFLAGS = -mno-crt0 -nostartfiles -L. -L$(PRO_HOME)/libs +LIBS += -lpspmodulemgr_kernel -lpspsystemctrl_kernel -lpspkubridge +LIBS += -lpspsemaphore + +BUILD_PRX=1 +PRX_EXPORTS = exports.exp + +USE_KERNEL_LIBS=1 +USE_KERNEL_LIBC=1 + +PSPSDK = $(shell psp-config --pspsdk-path) +include $(PSPSDK)/lib/build.mak diff --git a/popsloader/popcorn/main.c b/popsloader/popcorn/main.c index c987d49..ca99f94 100644 --- a/popsloader/popcorn/main.c +++ b/popsloader/popcorn/main.c @@ -1,1036 +1,1060 @@ -/* - * This file is part of PRO CFW. - - * PRO CFW is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * PRO CFW is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PRO CFW. If not, see -#include -#include -#include -#include -#include - -#include "pspmodulemgr_kernel.h" -#include "systemctrl.h" -#include "systemctrl_se.h" -#include "printk.h" -#include "utils.h" -#include "strsafe.h" -#include "libs.h" -#include "popcorn_patch_offset.h" - -struct Hooks { - u32 nid; - void *fp; -}; - -extern void patch_analog_imports(SceModule *mod); -extern int sceKernelRegisterGetIdFunc(int (*)(char *path, u8 *key)); - -SEConfig conf; - -enum { - ICON0_OK = 0, - ICON0_MISSING = 1, - ICON0_CORRUPTED = 2, -}; - -PSP_MODULE_INFO("PROPopcornManager", 0x1007, 1, 1); - -#define PGD_ID "XX0000-XXXX00000_00-XXXXXXXXXX000XXX" -#define ACT_DAT "flash2:/act.dat" - -#define RIF_MAGIC_FD 0x10000 -#define ACT_DAT_FD 0x10001 - -extern u8 g_icon_png[0x3730]; - -static u32 g_icon0_status; -static u32 g_keys_bin_found; -static u32 g_is_custom_ps1; -static SceUID g_plain_doc_fd = -1; - -static STMOD_HANDLER g_previous = NULL; - -static u8 g_keys[16]; - -u32 psp_fw_version = 0; -u32 psp_model = 0; - -int myIoRead(int fd, u8 *buf, int size) -{ - int ret; - u32 pos; - u32 k1; - - k1 = pspSdkSetK1(0); - - if(fd != RIF_MAGIC_FD && fd != ACT_DAT_FD) { - pos = sceIoLseek32(fd, 0, SEEK_CUR); - } else { - pos = 0; - } - - if(g_keys_bin_found || g_is_custom_ps1) { - if(fd == RIF_MAGIC_FD) { - size = 152; - printk("%s: fake rif content %d\n", __func__, size); - memset(buf, 0, size); - strcpy((char*)(buf+0x10), PGD_ID); - ret = size; - goto exit; - } else if (fd == ACT_DAT_FD) { - printk("%s: fake act.dat content %d\n", __func__, size); - memset(buf, 0, size); - ret = size; - goto exit; - } - } - - ret = sceIoRead(fd, buf, size); - - if(ret != size) { - goto exit; - } - - if (size == 4) { - u32 magic; - - magic = 0x464C457F; // ~ELF - - if(0 == memcmp(buf, &magic, sizeof(magic))) { - magic = 0x5053507E; // ~PSP - memcpy(buf, &magic, sizeof(magic)); - printk("%s: patch ~ELF -> ~PSP\n", __func__); - } - - ret = size; - goto exit; - } - - if(size == sizeof(g_icon_png)) { - u32 png_signature = 0x474E5089; - - if(g_icon0_status == ICON0_MISSING || ((g_icon0_status == ICON0_CORRUPTED) && 0 == memcmp(buf, &png_signature, 4))) { - printk("%s: fakes a PNG for icon0\n", __func__); - memcpy(buf, g_icon_png, size); - - ret = size; - goto exit; - } - } - - if (g_is_custom_ps1 && size >= 0x420 && buf[0x41B] == 0x27 && - buf[0x41C] == 0x19 && - buf[0x41D] == 0x22 && - buf[0x41E] == 0x41 && - buf[0x41A] == buf[0x41F]) { - buf[0x41B] = 0x55; - printk("%s: unknown patch loc_6c\n", __func__); - } - -exit: - pspSdkSetK1(k1); - printk("%s: fd=0x%08X pos=0x%08X size=%d -> 0x%08X\n", __func__, (uint)fd, (uint)pos, (int)size, ret); - - return ret; -} - -int myIoReadAsync(int fd, u8 *buf, int size) -{ - int ret; - u32 pos; - u32 k1; - - k1 = pspSdkSetK1(0); - pos = sceIoLseek32(fd, 0, SEEK_CUR); - ret = sceIoReadAsync(fd, buf, size); - printk("%s: 0x%08X 0x%08X 0x%08X -> 0x%08X\n", __func__, (uint)fd, (uint)pos, size, ret); - pspSdkSetK1(k1); - - return ret; -} - -SceOff myIoLseek(SceUID fd, SceOff offset, int whence) -{ - SceOff ret; - u32 k1; - - k1 = pspSdkSetK1(0); - - if(g_keys_bin_found || g_is_custom_ps1) { - if (fd == RIF_MAGIC_FD) { - printk("%s: [FAKE]\n", __func__); - ret = 0; - } else if (fd == ACT_DAT_FD) { - printk("%s: [FAKE]\n", __func__); - ret = 0; - } else { - ret = sceIoLseek(fd, offset, whence); - } - } else { - ret = sceIoLseek(fd, offset, whence); - } - - pspSdkSetK1(k1); - printk("%s: 0x%08X 0x%08X 0x%08X -> 0x%08X\n", __func__, (uint)fd, (uint)offset, (uint)whence, (int)ret); - - return ret; -} - -int myIoClose(SceUID fd) -{ - int ret; - u32 k1; - - k1 = pspSdkSetK1(0); - - if(g_keys_bin_found || g_is_custom_ps1) { - if (fd == RIF_MAGIC_FD) { - printk("%s: [FAKE]\n", __func__); - ret = 0; - } else if (fd == ACT_DAT_FD) { - printk("%s: [FAKE]\n", __func__); - ret = 0; - } else { - ret = sceIoClose(fd); - } - } else { - ret = sceIoClose(fd); - } - - if(g_plain_doc_fd == fd && ret == 0) { - g_plain_doc_fd = -1; - } - - pspSdkSetK1(k1); - printk("%s: 0x%08X -> 0x%08X\n", __func__, fd, ret); - - return ret; -} - -static const char *get_filename(const char *path) -{ - const char *p; - - if(path == NULL) { - return NULL; - } - - p = strrchr(path, '/'); - - if(p == NULL) { - p = path; - } else { - p++; - } - - return p; -} - -static int is_eboot_pbp_path(const char *path) -{ - const char *p; - - p = get_filename(path); - - if(p != NULL && 0 == strcmp(p, "EBOOT.PBP")) { - return 1; - } - - return 0; -} - -static int check_file_is_decrypted(const char *filename) -{ - SceUID fd = -1; - u32 k1; - int result = 0, ret; - u8 p[16 + 64], *buf; - u32 *magic; - - buf = (u8*)((((u32)p) & ~(64-1)) + 64); - - if(!g_is_custom_ps1 && is_eboot_pbp_path(filename)) { - goto exit; - } - - k1 = pspSdkSetK1(0); - fd = sceIoOpen(filename, PSP_O_RDONLY, 0777); - - if(fd < 0) { - goto exit; - } - - ret = sceIoRead(fd, buf, 16); - - if(ret != 16) { - goto exit; - } - - magic = (u32*)buf; - - if(*magic == 0x44475000) { // PGD - goto exit; - } - - result = 1; - -exit: - if(fd >= 0) { - sceIoClose(fd); - } - - pspSdkSetK1(k1); - - return result; -} - -static int is_document_path(const char *path) -{ - const char *p; - - p = get_filename(path); - - if(p != NULL && 0 == strcmp(p, "DOCUMENT.DAT")) { - return 1; - } - - return 0; -} - -static int sceIoOpenPlain(const char *file, int flag, int mode) -{ - int ret; - - if(flag == 0x40000001 && check_file_is_decrypted(file)) { - printk("%s: removed PGD open flag\n", __func__); - ret = sceIoOpen(file, flag & ~0x40000000, mode); - - if(ret >= 0 && is_document_path(file)) { - g_plain_doc_fd = ret; - } - } else { - ret = sceIoOpen(file, flag, mode); - } - - return ret; -} - -int myIoOpen(const char *file, int flag, int mode) -{ - int ret; - - if(g_keys_bin_found || g_is_custom_ps1) { - if(strstr(file, PGD_ID)) { - printk("%s: [FAKE]\n", __func__); - ret = RIF_MAGIC_FD; - } else if (0 == strcmp(file, ACT_DAT)) { - printk("%s: [FAKE]\n", __func__); - ret = ACT_DAT_FD; - } else { - ret = sceIoOpenPlain(file, flag, mode); - } - } else { - ret = sceIoOpenPlain(file, flag, mode); - } - - printk("%s: %s 0x%08X -> 0x%08X\n", __func__, file, flag, ret); - - return ret; -} - -int myIoIoctl(SceUID fd, unsigned int cmd, void * indata, int inlen, void * outdata, int outlen) -{ - int ret; - - if(cmd == 0x04100001) { - printk("%s: setting PGD key\n", __func__); - hexdump(indata, inlen); - } - - if(cmd == 0x04100002) { - printk("%s: setting PGD offset: 0x%08X\n", __func__, *(uint*)indata); - } - - if (g_is_custom_ps1 || (g_plain_doc_fd >= 0 && g_plain_doc_fd == fd)) { - if (cmd == 0x04100001) { - ret = 0; - printk("%s: [FAKE] 0x%08X 0x%08X -> 0x%08X\n", __func__, fd, cmd, ret); - goto exit; - } - - if (cmd == 0x04100002) { - ret = sceIoLseek32(fd, *(u32*)indata, PSP_SEEK_SET); - - if(ret < 0) { - printk("%s: sceIoLseek32 -> 0x%08X\n", __func__, ret); - } - - ret = 0; - printk("%s: [FAKE] 0x%08X 0x%08X -> 0x%08X\n", __func__, fd, cmd, ret); - goto exit; - } - } - - ret = sceIoIoctl(fd, cmd, indata, inlen, outdata, outlen); - -exit: - printk("%s: 0x%08X -> 0x%08X\n", __func__, fd, ret); - - return ret; -} - -int myIoGetstat(const char *path, SceIoStat *stat) -{ - int ret; - - if(g_keys_bin_found || g_is_custom_ps1) { - if(strstr(path, PGD_ID)) { - stat->st_mode = 0x21FF; - stat->st_attr = 0x20; - stat->st_size = 152; - ret = 0; - printk("%s: [FAKE]\n", __func__); - } else if (0 == strcmp(path, ACT_DAT)) { - stat->st_mode = 0x21FF; - stat->st_attr = 0x20; - stat->st_size = 4152; - ret = 0; - printk("%s: [FAKE]\n", __func__); - } else { - ret = sceIoGetstat(path, stat); - } - } else { - ret = sceIoGetstat(path, stat); - } - - printk("%s: %s -> 0x%08X\n", __func__, path, ret); - - return ret; -} - -static int (*_get_rif_path)(const char *name, char *path) = NULL; - -static int get_rif_path(char *name, char *path) -{ - int ret; - - if(g_keys_bin_found || g_is_custom_ps1) { - strcpy(name, PGD_ID); - } - - ret = (*_get_rif_path)(name, path); - printk("%s: %s %s -> 0x%08X\n", __func__, name, path, ret); - - return ret; -} - -static int get_keypath(char *keypath, int size) -{ - char *p; - - strcpy_s(keypath, size, sceKernelInitFileName()); - p = strrchr(keypath, '/'); - - if(p == NULL) { - return -1; - } - - p[1] = '\0'; - strcat_s(keypath, size, "KEYS.BIN"); - - return 0; -} - -static int save_key(const char *keypath, u8 *key, int size) -{ - SceUID keys; - int ret; - - keys = sceIoOpen(keypath, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777); - - if (keys < 0) { - return -1; - } - - ret = sceIoWrite(keys, key, size); - - if(ret == size) { - ret = 0; - } else { - ret = -2; - } - - sceIoClose(keys); - - return ret; -} - -static int load_key(const char *keypath, u8 *key, int size) -{ - SceUID keys; - int ret; - - keys = sceIoOpen(keypath, PSP_O_RDONLY, 0777); - - if (keys < 0) { - printk("%s: sceIoOpen %s -> 0x%08X\n", __func__, keypath, keys); - - return -1; - } - - ret = sceIoRead(keys, key, size); - - if (ret == size) { - ret = 0; - } else { - ret = -2; - } - - sceIoClose(keys); - - return ret; -} - -static int (*sceNpDrmGetVersionKey)(u8 * key, u8 * act, u8 * rif, u32 flags); - -static int _sceNpDrmGetVersionKey(u8 * key, u8 * act, u8 * rif, u32 flags) -{ - char keypath[128]; - int ret, result; - - result = (*sceNpDrmGetVersionKey)(key, act, rif, flags); - - if (g_is_custom_ps1) { - printk("%s: -> 0x%08X\n", __func__, result); - result = 0; - - if (g_keys_bin_found) { - memcpy(key, g_keys, sizeof(g_keys)); - } - - printk("%s:[FAKE] -> 0x%08X\n", __func__, result); - } else { - get_keypath(keypath, sizeof(keypath)); - - if (result == 0) { - memcpy(g_keys, key, sizeof(g_keys)); - ret = save_key(keypath, g_keys, sizeof(g_keys)); - printk("%s: save_key -> %d\n", __func__, ret); - } else { - if (g_keys_bin_found) { - memcpy(key, g_keys, sizeof(g_keys)); - result = 0; - } - } - } - - return result; -} - -static int (*scePspNpDrm_driver_9A34AC9F)(u8 *rif); - -static int _scePspNpDrm_driver_9A34AC9F(u8 *rif) -{ - int result; - - result = (*scePspNpDrm_driver_9A34AC9F)(rif); - printk("%s: 0x%08X -> 0x%08X\n", __func__, (uint)rif, result); - - if (result != 0) { - if (g_keys_bin_found || g_is_custom_ps1) { - result = 0; - printk("%s:[FAKE] -> 0x%08X\n", __func__, result); - } - } - - return result; -} - -static int _sceDrmBBCipherUpdate(void *ckey, u8 *data, int size) -{ - return 0; -} - -static int _sceDrmBBCipherInit(void *ckey, int type, int mode, u8 *header_key, u8 *version_key, u32 seed) -{ - return 0; -} - -static int _sceDrmBBMacInit(void *mkey, int type) -{ - return 0; -} - -static int _sceDrmBBMacUpdate(void *mkey, u8 *buf, int size) -{ - return 0; -} - -static int _sceDrmBBCipherFinal(void *ckey) -{ - return 0; -} - -static int _sceDrmBBMacFinal(void *mkey, u8 *buf, u8 *vkey) -{ - return 0; -} - -static int _sceDrmBBMacFinal2(void *mkey, u8 *out, u8 *vkey) -{ - return 0; -} - -static struct Hooks g_io_hooks[] = { - { 0x109F50BC, &myIoOpen, }, - { 0x27EB27B8, &myIoLseek, }, - { 0x63632449, &myIoIoctl, }, - { 0x6A638D83, &myIoRead, }, - { 0xA0B5A7C2, &myIoReadAsync, }, - { 0xACE946E8, &myIoGetstat, }, - { 0x810C4BC3, &myIoClose, }, -}; - -static struct Hooks g_amctrl_hooks[] = { - { 0x1CCB66D2, &_sceDrmBBCipherInit, }, - { 0x0785C974, &_sceDrmBBCipherUpdate, }, - { 0x9951C50F, &_sceDrmBBCipherFinal, }, - { 0x525B8218, &_sceDrmBBMacInit, }, - { 0x58163FBE, &_sceDrmBBMacUpdate, }, - { 0xEF95A213, &_sceDrmBBMacFinal, }, - { 0xF5186D8E, &_sceDrmBBMacFinal2, }, -}; - -static void patch_scePops_Manager(void) -{ - SceModule2 *mod; - u32 text_addr; - int i; - - mod = (SceModule2*) sceKernelFindModuleByName("scePops_Manager"); - text_addr = mod->text_addr; - - for(i=0; ipopsman_patch.get_rif_path != 0xDEADBEEF) { - _get_rif_path = (void*)(text_addr + g_offs->popsman_patch.get_rif_path); - _sw(MAKE_CALL(&get_rif_path), text_addr + g_offs->popsman_patch.get_rif_path_call1); - _sw(MAKE_CALL(&get_rif_path), text_addr + g_offs->popsman_patch.get_rif_path_call2); - } - - sceNpDrmGetVersionKey = (void*)sctrlHENFindFunction("scePspNpDrm_Driver", "scePspNpDrm_driver", 0x0F9547E6); - scePspNpDrm_driver_9A34AC9F = (void*)sctrlHENFindFunction("scePspNpDrm_Driver", "scePspNpDrm_driver", 0x9A34AC9F); - - if(g_offs->popsman_patch.sceNpDrmGetVersionKeyCall != 0xDEADBEEF) { - _sw(MAKE_CALL(_sceNpDrmGetVersionKey), text_addr + g_offs->popsman_patch.sceNpDrmGetVersionKeyCall); - } - - if(g_offs->popsman_patch.scePspNpDrm_driver_9A34AC9F_Call != 0xDEADBEEF) { - _sw(MAKE_CALL(_scePspNpDrm_driver_9A34AC9F), text_addr + g_offs->popsman_patch.scePspNpDrm_driver_9A34AC9F_Call); - } - - // remove the check in scePopsManLoadModule that only allows loading module below the FW 3.XX - if(g_offs->popsman_patch.scePopsManLoadModuleCheck != 0xDEADBEEF) { - _sw(NOP, text_addr + g_offs->popsman_patch.scePopsManLoadModuleCheck); - } - - if (g_is_custom_ps1) { - for(i=0; i 0x%08X\n", __func__, filename, fd); - result = 0; - goto exit; - } - - ret = sceIoRead(fd, header, 40); - - if(ret != 40) { - printk("%s: sceIoRead -> 0x%08X\n", __func__, ret); - result = 0; - goto exit; - } - - psar_offset = *(u32*)(header+0x24); - sceIoLseek32(fd, psar_offset, PSP_SEEK_SET); - ret = sceIoRead(fd, header, 40); - - if(ret != 40) { - printk("%s: sceIoRead -> 0x%08X\n", __func__, ret); - result = 0; - goto exit; - } - - pgd_offset = psar_offset; - - if(0 == memcmp(header, "PSTITLE", sizeof("PSTITLE")-1)) { - pgd_offset += 0x200; - } else { - pgd_offset += 0x400; - } - - sceIoLseek32(fd, pgd_offset, PSP_SEEK_SET); - ret = sceIoRead(fd, header, 4); - - if(ret != 4) { - printk("%s: sceIoRead -> 0x%08X\n", __func__, ret); - result = 0; - goto exit; - } - - magic = (u32*)header; - - // PGD offset - if(*magic != 0x44475000) { - printk("%s: custom pops found\n", __func__); - result = 1; - } - -exit: - if(fd >= 0) { - sceIoClose(fd); - } - - return result; -} - -static int place_syscall_stub(void* func, void *addr) -{ - u32 syscall_num; - extern u32 sceKernelQuerySystemCall(void *func); - - syscall_num = sceKernelQuerySystemCall(func); - - if(syscall_num == (u32)-1) { - return -1; - } - - _sw(0x03E00008, (u32)addr); - _sw(((syscall_num<<6)|12), (u32)(addr+4)); - - return 0; -} - -static void reboot_vsh_with_error(u32 error) -{ - struct SceKernelLoadExecVSHParam param; - u32 vshmain_args[0x20/4]; - - memset(¶m, 0, sizeof(param)); - memset(vshmain_args, 0, sizeof(vshmain_args)); - - vshmain_args[0/4] = 0x0400; - vshmain_args[4/4] = 0x20; - vshmain_args[0x14/4] = error; - - param.size = sizeof(param); - param.args = 0x400; - param.argp = vshmain_args; - param.vshmain_args_size = 0x400; - param.vshmain_args = vshmain_args; - param.configfile = "/kd/pspbtcnf.txt"; - - sctrlKernelExitVSH(¶m); -} - -int decompress_data(u32 destSize, const u8 *src, u8 *dest) -{ - u32 k1; - int ret; - - k1 = pspSdkSetK1(0); - - if (destSize < 0) { - reboot_vsh_with_error((u32)destSize); - pspSdkSetK1(k1); - - return 0; - } - - ret = sceKernelDeflateDecompress(dest, destSize, src, 0); - printk("%s: 0x%08X 0x%08X 0x%08X -> 0x%08X\n", __func__, (uint)destSize, (uint)src, (uint)dest, ret); - - if(ret >= 0) { - if(psp_fw_version >= FW_380) { - ret = 0x92FF; - } else { - ret = 0x9300; - } - - printk("%s: [FAKE] -> 0x%08X\n", __func__, ret); - } - - pspSdkSetK1(k1); - - return ret; -} - -int decompress_data_371(u8 *dest, u32 destSize, const u8 *src) -{ - return decompress_data(destSize, src, dest); -} - -static int patch_decompress_data(u32 text_addr) -{ - int ret; - void *stub_addr, *patch_addr; - - stub_addr = (void*)(text_addr + g_offs->pops_patch.decomp[psp_model].stub_offset); - patch_addr = (void*)(text_addr + g_offs->pops_patch.decomp[psp_model].patch_offset); - - if(psp_fw_version <= FW_371) { - ret = place_syscall_stub(decompress_data_371, stub_addr); - } else { - ret = place_syscall_stub(decompress_data, stub_addr); - } - - if (ret != 0) { - printk("%s: place_syscall_stub -> 0x%08X\n", __func__, ret); - - return -1; - } - - _sw(MAKE_CALL(stub_addr), (u32)patch_addr); - - return 0; -} - -static void patch_icon0_size(u32 text_addr) -{ - u32 patch_addr; - - patch_addr = text_addr + g_offs->pops_patch.ICON0SizeOffset[psp_model]; - - if(psp_fw_version <= FW_352) { - _sw(0x24030000 | (sizeof(g_icon_png) & 0xFFFF), patch_addr); - } else if(psp_fw_version <= FW_372) { - _sw(0x24090000 | (sizeof(g_icon_png) & 0xFFFF), patch_addr); - } else { - _sw(0x24050000 | (sizeof(g_icon_png) & 0xFFFF), patch_addr); - } -} - -static int (*sceMeAudio_67CD7972)(void *buf, int size); - -int _sceMeAudio_67CD7972(void *buf, int size) -{ - int ret; - u32 k1; - - k1 = pspSdkSetK1(0); - ret = (*sceMeAudio_67CD7972)(buf, size); - pspSdkSetK1(k1); - - printk("%s: 0x%08X -> 0x%08X\n", __func__, size, ret); - - return ret; -} - -static int popcorn_patch_chain(SceModule2 *mod) -{ - printk("%s: %s\n", __func__, mod->modname); - - if (0 == strcmp(mod->modname, "pops")) { - u32 text_addr = mod->text_addr; - int i; - - printk("%s: patching pops\n", __func__); - - if(g_is_custom_ps1) { - patch_decompress_data(text_addr); - } - - if(g_icon0_status) { - patch_icon0_size(text_addr); - } - - if(psp_fw_version <= FW_352) { - sceMeAudio_67CD7972 = (void*)sctrlHENFindFunction("scePops_Manager", "scePopsMan", g_offs->pops_patch.sceMeAudio_67CD7972_NID); - hook_import_bynid((SceModule*)mod, "scePopsMan", g_offs->pops_patch.sceMeAudio_67CD7972_NID, _sceMeAudio_67CD7972, 1); - } else { - sceMeAudio_67CD7972 = (void*)sctrlHENFindFunction("scePops_Manager", "sceMeAudio", g_offs->pops_patch.sceMeAudio_67CD7972_NID); - hook_import_bynid((SceModule*)mod, "sceMeAudio", g_offs->pops_patch.sceMeAudio_67CD7972_NID, _sceMeAudio_67CD7972, 1); - } - - if(g_offs->pops_patch.manualNameCheck[psp_model] != 0xDEADBEEF) { - _sw(0x24020001, text_addr + g_offs->pops_patch.manualNameCheck[psp_model]); - } - - for(i=0; i 0x%08X\n", __func__, filename, fd); - goto exit; - } - - sceIoRead(fd, header, 40); - icon0_offset = *(u32*)(header+0x0c); - sceIoLseek32(fd, icon0_offset, PSP_SEEK_SET); - sceIoRead(fd, header, 40); - - if(*(u32*)(header+4) == 0xA1A0A0D) { - if ( *(u32*)(header+0xc) == 0x52444849 && // IHDR - *(u32*)(header+0x10) == 0x50000000 && // - *(u32*)(header+0x14) == *(u32*)(header+0x10) - ) { - result = ICON0_OK; - } else { - result = ICON0_CORRUPTED; - } - } else { - result = ICON0_MISSING; - } - - printk("%s: PNG file status -> %d\n", __func__, result); - -exit: - if(fd >= 0) { - sceIoClose(fd); - } - - return result; -} - -static void setup_psx_fw_version(u32 fw_version) -{ - int (*_SysMemUserForUser_315AD3A0)(u32 fw_version); - - _SysMemUserForUser_315AD3A0 = (void*)sctrlHENFindFunction("sceSystemMemoryManager", "SysMemUserForUser", 0x315AD3A0); - - if (_SysMemUserForUser_315AD3A0 == NULL) { - printk("_SysMemUserForUser_315AD3A0 not found\n"); - reboot_vsh_with_error(0x80000001); - } - - _SysMemUserForUser_315AD3A0(fw_version); -} - -static int get_keys(char *filename, u8 *keys) -{ - memcpy(keys, g_keys, sizeof(g_keys)); - - return 0; -} - -int module_start(SceSize args, void* argp) -{ - char keypath[128]; - int ret; - SceIoStat stat; - - if(args != 4) { - return 1; - } - - psp_fw_version = *(u32*)argp; - setup_patch_offset_table(psp_fw_version); - psp_model = sceKernelGetModel(); - memset(&conf, 0, sizeof(conf)); - sctrlSEGetConfig(&conf); - printk_init("ms0:/popcorn.txt"); - printk("Popcorn: init_file = %s psp_fw_version = 0x%08X psp_model = %d\n", sceKernelInitFileName(), (uint)psp_fw_version, (int)psp_model); - - get_keypath(keypath, sizeof(keypath)); - ret = sceIoGetstat(keypath, &stat); - g_keys_bin_found = 0; - - sceKernelRegisterGetIdFunc(&get_keys); - - if(ret == 0) { - ret = load_key(keypath, g_keys, sizeof(g_keys)); - - if(ret == 0) { - g_keys_bin_found = 1; - printk("keys.bin found\n"); - } - } - - g_is_custom_ps1 = is_custom_ps1(); - g_icon0_status = get_icon0_status(); - - if(g_is_custom_ps1) { - setup_psx_fw_version(psp_fw_version); - } - - g_previous = sctrlHENSetStartModuleHandler(&popcorn_patch_chain); - patch_scePops_Manager(); - sync_cache(); - - return 0; -} - -int module_stop(SceSize args, void *argp) -{ - return 0; -} +/* + * This file is part of PRO CFW. + + * PRO CFW is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * PRO CFW is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PRO CFW. If not, see +#include +#include +#include +#include +#include + +#include "pspmodulemgr_kernel.h" +#include "systemctrl.h" +#include "systemctrl_se.h" +#include "printk.h" +#include "utils.h" +#include "strsafe.h" +#include "libs.h" +#include "popcorn_patch_offset.h" + +#include "../common/me_fw.h" + +#ifdef DEBUG +int (*myprintk)(char *fmt, ...); +int printk_void(char *fmt, ...){} +#else +#define myprintk(...) +#endif + +struct Hooks { + u32 nid; + void *fp; +}; + +extern void patch_analog_imports(SceModule *mod); +extern int sceKernelRegisterGetIdFunc(int (*)(char *path, u8 *key)); + +SEConfig conf; + +enum { + ICON0_OK = 0, + ICON0_MISSING = 1, + ICON0_CORRUPTED = 2, +}; + +PSP_MODULE_INFO("PROPopcornManager", 0x1007, 1, 1); + +#define PGD_ID "XX0000-XXXX00000_00-XXXXXXXXXX000XXX" +#define ACT_DAT "flash2:/act.dat" + +#define RIF_MAGIC_FD 0x10000 +#define ACT_DAT_FD 0x10001 + +extern u8 g_icon_png[0x3730]; + +static u32 g_icon0_status; +static u32 g_keys_bin_found; +static u32 g_is_custom_ps1; +static SceUID g_plain_doc_fd = -1; + +static STMOD_HANDLER g_previous = NULL; + +static u8 g_keys[16]; + +u32 psp_fw_version = 0; +u32 psp_model = 0; + +int myIoRead(int fd, u8 *buf, int size) +{ + int ret; + u32 pos; + u32 k1; + + k1 = pspSdkSetK1(0); + + if(fd != RIF_MAGIC_FD && fd != ACT_DAT_FD) { + pos = sceIoLseek32(fd, 0, SEEK_CUR); + } else { + pos = 0; + } + + if(g_keys_bin_found || g_is_custom_ps1) { + if(fd == RIF_MAGIC_FD) { + size = 152; + myprintk("%s: fake rif content %d\n", __func__, size); + memset(buf, 0, size); + strcpy((char*)(buf+0x10), PGD_ID); + ret = size; + goto exit; + } else if (fd == ACT_DAT_FD) { + myprintk("%s: fake act.dat content %d\n", __func__, size); + memset(buf, 0, size); + ret = size; + goto exit; + } + } + + ret = sceIoRead(fd, buf, size); + + if(ret != size) { + goto exit; + } + + if (size == 4) { + u32 magic; + + magic = 0x464C457F; // ~ELF + + if(0 == memcmp(buf, &magic, sizeof(magic))) { + magic = 0x5053507E; // ~PSP + memcpy(buf, &magic, sizeof(magic)); + myprintk("%s: patch ~ELF -> ~PSP\n", __func__); + } + + ret = size; + goto exit; + } + + if(size == sizeof(g_icon_png)) { + u32 png_signature = 0x474E5089; + + if(g_icon0_status == ICON0_MISSING || ((g_icon0_status == ICON0_CORRUPTED) && 0 == memcmp(buf, &png_signature, 4))) { + myprintk("%s: fakes a PNG for icon0\n", __func__); + memcpy(buf, g_icon_png, size); + + ret = size; + goto exit; + } + } + + if (g_is_custom_ps1 && size >= 0x420 && buf[0x41B] == 0x27 && + buf[0x41C] == 0x19 && + buf[0x41D] == 0x22 && + buf[0x41E] == 0x41 && + buf[0x41A] == buf[0x41F]) { + buf[0x41B] = 0x55; + myprintk("%s: unknown patch loc_6c\n", __func__); + } + +exit: + pspSdkSetK1(k1); + myprintk("%s: fd=0x%08X pos=0x%08X size=%d -> 0x%08X\n", __func__, (uint)fd, (uint)pos, (int)size, ret); + + return ret; +} + +int myIoReadAsync(int fd, u8 *buf, int size) +{ + int ret; + u32 pos; + u32 k1; + + k1 = pspSdkSetK1(0); + pos = sceIoLseek32(fd, 0, SEEK_CUR); + ret = sceIoReadAsync(fd, buf, size); + myprintk("%s: 0x%08X 0x%08X 0x%08X -> 0x%08X\n", __func__, (uint)fd, (uint)pos, size, ret); + pspSdkSetK1(k1); + + return ret; +} + +SceOff myIoLseek(SceUID fd, SceOff offset, int whence) +{ + SceOff ret; + u32 k1; + + k1 = pspSdkSetK1(0); + + if(g_keys_bin_found || g_is_custom_ps1) { + if (fd == RIF_MAGIC_FD) { + myprintk("%s: [FAKE]\n", __func__); + ret = 0; + } else if (fd == ACT_DAT_FD) { + myprintk("%s: [FAKE]\n", __func__); + ret = 0; + } else { + ret = sceIoLseek(fd, offset, whence); + } + } else { + ret = sceIoLseek(fd, offset, whence); + } + + pspSdkSetK1(k1); + myprintk("%s: 0x%08X 0x%08X 0x%08X -> 0x%08X\n", __func__, (uint)fd, (uint)offset, (uint)whence, (int)ret); + + return ret; +} + +int myIoClose(SceUID fd) +{ + int ret; + u32 k1; + + k1 = pspSdkSetK1(0); + + if(g_keys_bin_found || g_is_custom_ps1) { + if (fd == RIF_MAGIC_FD) { + myprintk("%s: [FAKE]\n", __func__); + ret = 0; + } else if (fd == ACT_DAT_FD) { + myprintk("%s: [FAKE]\n", __func__); + ret = 0; + } else { + ret = sceIoClose(fd); + } + } else { + ret = sceIoClose(fd); + } + + if(g_plain_doc_fd == fd && ret == 0) { + g_plain_doc_fd = -1; + } + + pspSdkSetK1(k1); + myprintk("%s: 0x%08X -> 0x%08X\n", __func__, fd, ret); + + return ret; +} + +static const char *get_filename(const char *path) +{ + const char *p; + + if(path == NULL) { + return NULL; + } + + p = strrchr(path, '/'); + + if(p == NULL) { + p = path; + } else { + p++; + } + + return p; +} + +static int is_eboot_pbp_path(const char *path) +{ + const char *p; + + p = get_filename(path); + + if(p != NULL && 0 == strcmp(p, "EBOOT.PBP")) { + return 1; + } + + return 0; +} + +static int check_file_is_decrypted(const char *filename) +{ + SceUID fd; + u32 k1; + int result = 0, ret; + u8 p[16 + 64], *buf; + u32 *magic; + + buf = (u8*)((((u32)p) & ~(64-1)) + 64); + + k1 = pspSdkSetK1(0); + if(!g_is_custom_ps1 && is_eboot_pbp_path(filename)) { + return 0; + } + + fd = sceIoOpen(filename, PSP_O_RDONLY, 0777); + + if(fd < 0) { + goto exit; + } + + ret = sceIoRead(fd, buf, 16); + + if(ret != 16) { + goto exit; + } + + magic = (u32*)buf; + + if(*magic == 0x44475000) { // PGD + goto exit; + } + + result = 1; + +exit: + if(fd >= 0) { + sceIoClose(fd); + } + + pspSdkSetK1(k1); + + return result; +} + +static int is_document_path(const char *path) +{ + const char *p; + + p = get_filename(path); + + if(p != NULL && 0 == strcmp(p, "DOCUMENT.DAT")) { + return 1; + } + + return 0; +} + +static int sceIoOpenPlain(const char *file, int flag, int mode) +{ + int ret; + + if(flag == 0x40000001 && check_file_is_decrypted(file)) { + myprintk("%s: removed PGD open flag\n", __func__); + ret = sceIoOpen(file, flag & ~0x40000000, mode); + + if(ret >= 0 && is_document_path(file)) { + g_plain_doc_fd = ret; + } + } else { + ret = sceIoOpen(file, flag, mode); + } + + return ret; +} + +int myIoOpen(const char *file, int flag, int mode) +{ + int ret; + + if(g_keys_bin_found || g_is_custom_ps1) { + if(strstr(file, PGD_ID)) { + myprintk("%s: [FAKE]\n", __func__); + ret = RIF_MAGIC_FD; + } else if (0 == strcmp(file, ACT_DAT)) { + myprintk("%s: [FAKE]\n", __func__); + ret = ACT_DAT_FD; + } else { + ret = sceIoOpenPlain(file, flag, mode); + } + } else { + ret = sceIoOpenPlain(file, flag, mode); + } + + myprintk("%s: %s 0x%08X -> 0x%08X\n", __func__, file, flag, ret); + + return ret; +} + +int myIoIoctl(SceUID fd, unsigned int cmd, void * indata, int inlen, void * outdata, int outlen) +{ + int ret; + + if(cmd == 0x04100001) { + myprintk("%s: setting PGD key\n", __func__); + hexdump(indata, inlen); + } + + if(cmd == 0x04100002) { + myprintk("%s: setting PGD offset: 0x%08X\n", __func__, *(uint*)indata); + } + + if (g_is_custom_ps1 || (g_plain_doc_fd >= 0 && g_plain_doc_fd == fd)) { + if (cmd == 0x04100001) { + ret = 0; + myprintk("%s: [FAKE] 0x%08X 0x%08X -> 0x%08X\n", __func__, fd, cmd, ret); + goto exit; + } + + if (cmd == 0x04100002) { + ret = sceIoLseek32(fd, *(u32*)indata, PSP_SEEK_SET); + + if(ret < 0) { + myprintk("%s: sceIoLseek32 -> 0x%08X\n", __func__, ret); + } + + ret = 0; + myprintk("%s: [FAKE] 0x%08X 0x%08X -> 0x%08X\n", __func__, fd, cmd, ret); + goto exit; + } + } + + ret = sceIoIoctl(fd, cmd, indata, inlen, outdata, outlen); + +exit: + myprintk("%s: 0x%08X -> 0x%08X\n", __func__, fd, ret); + + return ret; +} + +int myIoGetstat(const char *path, SceIoStat *stat) +{ + int ret; + + if(g_keys_bin_found || g_is_custom_ps1) { + if(strstr(path, PGD_ID)) { + stat->st_mode = 0x21FF; + stat->st_attr = 0x20; + stat->st_size = 152; + ret = 0; + myprintk("%s: [FAKE]\n", __func__); + } else if (0 == strcmp(path, ACT_DAT)) { + stat->st_mode = 0x21FF; + stat->st_attr = 0x20; + stat->st_size = 4152; + ret = 0; + myprintk("%s: [FAKE]\n", __func__); + } else { + ret = sceIoGetstat(path, stat); + } + } else { + ret = sceIoGetstat(path, stat); + } + + myprintk("%s: %s -> 0x%08X\n", __func__, path, ret); + + return ret; +} + +static int (*_get_rif_path)(const char *name, char *path) = NULL; + +static int get_rif_path(char *name, char *path) +{ + int ret; + + if(g_keys_bin_found || g_is_custom_ps1) { + strcpy(name, PGD_ID); + } + + ret = (*_get_rif_path)(name, path); + myprintk("%s: %s %s -> 0x%08X\n", __func__, name, path, ret); + + return ret; +} + +static int get_keypath(char *keypath, int size) +{ + char *p; + + strcpy_s(keypath, size, sceKernelInitFileName()); + p = strrchr(keypath, '/'); + + if(p == NULL) { + return -1; + } + + p[1] = '\0'; + strcat_s(keypath, size, "KEYS.BIN"); + + return 0; +} + +static int save_key(const char *keypath, u8 *key, int size) +{ + SceUID keys; + int ret; + + keys = sceIoOpen(keypath, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777); + + if (keys < 0) { + return -1; + } + + ret = sceIoWrite(keys, key, size); + + if(ret == size) { + ret = 0; + } else { + ret = -2; + } + + sceIoClose(keys); + + return ret; +} + +static int load_key(const char *keypath, u8 *key, int size) +{ + SceUID keys; + int ret; + + keys = sceIoOpen(keypath, PSP_O_RDONLY, 0777); + + if (keys < 0) { + myprintk("%s: sceIoOpen %s -> 0x%08X\n", __func__, keypath, keys); + + return -1; + } + + ret = sceIoRead(keys, key, size); + + if (ret == size) { + ret = 0; + } else { + ret = -2; + } + + sceIoClose(keys); + + return ret; +} + +static int (*sceNpDrmGetVersionKey)(u8 * key, u8 * act, u8 * rif, u32 flags); + +static int _sceNpDrmGetVersionKey(u8 * key, u8 * act, u8 * rif, u32 flags) +{ + char keypath[128]; + int ret, result; + + result = (*sceNpDrmGetVersionKey)(key, act, rif, flags); + + if (g_is_custom_ps1) { + myprintk("%s: -> 0x%08X\n", __func__, result); + result = 0; + + if (g_keys_bin_found) { + memcpy(key, g_keys, sizeof(g_keys)); + } + + myprintk("%s:[FAKE] -> 0x%08X\n", __func__, result); + } else { + get_keypath(keypath, sizeof(keypath)); + + if (result == 0) { + memcpy(g_keys, key, sizeof(g_keys)); + ret = save_key(keypath, g_keys, sizeof(g_keys)); + myprintk("%s: save_key -> %d\n", __func__, ret); + } else { + if (g_keys_bin_found) { + memcpy(key, g_keys, sizeof(g_keys)); + result = 0; + } + } + } + + return result; +} + +static int (*scePspNpDrm_driver_9A34AC9F)(u8 *rif); + +static int _scePspNpDrm_driver_9A34AC9F(u8 *rif) +{ + int result; + + result = (*scePspNpDrm_driver_9A34AC9F)(rif); + myprintk("%s: 0x%08X -> 0x%08X\n", __func__, (uint)rif, result); + + if (result != 0) { + if (g_keys_bin_found || g_is_custom_ps1) { + result = 0; + myprintk("%s:[FAKE] -> 0x%08X\n", __func__, result); + } + } + + return result; +} + +static int _sceDrmBBCipherUpdate(void *ckey, u8 *data, int size) +{ + return 0; +} + +static int _sceDrmBBCipherInit(void *ckey, int type, int mode, u8 *header_key, u8 *version_key, u32 seed) +{ + return 0; +} + +static int _sceDrmBBMacInit(void *mkey, int type) +{ + return 0; +} + +static int _sceDrmBBMacUpdate(void *mkey, u8 *buf, int size) +{ + return 0; +} + +static int _sceDrmBBCipherFinal(void *ckey) +{ + return 0; +} + +static int _sceDrmBBMacFinal(void *mkey, u8 *buf, u8 *vkey) +{ + return 0; +} + +static int _sceDrmBBMacFinal2(void *mkey, u8 *out, u8 *vkey) +{ + return 0; +} + +static struct Hooks g_io_hooks[] = { + { 0x109F50BC, &myIoOpen, }, + { 0x27EB27B8, &myIoLseek, }, + { 0x63632449, &myIoIoctl, }, + { 0x6A638D83, &myIoRead, }, + { 0xA0B5A7C2, &myIoReadAsync, }, + { 0xACE946E8, &myIoGetstat, }, + { 0x810C4BC3, &myIoClose, }, +}; + +static struct Hooks g_amctrl_hooks[] = { + { 0x1CCB66D2, &_sceDrmBBCipherInit, }, + { 0x0785C974, &_sceDrmBBCipherUpdate, }, + { 0x9951C50F, &_sceDrmBBCipherFinal, }, + { 0x525B8218, &_sceDrmBBMacInit, }, + { 0x58163FBE, &_sceDrmBBMacUpdate, }, + { 0xEF95A213, &_sceDrmBBMacFinal, }, + { 0xF5186D8E, &_sceDrmBBMacFinal2, }, +}; + +static void patch_scePops_Manager(void) +{ + SceModule2 *mod; + u32 text_addr; + int i; + + mod = (SceModule2*) sceKernelFindModuleByName("scePops_Manager"); + text_addr = mod->text_addr; + + for(i=0; ipopsman_patch.get_rif_path != 0xDEADBEEF) { + _get_rif_path = (void*)(text_addr + g_offs->popsman_patch.get_rif_path); + _sw(MAKE_CALL(&get_rif_path), text_addr + g_offs->popsman_patch.get_rif_path_call1); + _sw(MAKE_CALL(&get_rif_path), text_addr + g_offs->popsman_patch.get_rif_path_call2); + } + + sceNpDrmGetVersionKey = (void*)sctrlHENFindFunction("scePspNpDrm_Driver", "scePspNpDrm_driver", 0x0F9547E6); + scePspNpDrm_driver_9A34AC9F = (void*)sctrlHENFindFunction("scePspNpDrm_Driver", "scePspNpDrm_driver", 0x9A34AC9F); + + if(g_offs->popsman_patch.sceNpDrmGetVersionKeyCall != 0xDEADBEEF) { + _sw(MAKE_CALL(_sceNpDrmGetVersionKey), text_addr + g_offs->popsman_patch.sceNpDrmGetVersionKeyCall); + } + + if(g_offs->popsman_patch.scePspNpDrm_driver_9A34AC9F_Call != 0xDEADBEEF) { + _sw(MAKE_CALL(_scePspNpDrm_driver_9A34AC9F), text_addr + g_offs->popsman_patch.scePspNpDrm_driver_9A34AC9F_Call); + } + + // remove the check in scePopsManLoadModule that only allows loading module below the FW 3.XX + if(g_offs->popsman_patch.scePopsManLoadModuleCheck != 0xDEADBEEF) { + _sw(NOP, text_addr + g_offs->popsman_patch.scePopsManLoadModuleCheck); + } + + if (g_is_custom_ps1) { + for(i=0; i 0x%08X\n", __func__, filename, fd); + result = 0; + goto exit; + } + + ret = sceIoRead(fd, header, 40); + + if(ret != 40) { + printk("%s: sceIoRead -> 0x%08X\n", __func__, ret); + result = 0; + goto exit; + } + + psar_offset = *(u32*)(header+0x24); + sceIoLseek32(fd, psar_offset, PSP_SEEK_SET); + ret = sceIoRead(fd, header, 40); + + if(ret != 40) { + printk("%s: sceIoRead -> 0x%08X\n", __func__, ret); + result = 0; + goto exit; + } + + pgd_offset = psar_offset; + + if(0 == memcmp(header, "PSTITLE", sizeof("PSTITLE")-1)) { + pgd_offset += 0x200; + } else { + pgd_offset += 0x400; + } + + sceIoLseek32(fd, pgd_offset, PSP_SEEK_SET); + ret = sceIoRead(fd, header, 4); + + if(ret != 4) { + printk("%s: sceIoRead -> 0x%08X\n", __func__, ret); + result = 0; + goto exit; + } + + magic = (u32*)header; + + // PGD offset + if(*magic != 0x44475000) { + printk("%s: custom pops found\n", __func__); + result = 1; + } + +exit: + if(fd >= 0) { + sceIoClose(fd); + } + + return result; +} + +static int place_syscall_stub(void* func, void *addr) +{ + u32 syscall_num; + extern u32 sceKernelQuerySystemCall(void *func); + + syscall_num = sceKernelQuerySystemCall(func); + + if(syscall_num == (u32)-1) { + return -1; + } + + _sw(0x03E00008, (u32)addr); + _sw(((syscall_num<<6)|12), (u32)(addr+4)); + + return 0; +} + +static void reboot_vsh_with_error(u32 error) +{ + struct SceKernelLoadExecVSHParam param; + u32 vshmain_args[0x20/4]; + + memset(¶m, 0, sizeof(param)); + memset(vshmain_args, 0, sizeof(vshmain_args)); + + vshmain_args[0/4] = 0x0400; + vshmain_args[4/4] = 0x20; + vshmain_args[0x14/4] = error; + + param.size = sizeof(param); + param.args = 0x400; + param.argp = vshmain_args; + param.vshmain_args_size = 0x400; + param.vshmain_args = vshmain_args; + param.configfile = "/kd/pspbtcnf.txt"; + + sctrlKernelExitVSH(¶m); +} + + +int decompress_data(u32 destSize, const u8 *src, u8 *dest) +{ + u32 k1; + int ret; + + k1 = pspSdkSetK1(0); + + if (destSize < 0) { + reboot_vsh_with_error((u32)destSize); + pspSdkSetK1(k1); + + return 0; + } + + ret = sceKernelDeflateDecompress(dest, destSize, src, 0); + myprintk("%s: 0x%08X 0x%08X 0x%08X -> 0x%08X\n", __func__, (uint)destSize, (uint)src, (uint)dest, ret); + + if(ret >= 0) { + if(psp_fw_version >= FW_380) { + ret = 0x92FF; + } else { + ret = 0x9300; + } + + myprintk("%s: [FAKE] -> 0x%08X\n", __func__, ret); + } + + pspSdkSetK1(k1); + + return ret; +} + +int decompress_data_371(u8 *dest, u32 destSize, const u8 *src) +{ + return decompress_data(destSize, src, dest); +} + +static int patch_decompress_data(u32 text_addr) +{ + int ret; + void *stub_addr, *patch_addr; + + stub_addr = (void*)(text_addr + g_offs->pops_patch.decomp[psp_model].stub_offset); + patch_addr = (void*)(text_addr + g_offs->pops_patch.decomp[psp_model].patch_offset); + + if(psp_fw_version <= FW_371) { + ret = place_syscall_stub(decompress_data_371, stub_addr); + } else { + ret = place_syscall_stub(decompress_data, stub_addr); + } + + if (ret != 0) { + myprintk("%s: place_syscall_stub -> 0x%08X\n", __func__, ret); + + return -1; + } + + _sw(MAKE_CALL(stub_addr), (u32)patch_addr); + + return 0; +} + +static void patch_icon0_size(u32 text_addr) +{ + u32 patch_addr; + + patch_addr = text_addr + g_offs->pops_patch.ICON0SizeOffset[psp_model]; + + if(psp_fw_version <= FW_352) { + _sw(0x24030000 | (sizeof(g_icon_png) & 0xFFFF), patch_addr); + } else if(psp_fw_version <= FW_372) { + _sw(0x24090000 | (sizeof(g_icon_png) & 0xFFFF), patch_addr); + } else { + _sw(0x24050000 | (sizeof(g_icon_png) & 0xFFFF), patch_addr); + } +} + +static int (*sceMeAudio_67CD7972)(void *buf, int size); + +int _sceMeAudio_67CD7972(void *buf, int size) +{ + int ret; + u32 k1; + + k1 = pspSdkSetK1(0); + ret = (*sceMeAudio_67CD7972)(buf, size); + pspSdkSetK1(k1); + + myprintk("%s: 0x%08X -> 0x%08X\n", __func__, size, ret); + + return ret; +} + +static int popcorn_patch_chain(SceModule2 *mod) +{ + myprintk("%s: %s\n", __func__, mod->modname); + + if (0 == strcmp(mod->modname, "pops")) { + u32 text_addr = mod->text_addr; + int i; + + myprintk("%s: patching pops\n", __func__); + + if(g_is_custom_ps1) { + patch_decompress_data(text_addr); + } + + if(g_icon0_status) { + patch_icon0_size(text_addr); + } + + if(psp_fw_version <= FW_352) { + sceMeAudio_67CD7972 = (void*)sctrlHENFindFunction("scePops_Manager", "scePopsMan", g_offs->pops_patch.sceMeAudio_67CD7972_NID); + hook_import_bynid((SceModule*)mod, "scePopsMan", g_offs->pops_patch.sceMeAudio_67CD7972_NID, _sceMeAudio_67CD7972, 1); + } else { + sceMeAudio_67CD7972 = (void*)sctrlHENFindFunction("scePops_Manager", "sceMeAudio", g_offs->pops_patch.sceMeAudio_67CD7972_NID); + hook_import_bynid((SceModule*)mod, "sceMeAudio", g_offs->pops_patch.sceMeAudio_67CD7972_NID, _sceMeAudio_67CD7972, 1); + } + + if(g_offs->pops_patch.manualNameCheck[psp_model] != 0xDEADBEEF) { + _sw(0x24020001, text_addr + g_offs->pops_patch.manualNameCheck[psp_model]); + } + + for(i=0; imodname, "sceVshSDAuto_Module")){ + sceIoRemove("ms0:/__popcorn.txt"); + myprintk = printk_void; + } +#endif + + if( me_fw == 0 && conf.noanalog) { + patch_analog_imports((SceModule*)mod); + } + + if(g_previous) + return g_previous(mod); + + return 0; +} + +static int get_icon0_status(void) +{ + u32 icon0_offset = 0; + int result = ICON0_MISSING; + SceUID fd = -1;; + const char *filename; + u8 p[40 + 64], *header; + + header = (u8*)((((u32)p) & ~(64-1)) + 64); + filename = sceKernelInitFileName(); + + if(filename == NULL) { + goto exit; + } + + fd = sceIoOpen(filename, PSP_O_RDONLY, 0777); + + if(fd < 0) { + printk("%s: sceIoOpen %s -> 0x%08X\n", __func__, filename, fd); + goto exit; + } + + sceIoRead(fd, header, 40); + icon0_offset = *(u32*)(header+0x0c); + sceIoLseek32(fd, icon0_offset, PSP_SEEK_SET); + sceIoRead(fd, header, 40); + + if(*(u32*)(header+4) == 0xA1A0A0D) { + if ( *(u32*)(header+0xc) == 0x52444849 && // IHDR + *(u32*)(header+0x10) == 0x50000000 && // + *(u32*)(header+0x14) == *(u32*)(header+0x10) + ) { + result = ICON0_OK; + } else { + result = ICON0_CORRUPTED; + } + } else { + result = ICON0_MISSING; + } + + printk("%s: PNG file status -> %d\n", __func__, result); + +exit: + if(fd >= 0) { + sceIoClose(fd); + } + + return result; +} + +static void setup_psx_fw_version(u32 fw_version) +{ + int (*_SysMemUserForUser_315AD3A0)(u32 fw_version); + + _SysMemUserForUser_315AD3A0 = (void*)sctrlHENFindFunction("sceSystemMemoryManager", "SysMemUserForUser", 0x315AD3A0); + + if (_SysMemUserForUser_315AD3A0 == NULL) { + myprintk("_SysMemUserForUser_315AD3A0 not found\n"); + reboot_vsh_with_error(0x80000001); + } + + _SysMemUserForUser_315AD3A0(fw_version); +} + +static int get_keys(char *filename, u8 *keys) +{ + memcpy(keys, g_keys, sizeof(g_keys)); + + return 0; +} + +int module_start(SceSize args, void* argp) +{ + char keypath[128]; + int ret; + SceIoStat stat; + + if(args != 4) { + return 1; + } + + SetME(); + + psp_fw_version = *(u32*)argp; + setup_patch_offset_table(psp_fw_version); + psp_model = sceKernelGetModel(); + if( me_fw == 0 ) { + memset(&conf, 0, sizeof(conf)); + sctrlSEGetConfig(&conf); + } + //sceIoRemove("ms0:/__popcorn.txt"); + //printk_init("ms0:/__popcorn.txt"); + //myprintk = printk_void; + myprintk("Popcorn: init_file = %s psp_fw_version = 0x%08X psp_model = %d\n", sceKernelInitFileName(), (uint)psp_fw_version, (int)psp_model); + + get_keypath(keypath, sizeof(keypath)); + ret = sceIoGetstat(keypath, &stat); + g_keys_bin_found = 0; + + sceKernelRegisterGetIdFunc(&get_keys); + + if(ret == 0) { + ret = load_key(keypath, g_keys, sizeof(g_keys)); + + if(ret == 0) { + g_keys_bin_found = 1; + myprintk("keys.bin found\n"); + } + } + + g_is_custom_ps1 = is_custom_ps1(); + g_icon0_status = get_icon0_status(); + + if(g_is_custom_ps1) { + setup_psx_fw_version(psp_fw_version); + } + + g_previous = sctrlHENSetStartModuleHandler(&popcorn_patch_chain); + patch_scePops_Manager(); + sync_cache(); + + //sceKernelDelayThread(2000000); + return 0; +} + +int module_stop(SceSize args, void *argp) +{ + return 0; +} diff --git a/popsloader/popcorn/main.h b/popsloader/popcorn/main.h new file mode 100644 index 0000000..663ad1b --- /dev/null +++ b/popsloader/popcorn/main.h @@ -0,0 +1,41 @@ +/* + * This file is part of PRO CFW. + + * PRO CFW is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * PRO CFW is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PRO CFW. If not, see -#include "popcorn_patch_offset.h" - -#if !defined(CONFIG_660) && !defined(CONFIG_635) && !defined(CONFIG_620) && !defined(CONFIG_639) && !defined(CONFIG_610) && !defined(CONFIG_600) && !defined(CONFIG_551) && !defined(CONFIG_550) && !defined(CONFIG_503) && !defined(CONFIG_501) && !defined(CONFIG_500) && !defined(CONFIG_401) && !defined(CONFIG_396) && !defined(CONFIG_393) && !defined(CONFIG_390) && !defined(CONFIG_380) && !defined(CONFIG_372) && !defined(CONFIG_371) && !defined(CONFIG_352) && !defined(CONFIG_351) && !defined(CONFIG_350) && !defined(CONFIG_340) && !defined(CONFIG_330) && !defined(CONFIG_311) && !defined(CONFIG_310) && !defined(CONFIG_303) && !defined(CONFIG_302) -#error You have to define one of CONFIG_FW_VERSION -#endif - -#ifdef CONFIG_660 -PatchOffset g_660_offsets = { - .fw_version = FW_660, - .popsman_patch = { - .get_rif_path = 0x00000190, - .get_rif_path_call1 = 0x00002798, - .get_rif_path_call2 = 0x00002C58, - .sceNpDrmGetVersionKeyCall = 0x000029C4, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00002DA8, - .scePopsManLoadModuleCheck = 0x00001E80, - }, - .pops_patch = { - .decomp = { - { 0x000D5424, 0x0000DB78 }, // 01G - { 0x000D64DC, 0x0000DB78 }, // 02G - { 0x000D64DC, 0x0000DB78 }, // 03G - { 0x000D654C, 0x0000DBE8 }, // 04G - { 0x000D84D8, 0x0000E300 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000D656C, 0x0000DBE8 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000D656C, 0x0000DBE8 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000D5494, 0x0000DBE8 }, // 11G - }, - .ICON0SizeOffset = { - 0x00036D50, // 01G - 0x00037D8C, // 02G - 0x00037D8C, // 03G - 0x00037E04, // 04G - 0x00039BEC, // 05G - 0xDEADBEEF, // unused - 0x00037E1C, // 07G - 0xDEADBEEF, // unused - 0x00037E1C, // 09G - 0xDEADBEEF, // unused - 0x00036DCC, // 11G - }, - .manualNameCheck = { - 0x00025248, // 01G - 0x00025754, // 02G - 0x00025754, // 03G - 0x000257CC, // 04G - 0x00026060, // 05G - 0xDEADBEEF, // unused - 0x000257E4, // 07G - 0xDEADBEEF, // unused - 0x000257E4, // 09G - 0xDEADBEEF, // unused - 0x000252C4, // 11G - }, - .sceMeAudio_67CD7972_NID = 0x2AB4FE43, - }, -}; -#endif - -#ifdef CONFIG_639 -PatchOffset g_639_offsets = { - .fw_version = FW_639, - .popsman_patch = { - .get_rif_path = 0x00000190, - .get_rif_path_call1 = 0x00002798, - .get_rif_path_call2 = 0x00002C58, - .sceNpDrmGetVersionKeyCall = 0x000029C4, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00002DA8, - .scePopsManLoadModuleCheck = 0x00001E80, - }, - .pops_patch = { - .decomp = { - { 0x000D5654, 0x0000DC04 }, // 01G - { 0x000D671C, 0x0000DC04 }, // 02G - { 0x000D671C, 0x0000DC04 }, // 03G - { 0x000D670C, 0x0000DC04 }, // 04G - { 0x000D8698, 0x0000E31C }, // 05G - { 0x00000000, 0x00000000 }, // unused - { 0x000D670C, 0x0000DC04 }, // 07G - { 0x00000000, 0x00000000 }, // unused - { 0x000D670C, 0x0000DC04 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000D670C, 0x0000DC04 }, // 11G - }, - .ICON0SizeOffset = { - 0x00036F54, // 01G - 0x00037F90, // 02G - 0x00037F90, // 03G - 0x00037F90, // 04G - 0x00039D78, // 05G - 0xDEADBEEF, // unused - 0x00037F90, // 07G - 0xDEADBEEF, // unused - 0x00037F90, // 09G - 0xDEADBEEF, // unused - 0x00037F90, // 11G - }, - .manualNameCheck = { - 0x0002541C, // 01G - 0x00025928, // 02G - 0x00025928, // 03G - 0x00025928, // 04G - 0x000261BC, // 05G - 0xDEADBEEF, // unused - 0x00025928, // 07G - 0xDEADBEEF, // unused - 0x00025928, // 09G - 0xDEADBEEF, // unused - 0x00025928, // 11G - }, - .sceMeAudio_67CD7972_NID = 0x67CD7972, - }, -}; -#endif - -#ifdef CONFIG_635 -PatchOffset g_635_offsets = { - .fw_version = FW_635, - .popsman_patch = { - .get_rif_path = 0x00000190, - .get_rif_path_call1 = 0x00002798, - .get_rif_path_call2 = 0x00002C58, - .sceNpDrmGetVersionKeyCall = 0x000029C4, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00002DA8, - .scePopsManLoadModuleCheck = 0x00001E80, - }, - .pops_patch = { - .decomp = { - { 0x000D5404, 0x0000DAC0 }, // 01G - { 0x000D64BC, 0x0000DAC0 }, // 02G - { 0x000D64BC, 0x0000DAC0 }, // 03G - { 0x000D64FC, 0x0000DB00 }, // 04G - { 0x000D8488, 0x0000E218 }, // 05G - { 0x00000000, 0x00000000 }, // unused - { 0x000D64FC, 0x0000DB00 }, // 07G - { 0x00000000, 0x00000000 }, // unused - { 0x000D64FC, 0x0000DB00 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000D64FC, 0x0000DB00 }, // 11G - }, - .ICON0SizeOffset = { - 0x00036CF8, // 01G - 0x00037D34, // 02G - 0x00037D34, // 03G - 0x00037D74, // 04G - 0x00039B5C, // 05G - 0xDEADBEEF, // unused - 0x00037D74, // 07G - 0xDEADBEEF, // unused - 0x00037D74, // 09G - 0xDEADBEEF, // unused - 0x00037D74, // 11G - }, - .manualNameCheck = { - 0x000251C0, // 01G - 0x000256CC, // 02G - 0x000256CC, // 03G - 0x0002570C, // 04G - 0x00025FA0, // 05G - 0xDEADBEEF, // unused - 0x0002570C, // 07G - 0xDEADBEEF, // unused - 0x0002570C, // 09G - 0xDEADBEEF, // unused - 0x0002570C, // 11G - }, - .sceMeAudio_67CD7972_NID = 0x67CD7972, - }, -}; -#endif - -#ifdef CONFIG_620 -PatchOffset g_620_offsets = { - .fw_version = FW_620, - .popsman_patch = { - .get_rif_path = 0x00000190, - .get_rif_path_call1 = 0x00002824, - .get_rif_path_call2 = 0x00002CE4, - .sceNpDrmGetVersionKeyCall = 0x00002A50, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00002E34, - .scePopsManLoadModuleCheck = 0x00001EA8, - }, - .pops_patch = { - .decomp = { - { 0x000DA600, 0x0000DE18 }, // 01G - { 0x000DA600, 0x0000DE18 }, // 02G - { 0x000DA600, 0x0000DE18 }, // 03G - { 0x000DA630, 0x0000DE1C }, // 04G - { 0x000DC5CC, 0x0000E534 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000DA630, 0x0000DE1C }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000DA630, 0x0000DE1C }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000DA630, 0x0000DE1C }, // 11G - }, - .ICON0SizeOffset = { - 0x0003BCD0, // 01G - 0x0003BCD0, // 02G - 0x0003BCD0, // 03G - 0x0003BCFC, // 04G - 0x0003DAE4, // 05G - 0xDEADBEEF, // unused - 0x0003BCFC, // 07G - 0xDEADBEEF, // unused - 0x0003BCFC, // 09G - 0xDEADBEEF, // unused - 0x0003BCFC, // 11G - }, - .manualNameCheck = { - 0x00029710, // 01G - 0x00029710, // 02G - 0x00029710, // 03G - 0x0002973C, // 04G - 0x00029FD0, // 05G - 0xDEADBEEF, // unused - 0x0002973C, // 07G - 0xDEADBEEF, // unused - 0x0002973C, // 09G - 0xDEADBEEF, // unused - 0x0002973C, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xF43E573A, - }, -}; -#endif - -#ifdef CONFIG_610 -PatchOffset g_610_offsets = { - .fw_version = FW_610, - .popsman_patch = { - .get_rif_path = 0x00000190, - .get_rif_path_call1 = 0x0000239C, - .get_rif_path_call2 = 0x0000291C, - .sceNpDrmGetVersionKeyCall = 0x000025C8, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00002A88, - .scePopsManLoadModuleCheck = 0x00001A48, - }, - .pops_patch = { - .decomp = { - { 0x000CC83C, 0x0000D6B8 }, // 01G - { 0x000CC83C, 0x0000D6B8 }, // 02G - { 0x000CC83C, 0x0000D6B8 }, // 03G - { 0x000CC88C, 0x0000D6FC }, // 04G - { 0x000CE4E8, 0x0000DE08 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CC88C, 0x0000D6FC }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CC88C, 0x0000D6FC }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CC88C, 0x0000D6FC }, // 11G - }, - .ICON0SizeOffset = { - 0x0002E454, // 01G - 0x0002E454, // 02G - 0x0002E454, // 03G - 0x0002E49C, // 04G - 0x0002FF50, // 05G - 0xDEADBEEF, // unused - 0x0002E49C, // 07G - 0xDEADBEEF, // unused - 0x0002E49C, // 09G - 0xDEADBEEF, // unused - 0x0002E49C, // 11G - }, - .manualNameCheck = { - 0x0001C418, // 01G - 0x0001C418, // 02G - 0x0001C418, // 03G - 0x0001C460, // 04G - 0x0001CCC4, // 05G - 0xDEADBEEF, // unused - 0x0001C460, // 07G - 0xDEADBEEF, // unused - 0x0001C460, // 09G - 0xDEADBEEF, // unused - 0x0001C460, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xF43E573A, - }, -}; -#endif - -#ifdef CONFIG_600 -PatchOffset g_600_offsets = { - .fw_version = FW_600, - .popsman_patch = { - .get_rif_path = 0x00000190, - .get_rif_path_call1 = 0x0000239C, - .get_rif_path_call2 = 0x0000291C, - .sceNpDrmGetVersionKeyCall = 0x000025C8, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00002A88, - .scePopsManLoadModuleCheck = 0x00001A48, - }, - .pops_patch = { - .decomp = { - { 0x000CC82C, 0x0000D6B8 }, // 01G - { 0x000CC82C, 0x0000D6B8 }, // 02G - { 0x000CC82C, 0x0000D6B8 }, // 03G - { 0x000CC87C, 0x0000D6FC }, // 04G - { 0xDEADBEEF, 0xDEADBEEF }, // 05G TODO - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CC87C, 0x0000D6FC }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CC87C, 0x0000D6FC }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CC87C, 0x0000D6FC }, // 11G - }, - .ICON0SizeOffset = { - 0x0002E440, // 01G - 0x0002E440, // 02G - 0x0002E440, // 03G - 0x0002E488, // 04G - 0xDEADBEEF, // 05G TODO - 0xDEADBEEF, // unused - 0x0002E488, // 07G - 0xDEADBEEF, // unused - 0x0002E488, // 09G - 0xDEADBEEF, // unused - 0x0002E488, // 11G - }, - .manualNameCheck = { - 0x0001C404, // 01G - 0x0001C404, // 02G - 0x0001C404, // 03G - 0x0001C44C, // 04G - 0xDEADBEEF, // 05G TODO - 0xDEADBEEF, // unused - 0x0001C44C, // 07G - 0xDEADBEEF, // unused - 0x0001C44C, // 09G - 0xDEADBEEF, // unused - 0x0001C44C, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xF43E573A, - }, -}; -#endif - -#ifdef CONFIG_551 -PatchOffset g_551_offsets = { - .fw_version = FW_551, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00000144, - .scePopsManLoadModuleCheck = 0x000015C0, - }, - .pops_patch = { - .decomp = { - { 0x000CEDB8, 0x0000E84C }, // 01G - { 0x000CEDB8, 0x0000E84C }, // 02G - { 0x000CEDB8, 0x0000E84C }, // 03G - { 0x000CEDB8, 0x0000E84C }, // 04G - { 0x000CEDB8, 0x0000E84C }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CEDB8, 0x0000E84C }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CEDB8, 0x0000E84C }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CEDB8, 0x0000E84C }, // 11G - }, - .ICON0SizeOffset = { - 0x00030778, // 01G - 0x00030778, // 02G - 0x00030778, // 03G - 0x00030778, // 04G - 0x00030778, // 05G - 0xDEADBEEF, // unused - 0x00030778, // 07G - 0xDEADBEEF, // unused - 0x00030778, // 09G - 0xDEADBEEF, // unused - 0x00030778, // 11G - }, - .manualNameCheck = { - 0x0001FBD4, // 01G - 0x0001FBD4, // 02G - 0x0001FBD4, // 03G - 0x0001FBD4, // 04G - 0x0001FBD4, // 05G - 0xDEADBEEF, // unused - 0x0001FBD4, // 07G - 0xDEADBEEF, // unused - 0x0001FBD4, // 09G - 0xDEADBEEF, // unused - 0x0001FBD4, // 11G - }, - .sceMeAudio_67CD7972_NID = 0x1BDF9405, - }, -}; -#endif - -#ifdef CONFIG_550 -PatchOffset g_550_offsets = { - .fw_version = FW_550, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00000144, - .scePopsManLoadModuleCheck = 0x0000158C, - }, - .pops_patch = { - .decomp = { - { 0x000CEDB8, 0x0000E834 }, // 01G - { 0x000CEDB8, 0x0000E834 }, // 02G - { 0x000CEDB8, 0x0000E834 }, // 03G - { 0x000CEDB8, 0x0000E834 }, // 04G - { 0x000CEDB8, 0x0000E834 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CEDB8, 0x0000E834 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CEDB8, 0x0000E834 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CEDB8, 0x0000E834 }, // 11G - }, - .ICON0SizeOffset = { - 0x00030704, // 01G - 0x00030704, // 02G - 0x00030704, // 03G - 0x00030704, // 04G - 0x00030704, // 05G - 0xDEADBEEF, // unused - 0x00030704, // 07G - 0xDEADBEEF, // unused - 0x00030704, // 09G - 0xDEADBEEF, // unused - 0x00030704, // 11G - }, - .manualNameCheck = { - 0x0001FB60, // 01G - 0x0001FB60, // 02G - 0x0001FB60, // 03G - 0x0001FB60, // 04G - 0x0001FB60, // 05G - 0xDEADBEEF, // unused - 0x0001FB60, // 07G - 0xDEADBEEF, // unused - 0x0001FB60, // 09G - 0xDEADBEEF, // unused - 0x0001FB60, // 11G - }, - .sceMeAudio_67CD7972_NID = 0x1BDF9405, - }, -}; -#endif - -#ifdef CONFIG_503 -PatchOffset g_503_offsets = { - .fw_version = FW_503, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00000144, - .scePopsManLoadModuleCheck = 0x0000158C, - }, - .pops_patch = { - .decomp = { - { 0x000C588C, 0x0000E958 }, // 01G - { 0x000C588C, 0x0000E958 }, // 02G - { 0x000C588C, 0x0000E958 }, // 03G - { 0x000C588C, 0x0000E958 }, // 04G - { 0x000C588C, 0x0000E958 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000C588C, 0x0000E958 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000C588C, 0x0000E958 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000C588C, 0x0000E958 }, // 11G - }, - .ICON0SizeOffset = { - 0x000273A8, // 01G - 0x000273A8, // 02G - 0x000273A8, // 03G - 0x000273A8, // 04G - 0x000273A8, // 05G - 0xDEADBEEF, // unused - 0x000273A8, // 07G - 0xDEADBEEF, // unused - 0x000273A8, // 09G - 0xDEADBEEF, // unused - 0x000273A8, // 11G - }, - .manualNameCheck = { - 0x000190F8, // 01G - 0x000190F8, // 02G - 0x000190F8, // 03G - 0x000190F8, // 04G - 0x000190F8, // 05G - 0xDEADBEEF, // unused - 0x000190F8, // 07G - 0xDEADBEEF, // unused - 0x000190F8, // 09G - 0xDEADBEEF, // unused - 0x000190F8, // 11G - }, - .sceMeAudio_67CD7972_NID = 0x1BDF9405, - }, -}; -#endif - -#ifdef CONFIG_501 -PatchOffset g_501_offsets = { - .fw_version = FW_501, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00000144, - .scePopsManLoadModuleCheck = 0x0000158C, - }, - .pops_patch = { - .decomp = { - { 0x000C583C, 0x0000E90C }, // 01G - { 0x000C583C, 0x0000E90C }, // 02G - { 0x000C583C, 0x0000E90C }, // 03G - { 0x000C583C, 0x0000E90C }, // 04G - { 0x000C583C, 0x0000E90C }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000C583C, 0x0000E90C }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000C583C, 0x0000E90C }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000C583C, 0x0000E90C }, // 11G - }, - .ICON0SizeOffset = { - 0x00027354, // 01G - 0x00027354, // 02G - 0x00027354, // 03G - 0x00027354, // 04G - 0x00027354, // 05G - 0xDEADBEEF, // unused - 0x00027354, // 07G - 0xDEADBEEF, // unused - 0x00027354, // 09G - 0xDEADBEEF, // unused - 0x00027354, // 11G - }, - .manualNameCheck = { - 0x000190A4, // 01G - 0x000190A4, // 02G - 0x000190A4, // 03G - 0x000190A4, // 04G - 0x000190A4, // 05G - 0xDEADBEEF, // unused - 0x000190A4, // 07G - 0xDEADBEEF, // unused - 0x000190A4, // 09G - 0xDEADBEEF, // unused - 0x000190A4, // 11G - }, - .sceMeAudio_67CD7972_NID = 0x1BDF9405, - }, -}; -#endif - -#ifdef CONFIG_500 -PatchOffset g_500_offsets = { - .fw_version = FW_500, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00000144, - .scePopsManLoadModuleCheck = 0x0000158C, - }, - .pops_patch = { - .decomp = { - { 0x000C583C, 0x0000E90C }, // 01G - { 0x000C583C, 0x0000E90C }, // 02G - { 0x000C583C, 0x0000E90C }, // 03G - { 0x000C583C, 0x0000E90C }, // 04G - { 0x000C583C, 0x0000E90C }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000C583C, 0x0000E90C }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000C583C, 0x0000E90C }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000C583C, 0x0000E90C }, // 11G - }, - .ICON0SizeOffset = { - 0x0002734C, // 01G - 0x0002734C, // 02G - 0x0002734C, // 03G - 0x0002734C, // 04G - 0x0002734C, // 05G - 0xDEADBEEF, // unused - 0x0002734C, // 07G - 0xDEADBEEF, // unused - 0x0002734C, // 09G - 0xDEADBEEF, // unused - 0x0002734C, // 11G - }, - .manualNameCheck = { - 0x0001909C, // 01G - 0x0001909C, // 02G - 0x0001909C, // 03G - 0x0001909C, // 04G - 0x0001909C, // 05G - 0xDEADBEEF, // unused - 0x0001909C, // 07G - 0xDEADBEEF, // unused - 0x0001909C, // 09G - 0xDEADBEEF, // unused - 0x0001909C, // 11G - }, - .sceMeAudio_67CD7972_NID = 0x1BDF9405, - }, -}; -#endif - -#ifdef CONFIG_401 -PatchOffset g_401_offsets = { - .fw_version = FW_401, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00000138, - .scePopsManLoadModuleCheck = 0x000015F0, - }, - .pops_patch = { - .decomp = { - { 0x000CC12C, 0x000119CC }, // 01G - { 0x000CC12C, 0x000119CC }, // 02G - { 0x000CC12C, 0x000119CC }, // 03G - { 0x000CC12C, 0x000119CC }, // 04G - { 0x000CC12C, 0x000119CC }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CC12C, 0x000119CC }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CC12C, 0x000119CC }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000CC12C, 0x000119CC }, // 11G - }, - .ICON0SizeOffset = { - 0x0002CF88, // 01G - 0x0002CF88, // 02G - 0x0002CF88, // 03G - 0x0002CF88, // 04G - 0x0002CF88, // 05G - 0xDEADBEEF, // unused - 0x0002CF88, // 07G - 0xDEADBEEF, // unused - 0x0002CF88, // 09G - 0xDEADBEEF, // unused - 0x0002CF88, // 11G - }, - .manualNameCheck = { - 0x0001C044, // 01G - 0x0001C044, // 02G - 0x0001C044, // 03G - 0x0001C044, // 04G - 0x0001C044, // 05G - 0xDEADBEEF, // unused - 0x0001C044, // 07G - 0xDEADBEEF, // unused - 0x0001C044, // 09G - 0xDEADBEEF, // unused - 0x0001C044, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xBCC74871, - }, -}; -#endif - -#ifdef CONFIG_396 -PatchOffset g_396_offsets = { - .fw_version = FW_396, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00000138, - .scePopsManLoadModuleCheck = 0x000014E8, - }, - .pops_patch = { - .decomp = { - { 0x000C9BF8, 0x0000FAF0 }, // 01G - { 0x000C9BF8, 0x0000FAF0 }, // 02G - { 0x000C9BF8, 0x0000FAF0 }, // 03G - { 0x000C9BF8, 0x0000FAF0 }, // 04G - { 0x000C9BF8, 0x0000FAF0 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000C9BF8, 0x0000FAF0 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000C9BF8, 0x0000FAF0 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000C9BF8, 0x0000FAF0 }, // 11G - }, - .ICON0SizeOffset = { - 0x0002AEB4, // 01G - 0x0002AEB4, // 02G - 0x0002AEB4, // 03G - 0x0002AEB4, // 04G - 0x0002AEB4, // 05G - 0xDEADBEEF, // unused - 0x0002AEB4, // 07G - 0xDEADBEEF, // unused - 0x0002AEB4, // 09G - 0xDEADBEEF, // unused - 0x0002AEB4, // 11G - }, - .manualNameCheck = { - 0x0001A00C, // 01G - 0x0001A00C, // 02G - 0x0001A00C, // 03G - 0x0001A00C, // 04G - 0x0001A00C, // 05G - 0xDEADBEEF, // unused - 0x0001A00C, // 07G - 0xDEADBEEF, // unused - 0x0001A00C, // 09G - 0xDEADBEEF, // unused - 0x0001A00C, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xBCC74871, - }, -}; -#endif - -#ifdef CONFIG_393 -PatchOffset g_393_offsets = { - .fw_version = FW_393, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00000138, - .scePopsManLoadModuleCheck = 0x000014E8, - }, - .pops_patch = { - .decomp = { - { 0x000B40B4, 0x0000FA7C }, // 01G - { 0x000B40B4, 0x0000FA7C }, // 02G - { 0x000B40B4, 0x0000FA7C }, // 03G - { 0x000B40B4, 0x0000FA7C }, // 04G - { 0x000B40B4, 0x0000FA7C }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000B40B4, 0x0000FA7C }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000B40B4, 0x0000FA7C }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000B40B4, 0x0000FA7C }, // 11G - }, - .ICON0SizeOffset = { - 0x00028574, // 01G - 0x00028574, // 02G - 0x00028574, // 03G - 0x00028574, // 04G - 0x00028574, // 05G - 0xDEADBEEF, // unused - 0x00028574, // 07G - 0xDEADBEEF, // unused - 0x00028574, // 09G - 0xDEADBEEF, // unused - 0x00028574, // 11G - }, - .manualNameCheck = { - 0x00017DD8, // 01G - 0x00017DD8, // 02G - 0x00017DD8, // 03G - 0x00017DD8, // 04G - 0x00017DD8, // 05G - 0xDEADBEEF, // unused - 0x00017DD8, // 07G - 0xDEADBEEF, // unused - 0x00017DD8, // 09G - 0xDEADBEEF, // unused - 0x00017DD8, // 11G - }, - .sceMeAudio_67CD7972_NID = 0x79B3E859, - }, -}; -#endif - -#ifdef CONFIG_390 -PatchOffset g_390_offsets = { - .fw_version = FW_390, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00000138, - .scePopsManLoadModuleCheck = 0x000014E8, - }, - .pops_patch = { - .decomp = { - { 0x000B4094, 0x0000FA7C }, // 01G - { 0x000B4094, 0x0000FA7C }, // 02G - { 0x000B4094, 0x0000FA7C }, // 03G - { 0x000B4094, 0x0000FA7C }, // 04G - { 0x000B4094, 0x0000FA7C }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000B4094, 0x0000FA7C }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000B4094, 0x0000FA7C }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000B4094, 0x0000FA7C }, // 11G - }, - .ICON0SizeOffset = { - 0x00028558, // 01G - 0x00028558, // 02G - 0x00028558, // 03G - 0x00028558, // 04G - 0x00028558, // 05G - 0xDEADBEEF, // unused - 0x00028558, // 07G - 0xDEADBEEF, // unused - 0x00028558, // 09G - 0xDEADBEEF, // unused - 0x00028558, // 11G - }, - .manualNameCheck = { - 0x00017DD0, // 01G - 0x00017DD0, // 02G - 0x00017DD0, // 03G - 0x00017DD0, // 04G - 0x00017DD0, // 05G - 0xDEADBEEF, // unused - 0x00017DD0, // 07G - 0xDEADBEEF, // unused - 0x00017DD0, // 09G - 0xDEADBEEF, // unused - 0x00017DD0, // 11G - }, - .sceMeAudio_67CD7972_NID = 0x79B3E859, - }, -}; -#endif - -#ifdef CONFIG_380 -PatchOffset g_380_offsets = { - .fw_version = FW_380, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00000138, - .scePopsManLoadModuleCheck = 0x000014E4, - }, - .pops_patch = { - .decomp = { - { 0x000B3BD8, 0x0000E518 }, // 01G - { 0x000B3BD8, 0x0000E518 }, // 02G - { 0x000B3BD8, 0x0000E518 }, // 03G - { 0x000B3BD8, 0x0000E518 }, // 04G - { 0x000B3BD8, 0x0000E518 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000B3BD8, 0x0000E518 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000B3BD8, 0x0000E518 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x000B3BD8, 0x0000E518 }, // 11G - }, - .ICON0SizeOffset = { - 0x0002880C, // 01G - 0x0002880C, // 02G - 0x0002880C, // 03G - 0x0002880C, // 04G - 0x0002880C, // 05G - 0xDEADBEEF, // unused - 0x0002880C, // 07G - 0xDEADBEEF, // unused - 0x0002880C, // 09G - 0xDEADBEEF, // unused - 0x0002880C, // 11G - }, - .manualNameCheck = { - 0x000188B4, // 01G - 0x000188B4, // 02G - 0x000188B4, // 03G - 0x000188B4, // 04G - 0x000188B4, // 05G - 0xDEADBEEF, // unused - 0x000188B4, // 07G - 0xDEADBEEF, // unused - 0x000188B4, // 09G - 0xDEADBEEF, // unused - 0x000188B4, // 11G - }, - .sceMeAudio_67CD7972_NID = 0x79B3E859, - }, -}; -#endif - -#ifdef CONFIG_372 -PatchOffset g_372_offsets = { - .fw_version = FW_372, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0x00000138, - .scePopsManLoadModuleCheck = 0x000014B8, - }, - .pops_patch = { - .decomp = { - { 0x0002D480, 0x00013D6C }, // 01G - { 0x0002D480, 0x00013D6C }, // 02G - { 0x0002D480, 0x00013D6C }, // 03G - { 0x0002D480, 0x00013D6C }, // 04G - { 0x0002D480, 0x00013D6C }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002D480, 0x00013D6C }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002D480, 0x00013D6C }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002D480, 0x00013D6C }, // 11G - }, - .ICON0SizeOffset = { - 0x000294F8, // 01G - 0x000294F8, // 02G - 0x000294F8, // 03G - 0x000294F8, // 04G - 0x000294F8, // 05G - 0xDEADBEEF, // unused - 0x000294F8, // 07G - 0xDEADBEEF, // unused - 0x000294F8, // 09G - 0xDEADBEEF, // unused - 0x000294F8, // 11G - }, - .manualNameCheck = { - 0x0001D9FC, // 01G - 0x0001D9FC, // 02G - 0x0001D9FC, // 03G - 0x0001D9FC, // 04G - 0x0001D9FC, // 05G - 0xDEADBEEF, // unused - 0x0001D9FC, // 07G - 0xDEADBEEF, // unused - 0x0001D9FC, // 09G - 0xDEADBEEF, // unused - 0x0001D9FC, // 11G - }, - .sceMeAudio_67CD7972_NID = 0x902F30D8, - }, -}; -#endif - -#ifdef CONFIG_371 -PatchOffset g_371_offsets = { - .fw_version = FW_371, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0x0000059C, - .scePopsManLoadModuleCheck = 0x000000D4, - }, - .pops_patch = { - .decomp = { - { 0x0002BDA0, 0x00014100 }, // 01G - { 0x0002BDA0, 0x00014100 }, // 02G - { 0x0002BDA0, 0x00014100 }, // 03G - { 0x0002BDA0, 0x00014100 }, // 04G - { 0x0002BDA0, 0x00014100 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002BDA0, 0x00014100 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002BDA0, 0x00014100 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002BDA0, 0x00014100 }, // 11G - }, - .ICON0SizeOffset = { - 0x000253F4, // 01G - 0x000253F4, // 02G - 0x000253F4, // 03G - 0x000253F4, // 04G - 0x000253F4, // 05G - 0xDEADBEEF, // unused - 0x000253F4, // 07G - 0xDEADBEEF, // unused - 0x000253F4, // 09G - 0xDEADBEEF, // unused - 0x000253F4, // 11G - }, - .manualNameCheck = { - 0x0001B044, // 01G - 0x0001B044, // 02G - 0x0001B044, // 03G - 0x0001B044, // 04G - 0x0001B044, // 05G - 0xDEADBEEF, // unused - 0x0001B044, // 07G - 0xDEADBEEF, // unused - 0x0001B044, // 09G - 0xDEADBEEF, // unused - 0x0001B044, // 11G - }, - .sceMeAudio_67CD7972_NID = 0x902F30D8, - }, -}; -#endif - -#ifdef CONFIG_352 -PatchOffset g_352_offsets = { - .fw_version = FW_352, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, - .scePopsManLoadModuleCheck = 0x00000240, - }, - .pops_patch = { - .decomp = { - { 0x0002BD20, 0x00013E50 }, // 01G - { 0x0002BD20, 0x00013E50 }, // 02G - { 0x0002BD20, 0x00013E50 }, // 03G - { 0x0002BD20, 0x00013E50 }, // 04G - { 0x0002BD20, 0x00013E50 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002BD20, 0x00013E50 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002BD20, 0x00013E50 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002BD20, 0x00013E50 }, // 11G - }, - .ICON0SizeOffset = { - 0x00025080, // 01G - 0x00025080, // 02G - 0x00025080, // 03G - 0x00025080, // 04G - 0x00025080, // 05G - 0xDEADBEEF, // unused - 0x00025080, // 07G - 0xDEADBEEF, // unused - 0x00025080, // 09G - 0xDEADBEEF, // unused - 0x00025080, // 11G - }, - .manualNameCheck = { - 0x0001AF18, // 01G - 0x0001AF18, // 02G - 0x0001AF18, // 03G - 0x0001AF18, // 04G - 0x0001AF18, // 05G - 0xDEADBEEF, // unused - 0x0001AF18, // 07G - 0xDEADBEEF, // unused - 0x0001AF18, // 09G - 0xDEADBEEF, // unused - 0x0001AF18, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xFC56480E, - }, -}; -#endif - -#ifdef CONFIG_351 -PatchOffset g_351_offsets = { - .fw_version = FW_351, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, - .scePopsManLoadModuleCheck = 0x000000CC, - }, - .pops_patch = { - .decomp = { - { 0x0002B240, 0x00013C64 }, // 01G - { 0x0002B240, 0x00013C64 }, // 02G - { 0x0002B240, 0x00013C64 }, // 03G - { 0x0002B240, 0x00013C64 }, // 04G - { 0x0002B240, 0x00013C64 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002B240, 0x00013C64 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002B240, 0x00013C64 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002B240, 0x00013C64 }, // 11G - }, - .ICON0SizeOffset = { - 0x0001B030, // 01G - 0x0001B030, // 02G - 0x0001B030, // 03G - 0x0001B030, // 04G - 0x0001B030, // 05G - 0xDEADBEEF, // unused - 0x0001B030, // 07G - 0xDEADBEEF, // unused - 0x0001B030, // 09G - 0xDEADBEEF, // unused - 0x0001B030, // 11G - }, - .manualNameCheck = { - 0x0001C474, // 01G - 0x0001C474, // 02G - 0x0001C474, // 03G - 0x0001C474, // 04G - 0x0001C474, // 05G - 0xDEADBEEF, // unused - 0x0001C474, // 07G - 0xDEADBEEF, // unused - 0x0001C474, // 09G - 0xDEADBEEF, // unused - 0x0001C474, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xFC56480E, - }, -}; -#endif - -#ifdef CONFIG_350 -PatchOffset g_350_offsets = { - .fw_version = FW_350, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, - .scePopsManLoadModuleCheck = 0x000000CC, - }, - .pops_patch = { - .decomp = { - { 0x0002B240, 0x00013C64 }, // 01G - { 0x0002B240, 0x00013C64 }, // 02G - { 0x0002B240, 0x00013C64 }, // 03G - { 0x0002B240, 0x00013C64 }, // 04G - { 0x0002B240, 0x00013C64 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002B240, 0x00013C64 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002B240, 0x00013C64 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002B240, 0x00013C64 }, // 11G - }, - .ICON0SizeOffset = { - 0x0001B030, // 01G - 0x0001B030, // 02G - 0x0001B030, // 03G - 0x0001B030, // 04G - 0x0001B030, // 05G - 0xDEADBEEF, // unused - 0x0001B030, // 07G - 0xDEADBEEF, // unused - 0x0001B030, // 09G - 0xDEADBEEF, // unused - 0x0001B030, // 11G - }, - .manualNameCheck = { - 0x0001C474, // 01G - 0x0001C474, // 02G - 0x0001C474, // 03G - 0x0001C474, // 04G - 0x0001C474, // 05G - 0xDEADBEEF, // unused - 0x0001C474, // 07G - 0xDEADBEEF, // unused - 0x0001C474, // 09G - 0xDEADBEEF, // unused - 0x0001C474, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xFC56480E, - }, -}; -#endif - -#ifdef CONFIG_340 -PatchOffset g_340_offsets = { - .fw_version = FW_340, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, - .scePopsManLoadModuleCheck = 0x0000003C, - }, - .pops_patch = { - .decomp = { - { 0x0002A880, 0x00013850 }, // 01G - { 0x0002A880, 0x00013850 }, // 02G - { 0x0002A880, 0x00013850 }, // 03G - { 0x0002A880, 0x00013850 }, // 04G - { 0x0002A880, 0x00013850 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002A880, 0x00013850 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002A880, 0x00013850 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002A880, 0x00013850 }, // 11G - }, - .ICON0SizeOffset = { - 0x0001A45C, // 01G - 0x0001A45C, // 02G - 0x0001A45C, // 03G - 0x0001A45C, // 04G - 0x0001A45C, // 05G - 0xDEADBEEF, // unused - 0x0001A45C, // 07G - 0xDEADBEEF, // unused - 0x0001A45C, // 09G - 0xDEADBEEF, // unused - 0x0001A45C, // 11G - }, - .manualNameCheck = { - 0x0001B8BC, // 01G - 0x0001B8BC, // 02G - 0x0001B8BC, // 03G - 0x0001B8BC, // 04G - 0x0001B8BC, // 05G - 0xDEADBEEF, // unused - 0x0001B8BC, // 07G - 0xDEADBEEF, // unused - 0x0001B8BC, // 09G - 0xDEADBEEF, // unused - 0x0001B8BC, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xFC56480E, - }, -}; -#endif - -#ifdef CONFIG_330 -PatchOffset g_330_offsets = { - .fw_version = FW_330, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, - .scePopsManLoadModuleCheck = 0x0000003C, - }, - .pops_patch = { - .decomp = { - { 0x0002A000, 0x00013788 }, // 01G - { 0x0002A000, 0x00013788 }, // 02G - { 0x0002A000, 0x00013788 }, // 03G - { 0x0002A000, 0x00013788 }, // 04G - { 0x0002A000, 0x00013788 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002A000, 0x00013788 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002A000, 0x00013788 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0002A000, 0x00013788 }, // 11G - }, - .ICON0SizeOffset = { - 0x0001A0D4, // 01G - 0x0001A0D4, // 02G - 0x0001A0D4, // 03G - 0x0001A0D4, // 04G - 0x0001A0D4, // 05G - 0xDEADBEEF, // unused - 0x0001A0D4, // 07G - 0xDEADBEEF, // unused - 0x0001A0D4, // 09G - 0xDEADBEEF, // unused - 0x0001A0D4, // 11G - }, - .manualNameCheck = { - 0x0001B46C, // 01G - 0x0001B46C, // 02G - 0x0001B46C, // 03G - 0x0001B46C, // 04G - 0x0001B46C, // 05G - 0xDEADBEEF, // unused - 0x0001B46C, // 07G - 0xDEADBEEF, // unused - 0x0001B46C, // 09G - 0xDEADBEEF, // unused - 0x0001B46C, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xFC56480E, - }, -}; -#endif - -#ifdef CONFIG_311 -PatchOffset g_311_offsets = { - .fw_version = FW_311, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, - .scePopsManLoadModuleCheck = 0xDEADBEEF, - }, - .pops_patch = { - .decomp = { - { 0x00031D1C, 0x00010794 }, // 01G - { 0x00031D1C, 0x00010794 }, // 02G - { 0x00031D1C, 0x00010794 }, // 03G - { 0x00031D1C, 0x00010794 }, // 04G - { 0x00031D1C, 0x00010794 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x00031D1C, 0x00010794 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x00031D1C, 0x00010794 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x00031D1C, 0x00010794 }, // 11G - }, - .ICON0SizeOffset = { - 0x0002A640, // 01G - 0x0002A640, // 02G - 0x0002A640, // 03G - 0x0002A640, // 04G - 0x0002A640, // 05G - 0xDEADBEEF, // unused - 0x0002A640, // 07G - 0xDEADBEEF, // unused - 0x0002A640, // 09G - 0xDEADBEEF, // unused - 0x0002A640, // 11G - }, - .manualNameCheck = { - 0x0001C0C0, // 01G - 0x0001C0C0, // 02G - 0x0001C0C0, // 03G - 0x0001C0C0, // 04G - 0x0001C0C0, // 05G - 0xDEADBEEF, // unused - 0x0001C0C0, // 07G - 0xDEADBEEF, // unused - 0x0001C0C0, // 09G - 0xDEADBEEF, // unused - 0x0001C0C0, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xFC56480E, - }, -}; -#endif - -#ifdef CONFIG_310 -PatchOffset g_310_offsets = { - .fw_version = FW_310, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, - .scePopsManLoadModuleCheck = 0xDEADBEEF, - }, - .pops_patch = { - .decomp = { - { 0x00031B9C, 0x000105F0 }, // 01G - { 0x00031B9C, 0x000105F0 }, // 02G - { 0x00031B9C, 0x000105F0 }, // 03G - { 0x00031B9C, 0x000105F0 }, // 04G - { 0x00031B9C, 0x000105F0 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x00031B9C, 0x000105F0 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x00031B9C, 0x000105F0 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x00031B9C, 0x000105F0 }, // 11G - }, - .ICON0SizeOffset = { - 0x0002A498, // 01G - 0x0002A498, // 02G - 0x0002A498, // 03G - 0x0002A498, // 04G - 0x0002A498, // 05G - 0xDEADBEEF, // unused - 0x0002A498, // 07G - 0xDEADBEEF, // unused - 0x0002A498, // 09G - 0xDEADBEEF, // unused - 0x0002A498, // 11G - }, - .manualNameCheck = { - 0x0001C0FC, // 01G - 0x0001C0FC, // 02G - 0x0001C0FC, // 03G - 0x0001C0FC, // 04G - 0x0001C0FC, // 05G - 0xDEADBEEF, // unused - 0x0001C0FC, // 07G - 0xDEADBEEF, // unused - 0x0001C0FC, // 09G - 0xDEADBEEF, // unused - 0x0001C0FC, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xFC56480E, - }, -}; -#endif - -#ifdef CONFIG_303 -PatchOffset g_303_offsets = { - .fw_version = FW_303, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, - .scePopsManLoadModuleCheck = 0xDEADBEEF, - }, - .pops_patch = { - .decomp = { - { 0x0003A08C, 0x00012A60 }, // 01G - { 0x0003A08C, 0x00012A60 }, // 02G - { 0x0003A08C, 0x00012A60 }, // 03G - { 0x0003A08C, 0x00012A60 }, // 04G - { 0x0003A08C, 0x00012A60 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0003A08C, 0x00012A60 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0003A08C, 0x00012A60 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0003A08C, 0x00012A60 }, // 11G - }, - .ICON0SizeOffset = { - 0x00032E40, // 01G - 0x00032E40, // 02G - 0x00032E40, // 03G - 0x00032E40, // 04G - 0x00032E40, // 05G - 0xDEADBEEF, // unused - 0x00032E40, // 07G - 0xDEADBEEF, // unused - 0x00032E40, // 09G - 0xDEADBEEF, // unused - 0x00032E40, // 11G - }, - .manualNameCheck = { - 0xDEADBEEF, // 01G - 0xDEADBEEF, // 02G - 0xDEADBEEF, // 03G - 0xDEADBEEF, // 04G - 0xDEADBEEF, // 05G - 0xDEADBEEF, // unused - 0xDEADBEEF, // 07G - 0xDEADBEEF, // unused - 0xDEADBEEF, // 09G - 0xDEADBEEF, // unused - 0xDEADBEEF, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xFC56480E, - }, -}; -#endif - -#ifdef CONFIG_302 -PatchOffset g_302_offsets = { - .fw_version = FW_302, - .popsman_patch = { - .get_rif_path = 0xDEADBEEF, - .get_rif_path_call1 = 0xDEADBEEF, - .get_rif_path_call2 = 0xDEADBEEF, - .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, - .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, - .scePopsManLoadModuleCheck = 0xDEADBEEF, - }, - .pops_patch = { - .decomp = { - { 0x0003900C, 0x00012314 }, // 01G - { 0x0003900C, 0x00012314 }, // 02G - { 0x0003900C, 0x00012314 }, // 03G - { 0x0003900C, 0x00012314 }, // 04G - { 0x0003900C, 0x00012314 }, // 05G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0003900C, 0x00012314 }, // 07G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0003900C, 0x00012314 }, // 09G - { 0xDEADBEEF, 0xDEADBEEF }, // unused - { 0x0003900C, 0x00012314 }, // 11G - }, - .ICON0SizeOffset = { - 0x000315CC, // 01G - 0x000315CC, // 02G - 0x000315CC, // 03G - 0x000315CC, // 04G - 0x000315CC, // 05G - 0xDEADBEEF, // unused - 0x000315CC, // 07G - 0xDEADBEEF, // unused - 0x000315CC, // 09G - 0xDEADBEEF, // unused - 0x000315CC, // 11G - }, - .manualNameCheck = { - 0xDEADBEEF, // 01G - 0xDEADBEEF, // 02G - 0xDEADBEEF, // 03G - 0xDEADBEEF, // 04G - 0xDEADBEEF, // 05G - 0xDEADBEEF, // unused - 0xDEADBEEF, // 07G - 0xDEADBEEF, // unused - 0xDEADBEEF, // 09G - 0xDEADBEEF, // unused - 0xDEADBEEF, // 11G - }, - .sceMeAudio_67CD7972_NID = 0xFC56480E, - }, -}; -#endif - -PatchOffset *g_offs = NULL; - -void setup_patch_offset_table(u32 fw_version) -{ -#ifdef CONFIG_660 - if(fw_version == g_660_offsets.fw_version) { - g_offs = &g_660_offsets; - } -#endif - -#ifdef CONFIG_639 - if(fw_version == g_639_offsets.fw_version) { - g_offs = &g_639_offsets; - } -#endif - -#ifdef CONFIG_635 - if(fw_version == g_635_offsets.fw_version) { - g_offs = &g_635_offsets; - } -#endif - -#ifdef CONFIG_620 - if(fw_version == g_620_offsets.fw_version) { - g_offs = &g_620_offsets; - } -#endif - -#ifdef CONFIG_610 - if(fw_version == g_610_offsets.fw_version) { - g_offs = &g_610_offsets; - } -#endif - -#ifdef CONFIG_600 - if(fw_version == g_600_offsets.fw_version) { - g_offs = &g_600_offsets; - } -#endif - -#ifdef CONFIG_551 - if(fw_version == g_551_offsets.fw_version) { - g_offs = &g_551_offsets; - } -#endif - -#ifdef CONFIG_550 - if(fw_version == g_550_offsets.fw_version) { - g_offs = &g_550_offsets; - } -#endif - -#ifdef CONFIG_503 - if(fw_version == g_503_offsets.fw_version) { - g_offs = &g_503_offsets; - } -#endif - -#ifdef CONFIG_501 - if(fw_version == g_501_offsets.fw_version) { - g_offs = &g_501_offsets; - } -#endif - -#ifdef CONFIG_500 - if(fw_version == g_500_offsets.fw_version) { - g_offs = &g_500_offsets; - } -#endif - -#ifdef CONFIG_401 - if(fw_version == g_401_offsets.fw_version) { - g_offs = &g_401_offsets; - } -#endif - -#ifdef CONFIG_396 - if(fw_version == g_396_offsets.fw_version) { - g_offs = &g_396_offsets; - } -#endif - -#ifdef CONFIG_393 - if(fw_version == g_393_offsets.fw_version) { - g_offs = &g_393_offsets; - } -#endif - -#ifdef CONFIG_390 - if(fw_version == g_390_offsets.fw_version) { - g_offs = &g_390_offsets; - } -#endif - -#ifdef CONFIG_380 - if(fw_version == g_380_offsets.fw_version) { - g_offs = &g_380_offsets; - } -#endif - -#ifdef CONFIG_372 - if(fw_version == g_372_offsets.fw_version) { - g_offs = &g_372_offsets; - } -#endif - -#ifdef CONFIG_371 - if(fw_version == g_371_offsets.fw_version) { - g_offs = &g_371_offsets; - } -#endif - -#ifdef CONFIG_352 - if(fw_version == g_352_offsets.fw_version) { - g_offs = &g_352_offsets; - } -#endif - -#ifdef CONFIG_351 - if(fw_version == g_351_offsets.fw_version) { - g_offs = &g_351_offsets; - } -#endif - -#ifdef CONFIG_350 - if(fw_version == g_350_offsets.fw_version) { - g_offs = &g_350_offsets; - } -#endif - -#ifdef CONFIG_340 - if(fw_version == g_340_offsets.fw_version) { - g_offs = &g_340_offsets; - } -#endif - -#ifdef CONFIG_330 - if(fw_version == g_330_offsets.fw_version) { - g_offs = &g_330_offsets; - } -#endif - -#ifdef CONFIG_311 - if(fw_version == g_311_offsets.fw_version) { - g_offs = &g_311_offsets; - } -#endif - -#ifdef CONFIG_310 - if(fw_version == g_310_offsets.fw_version) { - g_offs = &g_310_offsets; - } -#endif - -#ifdef CONFIG_303 - if(fw_version == g_303_offsets.fw_version) { - g_offs = &g_303_offsets; - } -#endif - -#ifdef CONFIG_302 - if(fw_version == g_302_offsets.fw_version) { - g_offs = &g_302_offsets; - } -#endif -} +/* + * This file is part of PRO CFW. + + * PRO CFW is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * PRO CFW is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PRO CFW. If not, see +#include "popcorn_patch_offset.h" + +#if !defined(CONFIG_661) && !defined(CONFIG_660) && !defined(CONFIG_635) && !defined(CONFIG_620) && !defined(CONFIG_639) && !defined(CONFIG_610) && !defined(CONFIG_600) && !defined(CONFIG_551) && !defined(CONFIG_550) && !defined(CONFIG_503) && !defined(CONFIG_501) && !defined(CONFIG_500) && !defined(CONFIG_401) && !defined(CONFIG_396) && !defined(CONFIG_393) && !defined(CONFIG_390) && !defined(CONFIG_380) && !defined(CONFIG_372) && !defined(CONFIG_371) && !defined(CONFIG_352) && !defined(CONFIG_351) && !defined(CONFIG_350) && !defined(CONFIG_340) && !defined(CONFIG_330) && !defined(CONFIG_311) && !defined(CONFIG_310) && !defined(CONFIG_303) && !defined(CONFIG_302) +#error You have to define one of CONFIG_FW_VERSION +#endif + +#if defined(CONFIG_660) || defined(CONFIG_661) +#ifdef CONFIG_660 +PatchOffset g_660_offsets = { + .fw_version = FW_660, +#endif +#ifdef CONFIG_661 +PatchOffset g_661_offsets = { + .fw_version = FW_661, +#endif + .popsman_patch = { + .get_rif_path = 0x00000190, + .get_rif_path_call1 = 0x00002798, + .get_rif_path_call2 = 0x00002C58, + .sceNpDrmGetVersionKeyCall = 0x000029C4, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00002DA8, + .scePopsManLoadModuleCheck = 0x00001E80, + }, + .pops_patch = { + .decomp = { + { 0x000D5424, 0x0000DB78 }, // 01G + { 0x000D64DC, 0x0000DB78 }, // 02G + { 0x000D64DC, 0x0000DB78 }, // 03G + { 0x000D654C, 0x0000DBE8 }, // 04G + { 0x000D84D8, 0x0000E300 }, // 05G + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000D656C, 0x0000DBE8 }, // 07G + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000D656C, 0x0000DBE8 }, // 09G + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000D5494, 0x0000DBE8 }, // 11G + { 0xDEADBEEF, 0xDEADBEEF }, // unused + }, + .ICON0SizeOffset = { + 0x00036D50, // 01G + 0x00037D8C, // 02G + 0x00037D8C, // 03G + 0x00037E04, // 04G + 0x00039BEC, // 05G + 0xDEADBEEF, // unused + 0x00037E1C, // 07G + 0xDEADBEEF, // unused + 0x00037E1C, // 09G + 0xDEADBEEF, // unused + 0x00036DCC, // 11G + 0xDEADBEEF, // unused + }, + .manualNameCheck = { + 0x00025248, // 01G + 0x00025754, // 02G + 0x00025754, // 03G + 0x000257CC, // 04G + 0x00026060, // 05G + 0xDEADBEEF, // unused + 0x000257E4, // 07G + 0xDEADBEEF, // unused + 0x000257E4, // 09G + 0xDEADBEEF, // unused + 0x000252C4, // 11G + 0xDEADBEEF, // unused + }, + .sceMeAudio_67CD7972_NID = 0x2AB4FE43, + }, +}; +#endif + +#ifdef CONFIG_639 +PatchOffset g_639_offsets = { + .fw_version = FW_639, + .popsman_patch = { + .get_rif_path = 0x00000190, + .get_rif_path_call1 = 0x00002798, + .get_rif_path_call2 = 0x00002C58, + .sceNpDrmGetVersionKeyCall = 0x000029C4, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00002DA8, + .scePopsManLoadModuleCheck = 0x00001E80, + }, + .pops_patch = { + .decomp = { + { 0x000D5654, 0x0000DC04 }, // 01G + { 0x000D671C, 0x0000DC04 }, // 02G + { 0x000D671C, 0x0000DC04 }, // 03G + { 0x000D670C, 0x0000DC04 }, // 04G + { 0x000D8698, 0x0000E31C }, // 05G + { 0x00000000, 0x00000000 }, // unused + { 0x000D670C, 0x0000DC04 }, // 07G + { 0x00000000, 0x00000000 }, // unused + { 0x000D670C, 0x0000DC04 }, // 09G + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000D670C, 0x0000DC04 }, // 11G + { 0xDEADBEEF, 0xDEADBEEF }, // unused + }, + .ICON0SizeOffset = { + 0x00036F54, // 01G + 0x00037F90, // 02G + 0x00037F90, // 03G + 0x00037F90, // 04G + 0x00039D78, // 05G + 0xDEADBEEF, // unused + 0x00037F90, // 07G + 0xDEADBEEF, // unused + 0x00037F90, // 09G + 0xDEADBEEF, // unused + 0x00037F90, // 11G + 0xDEADBEEF, // unused + }, + .manualNameCheck = { + 0x0002541C, // 01G + 0x00025928, // 02G + 0x00025928, // 03G + 0x00025928, // 04G + 0x000261BC, // 05G + 0xDEADBEEF, // unused + 0x00025928, // 07G + 0xDEADBEEF, // unused + 0x00025928, // 11G + 0xDEADBEEF, // unused + }, + .sceMeAudio_67CD7972_NID = 0x67CD7972, + }, +}; +#endif + +#ifdef CONFIG_635 +PatchOffset g_635_offsets = { + .fw_version = FW_635, + .popsman_patch = { + .get_rif_path = 0x00000190, + .get_rif_path_call1 = 0x00002798, + .get_rif_path_call2 = 0x00002C58, + .sceNpDrmGetVersionKeyCall = 0x000029C4, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00002DA8, + .scePopsManLoadModuleCheck = 0x00001E80, + }, + .pops_patch = { + .decomp = { + { 0x000D5404, 0x0000DAC0 }, // 01G + { 0x000D64BC, 0x0000DAC0 }, // 02G + { 0x000D64BC, 0x0000DAC0 }, // 03G + { 0x000D64FC, 0x0000DB00 }, // 04G + { 0x000D8488, 0x0000E218 }, // 05G + { 0x00000000, 0x00000000 }, // unused + { 0x000D64FC, 0x0000DB00 }, // 07G + { 0x00000000, 0x00000000 }, // unused + { 0x000D64FC, 0x0000DB00 }, // 09G + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000D64FC, 0x0000DB00 }, // 11G + { 0xDEADBEEF, 0xDEADBEEF }, // unused + }, + .ICON0SizeOffset = { + 0x00036CF8, // 01G + 0x00037D34, // 02G + 0x00037D34, // 03G + 0x00037D74, // 04G + 0x00039B5C, // 05G + 0xDEADBEEF, // unused + 0x00037D74, // 07G + 0xDEADBEEF, // unused + 0x00037D74, // 09G + 0xDEADBEEF, // unused + 0x00037D74, // 11G + 0xDEADBEEF, // unused + }, + .manualNameCheck = { + 0x000251C0, // 01G + 0x000256CC, // 02G + 0x000256CC, // 03G + 0x0002570C, // 04G + 0x00025FA0, // 05G + 0xDEADBEEF, // unused + 0x0002570C, // 07G + 0xDEADBEEF, // unused + 0x0002570C, // 09G + 0xDEADBEEF, // unused + 0x0002570C, // 11G + 0xDEADBEEF, // unused + }, + .sceMeAudio_67CD7972_NID = 0x67CD7972, + }, +}; +#endif + +#ifdef CONFIG_620 +PatchOffset g_620_offsets = { + .fw_version = FW_620, + .popsman_patch = { + .get_rif_path = 0x00000190, + .get_rif_path_call1 = 0x00002824, + .get_rif_path_call2 = 0x00002CE4, + .sceNpDrmGetVersionKeyCall = 0x00002A50, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00002E34, + .scePopsManLoadModuleCheck = 0x00001EA8, + }, + .pops_patch = { + .decomp = { + { 0x000DA600, 0x0000DE18 }, // 01G + { 0x000DA600, 0x0000DE18 }, // 02G + { 0x000DA600, 0x0000DE18 }, // 03G + { 0x000DA630, 0x0000DE1C }, // 04G + { 0x000DC5CC, 0x0000E534 }, // 05G + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000DA630, 0x0000DE1C }, // unused + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000DA630, 0x0000DE1C }, // unused + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000DA630, 0x0000DE1C }, // unused + { 0xDEADBEEF, 0xDEADBEEF }, // unused + }, + .ICON0SizeOffset = { + 0x0003BCD0, // 01G + 0x0003BCD0, // 02G + 0x0003BCD0, // 03G + 0x0003BCFC, // 04G + 0x0003DAE4, // 05G + 0xDEADBEEF, // unused + 0x0003BCFC, // unused + 0xDEADBEEF, // unused + 0x0003BCFC, // unused + 0xDEADBEEF, // unused + 0x0003BCFC, // unused + 0xDEADBEEF, // unused + }, + .manualNameCheck = { + 0x00029710, // 01G + 0x00029710, // 02G + 0x00029710, // 03G + 0x0002973C, // 04G + 0x00029FD0, // 05G + 0xDEADBEEF, // unused + 0x0002973C, // unused + 0xDEADBEEF, // unused + 0x0002973C, // unused + 0xDEADBEEF, // unused + 0x0002973C, // unused + 0xDEADBEEF, // unused + }, + .sceMeAudio_67CD7972_NID = 0xF43E573A, + }, +}; +#endif + +#ifdef CONFIG_610 +PatchOffset g_610_offsets = { + .fw_version = FW_610, + .popsman_patch = { + .get_rif_path = 0x00000190, + .get_rif_path_call1 = 0x0000239C, + .get_rif_path_call2 = 0x0000291C, + .sceNpDrmGetVersionKeyCall = 0x000025C8, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00002A88, + .scePopsManLoadModuleCheck = 0x00001A48, + }, + .pops_patch = { + .decomp = { + { 0x000CC83C, 0x0000D6B8 }, // 01G + { 0x000CC83C, 0x0000D6B8 }, // 02G + { 0x000CC83C, 0x0000D6B8 }, // 03G + { 0x000CC88C, 0x0000D6FC }, // 04G + { 0x000CE4E8, 0x0000DE08 }, // 05G + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000CC88C, 0x0000D6FC }, // unused + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000CC88C, 0x0000D6FC }, // unused + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000CC88C, 0x0000D6FC }, // unused + { 0xDEADBEEF, 0xDEADBEEF }, // unused + }, + .ICON0SizeOffset = { + 0x0002E454, // 01G + 0x0002E454, // 02G + 0x0002E454, // 03G + 0x0002E49C, // 04G + 0x0002FF50, // 05G + 0xDEADBEEF, // unused + 0x0002E49C, // unused + 0xDEADBEEF, // unused + 0x0002E49C, // unused + 0xDEADBEEF, // unused + 0x0002E49C, // unused + 0xDEADBEEF, // unused + }, + .manualNameCheck = { + 0x0001C418, // 01G + 0x0001C418, // 02G + 0x0001C418, // 03G + 0x0001C460, // 04G + 0x0001CCC4, // 05G + 0xDEADBEEF, // unused + 0x0001C460, // unused + 0xDEADBEEF, // unused + 0x0001C460, // unused + 0xDEADBEEF, // unused + 0x0001C460, // unused + 0xDEADBEEF, // unused + }, + .sceMeAudio_67CD7972_NID = 0xF43E573A, + }, +}; +#endif + +#ifdef CONFIG_600 +PatchOffset g_600_offsets = { + .fw_version = FW_600, + .popsman_patch = { + .get_rif_path = 0x00000190, + .get_rif_path_call1 = 0x0000239C, + .get_rif_path_call2 = 0x0000291C, + .sceNpDrmGetVersionKeyCall = 0x000025C8, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00002A88, + .scePopsManLoadModuleCheck = 0x00001A48, + }, + .pops_patch = { + .decomp = { + { 0x000CC82C, 0x0000D6B8 }, // 01G + { 0x000CC82C, 0x0000D6B8 }, // 02G + { 0x000CC82C, 0x0000D6B8 }, // 03G + { 0x000CC87C, 0x0000D6FC }, // 04G + //{ 0xDEADBEEF, 0xDEADBEEF }, // 05G TODO + { 0x000CC87C, 0x0000D6FC }, // 05G + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000CC87C, 0x0000D6FC }, // unused + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000CC87C, 0x0000D6FC }, // unused + { 0xDEADBEEF, 0xDEADBEEF }, // unused + { 0x000CC87C, 0x0000D6FC }, // unused + { 0xDEADBEEF, 0xDEADBEEF }, // unused + }, + .ICON0SizeOffset = { + 0x0002E440, // 01G + 0x0002E440, // 02G + 0x0002E440, // 03G + 0x0002E488, // 04G + //0xDEADBEEF, // 05G TODO + 0x0002E488, // 05G + 0xDEADBEEF, // unused + 0x0002E488, // unused + 0xDEADBEEF, // unused + 0x0002E488, // unused + 0xDEADBEEF, // unused + 0x0002E488, // unused + 0xDEADBEEF, // unused + }, + .manualNameCheck = { + 0x0001C404, // 01G + 0x0001C404, // 02G + 0x0001C404, // 03G + 0x0001C44C, // 04G + //0xDEADBEEF, // 05G TODO + 0x0001C44C, // 05G + 0xDEADBEEF, // unused + 0x0001C44C, // unused + 0xDEADBEEF, // unused + 0x0001C44C, // unused + 0xDEADBEEF, // unused + 0x0001C44C, // unused + 0xDEADBEEF, // unused + }, + .sceMeAudio_67CD7972_NID = 0xF43E573A, + }, +}; +#endif + +#ifdef CONFIG_551 +PatchOffset g_551_offsets = { + .fw_version = FW_551, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00000144, + .scePopsManLoadModuleCheck = 0x000015C0, + }, + .pops_patch = { + .decomp = { + { 0x000CEDB8, 0x0000E84C }, // 01G + { 0x000CEDB8, 0x0000E84C }, // 02G + { 0x000CEDB8, 0x0000E84C }, // 03G + { 0x000CEDB8, 0x0000E84C }, // 04G + { 0x000CEDB8, 0x0000E84C }, // 05G + { 0x000CEDB8, 0x0000E84C }, // unused + { 0x000CEDB8, 0x0000E84C }, // unused + { 0x000CEDB8, 0x0000E84C }, // unused + { 0x000CEDB8, 0x0000E84C }, // unused + { 0x000CEDB8, 0x0000E84C }, // unused + { 0x000CEDB8, 0x0000E84C }, // unused + { 0x000CEDB8, 0x0000E84C }, // unused + }, + .ICON0SizeOffset = { + 0x00030778, // 01G + 0x00030778, // 02G + 0x00030778, // 03G + 0x00030778, // 04G + 0x00030778, // 05G + 0x00030778, // unused + 0x00030778, // unused + 0x00030778, // unused + 0x00030778, // unused + 0x00030778, // unused + 0x00030778, // unused + 0x00030778, // unused + }, + .manualNameCheck = { + 0x0001FBD4, // 01G + 0x0001FBD4, // 02G + 0x0001FBD4, // 03G + 0x0001FBD4, // 04G + 0x0001FBD4, // 05G + 0x0001FBD4, // unused + 0x0001FBD4, // unused + 0x0001FBD4, // unused + 0x0001FBD4, // unused + 0x0001FBD4, // unused + 0x0001FBD4, // unused + 0x0001FBD4, // unused + }, + .sceMeAudio_67CD7972_NID = 0x1BDF9405, + }, +}; +#endif + +#ifdef CONFIG_550 +PatchOffset g_550_offsets = { + .fw_version = FW_550, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00000144, + .scePopsManLoadModuleCheck = 0x0000158C, + }, + .pops_patch = { + .decomp = { + { 0x000CEDB8, 0x0000E834 }, // 01G + { 0x000CEDB8, 0x0000E834 }, // 02G + { 0x000CEDB8, 0x0000E834 }, // 03G + { 0x000CEDB8, 0x0000E834 }, // 04G + { 0x000CEDB8, 0x0000E834 }, // 05G + { 0x000CEDB8, 0x0000E834 }, // unused + { 0x000CEDB8, 0x0000E834 }, // unused + { 0x000CEDB8, 0x0000E834 }, // unused + { 0x000CEDB8, 0x0000E834 }, // unused + { 0x000CEDB8, 0x0000E834 }, // unused + { 0x000CEDB8, 0x0000E834 }, // unused + { 0x000CEDB8, 0x0000E834 }, // unused + }, + .ICON0SizeOffset = { + 0x00030704, // 01G + 0x00030704, // 02G + 0x00030704, // 03G + 0x00030704, // 04G + 0x00030704, // 05G + 0x00030704, // unused + 0x00030704, // unused + 0x00030704, // unused + 0x00030704, // unused + 0x00030704, // unused + 0x00030704, // unused + 0x00030704, // unused + }, + .manualNameCheck = { + 0x0001FB60, // 01G + 0x0001FB60, // 02G + 0x0001FB60, // 03G + 0x0001FB60, // 04G + 0x0001FB60, // 05G + 0x0001FB60, // unused + 0x0001FB60, // unused + 0x0001FB60, // unused + 0x0001FB60, // unused + 0x0001FB60, // unused + 0x0001FB60, // unused + 0x0001FB60, // unused + }, + .sceMeAudio_67CD7972_NID = 0x1BDF9405, + }, +}; +#endif + +#ifdef CONFIG_503 +PatchOffset g_503_offsets = { + .fw_version = FW_503, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00000144, + .scePopsManLoadModuleCheck = 0x0000158C, + }, + .pops_patch = { + .decomp = { + { 0x000C588C, 0x0000E958 }, // 01G + { 0x000C588C, 0x0000E958 }, // 02G + { 0x000C588C, 0x0000E958 }, // 03G + { 0x000C588C, 0x0000E958 }, // 04G + { 0x000C588C, 0x0000E958 }, // 05G + { 0x000C588C, 0x0000E958 }, // unused + { 0x000C588C, 0x0000E958 }, // unused + { 0x000C588C, 0x0000E958 }, // unused + { 0x000C588C, 0x0000E958 }, // unused + { 0x000C588C, 0x0000E958 }, // unused + { 0x000C588C, 0x0000E958 }, // unused + { 0x000C588C, 0x0000E958 }, // unused + }, + .ICON0SizeOffset = { + 0x000273A8, // 01G + 0x000273A8, // 02G + 0x000273A8, // 03G + 0x000273A8, // 04G + 0x000273A8, // 05G + 0x000273A8, // unused + 0x000273A8, // unused + 0x000273A8, // unused + 0x000273A8, // unused + 0x000273A8, // unused + 0x000273A8, // unused + 0x000273A8, // unused + }, + .manualNameCheck = { + 0x000190F8, // 01G + 0x000190F8, // 02G + 0x000190F8, // 03G + 0x000190F8, // 04G + 0x000190F8, // 05G + 0x000190F8, // unused + 0x000190F8, // unused + 0x000190F8, // unused + 0x000190F8, // unused + 0x000190F8, // unused + 0x000190F8, // unused + 0x000190F8, // unused + }, + .sceMeAudio_67CD7972_NID = 0x1BDF9405, + }, +}; +#endif + +#ifdef CONFIG_501 +PatchOffset g_501_offsets = { + .fw_version = FW_501, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00000144, + .scePopsManLoadModuleCheck = 0x0000158C, + }, + .pops_patch = { + .decomp = { + { 0x000C583C, 0x0000E90C }, // 01G + { 0x000C583C, 0x0000E90C }, // 02G + { 0x000C583C, 0x0000E90C }, // 03G + { 0x000C583C, 0x0000E90C }, // 04G + { 0x000C583C, 0x0000E90C }, // 05G + { 0x000C583C, 0x0000E90C }, // unused + { 0x000C583C, 0x0000E90C }, // unused + { 0x000C583C, 0x0000E90C }, // unused + { 0x000C583C, 0x0000E90C }, // unused + { 0x000C583C, 0x0000E90C }, // unused + { 0x000C583C, 0x0000E90C }, // unused + { 0x000C583C, 0x0000E90C }, // unused + }, + .ICON0SizeOffset = { + 0x00027354, // 01G + 0x00027354, // 02G + 0x00027354, // 03G + 0x00027354, // 04G + 0x00027354, // 05G + 0x00027354, // unused + 0x00027354, // unused + 0x00027354, // unused + 0x00027354, // unused + 0x00027354, // unused + 0x00027354, // unused + 0x00027354, // unused + }, + .manualNameCheck = { + 0x000190A4, // 01G + 0x000190A4, // 02G + 0x000190A4, // 03G + 0x000190A4, // 04G + 0x000190A4, // 05G + 0x000190A4, // unused + 0x000190A4, // unused + 0x000190A4, // unused + 0x000190A4, // unused + 0x000190A4, // unused + 0x000190A4, // unused + 0x000190A4, // unused + }, + .sceMeAudio_67CD7972_NID = 0x1BDF9405, + }, +}; +#endif + +#ifdef CONFIG_500 +PatchOffset g_500_offsets = { + .fw_version = FW_500, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00000144, + .scePopsManLoadModuleCheck = 0x0000158C, + }, + .pops_patch = { + .decomp = { + { 0x000C583C, 0x0000E90C }, // 01G + { 0x000C583C, 0x0000E90C }, // 02G + { 0x000C583C, 0x0000E90C }, // 03G + { 0x000C583C, 0x0000E90C }, // 04G + { 0x000C583C, 0x0000E90C }, // 05G + { 0x000C583C, 0x0000E90C }, // unused + { 0x000C583C, 0x0000E90C }, // unused + { 0x000C583C, 0x0000E90C }, // unused + { 0x000C583C, 0x0000E90C }, // unused + { 0x000C583C, 0x0000E90C }, // unused + { 0x000C583C, 0x0000E90C }, // unused + { 0x000C583C, 0x0000E90C }, // unused + }, + .ICON0SizeOffset = { + 0x0002734C, // 01G + 0x0002734C, // 02G + 0x0002734C, // 03G + 0x0002734C, // 04G + 0x0002734C, // 05G + 0x0002734C, // unused + 0x0002734C, // unused + 0x0002734C, // unused + 0x0002734C, // unused + 0x0002734C, // unused + 0x0002734C, // unused + 0x0002734C, // unused + }, + .manualNameCheck = { + 0x0001909C, // 01G + 0x0001909C, // 02G + 0x0001909C, // 03G + 0x0001909C, // 04G + 0x0001909C, // 05G + 0x0001909C, // unused + 0x0001909C, // unused + 0x0001909C, // unused + 0x0001909C, // unused + 0x0001909C, // unused + 0x0001909C, // unused + 0x0001909C, // unused + }, + .sceMeAudio_67CD7972_NID = 0x1BDF9405, + }, +}; +#endif + +#ifdef CONFIG_401 +PatchOffset g_401_offsets = { + .fw_version = FW_401, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00000138, + .scePopsManLoadModuleCheck = 0x000015F0, + }, + .pops_patch = { + .decomp = { + { 0x000CC12C, 0x000119CC }, // 01G + { 0x000CC12C, 0x000119CC }, // 02G + { 0x000CC12C, 0x000119CC }, // 03G + { 0x000CC12C, 0x000119CC }, // 04G + { 0x000CC12C, 0x000119CC }, // 05G + { 0x000CC12C, 0x000119CC }, // unused + { 0x000CC12C, 0x000119CC }, // unused + { 0x000CC12C, 0x000119CC }, // unused + { 0x000CC12C, 0x000119CC }, // unused + { 0x000CC12C, 0x000119CC }, // unused + { 0x000CC12C, 0x000119CC }, // unused + { 0x000CC12C, 0x000119CC }, // unused + }, + .ICON0SizeOffset = { + 0x0002CF88, // 01G + 0x0002CF88, // 02G + 0x0002CF88, // 03G + 0x0002CF88, // 04G + 0x0002CF88, // 05G + 0x0002CF88, // unused + 0x0002CF88, // unused + 0x0002CF88, // unused + 0x0002CF88, // unused + 0x0002CF88, // unused + 0x0002CF88, // unused + 0x0002CF88, // unused + }, + .manualNameCheck = { + 0x0001C044, // 01G + 0x0001C044, // 02G + 0x0001C044, // 03G + 0x0001C044, // 04G + 0x0001C044, // 05G + 0x0001C044, // unused + 0x0001C044, // unused + 0x0001C044, // unused + 0x0001C044, // unused + 0x0001C044, // unused + 0x0001C044, // unused + 0x0001C044, // unused + }, + .sceMeAudio_67CD7972_NID = 0xBCC74871, + }, +}; +#endif + +#ifdef CONFIG_396 +PatchOffset g_396_offsets = { + .fw_version = FW_396, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00000138, + .scePopsManLoadModuleCheck = 0x000014E8, + }, + .pops_patch = { + .decomp = { + { 0x000C9BF8, 0x0000FAF0 }, // 01G + { 0x000C9BF8, 0x0000FAF0 }, // 02G + { 0x000C9BF8, 0x0000FAF0 }, // 03G + { 0x000C9BF8, 0x0000FAF0 }, // 04G + { 0x000C9BF8, 0x0000FAF0 }, // 05G + { 0x000C9BF8, 0x0000FAF0 }, // unused + { 0x000C9BF8, 0x0000FAF0 }, // unused + { 0x000C9BF8, 0x0000FAF0 }, // unused + { 0x000C9BF8, 0x0000FAF0 }, // unused + { 0x000C9BF8, 0x0000FAF0 }, // unused + { 0x000C9BF8, 0x0000FAF0 }, // unused + { 0x000C9BF8, 0x0000FAF0 }, // unused + }, + .ICON0SizeOffset = { + 0x0002AEB4, // 01G + 0x0002AEB4, // 02G + 0x0002AEB4, // 03G + 0x0002AEB4, // 04G + 0x0002AEB4, // 05G + 0x0002AEB4, // unused + 0x0002AEB4, // unused + 0x0002AEB4, // unused + 0x0002AEB4, // unused + 0x0002AEB4, // unused + 0x0002AEB4, // unused + 0x0002AEB4, // unused + }, + .manualNameCheck = { + 0x0001A00C, // 01G + 0x0001A00C, // 02G + 0x0001A00C, // 03G + 0x0001A00C, // 04G + 0x0001A00C, // 05G + 0x0001A00C, // unused + 0x0001A00C, // unused + 0x0001A00C, // unused + 0x0001A00C, // unused + 0x0001A00C, // unused + 0x0001A00C, // unused + 0x0001A00C, // unused + }, + .sceMeAudio_67CD7972_NID = 0xBCC74871, + }, +}; +#endif + +#ifdef CONFIG_393 +PatchOffset g_393_offsets = { + .fw_version = FW_393, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00000138, + .scePopsManLoadModuleCheck = 0x000014E8, + }, + .pops_patch = { + .decomp = { + { 0x000B40B4, 0x0000FA7C }, // 01G + { 0x000B40B4, 0x0000FA7C }, // 02G + { 0x000B40B4, 0x0000FA7C }, // 03G + { 0x000B40B4, 0x0000FA7C }, // 04G + { 0x000B40B4, 0x0000FA7C }, // 05G + { 0x000B40B4, 0x0000FA7C }, // unused + { 0x000B40B4, 0x0000FA7C }, // unused + { 0x000B40B4, 0x0000FA7C }, // unused + { 0x000B40B4, 0x0000FA7C }, // unused + { 0x000B40B4, 0x0000FA7C }, // unused + { 0x000B40B4, 0x0000FA7C }, // unused + { 0x000B40B4, 0x0000FA7C }, // unused + }, + .ICON0SizeOffset = { + 0x00028574, // 01G + 0x00028574, // 02G + 0x00028574, // 03G + 0x00028574, // 04G + 0x00028574, // 05G + 0x00028574, // unused + 0x00028574, // unused + 0x00028574, // unused + 0x00028574, // unused + 0x00028574, // unused + 0x00028574, // unused + 0x00028574, // unused + }, + .manualNameCheck = { + 0x00017DD8, // 01G + 0x00017DD8, // 02G + 0x00017DD8, // 03G + 0x00017DD8, // 04G + 0x00017DD8, // 05G + 0x00017DD8, // unused + 0x00017DD8, // unused + 0x00017DD8, // unused + 0x00017DD8, // unused + 0x00017DD8, // unused + 0x00017DD8, // unused + 0x00017DD8, // unused + }, + .sceMeAudio_67CD7972_NID = 0x79B3E859, + }, +}; +#endif + +#ifdef CONFIG_390 +PatchOffset g_390_offsets = { + .fw_version = FW_390, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00000138, + .scePopsManLoadModuleCheck = 0x000014E8, + }, + .pops_patch = { + .decomp = { + { 0x000B4094, 0x0000FA7C }, // 01G + { 0x000B4094, 0x0000FA7C }, // 02G + { 0x000B4094, 0x0000FA7C }, // 03G + { 0x000B4094, 0x0000FA7C }, // 04G + { 0x000B4094, 0x0000FA7C }, // 05G + { 0x000B4094, 0x0000FA7C }, // unused + { 0x000B4094, 0x0000FA7C }, // unused + { 0x000B4094, 0x0000FA7C }, // unused + { 0x000B4094, 0x0000FA7C }, // unused + { 0x000B4094, 0x0000FA7C }, // unused + { 0x000B4094, 0x0000FA7C }, // unused + { 0x000B4094, 0x0000FA7C }, // unused + }, + .ICON0SizeOffset = { + 0x00028558, // 01G + 0x00028558, // 02G + 0x00028558, // 03G + 0x00028558, // 04G + 0x00028558, // 05G + 0x00028558, // unused + 0x00028558, // unused + 0x00028558, // unused + 0x00028558, // unused + 0x00028558, // unused + 0x00028558, // unused + 0x00028558, // unused + }, + .manualNameCheck = { + 0x00017DD0, // 01G + 0x00017DD0, // 02G + 0x00017DD0, // 03G + 0x00017DD0, // 04G + 0x00017DD0, // 05G + 0x00017DD0, // unused + 0x00017DD0, // unused + 0x00017DD0, // unused + 0x00017DD0, // unused + 0x00017DD0, // unused + 0x00017DD0, // unused + 0x00017DD0, // unused + }, + .sceMeAudio_67CD7972_NID = 0x79B3E859, + }, +}; +#endif + +#ifdef CONFIG_380 +PatchOffset g_380_offsets = { + .fw_version = FW_380, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00000138, + .scePopsManLoadModuleCheck = 0x000014E4, + }, + .pops_patch = { + .decomp = { + { 0x000B3BD8, 0x0000E518 }, // 01G + { 0x000B3BD8, 0x0000E518 }, // 02G + { 0x000B3BD8, 0x0000E518 }, // 03G + { 0x000B3BD8, 0x0000E518 }, // 04G + { 0x000B3BD8, 0x0000E518 }, // 05G + { 0x000B3BD8, 0x0000E518 }, // unused + { 0x000B3BD8, 0x0000E518 }, // unused + { 0x000B3BD8, 0x0000E518 }, // unused + { 0x000B3BD8, 0x0000E518 }, // unused + { 0x000B3BD8, 0x0000E518 }, // unused + { 0x000B3BD8, 0x0000E518 }, // unused + { 0x000B3BD8, 0x0000E518 }, // unused + }, + .ICON0SizeOffset = { + 0x0002880C, // 01G + 0x0002880C, // 02G + 0x0002880C, // 03G + 0x0002880C, // 04G + 0x0002880C, // 05G + 0x0002880C, // unused + 0x0002880C, // unused + 0x0002880C, // unused + 0x0002880C, // unused + 0x0002880C, // unused + 0x0002880C, // unused + 0x0002880C, // unused + }, + .manualNameCheck = { + 0x000188B4, // 01G + 0x000188B4, // 02G + 0x000188B4, // 03G + 0x000188B4, // 04G + 0x000188B4, // 05G + 0x000188B4, // unused + 0x000188B4, // unused + 0x000188B4, // unused + 0x000188B4, // unused + 0x000188B4, // unused + 0x000188B4, // unused + 0x000188B4, // unused + }, + .sceMeAudio_67CD7972_NID = 0x79B3E859, + }, +}; +#endif + +#ifdef CONFIG_372 +PatchOffset g_372_offsets = { + .fw_version = FW_372, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0x00000138, + .scePopsManLoadModuleCheck = 0x000014B8, + }, + .pops_patch = { + .decomp = { + { 0x0002D480, 0x00013D6C }, // 01G + { 0x0002D480, 0x00013D6C }, // 02G + { 0x0002D480, 0x00013D6C }, // 03G + { 0x0002D480, 0x00013D6C }, // 04G + { 0x0002D480, 0x00013D6C }, // 05G + { 0x0002D480, 0x00013D6C }, // unused + { 0x0002D480, 0x00013D6C }, // unused + { 0x0002D480, 0x00013D6C }, // unused + { 0x0002D480, 0x00013D6C }, // unused + { 0x0002D480, 0x00013D6C }, // unused + { 0x0002D480, 0x00013D6C }, // unused + { 0x0002D480, 0x00013D6C }, // unused + }, + .ICON0SizeOffset = { + 0x000294F8, // 01G + 0x000294F8, // 02G + 0x000294F8, // 03G + 0x000294F8, // 04G + 0x000294F8, // 05G + 0x000294F8, // unused + 0x000294F8, // unused + 0x000294F8, // unused + 0x000294F8, // unused + 0x000294F8, // unused + 0x000294F8, // unused + 0x000294F8, // unused + }, + .manualNameCheck = { + 0x0001D9FC, // 01G + 0x0001D9FC, // 02G + 0x0001D9FC, // 03G + 0x0001D9FC, // 04G + 0x0001D9FC, // 05G + 0x0001D9FC, // unused + 0x0001D9FC, // unused + 0x0001D9FC, // unused + 0x0001D9FC, // unused + 0x0001D9FC, // unused + 0x0001D9FC, // unused + 0x0001D9FC, // unused + }, + .sceMeAudio_67CD7972_NID = 0x902F30D8, + }, +}; +#endif + +#ifdef CONFIG_371 +PatchOffset g_371_offsets = { + .fw_version = FW_371, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0x0000059C, + .scePopsManLoadModuleCheck = 0x000000D4, + }, + .pops_patch = { + .decomp = { + { 0x0002BDA0, 0x00014100 }, // 01G + { 0x0002BDA0, 0x00014100 }, // 02G + { 0x0002BDA0, 0x00014100 }, // 03G + { 0x0002BDA0, 0x00014100 }, // 04G + { 0x0002BDA0, 0x00014100 }, // 05G + { 0x0002BDA0, 0x00014100 }, // unused + { 0x0002BDA0, 0x00014100 }, // unused + { 0x0002BDA0, 0x00014100 }, // unused + { 0x0002BDA0, 0x00014100 }, // unused + { 0x0002BDA0, 0x00014100 }, // unused + { 0x0002BDA0, 0x00014100 }, // unused + { 0x0002BDA0, 0x00014100 }, // unused + }, + .ICON0SizeOffset = { + 0x000253F4, // 01G + 0x000253F4, // 02G + 0x000253F4, // 03G + 0x000253F4, // 04G + 0x000253F4, // 05G + 0x000253F4, // unused + 0x000253F4, // unused + 0x000253F4, // unused + 0x000253F4, // unused + 0x000253F4, // unused + 0x000253F4, // unused + 0x000253F4, // unused + }, + .manualNameCheck = { + 0x0001B044, // 01G + 0x0001B044, // 02G + 0x0001B044, // 03G + 0x0001B044, // 04G + 0x0001B044, // 05G + 0x0001B044, // unused + 0x0001B044, // unused + 0x0001B044, // unused + 0x0001B044, // unused + 0x0001B044, // unused + 0x0001B044, // unused + 0x0001B044, // unused + }, + .sceMeAudio_67CD7972_NID = 0x902F30D8, + }, +}; +#endif + +#ifdef CONFIG_352 +PatchOffset g_352_offsets = { + .fw_version = FW_352, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, + .scePopsManLoadModuleCheck = 0x00000240, + }, + .pops_patch = { + .decomp = { + { 0x0002BD20, 0x00013E50 }, // 01G + { 0x0002BD20, 0x00013E50 }, // 02G + { 0x0002BD20, 0x00013E50 }, // 03G + { 0x0002BD20, 0x00013E50 }, // 04G + { 0x0002BD20, 0x00013E50 }, // 05G + { 0x0002BD20, 0x00013E50 }, // unused + { 0x0002BD20, 0x00013E50 }, // unused + { 0x0002BD20, 0x00013E50 }, // unused + { 0x0002BD20, 0x00013E50 }, // unused + { 0x0002BD20, 0x00013E50 }, // unused + { 0x0002BD20, 0x00013E50 }, // unused + { 0x0002BD20, 0x00013E50 }, // unused + }, + .ICON0SizeOffset = { + 0x00025080, // 01G + 0x00025080, // 02G + 0x00025080, // 03G + 0x00025080, // 04G + 0x00025080, // 05G + 0x00025080, // unused + 0x00025080, // unused + 0x00025080, // unused + 0x00025080, // unused + 0x00025080, // unused + 0x00025080, // unused + 0x00025080, // unused + }, + .manualNameCheck = { + 0x0001AF18, // 01G + 0x0001AF18, // 02G + 0x0001AF18, // 03G + 0x0001AF18, // 04G + 0x0001AF18, // 05G + 0x0001AF18, // unused + 0x0001AF18, // unused + 0x0001AF18, // unused + 0x0001AF18, // unused + 0x0001AF18, // unused + 0x0001AF18, // unused + 0x0001AF18, // unused + }, + .sceMeAudio_67CD7972_NID = 0xFC56480E, + }, +}; +#endif + +#ifdef CONFIG_351 +PatchOffset g_351_offsets = { + .fw_version = FW_351, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, + .scePopsManLoadModuleCheck = 0x000000CC, + }, + .pops_patch = { + .decomp = { + { 0x0002B240, 0x00013C64 }, // 01G + { 0x0002B240, 0x00013C64 }, // 02G + { 0x0002B240, 0x00013C64 }, // 03G + { 0x0002B240, 0x00013C64 }, // 04G + { 0x0002B240, 0x00013C64 }, // 05G + { 0x0002B240, 0x00013C64 }, // unused + { 0x0002B240, 0x00013C64 }, // unused + { 0x0002B240, 0x00013C64 }, // unused + { 0x0002B240, 0x00013C64 }, // unused + { 0x0002B240, 0x00013C64 }, // unused + { 0x0002B240, 0x00013C64 }, // unused + { 0x0002B240, 0x00013C64 }, // unused + }, + .ICON0SizeOffset = { + 0x0001B030, // 01G + 0x0001B030, // 02G + 0x0001B030, // 03G + 0x0001B030, // 04G + 0x0001B030, // 05G + 0x0001B030, // unused + 0x0001B030, // unused + 0x0001B030, // unused + 0x0001B030, // unused + 0x0001B030, // unused + 0x0001B030, // unused + 0x0001B030, // unused + }, + .manualNameCheck = { + 0x0001C474, // 01G + 0x0001C474, // 02G + 0x0001C474, // 03G + 0x0001C474, // 04G + 0x0001C474, // 05G + 0x0001C474, // unused + 0x0001C474, // unused + 0x0001C474, // unused + 0x0001C474, // unused + 0x0001C474, // unused + 0x0001C474, // unused + 0x0001C474, // unused + }, + .sceMeAudio_67CD7972_NID = 0xFC56480E, + }, +}; +#endif + +#ifdef CONFIG_350 +PatchOffset g_350_offsets = { + .fw_version = FW_350, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, + .scePopsManLoadModuleCheck = 0x000000CC, + }, + .pops_patch = { + .decomp = { + { 0x0002B240, 0x00013C64 }, // 01G + { 0x0002B240, 0x00013C64 }, // 02G + { 0x0002B240, 0x00013C64 }, // 03G + { 0x0002B240, 0x00013C64 }, // 04G + { 0x0002B240, 0x00013C64 }, // 05G + { 0x0002B240, 0x00013C64 }, // unused + { 0x0002B240, 0x00013C64 }, // unused + { 0x0002B240, 0x00013C64 }, // unused + { 0x0002B240, 0x00013C64 }, // unused + { 0x0002B240, 0x00013C64 }, // unused + { 0x0002B240, 0x00013C64 }, // unused + { 0x0002B240, 0x00013C64 }, // unused + }, + .ICON0SizeOffset = { + 0x0001B030, // 01G + 0x0001B030, // 02G + 0x0001B030, // 03G + 0x0001B030, // 04G + 0x0001B030, // 05G + 0x0001B030, // unused + 0x0001B030, // unused + 0x0001B030, // unused + 0x0001B030, // unused + 0x0001B030, // unused + 0x0001B030, // unused + 0x0001B030, // unused + }, + .manualNameCheck = { + 0x0001C474, // 01G + 0x0001C474, // 02G + 0x0001C474, // 03G + 0x0001C474, // 04G + 0x0001C474, // 05G + 0x0001C474, // unused + 0x0001C474, // unused + 0x0001C474, // unused + 0x0001C474, // unused + 0x0001C474, // unused + 0x0001C474, // unused + 0x0001C474, // unused + }, + .sceMeAudio_67CD7972_NID = 0xFC56480E, + }, +}; +#endif + +#ifdef CONFIG_340 +PatchOffset g_340_offsets = { + .fw_version = FW_340, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, + .scePopsManLoadModuleCheck = 0x0000003C, + }, + .pops_patch = { + .decomp = { + { 0x0002A880, 0x00013850 }, // 01G + { 0x0002A880, 0x00013850 }, // 02G + { 0x0002A880, 0x00013850 }, // 03G + { 0x0002A880, 0x00013850 }, // 04G + { 0x0002A880, 0x00013850 }, // 05G + { 0x0002A880, 0x00013850 }, // unused + { 0x0002A880, 0x00013850 }, // unused + { 0x0002A880, 0x00013850 }, // unused + { 0x0002A880, 0x00013850 }, // unused + { 0x0002A880, 0x00013850 }, // unused + { 0x0002A880, 0x00013850 }, // unused + { 0x0002A880, 0x00013850 }, // unused + }, + .ICON0SizeOffset = { + 0x0001A45C, // 01G + 0x0001A45C, // 02G + 0x0001A45C, // 03G + 0x0001A45C, // 04G + 0x0001A45C, // 05G + 0x0001A45C, // unused + 0x0001A45C, // unused + 0x0001A45C, // unused + 0x0001A45C, // unused + 0x0001A45C, // unused + 0x0001A45C, // unused + 0x0001A45C, // unused + }, + .manualNameCheck = { + 0x0001B8BC, // 01G + 0x0001B8BC, // 02G + 0x0001B8BC, // 03G + 0x0001B8BC, // 04G + 0x0001B8BC, // 05G + 0x0001B8BC, // unused + 0x0001B8BC, // unused + 0x0001B8BC, // unused + 0x0001B8BC, // unused + 0x0001B8BC, // unused + 0x0001B8BC, // unused + 0x0001B8BC, // unused + }, + .sceMeAudio_67CD7972_NID = 0xFC56480E, + }, +}; +#endif + +#ifdef CONFIG_330 +PatchOffset g_330_offsets = { + .fw_version = FW_330, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, + .scePopsManLoadModuleCheck = 0x0000003C, + }, + .pops_patch = { + .decomp = { + { 0x0002A000, 0x00013788 }, // 01G + { 0x0002A000, 0x00013788 }, // 02G + { 0x0002A000, 0x00013788 }, // 03G + { 0x0002A000, 0x00013788 }, // 04G + { 0x0002A000, 0x00013788 }, // 05G + { 0x0002A000, 0x00013788 }, // unused + { 0x0002A000, 0x00013788 }, // unused + { 0x0002A000, 0x00013788 }, // unused + { 0x0002A000, 0x00013788 }, // unused + { 0x0002A000, 0x00013788 }, // unused + { 0x0002A000, 0x00013788 }, // unused + { 0x0002A000, 0x00013788 }, // unused + }, + .ICON0SizeOffset = { + 0x0001A0D4, // 01G + 0x0001A0D4, // 02G + 0x0001A0D4, // 03G + 0x0001A0D4, // 04G + 0x0001A0D4, // 05G + 0x0001A0D4, // unused + 0x0001A0D4, // unused + 0x0001A0D4, // unused + 0x0001A0D4, // unused + 0x0001A0D4, // unused + 0x0001A0D4, // unused + 0x0001A0D4, // unused + }, + .manualNameCheck = { + 0x0001B46C, // 01G + 0x0001B46C, // 02G + 0x0001B46C, // 03G + 0x0001B46C, // 04G + 0x0001B46C, // 05G + 0x0001B46C, // unused + 0x0001B46C, // unused + 0x0001B46C, // unused + 0x0001B46C, // unused + 0x0001B46C, // unused + 0x0001B46C, // unused + 0x0001B46C, // unused + }, + .sceMeAudio_67CD7972_NID = 0xFC56480E, + }, +}; +#endif + +#ifdef CONFIG_311 +PatchOffset g_311_offsets = { + .fw_version = FW_311, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, + .scePopsManLoadModuleCheck = 0xDEADBEEF, + }, + .pops_patch = { + .decomp = { + { 0x00031D1C, 0x00010794 }, // 01G + { 0x00031D1C, 0x00010794 }, // 02G + { 0x00031D1C, 0x00010794 }, // 03G + { 0x00031D1C, 0x00010794 }, // 04G + { 0x00031D1C, 0x00010794 }, // 05G + { 0x00031D1C, 0x00010794 }, // unused + { 0x00031D1C, 0x00010794 }, // unused + { 0x00031D1C, 0x00010794 }, // unused + { 0x00031D1C, 0x00010794 }, // unused + { 0x00031D1C, 0x00010794 }, // unused + { 0x00031D1C, 0x00010794 }, // unused + { 0x00031D1C, 0x00010794 }, // unused + }, + .ICON0SizeOffset = { + 0x0002A640, // 01G + 0x0002A640, // 02G + 0x0002A640, // 03G + 0x0002A640, // 04G + 0x0002A640, // 05G + 0x0002A640, // unused + 0x0002A640, // unused + 0x0002A640, // unused + 0x0002A640, // unused + 0x0002A640, // unused + 0x0002A640, // unused + 0x0002A640, // unused + }, + .manualNameCheck = { + 0x0001C0C0, // 01G + 0x0001C0C0, // 02G + 0x0001C0C0, // 03G + 0x0001C0C0, // 04G + 0x0001C0C0, // 05G + 0x0001C0C0, // unused + 0x0001C0C0, // unused + 0x0001C0C0, // unused + 0x0001C0C0, // unused + 0x0001C0C0, // unused + 0x0001C0C0, // unused + 0x0001C0C0, // unused + }, + .sceMeAudio_67CD7972_NID = 0xFC56480E, + }, +}; +#endif + +#ifdef CONFIG_310 +PatchOffset g_310_offsets = { + .fw_version = FW_310, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, + .scePopsManLoadModuleCheck = 0xDEADBEEF, + }, + .pops_patch = { + .decomp = { + { 0x00031B9C, 0x000105F0 }, // 01G + { 0x00031B9C, 0x000105F0 }, // 02G + { 0x00031B9C, 0x000105F0 }, // 03G + { 0x00031B9C, 0x000105F0 }, // 04G + { 0x00031B9C, 0x000105F0 }, // 05G + { 0x00031B9C, 0x000105F0 }, // unused + { 0x00031B9C, 0x000105F0 }, // unused + { 0x00031B9C, 0x000105F0 }, // unused + { 0x00031B9C, 0x000105F0 }, // unused + { 0x00031B9C, 0x000105F0 }, // unused + { 0x00031B9C, 0x000105F0 }, // unused + { 0x00031B9C, 0x000105F0 }, // unused + }, + .ICON0SizeOffset = { + 0x0002A498, // 01G + 0x0002A498, // 02G + 0x0002A498, // 03G + 0x0002A498, // 04G + 0x0002A498, // 05G + 0x0002A498, // unused + 0x0002A498, // unused + 0x0002A498, // unused + 0x0002A498, // unused + 0x0002A498, // unused + 0x0002A498, // unused + 0x0002A498, // unused + }, + .manualNameCheck = { + 0x0001C0FC, // 01G + 0x0001C0FC, // 02G + 0x0001C0FC, // 03G + 0x0001C0FC, // 04G + 0x0001C0FC, // 05G + 0x0001C0FC, // unused + 0x0001C0FC, // unused + 0x0001C0FC, // unused + 0x0001C0FC, // unused + 0x0001C0FC, // unused + 0x0001C0FC, // unused + 0x0001C0FC, // unused + }, + .sceMeAudio_67CD7972_NID = 0xFC56480E, + }, +}; +#endif + +#ifdef CONFIG_303 +PatchOffset g_303_offsets = { + .fw_version = FW_303, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, + .scePopsManLoadModuleCheck = 0xDEADBEEF, + }, + .pops_patch = { + .decomp = { + { 0x0003A08C, 0x00012A60 }, // 01G + { 0x0003A08C, 0x00012A60 }, // 02G + { 0x0003A08C, 0x00012A60 }, // 03G + { 0x0003A08C, 0x00012A60 }, // 04G + { 0x0003A08C, 0x00012A60 }, // 05G + { 0x0003A08C, 0x00012A60 }, // unused + { 0x0003A08C, 0x00012A60 }, // unused + { 0x0003A08C, 0x00012A60 }, // unused + { 0x0003A08C, 0x00012A60 }, // unused + { 0x0003A08C, 0x00012A60 }, // unused + { 0x0003A08C, 0x00012A60 }, // unused + { 0x0003A08C, 0x00012A60 }, // unused + }, + .ICON0SizeOffset = { + 0x00032E40, // 01G + 0x00032E40, // 02G + 0x00032E40, // 03G + 0x00032E40, // 04G + 0x00032E40, // 05G + 0x00032E40, // unused + 0x00032E40, // unused + 0x00032E40, // unused + 0x00032E40, // unused + 0x00032E40, // unused + 0x00032E40, // unused + 0x00032E40, // unused + }, + .manualNameCheck = { + 0xDEADBEEF, // 01G + 0xDEADBEEF, // 02G + 0xDEADBEEF, // 03G + 0xDEADBEEF, // 04G + 0xDEADBEEF, // 05G + 0xDEADBEEF, // unused + 0xDEADBEEF, // unused + 0xDEADBEEF, // unused + 0xDEADBEEF, // unused + 0xDEADBEEF, // unused + 0xDEADBEEF, // unused + 0xDEADBEEF, // unused + }, + .sceMeAudio_67CD7972_NID = 0xFC56480E, + }, +}; +#endif + +#ifdef CONFIG_302 +PatchOffset g_302_offsets = { + .fw_version = FW_302, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0xDEADBEEF, + .scePopsManLoadModuleCheck = 0xDEADBEEF, + }, + .pops_patch = { + .decomp = { + { 0x0003900C, 0x00012314 }, // 01G + { 0x0003900C, 0x00012314 }, // 02G + { 0x0003900C, 0x00012314 }, // 03G + { 0x0003900C, 0x00012314 }, // 04G + { 0x0003900C, 0x00012314 }, // 05G + { 0x0003900C, 0x00012314 }, // unused + { 0x0003900C, 0x00012314 }, // unused + { 0x0003900C, 0x00012314 }, // unused + { 0x0003900C, 0x00012314 }, // unused + { 0x0003900C, 0x00012314 }, // unused + { 0x0003900C, 0x00012314 }, // unused + { 0x0003900C, 0x00012314 }, // unused + }, + .ICON0SizeOffset = { + 0x000315CC, // 01G + 0x000315CC, // 02G + 0x000315CC, // 03G + 0x000315CC, // 04G + 0x000315CC, // 05G + 0x000315CC, // unused + 0x000315CC, // unused + 0x000315CC, // unused + 0x000315CC, // unused + 0x000315CC, // unused + 0x000315CC, // unused + 0x000315CC, // unused + }, + .manualNameCheck = { + 0xDEADBEEF, // 01G + 0xDEADBEEF, // 02G + 0xDEADBEEF, // 03G + 0xDEADBEEF, // 04G + 0xDEADBEEF, // 05G + 0xDEADBEEF, // unused + 0xDEADBEEF, // unused + 0xDEADBEEF, // unused + 0xDEADBEEF, // unused + 0xDEADBEEF, // unused + 0xDEADBEEF, // unused + 0xDEADBEEF, // unused + }, + .sceMeAudio_67CD7972_NID = 0xFC56480E, + }, +}; +#endif + +PatchOffset *g_offs = NULL; + +void setup_patch_offset_table(u32 fw_version) +{ +#ifdef CONFIG_661 + if(fw_version == g_661_offsets.fw_version) { + g_offs = &g_661_offsets; + } +#endif + +#ifdef CONFIG_660 + if(fw_version == g_660_offsets.fw_version) { + g_offs = &g_660_offsets; + } +#endif + +#ifdef CONFIG_639 + if(fw_version == g_639_offsets.fw_version) { + g_offs = &g_639_offsets; + } +#endif + +#ifdef CONFIG_635 + if(fw_version == g_635_offsets.fw_version) { + g_offs = &g_635_offsets; + } +#endif + +#ifdef CONFIG_620 + if(fw_version == g_620_offsets.fw_version) { + g_offs = &g_620_offsets; + } +#endif + +#ifdef CONFIG_610 + if(fw_version == g_610_offsets.fw_version) { + g_offs = &g_610_offsets; + } +#endif + +#ifdef CONFIG_600 + if(fw_version == g_600_offsets.fw_version) { + g_offs = &g_600_offsets; + } +#endif + +#ifdef CONFIG_551 + if(fw_version == g_551_offsets.fw_version) { + g_offs = &g_551_offsets; + } +#endif + +#ifdef CONFIG_550 + if(fw_version == g_550_offsets.fw_version) { + g_offs = &g_550_offsets; + } +#endif + +#ifdef CONFIG_503 + if(fw_version == g_503_offsets.fw_version) { + g_offs = &g_503_offsets; + } +#endif + +#ifdef CONFIG_501 + if(fw_version == g_501_offsets.fw_version) { + g_offs = &g_501_offsets; + } +#endif + +#ifdef CONFIG_500 + if(fw_version == g_500_offsets.fw_version) { + g_offs = &g_500_offsets; + } +#endif + +#ifdef CONFIG_401 + if(fw_version == g_401_offsets.fw_version) { + g_offs = &g_401_offsets; + } +#endif + +#ifdef CONFIG_396 + if(fw_version == g_396_offsets.fw_version) { + g_offs = &g_396_offsets; + } +#endif + +#ifdef CONFIG_393 + if(fw_version == g_393_offsets.fw_version) { + g_offs = &g_393_offsets; + } +#endif + +#ifdef CONFIG_390 + if(fw_version == g_390_offsets.fw_version) { + g_offs = &g_390_offsets; + } +#endif + +#ifdef CONFIG_380 + if(fw_version == g_380_offsets.fw_version) { + g_offs = &g_380_offsets; + } +#endif + +#ifdef CONFIG_372 + if(fw_version == g_372_offsets.fw_version) { + g_offs = &g_372_offsets; + } +#endif + +#ifdef CONFIG_371 + if(fw_version == g_371_offsets.fw_version) { + g_offs = &g_371_offsets; + } +#endif + +#ifdef CONFIG_352 + if(fw_version == g_352_offsets.fw_version) { + g_offs = &g_352_offsets; + } +#endif + +#ifdef CONFIG_351 + if(fw_version == g_351_offsets.fw_version) { + g_offs = &g_351_offsets; + } +#endif + +#ifdef CONFIG_350 + if(fw_version == g_350_offsets.fw_version) { + g_offs = &g_350_offsets; + } +#endif + +#ifdef CONFIG_340 + if(fw_version == g_340_offsets.fw_version) { + g_offs = &g_340_offsets; + } +#endif + +#ifdef CONFIG_330 + if(fw_version == g_330_offsets.fw_version) { + g_offs = &g_330_offsets; + } +#endif + +#ifdef CONFIG_311 + if(fw_version == g_311_offsets.fw_version) { + g_offs = &g_311_offsets; + } +#endif + +#ifdef CONFIG_310 + if(fw_version == g_310_offsets.fw_version) { + g_offs = &g_310_offsets; + } +#endif + +#ifdef CONFIG_303 + if(fw_version == g_303_offsets.fw_version) { + g_offs = &g_303_offsets; + } +#endif + +#ifdef CONFIG_302 + if(fw_version == g_302_offsets.fw_version) { + g_offs = &g_302_offsets; + } +#endif +} + diff --git a/popsloader/popcorn/popcorn_patch_offset.h b/popsloader/popcorn/popcorn_patch_offset.h index 632f4cb..69134ef 100644 --- a/popsloader/popcorn/popcorn_patch_offset.h +++ b/popsloader/popcorn/popcorn_patch_offset.h @@ -35,9 +35,9 @@ struct PopsDecompressFunctionPatch { }; struct PopsPatch { - struct PopsDecompressFunctionPatch decomp[PSP_11000+1]; - u32 ICON0SizeOffset[PSP_11000+1]; - u32 manualNameCheck[PSP_11000+1]; + struct PopsDecompressFunctionPatch decomp[12]; + u32 ICON0SizeOffset[12]; + u32 manualNameCheck[12]; u32 sceMeAudio_67CD7972_NID; }; diff --git a/popsloader/popsloader.md5sum b/popsloader/popsloader.md5sum new file mode 100644 index 0000000..3946f16 --- /dev/null +++ b/popsloader/popsloader.md5sum @@ -0,0 +1,158 @@ +a3ae47d97667343c74de274b6f6fdc8b 302/common_util.prx +b7e5395bd9084bc848c857c77ee6aca8 302/meaudio.prx +cbb3dd179b64721814bc1770e61672f2 302/pafmini.prx +5aabe4c55235e38a5fb6c6232cf72ecc 302/pops.prx +47b8ff488f2fbb7a46a90b10d9542bc6 302/popsman.prx +47f7b2deddd8b5813e8db6ff7d93d467 303/common_util.prx +a370d82e56a2d980b0b3116747f94943 303/meaudio.prx +3ab31545a6e1f22b61b7090eefcf815b 303/pafmini.prx +78cef1f2e057de993a1db943a3eea9d3 303/pops.prx +e90a40a6d907093237b27f04309c428b 303/popsman.prx +1e481ef641cf2929208e9e4f4f8b1baa 310/common_util.prx +ee155179bc99433b0414c7303bb601e2 310/pafmini.prx +46f1f26cccfa3ddd1bf9ed29563cbfb6 310/pops.prx +3af1bb6ac434c737beb486980f30621c 310/popsman.prx +671a32d679b685839787c82e94e7a436 311/common_util.prx +5ff3ff9f7c17c00e7bf4286297c55343 311/pafmini.prx +1a105537235827308f03c4f79c5e2a30 311/pops.prx +93d5f9259cee27a08ab825a75426c694 311/popsman.prx +c7ca22a6cc186f7423edc60c9aa49f29 330/common_util.prx +ac9b4d77cc5ced992d835e639a75b7c0 330/pafmini.prx +f8b72518d6cb70a4e43c1f3ce97547ba 330/pops.prx +2690a87ea2d24904d4992cf8e509e9ac 330/popsman.prx +665225ee333f43247392756375bd7d34 340/common_util.prx +701fcac81a4bbd7326148444ba7180e2 340/libpspvmc.prx +2992f2b4157618fe99884b2ec8e1bdc8 340/pafmini.prx +d92c9bb8a8875ce9e05139bced3405f9 340/pops.prx +b82451cdc6a44b5f2e92cd60a4d7781d 340/popsman.prx +8d6709135dd28ae7abebd6177207ad61 350/common_util.prx +e7feff02b3dd85f30af8f052a0539969 350/libpspvmc.prx +09b84e772b0e735edd9b02255e2bd982 350/pafmini.prx +b57f07d7025cfc0572d5c2c9a0ba56c5 350/pops.prx +1d5c2754e06a074a89838d0d00f30adf 350/popsman.prx +1bbecac42f69eb79b2e1e89c34c0f7ba 351/common_util.prx +e7feff02b3dd85f30af8f052a0539969 351/libpspvmc.prx +fdd202af56300eb0688899e5d0308c30 351/pafmini.prx +17ef50b46a9cb1ee166f684c779b3fa5 351/pops.prx +1d5c2754e06a074a89838d0d00f30adf 351/popsman.prx +d0330ec67695753b3594147b94891b7a 352/common_util.prx +e7feff02b3dd85f30af8f052a0539969 352/libpspvmc.prx +100d809f9ac1836a94f0dbc7eada0da8 352/pafmini.prx +151bf8250ea0eb61988e00fbd452b463 352/pops.prx +694e39d5bdfcd3d46bbea686db317163 352/popsman.prx +e58a06739b8fd8a24069fdcf639d0563 371/common_util.prx +2e7fab241720ea780d5714623bade76e 371/libpspvmc.prx +2868ade923ee0a8472070b4d1eec48fd 371/pafmini.prx +9cfe02524495d63db616685cc4fb925c 371/pops.prx +667d3f2bd15851b77fce46896a359398 371/popsman.prx +f56bbf5497f10b65b2b9c0eef2e7db4d 372/common_util.prx +2e7fab241720ea780d5714623bade76e 372/libpspvmc.prx +1c5b18cf637acd634df89cbf69ab9c91 372/pafmini.prx +c978f025ae08bcfda5875728d286603e 372/pops.prx +55ac22c6aca6a673484a802729c0ccfc 372/popsman.prx +37f4da74751b8de0f52ea13e77b4bc8b 380/common_util.prx +688b687dd4b7382ac55ad04a98b2b2b4 380/libpspvmc.prx +30f952b16b948c6f21ecec6d23556156 380/pafmini.prx +ad17709f81bf0dfe469b44edff8ec49f 380/pops.prx +8dcd1483caed77140178b7b3e7cdc23b 380/popsman.prx +0d137751119665948527df7f83e0e9cc 390/common_util.prx +688b687dd4b7382ac55ad04a98b2b2b4 390/libpspvmc.prx +04b019e53ef9971cdae617a69e966edc 390/pafmini.prx +bb7c90524fea9d5ee887e567478428d1 390/pops.prx +8f0e79b427b9d9d198b96d4038b78a25 390/popsman.prx +3742daa41a4c0c272855d60d03d746fc 393/common_util.prx +688b687dd4b7382ac55ad04a98b2b2b4 393/libpspvmc.prx +92cf7f784c4d1097508355a1234b7aa9 393/pafmini.prx +e497119bc20386e3e5821b534aa5a1ae 393/pops.prx +98df48918c8627f031d47a12d9e289de 393/popsman.prx +84cedb0831a560862c1d4d4607d64a2b 396/common_util.prx +537b93ce8f1204163224f79fe5cdaec3 396/libpspvmc.prx +b8c23d1f10c5c303dcb227058438d041 396/pafmini.prx +28e30c544abe1ac513dd0b5a723c889c 396/pops.prx +5816eeb89da10cffd892b17abbd687d1 396/popsman.prx +afe8f5893df9d1960294f98aba3c3256 401/common_util.prx +537b93ce8f1204163224f79fe5cdaec3 401/libpspvmc.prx +8c0dd2681a8489a3ae2b852265b0538c 401/pafmini.prx +431574fe2a8e194d1c1a1f871015bc12 401/pops.prx +3994cafb93f0c4cb4d66d3e7a12cefdc 401/popsman.prx +43477aa446d3c1b0c69c42e4424d5318 500/common_util.prx +2676cceeba6a5d20c0031954bbabd6f5 500/libpspvmc.prx +fa42ce1d98273ba7358f2c075391a885 500/pafmini.prx +458a2452ab41b50977e518a3d3c951a1 500/pops.prx +9ba1c0659ddb24c6de163bfc596207f0 500/popsman.prx +d7534e9b624524d3d7bc2d67c802e551 501/common_util.prx +2676cceeba6a5d20c0031954bbabd6f5 501/libpspvmc.prx +bdfd24bbd2334132f5c4687ac4949c39 501/pafmini.prx +4d642adbfad551758b5be6851741ce7f 501/pops.prx +764b76452a2d5d53f8ea5bf424622804 501/popsman.prx +bae847071678e331a07674051887ae28 503/common_util.prx +2676cceeba6a5d20c0031954bbabd6f5 503/libpspvmc.prx +ccc82726e9b75a14058424804832b465 503/pafmini.prx +e07e484385be36e3d16d365273ca7569 503/pops.prx +3d3a8f5081741fde16b11d5959efddc0 503/popsman.prx +5732237f80a67f33ef2bf44e6af1631b 550/common_util.prx +2676cceeba6a5d20c0031954bbabd6f5 550/libpspvmc.prx +cd4d24ed758e27be290c39733c8d6752 550/pafmini.prx +368df14e056d524d94d11f95ddde3fef 550/pops.prx +8775db06cfb38ec001a658cca14dddb8 550/popsman.prx +c2933c8a24e34402fbdf5e9467af0a4f 551/common_util.prx +2676cceeba6a5d20c0031954bbabd6f5 551/libpspvmc.prx +63099c6a79f0f5b3e2800dd9d3437b8d 551/pafmini.prx +52141ff86ea245e9f50330839e38a89c 551/pops.prx +283f8d0d094a40f0f8d4664bc272807d 551/popsman.prx +8a190fa204050a09ce93f011d80e6578 600/common_util.prx +70f9cf608ab0d48e8aa4e617563e323f 600/libpspvmc.prx +5b1cc25978f77fc682f671711d3f5224 600/pafmini.prx +e4c37d59628e31d13a115eaa4d238ba9 600/pops.prx +9388a913015d6ac05e32302eedd2e5b7 600/pops_04g.prx +f1c8f9bf72c84a69b25ad95f93ea2af1 600/popsman.prx +e39dddec3e016d25bb40bc6543755476 610/common_util.prx +70f9cf608ab0d48e8aa4e617563e323f 610/libpspvmc.prx +1d39039de7974cd910c3c86327f05c0a 610/pafmini.prx +48e53839ef54e7d25f41d2270772fff7 610/pops.prx +2a878e0185531712db97462f7b46232a 610/pops_04g.prx +26eec9885a3b6e11f7b6ad68c3bd8fc7 610/pops_05g.prx +c4cbff016eba7e5f01746bb4bc164d50 610/popsman.prx +097098b21d470b0be91034fd0cad8058 620/common_util.prx +70f9cf608ab0d48e8aa4e617563e323f 620/libpspvmc.prx +2c6100a8b0f8aea963cb3ca027b977a1 620/pafmini.prx +d67d4bec74877aa88c9db3a1d494f51e 620/pops.prx +df7ec279f7469643e4a342f0b124bc34 620/pops_04g.prx +3992cefd79feba378f702bc640d51d9c 620/pops_05g.prx +1d1c387db3b75d9b2fe8fea504287234 620/popsman.prx +8262e018ab11a9bb53cff8b69f38aed3 635/common_util.prx +008ca1e259ad6e525f2ec405fccc8275 635/libpspvmc.prx +0f6e243ac0ea2bd84f992f608c680d37 635/pafmini.prx +a4d29cd64a4a94f94442bbe1c9fe1b6b 635/pops_01g.prx +3211d4df470beca912f4492d8947a894 635/pops_02g.prx +3211d4df470beca912f4492d8947a894 635/pops_03g.prx +d271bc8b072638614cf163092fc3ac06 635/pops_04g.prx +4f39ca2c5cf1fb35e1a8b5717b0e63db 635/pops_05g.prx +d271bc8b072638614cf163092fc3ac06 635/pops_07g.prx +d271bc8b072638614cf163092fc3ac06 635/pops_09g.prx +adf5bbfdb1fb9b60a235c8346caedab7 635/popsman.prx +ee29f36267bd75786bc69ff7ab6d8a8d 639/common_util.prx +008ca1e259ad6e525f2ec405fccc8275 639/libpspvmc.prx +aa6acce53e7e7ee8f5822c098a8472af 639/pafmini.prx +abe7ad822c7958f981d1356b8f056578 639/pops_01g.prx +851dba30fea51e004493ce3b4b41d65c 639/pops_02g.prx +851dba30fea51e004493ce3b4b41d65c 639/pops_03g.prx +482bff6eb92045b6c8ab3c52f3904141 639/pops_04g.prx +c4fe65f9b10dbb679acba9d0d635ed3f 639/pops_05g.prx +482bff6eb92045b6c8ab3c52f3904141 639/pops_07g.prx +482bff6eb92045b6c8ab3c52f3904141 639/pops_09g.prx +fd94f303a5134196bef4146fd0acab2b 639/popsman.prx +0ba077be38c1a4abe700f5955b33033c 660/common_util.prx +97ee471f71dc5e2523f583c4ae7f7109 660/libpspvmc.prx +330465b2c8770e44eff7b022ed3e73a9 660/pafmini.prx +cfbe7a9bbcaf875a8221c1d9abd78935 660/pops_01g.prx +0b7c223c83c3c40b45c5ad84ce36d821 660/pops_02g.prx +0b7c223c83c3c40b45c5ad84ce36d821 660/pops_03g.prx +e8a46c5034362002767290b57ce43912 660/pops_04g.prx +e063c6b088262f4f3606470d159a5969 660/pops_05g.prx +e3ed64ad963071dd95836a1d678289da 660/pops_07g.prx +e3ed64ad963071dd95836a1d678289da 660/pops_09g.prx +1a2eb72e7d373b6dcef4dd3d0d43e0ac 660/pops_11g.prx +567f008dbc7b4b91db423bd0fd0f9cf6 660/popsman.prx +1fb0f7f47bc2edf68cc121e8dc86d582 impose.prx +948076028178a6fe829db2e28655081e impose.rsc diff --git a/popsloader/proheaparea/exports.c b/popsloader/proheaparea/exports.c new file mode 100644 index 0000000..1165fb8 --- /dev/null +++ b/popsloader/proheaparea/exports.c @@ -0,0 +1,28 @@ +#include +#define NULL ((void *) 0) + +extern void module_start; +extern void module_stop; +extern void module_info; +static const unsigned int __syslib_exports[6] __attribute__((section(".rodata.sceResident"))) = { + 0xD632ACDB, + 0xCEE8593C, + 0xF01D73A7, + (unsigned int) &module_start, + (unsigned int) &module_stop, + (unsigned int) &module_info, +}; + +extern void scePafHeaparea_F50AAE41; +extern void scePafHeaparea_ACCE25B2; +static const unsigned int __scePafHeaparea_exports[4] __attribute__((section(".rodata.sceResident"))) = { + 0xF50AAE41, + 0xACCE25B2, + (unsigned int) &scePafHeaparea_F50AAE41, + (unsigned int) &scePafHeaparea_ACCE25B2, +}; + +const struct _PspLibraryEntry __library_exports[2] __attribute__((section(".lib.ent"), used)) = { + { NULL, 0x0000, 0x8000, 4, 1, 2, &__syslib_exports }, + { "scePafHeaparea", 0x0011, 0x0001, 4, 0, 2, &__scePafHeaparea_exports }, +};