mirror of
https://gitlab.com/Theopse/fbi-i18n-zh.git
synced 2025-06-13 02:29:58 +08:00
Only consider a TitleDB CIA/3DSX to be installed if present in cache, remove CIA installed version field as it is not very useful for TitleDB entries.
This commit is contained in:
parent
3ff6d55e2e
commit
6ee8f666ac
@ -93,15 +93,18 @@ void task_populate_titledb_cache_installed(u32 id, u32 subId, bool cia) {
|
||||
void task_populate_titledb_update_status(list_item* item) {
|
||||
titledb_info* info = (titledb_info*) item->data;
|
||||
|
||||
info->cia.installed = false;
|
||||
info->cia.outdated = false;
|
||||
|
||||
info->tdsx.installed = false;
|
||||
info->tdsx.outdated = false;
|
||||
|
||||
if(info->cia.exists) {
|
||||
AM_TitleEntry entry;
|
||||
info->cia.installed = R_SUCCEEDED(AM_GetTitleInfo(fs_get_title_destination(info->cia.titleId), 1, &info->cia.titleId, &entry));
|
||||
info->cia.installedVersion = info->cia.installed ? entry.version : (u16) 0;
|
||||
}
|
||||
|
||||
if(info->tdsx.exists) {
|
||||
info->tdsx.installed = false;
|
||||
|
||||
char name[FILE_NAME_MAX];
|
||||
string_escape_file_name(name, info->meta.shortDescription, sizeof(name));
|
||||
|
||||
@ -124,19 +127,30 @@ void task_populate_titledb_update_status(list_item* item) {
|
||||
if((info->cia.exists && info->cia.installed) || (info->tdsx.exists && info->tdsx.installed)) {
|
||||
json_t* cache = task_populate_titledb_get_cache_entry(info->id);
|
||||
if(json_is_object(cache)) {
|
||||
info->cia.outdated = info->cia.installed && json_object_get_integer(cache, "cia_id", 0) < info->cia.id;
|
||||
info->tdsx.outdated = info->tdsx.installed && json_object_get_integer(cache, "tdsx_id", 0) < info->tdsx.id;
|
||||
json_t* ciaId = json_object_get(cache, "cia_id");
|
||||
json_t* tdsxId = json_object_get(cache, "tdsx_id");
|
||||
|
||||
info->cia.installed = info->cia.installed && json_is_integer(ciaId);
|
||||
info->cia.outdated = info->cia.installed && json_integer_value(ciaId) < info->cia.id;
|
||||
|
||||
info->tdsx.installed = info->tdsx.installed && json_is_integer(tdsxId);
|
||||
info->tdsx.outdated = info->tdsx.installed && json_integer_value(tdsxId) < info->tdsx.id;
|
||||
} else {
|
||||
// If unknown, assume outdated.
|
||||
info->cia.outdated = true;
|
||||
info->tdsx.outdated = true;
|
||||
// If no cache entry exists, consider this entry as not installed.
|
||||
// Assuming an entry is outdated can cause issues with multiple entries that have the same name/title ID.
|
||||
|
||||
info->cia.installed = false;
|
||||
info->cia.outdated = false;
|
||||
|
||||
info->tdsx.installed = false;
|
||||
info->tdsx.outdated = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(info->cia.outdated || info->tdsx.outdated) {
|
||||
item->color = COLOR_TITLEDB_OUTDATED;
|
||||
} else {
|
||||
} else if(info->cia.installed || info->tdsx.installed) {
|
||||
item->color = COLOR_TITLEDB_INSTALLED;
|
||||
}
|
||||
} else {
|
||||
item->color = COLOR_TITLEDB_NOT_INSTALLED;
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ typedef struct titledb_cia_info_s {
|
||||
|
||||
bool installed;
|
||||
bool outdated;
|
||||
u16 installedVersion;
|
||||
} titledb_cia_info;
|
||||
|
||||
typedef struct titledb_smdh_info_s {
|
||||
|
@ -308,13 +308,11 @@ void task_draw_titledb_info_cia(ui_view* view, void* data, float x1, float y1, f
|
||||
snprintf(infoText, sizeof(infoText),
|
||||
"Title ID: %016llX\n"
|
||||
"TitleDB Version: %s\n"
|
||||
"Installed Version: %hu (%d.%d.%d)\n"
|
||||
"Size: %.2f %s\n"
|
||||
"Updated At: %s %s\n"
|
||||
"Update Available: %s",
|
||||
info->cia.titleId,
|
||||
info->cia.version,
|
||||
info->cia.installedVersion, (info->cia.installedVersion >> 10) & 0x3F, (info->cia.installedVersion >> 4) & 0x3F, info->cia.installedVersion & 0xF,
|
||||
ui_get_display_size(info->cia.size), ui_get_display_size_units(info->cia.size),
|
||||
updatedDate, updatedTime,
|
||||
info->cia.outdated ? "Yes" : "No");
|
||||
|
Loading…
x
Reference in New Issue
Block a user