//main int main(int argc, char **argv) { int result; netInitialize(); udp_printf_init(); PRINTF("%s:%d: start\n", __func__, __LINE__); result = lv2_sm_shutdown(0x8201, NULL, 0); if (result) { PRINTF("%s:%d: lv2_sm_shutdown failed (0x%08x)\n", __func__, __LINE__, result); goto done; } PRINTF("%s:%d: end\n", __func__, __LINE__); done: udp_printf_deinit(); netDeinitialize(); return 0; }
/*********************************************************************** * main ***********************************************************************/ int main(int argc, char **argv) { int result; netInitialize(); udp_printf_init(); PRINTF("%s:%d: start\n", __func__, __LINE__); result = lv1_map(); if (result) { PRINTF("%s:%d: lv1_map failed (0x%08x)\n", __func__, __LINE__, result); goto done; } PRINTF("%s:%d: patching log2 page size\n", __func__, __LINE__); lv1_poke(LOG2_PAGE_SIZE_OFFSET, LOG2_PAGE_SIZE); PRINTF("%s:%d: end\n", __func__, __LINE__); done: result = lv1_unmap(); if (result) PRINTF("%s:%d: lv1_unmap failed (0x%08x)\n", __func__, __LINE__, result); udp_printf_deinit(); netDeinitialize(); return 0; }
int ftp_init() { if(ftp_initialized) return 1; netInitialize(); netCtlInit(); union net_ctl_info info; if(netCtlGetInfo(NET_CTL_INFO_IP_ADDRESS, &info) == 0) { // start server thread appstate = 0; sprintf(ftp_ip_str, "FTP active (%s:%i)", info.ip_address, 21); sysThreadCreate(&thread_id, listener_thread, NULL, 1500, 0x400, 0, "listener"); //s32 fd; //u64 read = 0; /* if(sysLv2FsOpen(OFTP_PASSWORD_FILE, SYS_O_RDONLY | SYS_O_CREAT, &fd, 0660, NULL, 0) == 0) { sysLv2FsRead(fd, passwd, 63, &read); } passwd[read] = '\0'; sysLv2FsClose(fd); // prevent multiline passwords strreplace(passwd, '\r', '\0'); strreplace(passwd, '\n', '\0'); */ char dlgmsg[256]; sprintf(dlgmsg, "OpenPS3FTP %s by jjolano (Twitter: @jjolano)\nWebsite: http://jjolano.dashhacks.com\nDonations: http://bit.ly/gB8CJo\nStatus: FTP Server Active (%s port 21)\n\nPress OK to exit this program.", OFTP_VERSION, info.ip_address); //msgDialogOpen2(mt_ok, dlgmsg, dialog_handler, NULL, NULL); ftp_initialized = 1; return 0; } else { //msgDialogOpen2(mt_ok, OFTP_ERRMSG_NETWORK, dialog_handler, NULL, NULL); ftp_initialized = 0; netDeinitialize(); } return -1; }
int main(int argc,char *argv[]) { netInitialize(); debugInit(); debugPrintf("\nTEST!\nIf you see this you've set up netcat correctly.\n"); return 0; }
/* main */ int main(int argc, char **argv) { #ifndef USE_AIM uint64_t eid0_size; uint8_t eid0[4096]; #endif uint8_t value, idps[IDPS_SIZE], seed[TOKEN_SIZE], token[TOKEN_SIZE]; AES_KEY aes_ctx; int i, result; netInitialize(); udp_printf_init(); PRINTF("%s:%d: start\n", __func__, __LINE__); #ifdef USE_AIM result = lv2_ss_aim_if(AIM_PACKET_ID_GET_DEV_ID, (uint64_t) &idps); if (result) { PRINTF("%s:%d: lv2_ss_aim_if(GET_DEV_ID) failed (0x%08x)\n", __func__, __LINE__, result); goto done; } #else result = lv2_ss_indi_info_mgr_if(INDI_INFO_MGR_PACKET_ID_GET_DATA_SIZE_BY_INDEX, EID0_INDEX, (uint64_t) &eid0_size, 0, 0); if (result) { PRINTF("%s:%d: lv2_ss_indi_info_mgr_if(GET_DATA_SIZE_BY_INDEX) failed (0x%08x)\n", __func__, __LINE__, result); goto done; } PRINTF("%s:%d: EID0 size %ld\n", __func__, __LINE__, eid0_size); result = lv2_ss_indi_info_mgr_if(INDI_INFO_MGR_PACKET_ID_GET_DATA_BY_INDEX, EID0_INDEX, (uint64_t) eid0, sizeof(eid0), (uint64_t) &eid0_size); if (result) { PRINTF("%s:%d: lv2_ss_indi_info_mgr_if(GET_DATA_BY_INDEX) failed (0x%08x)\n", __func__, __LINE__, result); goto done; } PRINTF("%s:%d: EID0 size %ld\n", __func__, __LINE__, eid0_size); memcpy(idps, eid0, IDPS_SIZE); #endif PRINTF("%s: %d: IDPS: %02x %02x %02x %02x %02x %02x %02x %02x " "%02x %02x %02x %02x %02x %02x %02x %02x\n", __func__, __LINE__, idps[0], idps[1], idps[ 2], idps[ 3], idps[ 4], idps[ 5], idps[ 6], idps[ 7], idps[8], idps[9], idps[10], idps[11], idps[12], idps[13], idps[14], idps[15]); memset(seed, 0, TOKEN_SIZE);)
/* main */ int main(int argc, char **argv) { uint32_t dev_handle; uint64_t region_id; int result; netInitialize(); udp_printf_init(); PRINTF("%s:%d: start\n", __func__, __LINE__); dev_handle = 0; result = lv2_storage_open(VFLASH_DEV_ID, &dev_handle); if (result) { PRINTF("%s:%d: lv2_storage_open failed (0x%08x)\n", __func__, __LINE__, result); goto done; } result = lv2_storage_create_region(dev_handle, VFLASH_REGION_START_SECTOR, VFLASH_REGION_SECTOR_COUNT, 0, VFLASH_REGION_LAID, ®ion_id); if (result) { PRINTF("%s:%d: lv2_storage_create_region failed (0x%08x)\n", __func__, __LINE__, result); goto done; } PRINTF("%s:%d: region_id (%d)\n", __func__, __LINE__, region_id); PRINTF("%s:%d: end\n", __func__, __LINE__); lv2_sm_ring_buzzer(0x1004, 0xa, 0x1b6); done: result = lv2_storage_close(dev_handle); if (result) PRINTF("%s:%d: lv2_storage_close failed (0x%08x)\n", __func__, __LINE__, result); udp_printf_deinit(); netDeinitialize(); return 0; }
/* * main */ int main(int argc, char **argv) { FILE *fp; uint64_t off, val; int result; netInitialize(); udp_printf_init(); PRINTF("%s:%d: start\n", __func__, __LINE__); fp = open_dump(); if (!fp) goto done; for (off = DUMP_OFFSET; off < DUMP_OFFSET + DUMP_SIZE; off += sizeof(uint64_t)) { val = lv2_lv1_peek(off); result = fwrite(&val, 1, sizeof(val), fp); if (result != sizeof(val)) { PRINTF("%s:%d: fwrite failed (0x%08x)\n", __func__, __LINE__, result); goto done; } } fclose(fp); PRINTF("%s:%d: end\n", __func__, __LINE__); lv2_sm_ring_buzzer(0x1004, 0xa, 0x1b6); done: if (fp) fclose(fp); udp_printf_deinit(); netDeinitialize(); return 0; }
int main() { void *arg = NULL ; SystemClock_Config() ; #if !defined(NO_FILESYSTEM) init_filesystem (); #endif netInitialize() ; osDelay(300) ; #if defined(DEBUG_WOLFSSL) printf("Turning ON Debug message\n") ; wolfSSL_Debugging_ON() ; #endif shell_main(arg) ; }
void debugInit() { struct sockaddr_in stSockAddr; netInitialize(); SocketFD = netSocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); memset(&stSockAddr, 0, sizeof stSockAddr); stSockAddr.sin_family = AF_INET; stSockAddr.sin_port = htons(DEBUG_PORT); inet_pton(AF_INET, DEBUG_IP, &stSockAddr.sin_addr); netConnect(SocketFD, (struct sockaddr *)&stSockAddr, sizeof stSockAddr); debugPrintf("network debug module initialized\n") ; debugPrintf("ready to have a lot of fun\n") ; }
int main() { static char *argv[] = { "server", "-p", WOLFSSL_LISTEN_PORT, "-d"} ; static func_args args = { 4, argv } ; SystemClock_Config (); #if !defined(NO_FILESYSTEM) init_filesystem (); #endif netInitialize() ; osDelay(300) ; #if defined(DEBUG_WOLFSSL) printf("Turning ON Debug message\n") ; wolfSSL_Debugging_ON() ; #endif printf("Simple Server: Started\n") ; while(1) { server_test(&args) ; printf("Enter any key to iterate.\n") ; getchar() ; } }
/* main */ int main(int argc, char **argv) { #ifndef USE_AIM uint64_t eid0_size; uint8_t eid0[4096]; #endif uint8_t value, idps[IDPS_SIZE], seed[TOKEN_SIZE], token[TOKEN_SIZE]; AES_KEY aes_ctx; int i, result; netInitialize(); udp_printf_init(); PRINTF("%s:%d: start\n", __func__, __LINE__); #ifdef USE_AIM result = lv2_ss_aim_if(AIM_PACKET_ID_GET_DEV_ID, (uint64_t) &idps); if (result) { PRINTF("%s:%d: lv2_ss_aim_if(GET_DEV_ID) failed (0x%08x)\n", __func__, __LINE__, result); goto done; } #else result = lv2_ss_indi_info_mgr_if(INDI_INFO_MGR_PACKET_ID_GET_DATA_SIZE_BY_INDEX, EID0_INDEX, (uint64_t) &eid0_size, 0, 0); if (result) { PRINTF("%s:%d: lv2_ss_indi_info_mgr_if(GET_DATA_SIZE_BY_INDEX) failed (0x%08x)\n", __func__, __LINE__, result); goto done; } PRINTF("%s:%d: EID0 size %ld\n", __func__, __LINE__, eid0_size); result = lv2_ss_indi_info_mgr_if(INDI_INFO_MGR_PACKET_ID_GET_DATA_BY_INDEX, EID0_INDEX, (uint64_t) eid0, sizeof(eid0), (uint64_t) &eid0_size); if (result) { PRINTF("%s:%d: lv2_ss_indi_info_mgr_if(GET_DATA_BY_INDEX) failed (0x%08x)\n", __func__, __LINE__, result); goto done; } PRINTF("%s:%d: EID0 size %ld\n", __func__, __LINE__, eid0_size); memcpy(idps, eid0, IDPS_SIZE); #endif PRINTF("%s: %d: IDPS: %02x %02x %02x %02x %02x %02x %02x %02x " "%02x %02x %02x %02x %02x %02x %02x %02x\n", __func__, __LINE__, idps[0], idps[1], idps[ 2], idps[ 3], idps[ 4], idps[ 5], idps[ 6], idps[ 7], idps[8], idps[9], idps[10], idps[11], idps[12], idps[13], idps[14], idps[15]); memset(seed, 0, TOKEN_SIZE); memcpy(seed + 4, idps, IDPS_SIZE); seed[3] = 1; hmac_sha1(hmac, sizeof(hmac), seed, 60, seed + 60); result = AES_set_encrypt_key(erk, 256, &aes_ctx); if (result) { PRINTF("%s:%d: AES_set_encrypt_key failed (0x%08x)\n", __func__, __LINE__, result); goto done; } AES_cbc_encrypt(iv, seed, token, TOKEN_SIZE, &aes_ctx); PRINTF("%s: %d: TOKEN SEED:\n", __func__, __LINE__); for (i = 0; i < TOKEN_SIZE; i += 16) PRINTF("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", seed[i + 0], seed[i + 1], seed[i + 2], seed[i + 3], seed[i + 4], seed[i + 5], seed[i + 6], seed[i + 7], seed[i + 8], seed[i + 9], seed[i + 10], seed[i + 11], seed[i + 12], seed[i + 13], seed[i + 14], seed[i + 15]); PRINTF("%s: %d: TOKEN:\n", __func__, __LINE__); for (i = 0; i < TOKEN_SIZE; i += 16) PRINTF("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", token[i + 0], token[i + 1], token[i + 2], token[i + 3], token[i + 4], token[i + 5], token[i + 6], token[i + 7], token[i + 8], token[i + 9], token[i + 10], token[i + 11], token[i + 12], token[i + 13], token[i + 14], token[i + 15]); result = lv2_ss_update_mgr_if(UPDATE_MGR_PACKET_ID_SET_TOKEN, (uint64_t) token, TOKEN_SIZE, 0, 0, 0, 0); if (result) { PRINTF("%s:%d: lv1_ss_update_mgr_if(SET_TOKEN) failed (0x%08x)\n", __func__, __LINE__, result); goto done; } result = lv2_ss_update_mgr_if(UPDATE_MGR_PACKET_ID_READ_EPROM, EPROM_QA_FLAG_OFFSET, (uint64_t) &value, 0, 0, 0, 0); if (result) { PRINTF("%s:%d: lv1_ss_update_mgr_if(READ_EPROM) failed (0x%08x)\n", __func__, __LINE__, result); goto done; } PRINTF("%s:%d: current QA flag 0x%02x\n", __func__, __LINE__, value); result = lv2_ss_update_mgr_if(UPDATE_MGR_PACKET_ID_WRITE_EPROM, EPROM_QA_FLAG_OFFSET, 0xff /* disable QA token */, 0, 0, 0, 0); if (result) { PRINTF("%s:%d: lv1_ss_update_mgr_if(WRITE_EPROM) failed (0x%08x)\n", __func__, __LINE__, result); goto done; } PRINTF("%s:%d: end\n", __func__, __LINE__); lv2_sm_ring_buzzer(0x1004, 0xa, 0x1b6); done: udp_printf_deinit(); netDeinitialize(); return 0; }
int main(int argc, char *argv[]) { int ret, server_mode; void *host_addr = memalign(1024 * 1024, HOST_SIZE); msgType dialog_type; sys_ppu_thread_t id; // start server thread load_modules(); init_logging(); netInitialize(); netCtlInit(); // Initialize SPUs LOG(lm_main, LOG_DEBUG, ("Initializing SPUs\n")); ret = sysSpuInitialize(MAX_PHYSICAL_SPU, MAX_RAW_SPU); if (ret != 0) { LOG(lm_main, LOG_ERROR, ("sysSpuInitialize failed: %d\n", ret)); goto quit; } init_screen(host_addr, HOST_SIZE); ioPadInit(7); ret = initialize_exit_handlers(); if (ret != 0) goto quit; show_version(); if (user_requested_exit()) goto quit; u64 CEX=0x4345580000000000ULL; u64 DEX=0x4445580000000000ULL; u64 DEH=0x4445480000000000ULL; if(lv2peek(0x80000000002E79C8ULL)==DEX) {dex_mode=2; c_firmware=3.41f;} else if(lv2peek(0x80000000002CFF98ULL)==CEX) {dex_mode=0; c_firmware=3.41f;} else if(lv2peek(0x80000000002EFE20ULL)==DEX) {dex_mode=2; c_firmware=3.55f;} else if(lv2peek(0x80000000002D83D0ULL)==CEX) {dex_mode=0; c_firmware=3.55f;} else if(lv2peek(0x8000000000302D88ULL)==DEX) {dex_mode=2; c_firmware=4.21f;} else if(lv2peek(0x80000000002E8610ULL)==CEX) {dex_mode=0; c_firmware=4.21f;} else if(lv2peek(0x80000000002E9F08ULL)==CEX) {dex_mode=0; c_firmware=4.30f;} else if(lv2peek(0x8000000000304630ULL)==DEX) {dex_mode=2; c_firmware=4.30f;} else if(lv2peek(0x80000000002E9F18ULL)==CEX) {dex_mode=0; c_firmware=4.31f;} else if(lv2peek(0x80000000002EA488ULL)==CEX) {dex_mode=0; c_firmware=4.40f;} else if(lv2peek(0x80000000002EA498ULL)==CEX) {dex_mode=0; c_firmware=4.41f;} else if(lv2peek(0x8000000000304EF0ULL)==DEX) {dex_mode=2; c_firmware=4.41f;} else if(lv2peek(0x80000000002EA9B8ULL)==CEX) {dex_mode=0; c_firmware=4.46f;} else if(lv2peek(0x8000000000305410ULL)==DEX) {dex_mode=2; c_firmware=4.46f;} else if(lv2peek(0x80000000002E9BE0ULL)==CEX) {dex_mode=0; c_firmware=4.50f;} else if(lv2peek(0x8000000000309698ULL)==DEX) {dex_mode=2; c_firmware=4.50f;} else if(lv2peek(0x80000000002E9D70ULL)==CEX) {dex_mode=0; c_firmware=4.53f;} else if(lv2peek(0x80000000002EC5E0ULL)==CEX) {dex_mode=0; c_firmware=4.55f;} else if(lv2peek(0x80000000002ED850ULL)==CEX) {dex_mode=0; c_firmware=4.60f;} else if(lv2peek(0x80000000002ED860ULL)==CEX) {dex_mode=0; c_firmware=4.65f;} else if(lv2peek(0x800000000030F1A8ULL)==DEX) {dex_mode=2; c_firmware=4.65f;} else if(lv2peek(0x80000000002ED778ULL)==CEX) {dex_mode=0; c_firmware=4.70f;} else if(lv2peek(0x800000000030F240ULL)==DEX) {dex_mode=2; c_firmware=4.70f;} else if(lv2peek(0x80000000002ED818ULL)==CEX) {dex_mode=0; c_firmware=4.75f;} else if(lv2peek(0x800000000030F2D0ULL)==DEX) {dex_mode=2; c_firmware=4.75f;} else if(lv2peek(0x80000000002ED808ULL)==CEX) {dex_mode=0; c_firmware=4.80f;} else if(lv2peek(0x800000000030F3A0ULL)==DEX) {dex_mode=2; c_firmware=4.80f;} else if(lv2peek(0x800000000030F3B0ULL)==DEX) {dex_mode=2; c_firmware=4.81f;} else if(lv2peek(0x800000000032EB60ULL)==DEH) {deh_mode=2; c_firmware=4.81f;} else c_firmware=0.00f; if(c_firmware==3.55f && dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_355D; } else if(c_firmware==3.55f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_355; } else if(c_firmware==4.21f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_421; } else if(c_firmware==4.30f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_430; } else if(c_firmware==4.30f && dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_430D; } else if(c_firmware==4.31f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_431; } else if(c_firmware==4.40f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_440; } else if(c_firmware==4.41f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_441; } else if(c_firmware==4.41f && dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_441D; } else if(c_firmware==4.46f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_446; } else if(c_firmware==4.50f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_450; } else if(c_firmware==4.53f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_453; } else if(c_firmware==4.55f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_455; } else if(c_firmware==4.60f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_460; } else if(c_firmware==4.65f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_465; } else if(c_firmware==4.65f && dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_465D; } else if(c_firmware==4.70f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_470; } else if(c_firmware==4.70f && dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_470D; } else if(c_firmware==4.75f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_475; } else if(c_firmware==4.80f && !dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_480; } else if(c_firmware==4.80f && dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_480D; } else if(c_firmware==4.75f && dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_475D; } else if(c_firmware==4.81f && dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_481D; } else if(c_firmware==4.46f && dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_446D; } else if(c_firmware==4.50f && dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_450D; } else if(c_firmware==4.21f && dex_mode) { SYSCALL_TABLE = SYSCALL_TABLE_421D; } else if(c_firmware==3.41f) { SYSCALL_TABLE = SYSCALL_TABLE_341; } else if(c_firmware==4.81f && deh_mode) { SYSCALL_TABLE = SYSCALL_TABLE_481H; } /* if(c_firmware>=4.20f && SYSCALL_TABLE) { // add and enable lv2 peek/poke + lv1 peek/poke lv2poke(0x800000000000171CULL, 0x7C0802A6F8010010ULL); lv2poke(0x800000000000171CULL + 8, 0x396000B644000022ULL); lv2poke(0x800000000000171CULL + 16, 0x7C832378E8010010ULL); lv2poke(0x800000000000171CULL + 24, 0x7C0803A64E800020ULL); lv2poke(0x800000000000171CULL + 32, 0x7C0802A6F8010010ULL); lv2poke(0x800000000000171CULL + 40, 0x396000B744000022ULL); lv2poke(0x800000000000171CULL + 48, 0x38600000E8010010ULL); lv2poke(0x800000000000171CULL + 56, 0x7C0803A64E800020ULL); lv2poke(0x800000000000171CULL + 64, 0x7C0802A6F8010010ULL); lv2poke(0x800000000000171CULL + 72, 0x7D4B537844000022ULL); lv2poke(0x800000000000171CULL + 80, 0xE80100107C0803A6ULL); lv2poke(0x800000000000171CULL + 88, 0x4E80002080000000ULL); lv2poke(0x800000000000171CULL + 96, 0x0000170C80000000ULL); lv2poke(0x800000000000171CULL + 104, 0x0000171480000000ULL); lv2poke(0x800000000000171CULL + 112, 0x0000171C80000000ULL); lv2poke(0x800000000000171CULL + 120, 0x0000173C80000000ULL); lv2poke(0x800000000000171CULL + 128, 0x0000175C00000000ULL); lv2poke(SYSCALL_PTR( 6), 0x8000000000001778ULL); //sc6 lv2poke(SYSCALL_PTR( 7), 0x8000000000001780ULL); //sc7 lv2poke(SYSCALL_PTR( 8), 0x8000000000001788ULL); //sc8 lv2poke(SYSCALL_PTR( 9), 0x8000000000001790ULL); //sc9 lv2poke(SYSCALL_PTR(10), 0x8000000000001798ULL); //sc10 }*/ // remove patch protection if(c_firmware==3.55f) remove_protection(); if(c_firmware==0.00f) ret = -1; else ret = patch_lv1_ss_services(); if (ret < 0) { dialog_type = (MSG_DIALOG_NORMAL | MSG_DIALOG_BTN_TYPE_OK | MSG_DIALOG_DISABLE_CANCEL_ON); msgDialogOpen2(dialog_type, "ERROR: Couldn't patch lv1 services, returning to the XMB.\nMake sure you are running a firmware which allows patching!", dialog_handler, NULL, NULL); dialog_action = 0; while (!dialog_action && !user_requested_exit()) { sysUtilCheckCallback(); flip(); } msgDialogAbort(); goto quit; } // patch syscall 864 to allow drive re-init if(c_firmware==0.0f) ret = -1; else ret = patch_syscall_864(); if (ret < 0) { dialog_type = (MSG_DIALOG_NORMAL | MSG_DIALOG_BTN_TYPE_OK | MSG_DIALOG_DISABLE_CANCEL_ON); msgDialogOpen2(dialog_type, "ERROR: Couldn't patch syscall 864, returning to the XMB.\nMake sure you are running a firmware which allows patching!", dialog_handler, NULL, NULL); dialog_action = 0; while (!dialog_action && !user_requested_exit()) { sysUtilCheckCallback(); flip(); } msgDialogAbort(); goto quit; } // install the necessary modules ret = install_modules(); if (ret < 0) { dialog_type = (MSG_DIALOG_NORMAL | MSG_DIALOG_BTN_TYPE_OK | MSG_DIALOG_DISABLE_CANCEL_ON); msgDialogOpen2(dialog_type, "Installation was aborted, returning to the XMB.", dialog_handler, NULL, NULL); dialog_action = 0; while (!dialog_action && !user_requested_exit()) { sysUtilCheckCallback(); flip(); } msgDialogAbort(); goto quit; } if (user_requested_exit()) goto quit; // reset & re-authenticate the BD drive sys_storage_reset_bd(); sys_storage_authenticate_bd(); // eject current disc { int fd; ret = sys_storage_open(BD_DEVICE, &fd); if (ret == 0) { ioctl_eject(fd); sys_storage_close(fd); } } ret = sysDiscRegisterDiscChangeCallback(&bd_eject_disc_callback, &bd_insert_disc_callback); // poll for an output_device poll_output_devices(); server_mode = user_select_server_mode(); if (user_requested_exit()) goto quit; if (server_mode) { #ifdef ENABLE_LOGGING if (output_device) { char file_path[100]; sprintf(file_path, "%s/daemon_log.txt", output_device); set_log_file(file_path); } #endif sysThreadCreate(&id, listener_thread, NULL, 1500, 0x400, 0, "listener"); while (1) { // server loop server_loop(); // break out of the loop when requested if (user_requested_exit()) break; } } else { while (1) { // main loop main_loop(); // break out of the loop when requested if (user_requested_exit()) break; } } ret = sysDiscUnregisterDiscChangeCallback(); quit: unpatch_lv1_ss_services(); destroy_logging(); netDeinitialize(); unload_modules(); free(host_addr); return 0; }
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; }
/* * main */ int main(int argc, char **argv) { uint32_t dev_handle; int start_sector, sector_count; struct storage_device_info info; uint8_t buf[VFLASH5_SECTOR_SIZE * 16]; struct os_area_header *hdr; struct os_area_params *params; uint32_t unknown2; int result; netInitialize(); udp_printf_init(); PRINTF("%s:%d: start\n", __func__, __LINE__); dev_handle = 0; result = lv2_storage_get_device_info(VFLASH5_DEV_ID, &info); if (result) { PRINTF("%s:%d: lv2_storage_get_device_info failed (0x%08x)\n", __func__, __LINE__, result); goto done; } PRINTF("%s:%d: capacity (0x%16llx)\n", __func__, __LINE__, info.capacity); if (info.capacity < VFLASH5_HEADER_SECTORS) { PRINTF("%s:%d: device capacity too small\n", __func__, __LINE__); goto done; } result = lv2_storage_open(VFLASH5_DEV_ID, &dev_handle); if (result) { PRINTF("%s:%d: lv2_storage_open failed (0x%08x)\n", __func__, __LINE__, result); goto done; } /* write os header and params */ start_sector = 0; sector_count = VFLASH5_HEADER_SECTORS; PRINTF("%s:%d: reading header start_sector (0x%08x) sector_count (0x%08x)\n", __func__, __LINE__, start_sector, sector_count); memset(buf, 0, sizeof(buf)); hdr = (struct os_area_header *) buf; params = (struct os_area_params *) (buf + OS_AREA_SEGMENT_SIZE); result = lv2_storage_read(dev_handle, 0, start_sector, sector_count, buf, &unknown2, 0); if (result) { PRINTF("%s:%d: lv2_storage_read failed (0x%08x)\n", __func__, __LINE__, result); goto done; } if (strncmp((const char *) hdr->magic, HEADER_MAGIC, sizeof(hdr->magic))) { PRINTF("%s:%d: invalid header magic\n", __func__, __LINE__, result); goto done; } if (hdr->version != HEADER_VERSION) { PRINTF("%s:%d: invalid header version\n", __func__, __LINE__, result); goto done; } if (params->boot_flag != PARAM_BOOT_FLAG_GAME_OS) { params->boot_flag = PARAM_BOOT_FLAG_GAME_OS; result = lv2_storage_write(dev_handle, 0, start_sector, sector_count, buf, &unknown2, 0); if (result) { PRINTF("%s:%d: lv2_storage_write failed (0x%08x)\n", __func__, __LINE__, result); goto done; } } PRINTF("%s:%d: end\n", __func__, __LINE__); lv2_sm_ring_buzzer(0x1004, 0xa, 0x1b6); done: result = lv2_storage_close(dev_handle); if (result) PRINTF("%s:%d: lv2_storage_close failed (0x%08x)\n", __func__, __LINE__, result); udp_printf_deinit(); netDeinitialize(); return 0; }
/* * main */ int main(int argc, char **argv) { uint32_t dev_handle; FILE *fp; int start_sector, sector_count; uint32_t unknown2; uint8_t buf[VFLASH_SECTOR_SIZE * VFLASH_SECTOR_COUNT]; int result; netInitialize(); udp_printf_init(); PRINTF("%s:%d: start\n", __func__, __LINE__); dev_handle = 0; fp = NULL; result = lv2_storage_open(VFLASH_DEV_ID, &dev_handle); if (result) { PRINTF("%s:%d: lv2_storage_open failed (0x%08x)\n", __func__, __LINE__, result); goto done; } fp = open_dump(); if (!fp) goto done; start_sector = VFLASH_START_SECTOR; sector_count = VFLASH_SECTOR_COUNT; PRINTF("%s:%d: reading data start_sector (0x%08x) sector_count (0x%08x)\n", __func__, __LINE__, start_sector, sector_count); result = lv2_storage_read(dev_handle, 0, start_sector, sector_count, buf, &unknown2, VFLASH_FLAGS); if (result) { PRINTF("%s:%d: lv2_storage_read failed (0x%08x)\n", __func__, __LINE__, result); goto done; } usleep(10000); PRINTF("%s:%d: dumping data\n", __func__, __LINE__, start_sector, sector_count); result = fwrite(buf, 1, VFLASH_SECTOR_COUNT * VFLASH_SECTOR_SIZE, fp); if (result < 0) { PRINTF("%s:%d: fwrite failed (0x%08x)\n", __func__, __LINE__, result); goto done; } fclose(fp); PRINTF("%s:%d: end\n", __func__, __LINE__); lv2_sm_ring_buzzer(0x1004, 0xa, 0x1b6); done: if (fp) fclose(fp); result = lv2_storage_close(dev_handle); if (result) PRINTF("%s:%d: lv2_storage_close failed (0x%08x)\n", __func__, __LINE__, result); udp_printf_deinit(); netDeinitialize(); return 0; }