Allow deleting CIAs as they're installed.

This commit is contained in:
Steven Smith 2016-04-12 13:04:27 -07:00
parent 7f394dbb5f
commit 81cd7e06bb
3 changed files with 31 additions and 7 deletions

View File

@ -11,6 +11,8 @@ void action_delete_system_save_data(system_save_data_info* info, bool* populated
void action_install_cias_nand(file_info* info, bool* populated);
void action_install_cias_sd(file_info* info, bool* populated);
void action_install_cias_delete_nand(file_info* info, bool* populated);
void action_install_cias_delete_sd(file_info* info, bool* populated);
void action_copy_contents(file_info* info, bool* populated);
void action_delete_contents(file_info* info, bool* populated);
void action_delete_dir_contents(file_info* info, bool* populated);

View File

@ -15,6 +15,8 @@
typedef struct {
file_info* base;
FS_MediaType dest;
bool delete;
bool* populated;
Handle currHandle;
bool installStarted;
u64 currProcessed;
@ -112,6 +114,12 @@ static void action_install_cias_update(ui_view* view, void* data, float* progres
}
}
if(installData->delete) {
FSUSER_DeleteFile(*installData->base->archive, fsMakePath(PATH_ASCII, path));
*installData->populated = false;
}
installData->processed++;
}
@ -184,10 +192,12 @@ static void action_install_cias_onresponse(ui_view* view, void* data, bool respo
}
}
static void action_install_cias(file_info* info, FS_MediaType mediaType) {
static void action_install_cias(file_info* info, bool* populated, FS_MediaType mediaType, bool delete) {
install_cias_data* data = (install_cias_data*) calloc(1, sizeof(install_cias_data));
data->base = info;
data->dest = mediaType;
data->delete = delete;
data->populated = populated;
data->installStarted = false;
data->currProcessed = 0;
data->currTotal = 0;
@ -204,10 +214,18 @@ static void action_install_cias(file_info* info, FS_MediaType mediaType) {
ui_push(prompt_create("Confirmation", "Install the selected CIA(s)?", COLOR_TEXT, true, data, NULL, action_install_cias_draw_top, action_install_cias_onresponse));
}
void action_install_cias_sd(file_info* info, bool* populated) {
action_install_cias(info, MEDIATYPE_SD);
void action_install_cias_nand(file_info* info, bool* populated) {
action_install_cias(info, populated, MEDIATYPE_NAND, false);
}
void action_install_cias_nand(file_info* info, bool* populated) {
action_install_cias(info, MEDIATYPE_NAND);
void action_install_cias_sd(file_info* info, bool* populated) {
action_install_cias(info, populated, MEDIATYPE_SD, false);
}
void action_install_cias_delete_nand(file_info* info, bool* populated) {
action_install_cias(info, populated, MEDIATYPE_NAND, true);
}
void action_install_cias_delete_sd(file_info* info, bool* populated) {
action_install_cias(info, populated, MEDIATYPE_SD, true);
}

View File

@ -36,12 +36,14 @@ static list_item files_action_items[FILES_ACTION_COUNT] = {
{"Paste", COLOR_TEXT, action_paste_contents},
};
#define CIA_FILES_ACTION_COUNT 5
#define CIA_FILES_ACTION_COUNT 7
static u32 cia_files_action_count = CIA_FILES_ACTION_COUNT;
static list_item cia_files_action_items[CIA_FILES_ACTION_COUNT] = {
{"Install CIA to SD", COLOR_TEXT, action_install_cias_sd},
{"Install CIA to NAND", COLOR_TEXT, action_install_cias_nand},
{"Install CIA to SD and delete", COLOR_TEXT, action_install_cias_delete_sd},
{"Install CIA to NAND and delete", COLOR_TEXT, action_install_cias_delete_nand},
{"Delete", COLOR_TEXT, action_delete_contents},
{"Copy", COLOR_TEXT, action_copy_contents},
{"Paste", COLOR_TEXT, action_paste_contents},
@ -57,12 +59,14 @@ static list_item directories_action_items[DIRECTORIES_ACTION_COUNT] = {
{"Paste", COLOR_TEXT, action_paste_contents},
};
#define CIA_DIRECTORIES_ACTION_COUNT 7
#define CIA_DIRECTORIES_ACTION_COUNT 9
static u32 cia_directories_action_count = CIA_DIRECTORIES_ACTION_COUNT;
static list_item cia_directories_action_items[CIA_DIRECTORIES_ACTION_COUNT] = {
{"Install all CIAs to SD", COLOR_TEXT, action_install_cias_sd},
{"Install all CIAs to NAND", COLOR_TEXT, action_install_cias_nand},
{"Install all CIAs to SD and delete", COLOR_TEXT, action_install_cias_delete_sd},
{"Install all CIAs to NAND and delete", COLOR_TEXT, action_install_cias_delete_nand},
{"Delete all CIAs", COLOR_TEXT, action_delete_dir_cias},
{"Delete all contents", COLOR_TEXT, action_delete_dir_contents},
{"Delete", COLOR_TEXT, action_delete_contents},