static void action_delete_title_update(ui_view* view, void* data, float* progress, char* text) { delete_title_data* deleteData = (delete_title_data*) data; title_info* info = (title_info*) deleteData->selected->data; Result res = 0; if(R_SUCCEEDED(res = AM_DeleteTitle(info->mediaType, info->titleId)) && deleteData->ticket) { res = AM_DeleteTicket(info->titleId); } ui_pop(); info_destroy(view); if(R_FAILED(res)) { error_display_res(info, ui_draw_title_info, res, "Failed to delete title."); } else { linked_list_remove(deleteData->items, deleteData->selected); task_free_title(deleteData->selected); prompt_display("Success", "Title deleted.", COLOR_TEXT, false, NULL, NULL, NULL); } free(data); }
void deleteTitle(FS_MediaType mediaType, u64 titleID) { Result res; // System app if(titleID>>32 & 0xFFFF) {if((res = AM_DeleteTitle(mediaType, titleID))) throw titleException(_FILE_, __LINE__, res, "Failed to delete system title!");} // Who likes ambiguous else? // Normal app else if((res = AM_DeleteAppTitle(mediaType, titleID))) throw titleException(_FILE_, __LINE__, res, "Failed to delete app title!");
int deleteTitle(u64 titleID) { LOG_INFO("deleteTitle: %016llX", titleID); #ifdef ARMED if(R_FAILED(AM_DeleteTitle(MEDIATYPE_NAND, titleID))) { return(-1); } #endif return(0); }
static Result action_url_install_open_dst(void* data, u32 index, void* initialReadBlock, u64 size, u32* handle) { url_install_data* installData = (url_install_data*) data; Result res = 0; installData->responseCode = 0; installData->ticket = false; installData->currTitleId = 0; installData->n3dsContinue = false; memset(&installData->ticketInfo, 0, sizeof(installData->ticketInfo)); if(*(u16*) initialReadBlock == 0x0100) { if(!installData->cdnDecided) { ui_view* view = prompt_display("Optional", "Install ticket titles from CDN?", COLOR_TEXT, true, data, NULL, action_url_install_cdn_check_onresponse); if(view != NULL) { svcWaitSynchronization(view->active, U64_MAX); } } installData->ticket = true; installData->ticketInfo.titleId = util_get_ticket_title_id((u8*) initialReadBlock); AM_DeleteTicket(installData->ticketInfo.titleId); res = AM_InstallTicketBegin(handle); } else if(*(u16*) initialReadBlock == 0x2020) { u64 titleId = util_get_cia_title_id((u8*) initialReadBlock); FS_MediaType dest = (titleId & 0x0000801000000002) != 0 ? MEDIATYPE_NAND : MEDIATYPE_SD; bool n3ds = false; if(R_SUCCEEDED(APT_CheckNew3DS(&n3ds)) && !n3ds && ((titleId >> 28) & 0xF) == 2) { ui_view* view = prompt_display("Confirmation", "Title is intended for New 3DS systems.\nContinue?", COLOR_TEXT, true, data, NULL, action_url_install_n3ds_onresponse); if(view != NULL) { svcWaitSynchronization(view->active, U64_MAX); } if(!installData->n3dsContinue) { return R_FBI_WRONG_SYSTEM; } } // Deleting FBI before it reinstalls itself causes issues. if(((titleId >> 8) & 0xFFFFF) != 0xF8001) { AM_DeleteTitle(dest, titleId); AM_DeleteTicket(titleId); if(dest == MEDIATYPE_SD) { AM_QueryAvailableExternalTitleDatabase(NULL); } } if(R_SUCCEEDED(res = AM_StartCiaInstall(dest, handle))) { installData->currTitleId = titleId; } } else {
AppResult appDelete(App app) { if(!serviceRequire("am")) { return APP_AM_INIT_FAILED; } Result res = AM_DeleteTitle(appMediatypeToByte(app.mediaType), app.titleId); if(res != 0) { platformSetError(serviceParseError((u32) res)); return APP_DELETE_FAILED; } return APP_SUCCESS; }
static void action_delete_title_update(ui_view* view, void* data, float* progress, char* text) { delete_title_data* deleteData = (delete_title_data*) data; Result res = AM_DeleteTitle(deleteData->info->mediaType, deleteData->info->titleId); ui_pop(); info_destroy(view); if(R_FAILED(res)) { error_display_res(NULL, deleteData->info, ui_draw_title_info, res, "Failed to delete title."); } else { *deleteData->populated = false; prompt_display("Success", "Title deleted.", COLOR_TEXT, false, deleteData->info, NULL, ui_draw_title_info, NULL); } free(data); }