int run_uninstall_autoloader() { #ifdef ENABLE_LOG if (verbose) WriteToLog("[UNINSTALLER]"); #endif //Check if installed if(file_exists("/dev_flash/sys/internal/sys_init_osd_orig.self") != SUCCESS) { #ifdef ENABLE_LOG if (verbose) WriteToLog("Error: sys_init_osd_orig.self not found\r\n"); #endif return FAILED; } //Enable dev_blind if(dir_exists("/dev_blind") != SUCCESS) { {lv2syscall8(SC_FS_MOUNT, (u64)(char*)"CELL_FS_IOS:BUILTIN_FLSH1", (u64)(char*)"CELL_FS_FAT", (u64)(char*)"/dev_blind", 0, 0, 0, 0, 0); } } //Restore original sys_init_osd.self if(file_exists(PATH_SYS_INI_OSD_ORIG) == SUCCESS) { if(file_exists(PATH_SYS_INI_OSD) == SUCCESS) { unlink_secure(PATH_SYS_INI_OSD); sysLv2FsRename(PATH_SYS_INI_OSD_ORIG, PATH_SYS_INI_OSD); //Remove payload char filename[128]; int fw_list[32] = { 0x355C,0x421C,0x430C,0x431C,0x440C,0x441C,0x446C,0x450C,0x453C,0x455C,0x460C,0x465C,0x466C,0x470C,0x475C,0x476C, 0x355D,0x421D,0x430D, 0x441D,0x446D,0x450D,0x453D,0x455D,0x460D,0x465D,0x466D,0x470D,0x475D,0x476D}; int i; for (i = 0; i < 32; i++) { if (fw_list[i] == 0) break; sprintf (filename, "/dev_blind/sys/internal/mpl_payload_%X.bin", fw_list[i]); if (file_exists(filename) == SUCCESS) unlink_secure(filename); sprintf (filename, "/dev_blind/sys/internal/mamba_%X.bin", fw_list[i]); if (file_exists(filename) == SUCCESS) unlink_secure(filename); } #ifdef ENABLE_LOG if (verbose) WriteToLog("Success: MAMBA/PRX Autoloader uninstalled\r\n"); #endif return SUCCESS; } else { #ifdef ENABLE_LOG if (verbose) WriteToLog("Error: sys_init_osd.self not found\r\n"); #endif return FAILED; } } else { #ifdef ENABLE_LOG if (verbose) WriteToLog("Error: /dev_blind not mounted\r\n"); #endif return FAILED; } }
bool is_disabled(char *filename, char *filename2) { sysFSStat stat; if(sysLv2FsStat("/dev_blind", &stat) != SUCCESS) sys_fs_mount("CELL_FS_IOS:BUILTIN_FLSH1", "CELL_FS_FAT", "/dev_blind", 0); if(sysLv2FsStat(filename, &stat) == SUCCESS) { sysLv2FsRename(filename, filename2); // re-enable stage2.bin return true; } return false; }
int add_mygame() { // -2 failed and cannot rename the backup // -1 failed // 0 already // 1 done char gameexit[] = {0x0d, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x78, 0x2d, 0x78, 0x6d, 0x62, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x2d, 0x70, 0x69, 0x78, 0x6d, 0x61, 0x70, 0x22, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x6b, 0x65, 0x79, 0x3d, 0x22, 0x73, 0x65, 0x67, 0x5f, 0x67, 0x61, 0x6d, 0x65, 0x65, 0x78, 0x69, 0x74, 0x22, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x73, 0x65, 0x6c, 0x3a, 0x2f, 0x2f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x2f, 0x69, 0x6e, 0x67, 0x61, 0x6d, 0x65, 0x3f, 0x70, 0x61, 0x74, 0x68, 0x3d, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x67, 0x61, 0x6d, 0x65, 0x2e, 0x78, 0x6d, 0x6c, 0x23, 0x73, 0x65, 0x67, 0x5f, 0x67, 0x61, 0x6d, 0x65, 0x65, 0x78, 0x69, 0x74, 0x26, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x67, 0x61, 0x6d, 0x65, 0x22, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x2f, 0x3e}; char fb[] = {0x0d, 0x0a, 0x09, 0x09, 0x09, 0x3c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x78, 0x2d, 0x78, 0x6d, 0x62, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x2d, 0x70, 0x69, 0x78, 0x6d, 0x61, 0x70, 0x22, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x6b, 0x65, 0x79, 0x3d, 0x22, 0x78, 0x6d, 0x62, 0x5f, 0x61, 0x70, 0x70, 0x33, 0x22, 0x20, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x61, 0x74, 0x74, 0x72, 0x3d, 0x22, 0x78, 0x6d, 0x62, 0x5f, 0x61, 0x70, 0x70, 0x33, 0x22, 0x20, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x78, 0x6d, 0x62, 0x3a, 0x2f, 0x2f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x2f, 0x64, 0x65, 0x76, 0x5f, 0x68, 0x64, 0x64, 0x30, 0x2f, 0x78, 0x6d, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x66, 0x62, 0x2e, 0x78, 0x6d, 0x6c, 0x23, 0x73, 0x65, 0x67, 0x5f, 0x66, 0x62, 0x22, 0x0d, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x2f, 0x3e}; FILE* f; long size; char *cat; char cat_path[255]; size_t result; int i, j, pos=0; sysFSStat stat; //read original cat f=fopen("/dev_flash/vsh/resource/explore/xmb/category_game.xml", "r"); if(f==NULL) return FAILED; fseek (f , 0 , SEEK_END); size = ftell (f); fseek(f, 0, SEEK_SET); cat = (char*) malloc (sizeof(char)*size); if (cat == NULL) {free(cat); return FAILED;} result = fread(cat,1,size, f); if (result != size) {free (cat); fclose (f); return FAILED;} fclose (f); // is fb.xml entry in cat file ? if(strstr(cat, "fb.xml")!=NULL) {free(cat); return 0;} // search position for(i=0; i < size - sizeof(gameexit); i++) { pos=i; for(j=0; j<sizeof(gameexit); j++) { if( cat[i+j] != gameexit[j]) break; if(j==(sizeof(gameexit)-1)) goto out_s; } } out_s: //write patched cat f=fopen("/dev_hdd0/game/UPDWEBMOD/USRDIR/category_game.xml", "w"); if(f==NULL) {free(cat); return FAILED;} fwrite(cat, 1, pos, f); fwrite(fb, 1, sizeof(fb), f); fwrite(&cat[pos], 1, size-pos, f); fclose(f); // set target path for category_game.xml strcpy(cat_path, "/dev_blind/vsh/resource/explore/xmb/category_game.xml"); if(sysLv2FsStat(cat_path, &stat) != SUCCESS) { strcpy(cat_path, "/dev_habib/vsh/resource/explore/xmb/category_game.xml"); if(sysLv2FsStat(cat_path, &stat) != SUCCESS) { strcpy(cat_path, "/dev_rewrite/vsh/resource/explore/xmb/category_game.xml"); // mount /dev_blind if category_game.xml is not found if(sysLv2FsStat(cat_path, &stat) != SUCCESS) { if(sys_fs_mount("CELL_FS_IOS:BUILTIN_FLSH1", "CELL_FS_FAT", "/dev_blind", 0) == SUCCESS) { strcpy(cat_path, "/dev_blind/vsh/resource/explore/xmb/category_game.xml"); if(sysLv2FsStat(cat_path, &stat) != SUCCESS) { free(cat); return FAILED;} } else { free(cat); return FAILED;} } } } // rename category_game.xml as category_game.xml.bak char cat_path_bak[255]; strcpy(cat_path_bak, cat_path); strcat(cat_path_bak, ".bak"); sysLv2FsUnlink(cat_path_bak); if(sysLv2FsRename(cat_path, cat_path_bak) != SUCCESS) {free(cat); return FAILED;} ; // update category_game.xml if(CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/category_game.xml", cat_path) != SUCCESS) { sysLv2FsUnlink(cat_path); if(sysLv2FsRename(cat_path_bak, cat_path)) { //restore category_game.xml from category_game.xml.bak {lv2syscall3(392, 0x1004, 0xa, 0x1b6);} ///TRIPLE BIP free(cat); return -2; } } free(cat); return 1; }
int run_install_autoloader() { //Init FW int firmware = get_firmware(); #ifdef ENABLE_LOG if (verbose) {WriteToLog(PATH_SYS_INI_OSD_NEW); WriteToLog("\r\n");} #endif if(file_exists(PATH_SYS_INI_OSD_NEW) != SUCCESS) { #ifdef ENABLE_LOG if (verbose) WriteToLog("Error: Unable to find file\r\n"); #endif return FAILED; } char filename_mpl_payload[256]; sprintf (filename_mpl_payload, "%smpl_payload_%X.bin",PATH_DIR_PAYLOAD , firmware); #ifdef ENABLE_LOG if (verbose) {WriteToLog(filename_mpl_payload); WriteToLog("\r\n");} #endif if(file_exists(filename_mpl_payload) != SUCCESS) { #ifdef ENABLE_LOG if (verbose) WriteToLog("Error: Unable to find file\r\n"); #endif return FAILED; } char filename_mamba_payload[256]; sprintf (filename_mamba_payload, "%smamba_%X.bin",PATH_DIR_PAYLOAD , firmware); #ifdef ENABLE_LOG if (verbose) {WriteToLog(filename_mamba_payload); WriteToLog("\r\n");} #endif if(file_exists(filename_mamba_payload) != SUCCESS) { #ifdef ENABLE_LOG if (verbose) WriteToLog("Error: Unable to find file\r\n"); #endif return FAILED; } //Uninstall New_Core run_uninstall_autoloader(); #ifdef ENABLE_LOG if (verbose) WriteToLog("[INSTALLER]"); #endif //Enable dev_blind if(file_exists(PATH_SYS_INI_OSD) != SUCCESS) {{lv2syscall8(SC_FS_MOUNT, (u64)(char*)"CELL_FS_IOS:BUILTIN_FLSH1", (u64)(char*)"CELL_FS_FAT", (u64)(char*)"/dev_blind", 0, 0, 0, 0, 0); }} //Install New_Core if(file_exists(PATH_SYS_INI_OSD_ORIG) != SUCCESS) { if((file_exists(PATH_SYS_INI_OSD) == SUCCESS)) { sysLv2FsChmod(PATH_SYS_INI_OSD, 0777); sysLv2FsRename(PATH_SYS_INI_OSD, PATH_SYS_INI_OSD_ORIG); CopyFile(PATH_SYS_INI_OSD_NEW, PATH_SYS_INI_OSD); char filename[128]; sprintf (filename, "/dev_blind/sys/internal/mpl_payload_%X.bin", firmware); if (file_exists(filename) == SUCCESS) unlink_secure(filename); CopyFile(filename_mpl_payload, filename); sprintf (filename, "/dev_blind/sys/internal/mamba_%X.bin", firmware); if (file_exists(filename) == SUCCESS) unlink_secure(filename); CopyFile(filename_mamba_payload, filename); if ((file_exists("/dev_hdd0/game/MAMBAINST/USRDIR/mamba_plugins.txt") == SUCCESS) && (file_exists(VSH_PLUGINS_PATH_MAMBA) != SUCCESS)) { CopyFile("/dev_hdd0/game/MAMBAINST/USRDIR/mamba_plugins.txt", VSH_PLUGINS_PATH_MAMBA); } if ((file_exists("/dev_hdd0/game/MAMBAINST/USRDIR/prx_plugins.txt") == SUCCESS) && (file_exists(VSH_PLUGINS_PATH_PRX) != SUCCESS)) { CopyFile("/dev_hdd0/game/MAMBAINST/USRDIR/prx_plugins.txt", VSH_PLUGINS_PATH_PRX); } } else { #ifdef ENABLE_LOG if (verbose) WriteToLog("Error: sys_init_osd.self not found (/dev_blind not mounted?)\r\n"); #endif return FAILED; } return SUCCESS; } else { #ifdef ENABLE_LOG if (verbose) WriteToLog("Error: sys_init_osd_orig.self already exist\r\n"); #endif return FAILED; } }