1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-26 12:12:02 +00:00

Clear previous and next pointers from user application entries while freeing gamecard title info entries.

This commit is contained in:
Pablo Curiel 2020-08-13 14:20:53 -04:00
parent 90c6d8a9f8
commit 7606f7b40a

View file

@ -1542,19 +1542,24 @@ static void titleRemoveGameCardTitleInfoEntries(void)
/* Free all title info entries. */ /* Free all title info entries. */
titleFreeTitleInfo(); titleFreeTitleInfo();
} else { } else {
/* Update parent, previous and next title info pointers from patches and add-on content entries. */ /* Update parent, previous and next title info pointers from user application, patch and add-on content entries. */
for(u32 i = 0; i < (g_titleInfoCount - g_titleInfoGameCardCount); i++) for(u32 i = 0; i < (g_titleInfoCount - g_titleInfoGameCardCount); i++)
{ {
if (g_titleInfo[i].meta_key.type != NcmContentMetaType_Patch && g_titleInfo[i].meta_key.type != NcmContentMetaType_AddOnContent) continue; TitleInfo *cur_title_info = &(g_titleInfo[i]);
if (g_titleInfo[i].parent && g_titleInfo[i].parent->storage_id == NcmStorageId_GameCard) g_titleInfo[i].parent = NULL;
if (g_titleInfo[i].previous && g_titleInfo[i].previous->storage_id == NcmStorageId_GameCard) g_titleInfo[i].previous = NULL; if (cur_title_info->meta_key.type != NcmContentMetaType_Application && cur_title_info->meta_key.type != NcmContentMetaType_Patch && \
if (g_titleInfo[i].next && g_titleInfo[i].next->storage_id == NcmStorageId_GameCard) g_titleInfo[i].next = NULL; cur_title_info->meta_key.type != NcmContentMetaType_AddOnContent) continue;
if (cur_title_info->parent && cur_title_info->parent->storage_id == NcmStorageId_GameCard) cur_title_info->parent = NULL;
if (cur_title_info->previous && cur_title_info->previous->storage_id == NcmStorageId_GameCard) cur_title_info->previous = NULL;
if (cur_title_info->next && cur_title_info->next->storage_id == NcmStorageId_GameCard) cur_title_info->next = NULL;
} }
/* Free content infos from gamecard title info entries. */ /* Free content infos from gamecard title info entries. */
for(u32 i = (g_titleInfoCount - g_titleInfoGameCardCount); i < g_titleInfoCount; i++) for(u32 i = (g_titleInfoCount - g_titleInfoGameCardCount); i < g_titleInfoCount; i++)
{ {
if (g_titleInfo[i].content_infos) free(g_titleInfo[i].content_infos); TitleInfo *cur_title_info = &(g_titleInfo[i]);
if (cur_title_info->content_infos) free(cur_title_info->content_infos);
} }
/* Reallocate title info buffer. */ /* Reallocate title info buffer. */