From d0ea37d0e0bde787d90cb5127d843bcbac58a982 Mon Sep 17 00:00:00 2001 From: Steven Smith Date: Tue, 12 Jul 2016 15:31:47 -0700 Subject: [PATCH] Color TitleDB entries based on whether they are installed. --- romfs/textcolor.cfg | 4 +++- source/core/screen.c | 4 ++++ source/core/screen.h | 4 +++- source/ui/section/task/listtitledb.c | 8 +++++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/romfs/textcolor.cfg b/romfs/textcolor.cfg index db7e3de..ecb87ff 100644 --- a/romfs/textcolor.cfg +++ b/romfs/textcolor.cfg @@ -6,4 +6,6 @@ dstitle=FF82004B file=FF000000 directory=FF0000FF enabled=FF00FF00 -disabled=FF0000FF \ No newline at end of file +disabled=FF0000FF +installed=FF00FF00 +notinstalled=FF0000FF \ No newline at end of file diff --git a/source/core/screen.c b/source/core/screen.c index 6d6f17e..bfb003c 100644 --- a/source/core/screen.c +++ b/source/core/screen.c @@ -207,6 +207,10 @@ void screen_init() { colorConfig[COLOR_ENABLED] = color; } else if(strcasecmp(key, "disabled") == 0) { colorConfig[COLOR_DISABLED] = color; + } else if(strcasecmp(key, "installed") == 0) { + colorConfig[COLOR_INSTALLED] = color; + } else if(strcasecmp(key, "notinstalled") == 0) { + colorConfig[COLOR_NOT_INSTALLED] = color; } } } diff --git a/source/core/screen.h b/source/core/screen.h index 7a43bab..0ea9ff6 100644 --- a/source/core/screen.h +++ b/source/core/screen.h @@ -42,7 +42,7 @@ #define TEXTURE_AUTO_START 32 -#define NUM_COLORS 9 +#define NUM_COLORS 11 #define COLOR_TEXT 0 #define COLOR_NAND 1 @@ -53,6 +53,8 @@ #define COLOR_DIRECTORY 6 #define COLOR_ENABLED 7 #define COLOR_DISABLED 8 +#define COLOR_INSTALLED 9 +#define COLOR_NOT_INSTALLED 10 void screen_init(); void screen_exit(); diff --git a/source/ui/section/task/listtitledb.c b/source/ui/section/task/listtitledb.c index 8f57a3a..8525ca5 100644 --- a/source/ui/section/task/listtitledb.c +++ b/source/ui/section/task/listtitledb.c @@ -105,7 +105,13 @@ static void task_populate_titledb_thread(void* arg) { snprintf(item->name, LIST_ITEM_NAME_MAX, "%016llX", titledbInfo->titleId); } - item->color = COLOR_TEXT; + AM_TitleEntry entry; + if(R_SUCCEEDED(AM_GetTitleInfo(((titledbInfo->titleId >> 32) & 0x8010) != 0 ? MEDIATYPE_NAND : MEDIATYPE_SD, 1, &titledbInfo->titleId, &entry))) { + item->color = COLOR_INSTALLED; + } else { + item->color = COLOR_NOT_INSTALLED; + } + item->data = titledbInfo; linked_list_add(data->items, item);