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; } }
int sys_fs_mount(char const* deviceName, char const* deviceFileSystem, char const* devicePath, int writeProt) { lv2syscall8(837, (u64) deviceName, (u64) deviceFileSystem, (u64) devicePath, 0, (u64) writeProt, 0, 0, 0 ); return_to_user_prog(int); }
s32 sysFsMount(const char* MOUNT_POINT, const char* TYPE_OF_FILESYSTEM, const char* PATH_TO_MOUNT, int IF_READ_ONLY) { lv2syscall8(837, (u64)MOUNT_POINT, (u64)TYPE_OF_FILESYSTEM, (u64)PATH_TO_MOUNT, 0, IF_READ_ONLY, 0, 0, 0); return_to_user_prog(s32); }
int main(s32 argc, char* argv[]) { atexit(_unload); // Initialize graphics GFX = new NoRSX(); MsgDialog MSG(GFX); // Release message MSG.Dialog(MSG_OK, "This build of OpenPS3FTP has not been tested by the author. As such, you use this software at your own risk. Please report any issues found to the OpenPS3FTP GitHub repository or send a tweet to @jjolano. See README.txt for more details."); // Initialize required libraries: net, netctl, io netInitialize(); netCtlInit(); ioPadInit(7); // Verify connection state s32 state; netCtlGetState(&state); if(state != NET_CTL_STATE_IPObtained) { // not connected to network - terminate program MSG.Dialog(MSG_OK, "Could not verify connection status. OpenPS3FTP will now exit."); exit(EXIT_FAILURE); } // Set application running state GFX->AppStart(); // Create thread for server sys_ppu_thread_t id; sysThreadCreate(&id, ftp_main, GFX, 1001, 0x1000, THREAD_JOINABLE, const_cast<char*>("opf_ftp_main")); // Set up graphics Font F1(LATIN2, GFX); Background BG(GFX); Bitmap BM(GFX); NoRSX_Bitmap PCL; BM.GenerateBitmap(&PCL); BG.MonoBitmap(COLOR_BLACK, &PCL); // Retrieve detailed connection information (ip address) net_ctl_info info; netCtlGetInfo(NET_CTL_INFO_IP_ADDRESS, &info); // Draw bitmap layer // Not sure how this will actually look. F1.PrintfToBitmap(50, 50, &PCL, COLOR_WHITE, "OpenPS3FTP version %s", OFTP_VERSION); F1.PrintfToBitmap(50, 100, &PCL, COLOR_WHITE, "Written by John Olano (twitter: @jjolano)"); F1.PrintfToBitmap(50, 200, &PCL, COLOR_WHITE, "IP Address: %s (port 21)", info.ip_address); F1.PrintfToBitmap(50, 300, &PCL, COLOR_WHITE, "SELECT: Execute dev_blind"); F1.PrintfToBitmap(50, 350, &PCL, COLOR_WHITE, "START: Exit OpenPS3FTP"); // Pad IO variables padInfo padinfo; padData paddata; padData paddata_old[MAX_PADS]; // Main thread loop while(GFX->GetAppStatus() != APP_EXIT) { // Get Pad Status ioPadGetInfo(&padinfo); for(unsigned int i = 0; i < MAX_PADS; i++) { if(padinfo.status[i]) { // Get Pad Data ioPadGetData(i, &paddata); // Parse Pad Data if(Pad_onPress(paddata, paddata_old[i], BTN_SELECT)) { // dev_blind stuff sysFSStat stat; s32 ret = sysFsStat("/dev_blind", &stat); if(ret == 0) { // dev_blind exists - ask to unmount MSG.Dialog(MSG_YESNO, "Do you want to unmount dev_blind?"); if(MSG.GetResponse(MSG_DIALOG_BTN_YES) == 1) { // syscall unmount lv2syscall1(838, (u64)"/dev_blind"); // display success MSG.Dialog(MSG_OK, "dev_blind was successfully unmounted."); } } else { // dev_blind does not exist - ask to mount MSG.Dialog(MSG_YESNO, "Do you want to mount dev_blind?"); if(MSG.GetResponse(MSG_DIALOG_BTN_YES) == 1) { // syscall mount lv2syscall8(837, (u64)"CELL_FS_IOS:BUILTIN_FLSH1", (u64)"CELL_FS_FAT", (u64)"/dev_blind", 0, 0 /* readonly */, 0, 0, 0); // display success with info MSG.Dialog(MSG_OK, "dev_blind was successfully mounted. Please note that dev_blind will not automatically unmount upon exiting OpenPS3FTP."); } } } if(Pad_onPress(paddata, paddata_old[i], BTN_START)) { // Exit application GFX->AppExit(); } paddata_old[i] = paddata; } } // Draw bitmap->screenbuffer BM.DrawBitmap(&PCL); GFX->Flip(); } BM.ClearBitmap(&PCL); // Wait for server thread to complete u64 retval; sysThreadJoin(id, &retval); // Parse thread return value if application is not exiting if(GFX->ExitSignalStatus() == NO_SIGNAL && retval != 0) { // Error - see ftp.cpp MSG.ErrorDialog((u32)retval); exit(EXIT_FAILURE); } return 0; }
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; } }