Color tickets based on whether they are in use.

This commit is contained in:
Steveice10 2016-12-24 09:09:45 -08:00
parent e906e108ab
commit 9182ebfa00
8 changed files with 26 additions and 11 deletions

View File

@ -8,4 +8,6 @@ directory=FF0000FF
enabled=FF00FF00
disabled=FF0000FF
installed=FF00FF00
notinstalled=FF0000FF
notinstalled=FF0000FF
ticketinuse=FF00FF00
ticketnotinuse=FF0000FF

View File

@ -211,6 +211,10 @@ void screen_init() {
colorConfig[COLOR_INSTALLED] = color;
} else if(strcasecmp(key, "notinstalled") == 0) {
colorConfig[COLOR_NOT_INSTALLED] = color;
} else if(strcasecmp(key, "ticketinuse") == 0) {
colorConfig[COLOR_TICKET_IN_USE] = color;
} else if(strcasecmp(key, "ticketnotinuse") == 0) {
colorConfig[COLOR_TICKET_NOT_IN_USE] = color;
}
}
}

View File

@ -42,7 +42,7 @@
#define TEXTURE_AUTO_START 32
#define NUM_COLORS 11
#define NUM_COLORS 13
#define COLOR_TEXT 0
#define COLOR_NAND 1
@ -55,6 +55,8 @@
#define COLOR_DISABLED 8
#define COLOR_INSTALLED 9
#define COLOR_NOT_INSTALLED 10
#define COLOR_TICKET_IN_USE 11
#define COLOR_TICKET_NOT_IN_USE 12
void screen_init();
void screen_exit();

View File

@ -157,14 +157,9 @@ static void action_delete_tickets_loading_update(ui_view* view, void* data, floa
list_item* item = (list_item*) linked_list_iter_next(&iter);
ticket_info* info = (ticket_info*) item->data;
AM_TitleEntry entry;
for(FS_MediaType mediaType = MEDIATYPE_NAND; mediaType != MEDIATYPE_GAME_CARD; mediaType++) {
if(R_SUCCEEDED(AM_GetTitleInfo(mediaType, 1, &info->titleId, &entry))) {
linked_list_iter_remove(&iter);
task_free_ticket(item);
break;
}
if(info->inUse) {
linked_list_iter_remove(&iter);
task_free_ticket(item);
}
}

View File

@ -118,6 +118,7 @@ static Result action_url_install_open_dst(void* data, u32 index, void* initialRe
installData->ticket = true;
installData->ticketInfo.titleId = util_get_ticket_title_id((u8*) initialReadBlock);
installData->ticketInfo.inUse = false;
AM_DeleteTicket(installData->ticketInfo.titleId);
res = AM_InstallTicketBegin(handle);

View File

@ -103,6 +103,7 @@ Result task_create_file_item(list_item** out, FS_Archive archive, const char* pa
if(R_SUCCEEDED(FSFILE_Read(fileHandle, &bytesRead, dataOffsets[sigType] + titleIdOffset, &titleId, sizeof(titleId))) && bytesRead == sizeof(titleId)) {
fileInfo->isTicket = true;
fileInfo->ticketInfo.titleId = __builtin_bswap64(titleId);
fileInfo->ticketInfo.inUse = false;
}
}
}

View File

@ -41,9 +41,18 @@ static void task_populate_tickets_thread(void* arg) {
ticket_info* ticketInfo = (ticket_info*) calloc(1, sizeof(ticket_info));
if(ticketInfo != NULL) {
ticketInfo->titleId = ticketIds[i];
ticketInfo->inUse = false;
AM_TitleEntry entry;
for(FS_MediaType mediaType = MEDIATYPE_NAND; mediaType != MEDIATYPE_GAME_CARD; mediaType++) {
if(R_SUCCEEDED(AM_GetTitleInfo(mediaType, 1, &ticketInfo->titleId, &entry))) {
ticketInfo->inUse = true;
break;
}
}
snprintf(item->name, LIST_ITEM_NAME_MAX, "%016llX", ticketIds[i]);
item->color = COLOR_TEXT;
item->color = ticketInfo->inUse ? COLOR_TICKET_IN_USE : COLOR_TICKET_NOT_IN_USE;
item->data = ticketInfo;
linked_list_add(data->items, item);

View File

@ -33,6 +33,7 @@ typedef struct pending_title_info_s {
typedef struct ticket_info_s {
u64 titleId;
bool inUse;
} ticket_info;
typedef struct ext_save_data_info_s {