mirror of
https://gitlab.com/Theopse/fbi-i18n-zh.git
synced 2025-04-06 03:58:02 +08:00
Only repopulate lists when changes are known to have occurred.
This commit is contained in:
parent
061dd0209f
commit
1f7f33390d
@ -2,28 +2,28 @@
|
||||
|
||||
#include "../task/task.h"
|
||||
|
||||
void action_browse_boss_ext_save_data(ext_save_data_info* info);
|
||||
void action_browse_user_ext_save_data(ext_save_data_info* info);
|
||||
void action_delete_ext_save_data(ext_save_data_info* info);
|
||||
void action_browse_boss_ext_save_data(ext_save_data_info* info, bool* populated);
|
||||
void action_browse_user_ext_save_data(ext_save_data_info* , bool* populatedinfo);
|
||||
void action_delete_ext_save_data(ext_save_data_info* info, bool* populated);
|
||||
|
||||
void action_browse_system_save_data(system_save_data_info* info);
|
||||
void action_delete_system_save_data(system_save_data_info* info);
|
||||
void action_browse_system_save_data(system_save_data_info* info, bool* populated);
|
||||
void action_delete_system_save_data(system_save_data_info* info, bool* populated);
|
||||
|
||||
void action_install_cias_nand(file_info* info);
|
||||
void action_install_cias_sd(file_info* info);
|
||||
void action_copy_contents(file_info* info);
|
||||
void action_delete_contents(file_info* info);
|
||||
void action_delete_dir_contents(file_info* info);
|
||||
void action_delete_dir_cias(file_info* info);
|
||||
void action_paste_contents(file_info* info);
|
||||
void action_install_cias_nand(file_info* info, bool* populated);
|
||||
void action_install_cias_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);
|
||||
void action_delete_dir_cias(file_info* info, bool* populated);
|
||||
void action_paste_contents(file_info* info, bool* populated);
|
||||
|
||||
void action_delete_pending_title(pending_title_info* info);
|
||||
void action_delete_all_pending_titles(pending_title_info* info);
|
||||
void action_delete_pending_title(pending_title_info* info, bool* populated);
|
||||
void action_delete_all_pending_titles(pending_title_info* info, bool* populated);
|
||||
|
||||
void action_delete_ticket(ticket_info* info);
|
||||
void action_delete_ticket(ticket_info* info, bool* populated);
|
||||
|
||||
void action_delete_title(title_info* info);
|
||||
void action_launch_title(title_info* info);
|
||||
void action_browse_title_save_data(title_info* info);
|
||||
void action_import_secure_value(title_info* info);
|
||||
void action_export_secure_value(title_info* info);
|
||||
void action_delete_title(title_info* info, bool* populated);
|
||||
void action_launch_title(title_info* info, bool* populated);
|
||||
void action_browse_title_save_data(title_info* info, bool* populated);
|
||||
void action_import_secure_value(title_info* info, bool* populated);
|
||||
void action_export_secure_value(title_info* info, bool* populated);
|
@ -3,7 +3,7 @@
|
||||
#include "action.h"
|
||||
#include "../section.h"
|
||||
|
||||
void action_browse_boss_ext_save_data(ext_save_data_info* info) {
|
||||
void action_browse_boss_ext_save_data(ext_save_data_info* info, bool* populated) {
|
||||
u32 path[3] = {info->mediaType, (u32) (info->extSaveDataId & 0xFFFFFFFF), (u32) ((info->extSaveDataId >> 32) & 0xFFFFFFFF)};
|
||||
FS_Archive archive = {ARCHIVE_BOSS_EXTDATA, {PATH_BINARY, 12, path}};
|
||||
files_open(archive);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "action.h"
|
||||
#include "../section.h"
|
||||
|
||||
void action_browse_user_ext_save_data(ext_save_data_info* info) {
|
||||
void action_browse_user_ext_save_data(ext_save_data_info* info, bool* populated) {
|
||||
u32 path[3] = {info->mediaType, (u32) (info->extSaveDataId & 0xFFFFFFFF), (u32) ((info->extSaveDataId >> 32) & 0xFFFFFFFF)};
|
||||
FS_Archive archive = {info->shared ? ARCHIVE_SHARED_EXTDATA : ARCHIVE_EXTDATA, {PATH_BINARY, 12, path}};
|
||||
files_open(archive);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "action.h"
|
||||
#include "../section.h"
|
||||
|
||||
void action_browse_system_save_data(system_save_data_info* info) {
|
||||
void action_browse_system_save_data(system_save_data_info* info, bool* populated) {
|
||||
u32 path[2] = {MEDIATYPE_NAND, (u32) (info->systemSaveDataId & 0xFFFFFFFF)};
|
||||
FS_Archive archive = {ARCHIVE_SYSTEM_SAVEDATA, {PATH_BINARY, 8, path}};
|
||||
files_open(archive);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "action.h"
|
||||
#include "../section.h"
|
||||
|
||||
void action_browse_title_save_data(title_info* info) {
|
||||
void action_browse_title_save_data(title_info* info, bool* populated) {
|
||||
u32 path[3] = {info->mediaType, (u32) (info->titleId & 0xFFFFFFFF), (u32) ((info->titleId >> 32) & 0xFFFFFFFF)};
|
||||
FS_Archive archive = {ARCHIVE_USER_SAVEDATA, {PATH_BINARY, 12, path}};
|
||||
files_open(archive);
|
||||
|
@ -9,7 +9,7 @@ static void action_copy_files_success_onresponse(ui_view* view, void* data, bool
|
||||
prompt_destroy(view);
|
||||
}
|
||||
|
||||
void action_copy_contents(file_info* info) {
|
||||
void action_copy_contents(file_info* info, bool* populated) {
|
||||
Result res = 0;
|
||||
if(R_FAILED(res = clipboard_set_contents(*info->archive, info->path))) {
|
||||
error_display_res(info, ui_draw_file_info, res, "Failed to copy contents to clipboard.");
|
||||
|
@ -10,8 +10,6 @@ static void action_delete_all_pending_titles_success_onresponse(ui_view* view, v
|
||||
}
|
||||
|
||||
static void action_delete_all_pending_titles_update(ui_view* view, void* data, float* progress, char* progressText) {
|
||||
pending_title_info* info = (pending_title_info*) data;
|
||||
|
||||
Result res = AM_DeleteAllPendingTitles(MEDIATYPE_NAND);
|
||||
if(R_SUCCEEDED(res)) {
|
||||
res = AM_DeleteAllPendingTitles(MEDIATYPE_SD);
|
||||
@ -21,15 +19,17 @@ static void action_delete_all_pending_titles_update(ui_view* view, void* data, f
|
||||
progressbar_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
error_display_res(info, ui_draw_pending_title_info, res, "Failed to delete pending titles.");
|
||||
error_display_res(NULL, NULL, res, "Failed to delete pending titles.");
|
||||
|
||||
return;
|
||||
} else {
|
||||
*(bool*) data = false;
|
||||
}
|
||||
|
||||
progressbar_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
ui_push(prompt_create("Success", "Pending titles deleted.", 0xFF000000, false, info, NULL, NULL, action_delete_all_pending_titles_success_onresponse));
|
||||
ui_push(prompt_create("Success", "Pending titles deleted.", 0xFF000000, false, NULL, NULL, NULL, action_delete_all_pending_titles_success_onresponse));
|
||||
}
|
||||
|
||||
static void action_delete_all_pending_titles_onresponse(ui_view* view, void* data, bool response) {
|
||||
@ -40,6 +40,6 @@ static void action_delete_all_pending_titles_onresponse(ui_view* view, void* dat
|
||||
}
|
||||
}
|
||||
|
||||
void action_delete_all_pending_titles(pending_title_info* info) {
|
||||
ui_push(prompt_create("Confirmation", "Delete all pending titles?", 0xFF000000, true, NULL, NULL, NULL, action_delete_all_pending_titles_onresponse));
|
||||
void action_delete_all_pending_titles(pending_title_info* info, bool* populated) {
|
||||
ui_push(prompt_create("Confirmation", "Delete all pending titles?", 0xFF000000, true, populated, NULL, NULL, action_delete_all_pending_titles_onresponse));
|
||||
}
|
@ -12,6 +12,7 @@
|
||||
|
||||
typedef struct {
|
||||
file_info* base;
|
||||
bool* populated;
|
||||
u32 processed;
|
||||
u32 total;
|
||||
char** contents;
|
||||
@ -76,6 +77,8 @@ static void action_delete_dir_contents_update(ui_view* view, void* data, float*
|
||||
progressbar_destroy(view);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
*deleteData->populated = false;
|
||||
}
|
||||
|
||||
deleteData->processed++;
|
||||
@ -97,9 +100,10 @@ static void action_delete_dir_contents_onresponse(ui_view* view, void* data, boo
|
||||
}
|
||||
}
|
||||
|
||||
void action_delete_contents(file_info* info) {
|
||||
void action_delete_contents(file_info* info, bool* populated) {
|
||||
delete_dir_contents_data* data = (delete_dir_contents_data*) calloc(1, sizeof(delete_dir_contents_data));
|
||||
data->base = info;
|
||||
data->populated = populated;
|
||||
data->processed = 0;
|
||||
|
||||
Result res = 0;
|
||||
@ -113,9 +117,10 @@ void action_delete_contents(file_info* info) {
|
||||
ui_push(prompt_create("Confirmation", "Delete the selected content?", 0xFF000000, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse));
|
||||
}
|
||||
|
||||
void action_delete_dir_contents(file_info* info) {
|
||||
void action_delete_dir_contents(file_info* info, bool* populated) {
|
||||
delete_dir_contents_data* data = (delete_dir_contents_data*) calloc(1, sizeof(delete_dir_contents_data));
|
||||
data->base = info;
|
||||
data->populated = populated;
|
||||
data->processed = 0;
|
||||
|
||||
Result res = 0;
|
||||
@ -129,9 +134,10 @@ void action_delete_dir_contents(file_info* info) {
|
||||
ui_push(prompt_create("Confirmation", "Delete all contents of the selected directory?", 0xFF000000, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse));
|
||||
}
|
||||
|
||||
void action_delete_dir_cias(file_info* info) {
|
||||
void action_delete_dir_cias(file_info* info, bool* populated) {
|
||||
delete_dir_contents_data* data = (delete_dir_contents_data*) calloc(1, sizeof(delete_dir_contents_data));
|
||||
data->base = info;
|
||||
data->populated = populated;
|
||||
data->processed = 0;
|
||||
|
||||
Result res = 0;
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include <malloc.h>
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
#include "action.h"
|
||||
@ -6,38 +8,53 @@
|
||||
#include "../../prompt.h"
|
||||
#include "../task/task.h"
|
||||
|
||||
typedef struct {
|
||||
ext_save_data_info* info;
|
||||
bool* populated;
|
||||
} delete_ext_save_data_data;
|
||||
|
||||
static void action_delete_ext_save_data_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2) {
|
||||
ui_draw_ext_save_data_info(view, ((delete_ext_save_data_data*) data)->info, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void action_delete_ext_save_data_success_onresponse(ui_view* view, void* data, bool response) {
|
||||
prompt_destroy(view);
|
||||
}
|
||||
|
||||
static void action_delete_ext_save_data_update(ui_view* view, void* data, float* progress, char* progressText) {
|
||||
ext_save_data_info* info = (ext_save_data_info*) data;
|
||||
delete_ext_save_data_data* deleteData = (delete_ext_save_data_data*) data;
|
||||
|
||||
FS_ExtSaveDataInfo extInfo = {.mediaType = info->mediaType, .saveId = info->extSaveDataId};
|
||||
FS_ExtSaveDataInfo extInfo = {.mediaType = deleteData->info->mediaType, .saveId = deleteData->info->extSaveDataId};
|
||||
Result res = FSUSER_DeleteExtSaveData(extInfo);
|
||||
if(R_FAILED(res)) {
|
||||
progressbar_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
error_display_res(info, ui_draw_ext_save_data_info, res, "Failed to delete ext save data.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
progressbar_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
ui_push(prompt_create("Success", "Ext save data deleted.", 0xFF000000, false, info, NULL, ui_draw_ext_save_data_info, action_delete_ext_save_data_success_onresponse));
|
||||
if(R_FAILED(res)) {
|
||||
error_display_res(deleteData->info, ui_draw_ext_save_data_info, res, "Failed to delete ext save data.");
|
||||
} else {
|
||||
*deleteData->populated = false;
|
||||
|
||||
ui_push(prompt_create("Success", "Ext save data deleted.", 0xFF000000, false, deleteData->info, NULL, ui_draw_ext_save_data_info, action_delete_ext_save_data_success_onresponse));
|
||||
}
|
||||
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void action_delete_ext_save_data_onresponse(ui_view* view, void* data, bool response) {
|
||||
prompt_destroy(view);
|
||||
|
||||
if(response) {
|
||||
ui_push(progressbar_create("Deleting Ext Save Data", "", data, action_delete_ext_save_data_update, ui_draw_ext_save_data_info));
|
||||
ui_push(progressbar_create("Deleting Ext Save Data", "", data, action_delete_ext_save_data_update, action_delete_ext_save_data_draw_top));
|
||||
} else {
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
|
||||
void action_delete_ext_save_data(ext_save_data_info* info) {
|
||||
ui_push(prompt_create("Confirmation", "Delete the selected ext save data?", 0xFF000000, true, info, NULL, ui_draw_ext_save_data_info, action_delete_ext_save_data_onresponse));
|
||||
void action_delete_ext_save_data(ext_save_data_info* info, bool* populated) {
|
||||
delete_ext_save_data_data* data = (delete_ext_save_data_data*) calloc(1, sizeof(delete_ext_save_data_data));
|
||||
data->info = info;
|
||||
data->populated = populated;
|
||||
|
||||
ui_push(prompt_create("Confirmation", "Delete the selected ext save data?", 0xFF000000, true, data, NULL, action_delete_ext_save_data_draw_top, action_delete_ext_save_data_onresponse));
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
#include <malloc.h>
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
#include "action.h"
|
||||
@ -5,37 +7,52 @@
|
||||
#include "../../progressbar.h"
|
||||
#include "../../prompt.h"
|
||||
|
||||
typedef struct {
|
||||
pending_title_info* info;
|
||||
bool* populated;
|
||||
} delete_pending_title_data;
|
||||
|
||||
static void action_delete_pending_title_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2) {
|
||||
ui_draw_pending_title_info(view, ((delete_pending_title_data*) data)->info, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void action_delete_pending_title_success_onresponse(ui_view* view, void* data, bool response) {
|
||||
prompt_destroy(view);
|
||||
}
|
||||
|
||||
static void action_delete_pending_title_update(ui_view* view, void* data, float* progress, char* progressText) {
|
||||
pending_title_info* info = (pending_title_info*) data;
|
||||
delete_pending_title_data* deleteData = (delete_pending_title_data*) data;
|
||||
|
||||
Result res = AM_DeletePendingTitle(info->mediaType, info->titleId);
|
||||
if(R_FAILED(res)) {
|
||||
progressbar_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
error_display_res(info, ui_draw_pending_title_info, res, "Failed to delete pending title.");
|
||||
|
||||
return;
|
||||
}
|
||||
Result res = AM_DeletePendingTitle(deleteData->info->mediaType, deleteData->info->titleId);
|
||||
|
||||
progressbar_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
ui_push(prompt_create("Success", "Pending title deleted.", 0xFF000000, false, info, NULL, ui_draw_pending_title_info, action_delete_pending_title_success_onresponse));
|
||||
if(R_FAILED(res)) {
|
||||
error_display_res(deleteData->info, ui_draw_pending_title_info, res, "Failed to delete pending title.");
|
||||
} else {
|
||||
*deleteData->populated = false;
|
||||
|
||||
ui_push(prompt_create("Success", "Pending title deleted.", 0xFF000000, false, deleteData->info, NULL, ui_draw_pending_title_info, action_delete_pending_title_success_onresponse));
|
||||
}
|
||||
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void action_delete_pending_title_onresponse(ui_view* view, void* data, bool response) {
|
||||
prompt_destroy(view);
|
||||
|
||||
if(response) {
|
||||
ui_push(progressbar_create("Deleting Pending Title", "", data, action_delete_pending_title_update, ui_draw_pending_title_info));
|
||||
ui_push(progressbar_create("Deleting Pending Title", "", data, action_delete_pending_title_update, action_delete_pending_title_draw_top));
|
||||
} else {
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
|
||||
void action_delete_pending_title(pending_title_info* info) {
|
||||
ui_push(prompt_create("Confirmation", "Delete the selected pending title?", 0xFF000000, true, info, NULL, ui_draw_pending_title_info, action_delete_pending_title_onresponse));
|
||||
void action_delete_pending_title(pending_title_info* info, bool* populated) {
|
||||
delete_pending_title_data* data = (delete_pending_title_data*) calloc(1, sizeof(delete_pending_title_data));
|
||||
data->info = info;
|
||||
data->populated = populated;
|
||||
|
||||
ui_push(prompt_create("Confirmation", "Delete the selected pending title?", 0xFF000000, true, data, NULL, action_delete_pending_title_draw_top, action_delete_pending_title_onresponse));
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
#include <malloc.h>
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
#include "action.h"
|
||||
@ -5,38 +7,53 @@
|
||||
#include "../../progressbar.h"
|
||||
#include "../../prompt.h"
|
||||
|
||||
typedef struct {
|
||||
system_save_data_info* info;
|
||||
bool* populated;
|
||||
} delete_system_save_data_data;
|
||||
|
||||
static void action_delete_system_save_data_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2) {
|
||||
ui_draw_system_save_data_info(view, ((delete_system_save_data_data*) data)->info, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void action_delete_system_save_data_success_onresponse(ui_view* view, void* data, bool response) {
|
||||
prompt_destroy(view);
|
||||
}
|
||||
|
||||
static void action_delete_system_save_data_update(ui_view* view, void* data, float* progress, char* progressText) {
|
||||
system_save_data_info* info = (system_save_data_info*) data;
|
||||
delete_system_save_data_data* deleteData = (delete_system_save_data_data*) data;
|
||||
|
||||
FS_SystemSaveDataInfo sysInfo = *(FS_SystemSaveDataInfo*) &info->systemSaveDataId;
|
||||
FS_SystemSaveDataInfo sysInfo = *(FS_SystemSaveDataInfo*) &deleteData->info->systemSaveDataId;
|
||||
Result res = FSUSER_DeleteSystemSaveData(sysInfo);
|
||||
if(R_FAILED(res)) {
|
||||
progressbar_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
error_display_res(info, ui_draw_system_save_data_info, res, "Failed to delete system save data.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
progressbar_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
ui_push(prompt_create("Success", "System save data deleted.", 0xFF000000, false, info, NULL, ui_draw_system_save_data_info, action_delete_system_save_data_success_onresponse));
|
||||
if(R_FAILED(res)) {
|
||||
error_display_res(deleteData->info, ui_draw_system_save_data_info, res, "Failed to delete system save data.");
|
||||
} else {
|
||||
*deleteData->populated = false;
|
||||
|
||||
ui_push(prompt_create("Success", "System save data deleted.", 0xFF000000, false, deleteData->info, NULL, ui_draw_system_save_data_info, action_delete_system_save_data_success_onresponse));
|
||||
}
|
||||
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void action_delete_system_save_data_onresponse(ui_view* view, void* data, bool response) {
|
||||
prompt_destroy(view);
|
||||
|
||||
if(response) {
|
||||
ui_push(progressbar_create("Deleting System Save Data", "", data, action_delete_system_save_data_update, ui_draw_system_save_data_info));
|
||||
ui_push(progressbar_create("Deleting System Save Data", "", data, action_delete_system_save_data_update, action_delete_system_save_data_draw_top));
|
||||
} else {
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
|
||||
void action_delete_system_save_data(system_save_data_info* info) {
|
||||
ui_push(prompt_create("Confirmation", "Delete the selected system save data?", 0xFF000000, true, info, NULL, ui_draw_system_save_data_info, action_delete_system_save_data_onresponse));
|
||||
void action_delete_system_save_data(system_save_data_info* info, bool* populated) {
|
||||
delete_system_save_data_data* data = (delete_system_save_data_data*) calloc(1, sizeof(delete_system_save_data_data));
|
||||
data->info = info;
|
||||
data->populated = populated;
|
||||
|
||||
ui_push(prompt_create("Confirmation", "Delete the selected system save data?", 0xFF000000, true, data, NULL, action_delete_system_save_data_draw_top, action_delete_system_save_data_onresponse));
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
#include <malloc.h>
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
#include "action.h"
|
||||
@ -5,37 +7,52 @@
|
||||
#include "../../progressbar.h"
|
||||
#include "../../prompt.h"
|
||||
|
||||
typedef struct {
|
||||
ticket_info* info;
|
||||
bool* populated;
|
||||
} delete_ticket_data;
|
||||
|
||||
static void action_delete_ticket_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2) {
|
||||
ui_draw_ticket_info(view, ((delete_ticket_data*) data)->info, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void action_delete_ticket_success_onresponse(ui_view* view, void* data, bool response) {
|
||||
prompt_destroy(view);
|
||||
}
|
||||
|
||||
static void action_delete_ticket_update(ui_view* view, void* data, float* progress, char* progressText) {
|
||||
ticket_info* info = (ticket_info*) data;
|
||||
delete_ticket_data* deleteData = (delete_ticket_data*) data;
|
||||
|
||||
Result res = AM_DeleteTicket(info->ticketId);
|
||||
if(R_FAILED(res)) {
|
||||
progressbar_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
error_display_res(info, ui_draw_ticket_info, res, "Failed to delete ticket.");
|
||||
|
||||
return;
|
||||
}
|
||||
Result res = AM_DeleteTicket(deleteData->info->ticketId);
|
||||
|
||||
progressbar_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
ui_push(prompt_create("Success", "Ticket deleted.", 0xFF000000, false, info, NULL, ui_draw_ticket_info, action_delete_ticket_success_onresponse));
|
||||
if(R_FAILED(res)) {
|
||||
error_display_res(deleteData->info, ui_draw_ticket_info, res, "Failed to delete ticket.");
|
||||
} else {
|
||||
*deleteData->populated = false;
|
||||
|
||||
ui_push(prompt_create("Success", "Ticket deleted.", 0xFF000000, false, deleteData->info, NULL, ui_draw_ticket_info, action_delete_ticket_success_onresponse));
|
||||
}
|
||||
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void action_delete_ticket_onresponse(ui_view* view, void* data, bool response) {
|
||||
prompt_destroy(view);
|
||||
|
||||
if(response) {
|
||||
ui_push(progressbar_create("Deleting Ticket", "", data, action_delete_ticket_update, ui_draw_ticket_info));
|
||||
ui_push(progressbar_create("Deleting Ticket", "", data, action_delete_ticket_update, action_delete_ticket_draw_top));
|
||||
} else {
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
|
||||
void action_delete_ticket(ticket_info* info) {
|
||||
ui_push(prompt_create("Confirmation", "Delete the selected ticket?", 0xFF000000, true, info, NULL, ui_draw_ticket_info, action_delete_ticket_onresponse));
|
||||
void action_delete_ticket(ticket_info* info, bool* populated) {
|
||||
delete_ticket_data* data = (delete_ticket_data*) calloc(1, sizeof(delete_ticket_data));
|
||||
data->info = info;
|
||||
data->populated = populated;
|
||||
|
||||
ui_push(prompt_create("Confirmation", "Delete the selected ticket?", 0xFF000000, true, data, NULL, action_delete_ticket_draw_top, action_delete_ticket_onresponse));
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
#include <malloc.h>
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
#include "action.h"
|
||||
@ -5,37 +7,52 @@
|
||||
#include "../../progressbar.h"
|
||||
#include "../../prompt.h"
|
||||
|
||||
typedef struct {
|
||||
title_info* info;
|
||||
bool* populated;
|
||||
} delete_title_data;
|
||||
|
||||
static void action_delete_title_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2) {
|
||||
ui_draw_title_info(view, ((delete_title_data*) data)->info, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void action_delete_title_success_onresponse(ui_view* view, void* data, bool response) {
|
||||
prompt_destroy(view);
|
||||
}
|
||||
|
||||
static void action_delete_title_update(ui_view* view, void* data, float* progress, char* progressText) {
|
||||
title_info* info = (title_info*) data;
|
||||
delete_title_data* deleteData = (delete_title_data*) data;
|
||||
|
||||
Result res = AM_DeleteTitle(info->mediaType, info->titleId);
|
||||
if(R_FAILED(res)) {
|
||||
progressbar_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
error_display_res(info, ui_draw_title_info, res, "Failed to delete title.");
|
||||
|
||||
return;
|
||||
}
|
||||
Result res = AM_DeleteTitle(deleteData->info->mediaType, deleteData->info->titleId);
|
||||
|
||||
progressbar_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
ui_push(prompt_create("Success", "Title deleted.", 0xFF000000, false, info, NULL, ui_draw_title_info, action_delete_title_success_onresponse));
|
||||
if(R_FAILED(res)) {
|
||||
error_display_res(deleteData->info, ui_draw_title_info, res, "Failed to delete title.");
|
||||
} else {
|
||||
*deleteData->populated = false;
|
||||
|
||||
ui_push(prompt_create("Success", "Title deleted.", 0xFF000000, false, deleteData->info, NULL, ui_draw_title_info, action_delete_title_success_onresponse));
|
||||
}
|
||||
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void action_delete_title_onresponse(ui_view* view, void* data, bool response) {
|
||||
prompt_destroy(view);
|
||||
|
||||
if(response) {
|
||||
ui_push(progressbar_create("Deleting Title", "", data, action_delete_title_update, ui_draw_title_info));
|
||||
ui_push(progressbar_create("Deleting Title", "", data, action_delete_title_update, action_delete_title_draw_top));
|
||||
} else {
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
|
||||
void action_delete_title(title_info* info) {
|
||||
ui_push(prompt_create("Confirmation", "Delete the selected title?", 0xFF000000, true, info, NULL, ui_draw_title_info, action_delete_title_onresponse));
|
||||
void action_delete_title(title_info* info, bool* populated) {
|
||||
delete_title_data* data = (delete_title_data*) calloc(1, sizeof(delete_title_data));
|
||||
data->info = info;
|
||||
data->populated = populated;
|
||||
|
||||
ui_push(prompt_create("Confirmation", "Delete the selected title?", 0xFF000000, true, data, NULL, action_delete_title_draw_top, action_delete_title_onresponse));
|
||||
}
|
@ -70,6 +70,6 @@ static void action_export_secure_value_onresponse(ui_view* view, void* data, boo
|
||||
}
|
||||
}
|
||||
|
||||
void action_export_secure_value(title_info* info) {
|
||||
void action_export_secure_value(title_info* info, bool* populated) {
|
||||
ui_push(prompt_create("Confirmation", "Export secure value for the selected title?", 0xFF000000, true, info, NULL, ui_draw_title_info, action_export_secure_value_onresponse));
|
||||
}
|
@ -54,6 +54,6 @@ static void action_import_secure_value_onresponse(ui_view* view, void* data, boo
|
||||
}
|
||||
}
|
||||
|
||||
void action_import_secure_value(title_info* info) {
|
||||
void action_import_secure_value(title_info* info, bool* populated) {
|
||||
ui_push(prompt_create("Confirmation", "Import secure value for the selected title?", 0xFF000000, true, info, NULL, ui_draw_title_info, action_import_secure_value_onresponse));
|
||||
}
|
@ -203,10 +203,10 @@ static void action_install_cias(file_info* info, FS_MediaType mediaType) {
|
||||
ui_push(prompt_create("Confirmation", "Install the selected CIA(s)?", 0xFF000000, true, data, NULL, action_install_cias_draw_top, action_install_cias_onresponse));
|
||||
}
|
||||
|
||||
void action_install_cias_sd(file_info* info) {
|
||||
void action_install_cias_sd(file_info* info, bool* populated) {
|
||||
action_install_cias(info, MEDIATYPE_SD);
|
||||
}
|
||||
|
||||
void action_install_cias_nand(file_info* info) {
|
||||
void action_install_cias_nand(file_info* info, bool* populated) {
|
||||
action_install_cias(info, MEDIATYPE_NAND);
|
||||
}
|
@ -42,6 +42,6 @@ static void action_launch_title_onresponse(ui_view* view, void* data, bool respo
|
||||
}
|
||||
}
|
||||
|
||||
void action_launch_title(title_info* info) {
|
||||
void action_launch_title(title_info* info, bool* populated) {
|
||||
ui_push(prompt_create("Confirmation", "Launch the selected title?", 0xFF000000, true, info, NULL, ui_draw_title_info, action_launch_title_onresponse));
|
||||
}
|
@ -13,6 +13,7 @@
|
||||
|
||||
typedef struct {
|
||||
file_info* base;
|
||||
bool* populated;
|
||||
u32 processed;
|
||||
u32 total;
|
||||
char** contents;
|
||||
@ -124,6 +125,8 @@ static void action_paste_files_update(ui_view* view, void* data, float* progress
|
||||
progressbar_destroy(view);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
*pasteData->populated = false;
|
||||
}
|
||||
|
||||
pasteData->processed++;
|
||||
@ -145,7 +148,7 @@ static void action_paste_files_onresponse(ui_view* view, void* data, bool respon
|
||||
}
|
||||
}
|
||||
|
||||
void action_paste_contents(file_info* info) {
|
||||
void action_paste_contents(file_info* info, bool* populated) {
|
||||
if(!clipboard_has_contents()) {
|
||||
ui_push(prompt_create("Failure", "Clipboard empty.", 0xFF000000, false, info, NULL, ui_draw_file_info, action_paste_files_failure_onresponse));
|
||||
return;
|
||||
@ -153,6 +156,7 @@ void action_paste_contents(file_info* info) {
|
||||
|
||||
paste_files_data* data = (paste_files_data*) calloc(1, sizeof(paste_files_data));
|
||||
data->base = info;
|
||||
data->populated = populated;
|
||||
data->processed = 0;
|
||||
|
||||
Result res = 0;
|
||||
|
@ -25,24 +25,37 @@ static list_item extsavedata_action_items[EXTSAVEDATA_ACTION_COUNT] = {
|
||||
{"Delete Save Data", 0xFF000000, action_delete_ext_save_data},
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
ext_save_data_info* info;
|
||||
bool* populated;
|
||||
} extsavedata_action_data;
|
||||
|
||||
static void extsavedata_action_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected) {
|
||||
ui_draw_ext_save_data_info(view, data, x1, y1, x2, y2);
|
||||
ui_draw_ext_save_data_info(view, ((extsavedata_action_data*) data)->info, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void extsavedata_action_update(ui_view* view, void* data, list_item** items, u32** itemCount, list_item* selected, bool selectedTouched) {
|
||||
extsavedata_action_data* actionData = (extsavedata_action_data*) data;
|
||||
|
||||
if(hidKeysDown() & KEY_B) {
|
||||
list_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
free(data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(selected != NULL && selected->data != NULL && (selectedTouched || (hidKeysDown() & KEY_A))) {
|
||||
void(*action)(ext_save_data_info*) = (void(*)(ext_save_data_info*)) selected->data;
|
||||
void(*action)(ext_save_data_info*, bool*) = (void(*)(ext_save_data_info*, bool*)) selected->data;
|
||||
|
||||
list_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
action((ext_save_data_info*) data);
|
||||
action(actionData->info, actionData->populated);
|
||||
|
||||
free(data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -52,8 +65,12 @@ static void extsavedata_action_update(ui_view* view, void* data, list_item** ite
|
||||
}
|
||||
}
|
||||
|
||||
static ui_view* extsavedata_action_create(ext_save_data_info* info) {
|
||||
return list_create("Ext Save Data Action", "A: Select, B: Return", info, extsavedata_action_update, extsavedata_action_draw_top);
|
||||
static ui_view* extsavedata_action_create(ext_save_data_info* info, bool* populated) {
|
||||
extsavedata_action_data* data = (extsavedata_action_data*) calloc(1, sizeof(extsavedata_action_data));
|
||||
data->info = info;
|
||||
data->populated = populated;
|
||||
|
||||
return list_create("Ext Save Data Action", "A: Select, B: Return", data, extsavedata_action_update, extsavedata_action_draw_top);
|
||||
}
|
||||
|
||||
static void extsavedata_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected) {
|
||||
@ -87,9 +104,7 @@ static void extsavedata_update(ui_view* view, void* data, list_item** items, u32
|
||||
}
|
||||
|
||||
if(selected != NULL && selected->data != NULL && (selectedTouched || (hidKeysDown() & KEY_A))) {
|
||||
listData->populated = false;
|
||||
|
||||
ui_push(extsavedata_action_create((ext_save_data_info*) selected->data));
|
||||
ui_push(extsavedata_action_create((ext_save_data_info*) selected->data, &listData->populated));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -67,31 +67,42 @@ static list_item cia_directories_action_items[CIA_DIRECTORIES_ACTION_COUNT] = {
|
||||
{"Paste", 0xFF000000, action_paste_contents},
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
file_info* info;
|
||||
bool* populated;
|
||||
} files_action_data;
|
||||
|
||||
static void files_action_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected) {
|
||||
ui_draw_file_info(view, data, x1, y1, x2, y2);
|
||||
ui_draw_file_info(view, ((files_action_data*) data)->info, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void files_action_update(ui_view* view, void* data, list_item** items, u32** itemCount, list_item* selected, bool selectedTouched) {
|
||||
file_info* fileInfo = (file_info*) data;
|
||||
files_action_data* actionData = (files_action_data*) data;
|
||||
|
||||
if(hidKeysDown() & KEY_B) {
|
||||
list_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
free(data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(selected != NULL && selected->data != NULL && (selectedTouched || (hidKeysDown() & KEY_A))) {
|
||||
void(*action)(file_info*) = (void(*)(file_info*)) selected->data;
|
||||
void(*action)(file_info*, bool*) = (void(*)(file_info*, bool*)) selected->data;
|
||||
|
||||
list_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
action(fileInfo);
|
||||
action(actionData->info, actionData->populated);
|
||||
|
||||
free(data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(fileInfo->isDirectory) {
|
||||
if(fileInfo->containsCias) {
|
||||
if(actionData->info->isDirectory) {
|
||||
if(actionData->info->containsCias) {
|
||||
if(*itemCount != &cia_directories_action_count || *items != cia_directories_action_items) {
|
||||
*itemCount = &cia_directories_action_count;
|
||||
*items = cia_directories_action_items;
|
||||
@ -103,7 +114,7 @@ static void files_action_update(ui_view* view, void* data, list_item** items, u3
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(fileInfo->isCia) {
|
||||
if(actionData->info->isCia) {
|
||||
if(*itemCount != &cia_files_action_count || *items != cia_files_action_items) {
|
||||
*itemCount = &cia_files_action_count;
|
||||
*items = cia_files_action_items;
|
||||
@ -117,8 +128,12 @@ static void files_action_update(ui_view* view, void* data, list_item** items, u3
|
||||
}
|
||||
}
|
||||
|
||||
static ui_view* files_action_create(file_info* info) {
|
||||
return list_create(info->isDirectory ? "Directory Action" : "File Action", "A: Select, B: Return", info, files_action_update, files_action_draw_top);
|
||||
static ui_view* files_action_create(file_info* info, bool* populated) {
|
||||
files_action_data* data = (files_action_data*) calloc(1, sizeof(files_action_data));
|
||||
data->info = info;
|
||||
data->populated = populated;
|
||||
|
||||
return list_create(info->isDirectory ? "Directory Action" : "File Action", "A: Select, B: Return", data, files_action_update, files_action_draw_top);
|
||||
}
|
||||
|
||||
static void files_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected) {
|
||||
@ -184,9 +199,7 @@ static void files_update(ui_view* view, void* data, list_item** items, u32** ite
|
||||
file_info* fileInfo = (file_info*) selected->data;
|
||||
|
||||
if(strcmp(selected->name, ".") == 0) {
|
||||
listData->populated = false;
|
||||
|
||||
ui_push(files_action_create(fileInfo));
|
||||
ui_push(files_action_create(fileInfo, &listData->populated));
|
||||
return;
|
||||
} else if(strcmp(selected->name, "..") == 0) {
|
||||
strncpy(listData->path, fileInfo->path, PATH_MAX);
|
||||
@ -196,9 +209,7 @@ static void files_update(ui_view* view, void* data, list_item** items, u32** ite
|
||||
strncpy(listData->path, fileInfo->path, PATH_MAX);
|
||||
files_repopulate(listData);
|
||||
} else {
|
||||
listData->populated = false;
|
||||
|
||||
ui_push(files_action_create(fileInfo));
|
||||
ui_push(files_action_create(fileInfo, &listData->populated));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -24,24 +24,37 @@ static list_item pending_titles_action_items[PENDINGTITLES_ACTION_COUNT] = {
|
||||
{"Delete All Pending Titles", 0xFF000000, action_delete_all_pending_titles},
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
pending_title_info* info;
|
||||
bool* populated;
|
||||
} pendingtitles_action_data;
|
||||
|
||||
static void pendingtitles_action_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected) {
|
||||
ui_draw_pending_title_info(view, data, x1, y1, x2, y2);
|
||||
ui_draw_pending_title_info(view, ((pendingtitles_action_data*) data)->info, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void pendingtitles_action_update(ui_view* view, void* data, list_item** items, u32** itemCount, list_item* selected, bool selectedTouched) {
|
||||
pendingtitles_action_data* actionData = (pendingtitles_action_data*) data;
|
||||
|
||||
if(hidKeysDown() & KEY_B) {
|
||||
list_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
free(data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(selected != NULL && selected->data != NULL && (selectedTouched || (hidKeysDown() & KEY_A))) {
|
||||
void(*action)(pending_title_info*) = (void(*)(pending_title_info*)) selected->data;
|
||||
void(*action)(pending_title_info*, bool*) = (void(*)(pending_title_info*, bool*)) selected->data;
|
||||
|
||||
list_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
action((pending_title_info*) data);
|
||||
action(actionData->info, actionData->populated);
|
||||
|
||||
free(data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -51,8 +64,12 @@ static void pendingtitles_action_update(ui_view* view, void* data, list_item** i
|
||||
}
|
||||
}
|
||||
|
||||
static ui_view* pendingtitles_action_create(pending_title_info* info) {
|
||||
return list_create("Pending Title Action", "A: Select, B: Return", info, pendingtitles_action_update, pendingtitles_action_draw_top);
|
||||
static ui_view* pendingtitles_action_create(pending_title_info* info, bool* populated) {
|
||||
pendingtitles_action_data* data = (pendingtitles_action_data*) calloc(1, sizeof(pendingtitles_action_data));
|
||||
data->info = info;
|
||||
data->populated = populated;
|
||||
|
||||
return list_create("Pending Title Action", "A: Select, B: Return", data, pendingtitles_action_update, pendingtitles_action_draw_top);
|
||||
}
|
||||
|
||||
static void pendingtitles_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected) {
|
||||
@ -86,9 +103,7 @@ static void pendingtitles_update(ui_view* view, void* data, list_item** items, u
|
||||
}
|
||||
|
||||
if(selected != NULL && selected->data != NULL && (selectedTouched || (hidKeysDown() & KEY_A))) {
|
||||
listData->populated = false;
|
||||
|
||||
ui_push(pendingtitles_action_create((pending_title_info*) selected->data));
|
||||
ui_push(pendingtitles_action_create((pending_title_info*) selected->data, &listData->populated));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -24,24 +24,37 @@ static list_item systemsavedata_action_items[SYSTEMSAVEDATA_ACTION_COUNT] = {
|
||||
{"Delete Save Data", 0xFF000000, action_delete_system_save_data},
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
system_save_data_info* info;
|
||||
bool* populated;
|
||||
} systemsavedata_action_data;
|
||||
|
||||
static void systemsavedata_action_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected) {
|
||||
ui_draw_system_save_data_info(view, data, x1, y1, x2, y2);
|
||||
ui_draw_system_save_data_info(view, ((systemsavedata_action_data*) data)->info, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void systemsavedata_action_update(ui_view* view, void* data, list_item** items, u32** itemCount, list_item* selected, bool selectedTouched) {
|
||||
systemsavedata_action_data* actionData = (systemsavedata_action_data*) data;
|
||||
|
||||
if(hidKeysDown() & KEY_B) {
|
||||
list_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
free(data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(selected != NULL && selected->data != NULL && (selectedTouched || (hidKeysDown() & KEY_A))) {
|
||||
void(*action)(system_save_data_info*) = (void(*)(system_save_data_info*)) selected->data;
|
||||
void(*action)(system_save_data_info*, bool*) = (void(*)(system_save_data_info*, bool*)) selected->data;
|
||||
|
||||
list_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
action((system_save_data_info*) data);
|
||||
action(actionData->info, actionData->populated);
|
||||
|
||||
free(data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -51,8 +64,12 @@ static void systemsavedata_action_update(ui_view* view, void* data, list_item**
|
||||
}
|
||||
}
|
||||
|
||||
static ui_view* systemsavedata_action_create(system_save_data_info* info) {
|
||||
return list_create("System Save Data Action", "A: Select, B: Return", info, systemsavedata_action_update, systemsavedata_action_draw_top);
|
||||
static ui_view* systemsavedata_action_create(system_save_data_info* info, bool* populated) {
|
||||
systemsavedata_action_data* data = (systemsavedata_action_data*) calloc(1, sizeof(systemsavedata_action_data));
|
||||
data->info = info;
|
||||
data->populated = populated;
|
||||
|
||||
return list_create("System Save Data Action", "A: Select, B: Return", data, systemsavedata_action_update, systemsavedata_action_draw_top);
|
||||
}
|
||||
|
||||
static void systemsavedata_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected) {
|
||||
@ -86,9 +103,7 @@ static void systemsavedata_update(ui_view* view, void* data, list_item** items,
|
||||
}
|
||||
|
||||
if(selected != NULL && selected->data != NULL && (selectedTouched || (hidKeysDown() & KEY_A))) {
|
||||
listData->populated = false;
|
||||
|
||||
ui_push(systemsavedata_action_create((system_save_data_info*) selected->data));
|
||||
ui_push(systemsavedata_action_create((system_save_data_info*) selected->data, &listData->populated));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -23,24 +23,37 @@ static list_item tickets_action_items[TICKETS_ACTION_COUNT] = {
|
||||
{"Delete Ticket", 0xFF000000, action_delete_ticket},
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
ticket_info* info;
|
||||
bool* populated;
|
||||
} tickets_action_data;
|
||||
|
||||
static void tickets_action_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected) {
|
||||
ui_draw_ticket_info(view, data, x1, y1, x2, y2);
|
||||
ui_draw_ticket_info(view, ((tickets_action_data*) data)->info, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void tickets_action_update(ui_view* view, void* data, list_item** items, u32** itemCount, list_item* selected, bool selectedTouched) {
|
||||
tickets_action_data* actionData = (tickets_action_data*) data;
|
||||
|
||||
if(hidKeysDown() & KEY_B) {
|
||||
list_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
free(data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(selected != NULL && selected->data != NULL && (selectedTouched || (hidKeysDown() & KEY_A))) {
|
||||
void(*action)(ticket_info*) = (void(*)(ticket_info*)) selected->data;
|
||||
void(*action)(ticket_info*, bool*) = (void(*)(ticket_info*, bool*)) selected->data;
|
||||
|
||||
list_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
action((ticket_info*) data);
|
||||
action(actionData->info, actionData->populated);
|
||||
|
||||
free(data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -50,8 +63,12 @@ static void tickets_action_update(ui_view* view, void* data, list_item** items,
|
||||
}
|
||||
}
|
||||
|
||||
static ui_view* tickets_action_create(ticket_info* info) {
|
||||
return list_create("Ticket Action", "A: Select, B: Return", info, tickets_action_update, tickets_action_draw_top);
|
||||
static ui_view* tickets_action_create(ticket_info* info, bool* populated) {
|
||||
tickets_action_data* data = (tickets_action_data*) calloc(1, sizeof(tickets_action_data));
|
||||
data->info = info;
|
||||
data->populated = populated;
|
||||
|
||||
return list_create("Ticket Action", "A: Select, B: Return", data, tickets_action_update, tickets_action_draw_top);
|
||||
}
|
||||
|
||||
static void tickets_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected) {
|
||||
@ -85,9 +102,7 @@ static void tickets_update(ui_view* view, void* data, list_item** items, u32** i
|
||||
}
|
||||
|
||||
if(selected != NULL && selected->data != NULL && (selectedTouched || (hidKeysDown() & KEY_A))) {
|
||||
listData->populated = false;
|
||||
|
||||
ui_push(tickets_action_create((ticket_info*) selected->data));
|
||||
ui_push(tickets_action_create((ticket_info*) selected->data, &listData->populated));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -27,24 +27,37 @@ static list_item titles_action_items[TITLES_ACTION_COUNT] = {
|
||||
{"Export Secure Value", 0xFF000000, action_export_secure_value},
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
title_info* info;
|
||||
bool* populated;
|
||||
} titles_action_data;
|
||||
|
||||
static void titles_action_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected) {
|
||||
ui_draw_title_info(view, data, x1, y1, x2, y2);
|
||||
ui_draw_title_info(view, ((titles_action_data*) data)->info, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void titles_action_update(ui_view* view, void* data, list_item** items, u32** itemCount, list_item* selected, bool selectedTouched) {
|
||||
titles_action_data* actionData = (titles_action_data*) data;
|
||||
|
||||
if(hidKeysDown() & KEY_B) {
|
||||
list_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
free(data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(selected != NULL && selected->data != NULL && (selectedTouched || (hidKeysDown() & KEY_A))) {
|
||||
void(*action)(title_info*) = (void(*)(title_info*)) selected->data;
|
||||
void(*action)(title_info*, bool*) = (void(*)(title_info*, bool*)) selected->data;
|
||||
|
||||
list_destroy(view);
|
||||
ui_pop();
|
||||
|
||||
action((title_info*) data);
|
||||
action(actionData->info, actionData->populated);
|
||||
|
||||
free(data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -54,8 +67,12 @@ static void titles_action_update(ui_view* view, void* data, list_item** items, u
|
||||
}
|
||||
}
|
||||
|
||||
static ui_view* titles_action_create(title_info* info) {
|
||||
return list_create("Title Action", "A: Select, B: Return", info, titles_action_update, titles_action_draw_top);
|
||||
static ui_view* titles_action_create(title_info* info, bool* populated) {
|
||||
titles_action_data* data = (titles_action_data*) calloc(1, sizeof(titles_action_data));
|
||||
data->info = info;
|
||||
data->populated = populated;
|
||||
|
||||
return list_create("Title Action", "A: Select, B: Return", data, titles_action_update, titles_action_draw_top);
|
||||
}
|
||||
|
||||
static void titles_draw_top(ui_view* view, void* data, float x1, float y1, float x2, float y2, list_item* selected) {
|
||||
@ -89,9 +106,7 @@ static void titles_update(ui_view* view, void* data, list_item** items, u32** it
|
||||
}
|
||||
|
||||
if(selected != NULL && selected->data != NULL && (selectedTouched || (hidKeysDown() & KEY_A))) {
|
||||
listData->populated = false;
|
||||
|
||||
ui_push(titles_action_create((title_info*) selected->data));
|
||||
ui_push(titles_action_create((title_info*) selected->data, &listData->populated));
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user