Add .cetk to ticket filter.

This commit is contained in:
Steveice10 2017-02-16 10:04:55 -08:00
parent 6b5e4e1a54
commit 77625262fb
3 changed files with 43 additions and 50 deletions

View File

@ -406,7 +406,7 @@ bool util_filter_tickets(void* data, const char* name, u32 attributes) {
}
size_t len = strlen(name);
return len >= 4 && strncasecmp(name + len - 4, ".tik", 4) == 0;
return (len >= 4 && strncasecmp(name + len - 4, ".tik", 4) == 0) || (len >= 5 && strncasecmp(name + len - 5, ".cetk", 5) == 0);
}
int util_compare_file_infos(void* userData, const void* p1, const void* p2) {

View File

@ -358,13 +358,9 @@ static bool files_filter(void* data, const char* name, u32 attributes) {
if((attributes & FS_ATTRIBUTE_DIRECTORY) != 0) {
return listData->showDirectories;
} else {
size_t len = strlen(name);
if(len >= 4) {
const char* extension = name + len - 4;
if((strncasecmp(extension, ".cia", 4) == 0 && !listData->showCias) || (strncasecmp(extension, ".tik", 4) == 0 && !listData->showTickets)) {
if((util_filter_cias(NULL, name, attributes) && !listData->showCias) || (util_filter_tickets(NULL, name, attributes) && !listData->showTickets)) {
return false;
}
}
return listData->showFiles;
}

View File

@ -57,9 +57,7 @@ Result task_create_file_item(list_item** out, FS_Archive archive, const char* pa
FSFILE_GetSize(fileHandle, &fileInfo->size);
size_t len = strlen(fileInfo->path);
if(len > 4) {
if(strcasecmp(&fileInfo->path[len - 4], ".cia") == 0) {
if(util_filter_cias(NULL, fileInfo->path, fileInfo->attributes)) {
AM_TitleEntry titleEntry;
if(R_SUCCEEDED(AM_GetCiaFileInfo(MEDIATYPE_SD, &titleEntry, fileHandle))) {
fileInfo->isCia = true;
@ -91,7 +89,7 @@ Result task_create_file_item(list_item** out, FS_Archive archive, const char* pa
free(smdh);
}
}
} else if(strcasecmp(&fileInfo->path[len - 4], ".tik") == 0) {
} else if(util_filter_tickets(NULL, fileInfo->path, fileInfo->attributes)) {
u32 bytesRead = 0;
u8 sigType = 0;
@ -107,7 +105,6 @@ Result task_create_file_item(list_item** out, FS_Archive archive, const char* pa
}
}
}
}
FSFILE_Close(fileHandle);
}