diff --git a/source/fs.c b/source/fs.c index 015cb2ca..2b954f67 100644 --- a/source/fs.c +++ b/source/fs.c @@ -176,6 +176,7 @@ u32 zip_file_to_buf(char *file_name, u16 *zip_path, char **buf) archive_read_support_format_zip(a); int r = archive_read_open_filename(a, path, 0x4000); + free(path); if(r != ARCHIVE_OK) { DEBUG("Invalid zip being opened\n"); diff --git a/source/loading.c b/source/loading.c index acfe9311..61556c57 100644 --- a/source/loading.c +++ b/source/loading.c @@ -187,9 +187,27 @@ Result load_entries(const char * loading_path, Entry_List_s * list) if(R_FAILED(res) || entries_read == 0) break; - if(!(dir_entry.attributes & FS_ATTRIBUTE_DIRECTORY) && strcmp(dir_entry.shortExt, "ZIP")) + if(!(dir_entry.attributes & FS_ATTRIBUTE_DIRECTORY) && strcmp(dir_entry.shortExt, "ZIP")) continue; + u16 path[0x106] = {0}; + struacat(path, loading_path); + strucat(path, dir_entry.name); + char * buf = NULL; + + if (!strcmp(dir_entry.shortExt, "ZIP")) + { + u32 size = zip_file_to_buf("info.smdh", path, &buf); + if (size == 0) continue; + } + else + { + struacat(path, "/info.smdh"); + u32 size = file_to_buf(fsMakePath(PATH_UTF16, path), ArchiveSD, &buf); + if (size == 0) continue; + } + + free(buf); list->entries_count++; Entry_s * new_list = realloc(list->entries, list->entries_count * sizeof(Entry_s)); if(new_list == NULL) @@ -645,4 +663,4 @@ Result load_audio(Entry_s entry, audio_s *audio) DEBUG(" fmemopen failed!\n"); return MAKERESULT(RL_FATAL, RS_NOTFOUND, RM_APPLICATION, RD_NOT_FOUND); } -} \ No newline at end of file +}