1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-09 20:21:45 +00:00

title: handle extra allocated user application metadata entries in titleFindApplicationMetadataByTitleId().

This commit is contained in:
Pablo Curiel 2021-06-15 01:44:10 -04:00
parent 7a964c8282
commit b7daac6807
2 changed files with 7 additions and 11 deletions

View file

@ -377,12 +377,7 @@ static bool waitForGameCardAndUsb(void)
consolePrint("waiting for gamecard...\n");
u8 status = GameCardStatus_NotInserted;
while(true)
{
status = gamecardGetStatus();
if (status > GameCardStatus_NotInserted) break;
}
while(status <= GameCardStatus_Processing) status = gamecardGetStatus();
switch(status)
{
@ -401,6 +396,7 @@ static bool waitForGameCardAndUsb(void)
if (status != GameCardStatus_InsertedAndInfoLoaded)
{
consolePrint("press any button\n");
utilsWaitForButtonPress(0);
return false;
}

View file

@ -443,7 +443,7 @@ static bool titleGenerateMetadataEntriesFromNsRecords(void);
static TitleApplicationMetadata *titleGenerateDummySystemMetadataEntry(u64 title_id);
static bool titleRetrieveUserApplicationMetadataByTitleId(u64 title_id, TitleApplicationMetadata *out);
NX_INLINE TitleApplicationMetadata *titleFindApplicationMetadataByTitleId(u64 title_id, bool is_system);
NX_INLINE TitleApplicationMetadata *titleFindApplicationMetadataByTitleId(u64 title_id, bool is_system, u32 extra_app_count);
static bool titleGenerateTitleInfoEntriesForTitleStorage(TitleStorage *title_storage);
static bool titleGetMetaKeysFromContentDatabase(NcmContentMetaDatabase *ncm_db, NcmContentMetaKey **out_meta_keys, u32 *out_meta_key_count);
@ -1619,12 +1619,12 @@ static bool titleRetrieveUserApplicationMetadataByTitleId(u64 title_id, TitleApp
return true;
}
NX_INLINE TitleApplicationMetadata *titleFindApplicationMetadataByTitleId(u64 title_id, bool is_system)
NX_INLINE TitleApplicationMetadata *titleFindApplicationMetadataByTitleId(u64 title_id, bool is_system, u32 extra_app_count)
{
if ((is_system && (!g_systemMetadata || !g_systemMetadataCount)) || (!is_system && (!g_userMetadata || !g_userMetadataCount)) || !title_id) return NULL;
TitleApplicationMetadata **cached_app_metadata = (is_system ? g_systemMetadata : g_userMetadata);
u32 cached_app_metadata_count = (is_system ? g_systemMetadataCount : g_userMetadataCount);
u32 cached_app_metadata_count = ((is_system ? g_systemMetadataCount : g_userMetadataCount) + extra_app_count);
for(u32 i = 0; i < cached_app_metadata_count; i++)
{
@ -1713,7 +1713,7 @@ static bool titleGenerateTitleInfoEntriesForTitleStorage(TitleStorage *title_sto
(cur_title_info->meta_key.type == NcmContentMetaType_AddOnContent ? titleGetApplicationIdByAddOnContentId(cur_title_info->meta_key.id) : \
titleGetApplicationIdByDeltaId(cur_title_info->meta_key.id))));
cur_title_info->app_metadata = titleFindApplicationMetadataByTitleId(app_id, storage_id == NcmStorageId_BuiltInSystem);
cur_title_info->app_metadata = titleFindApplicationMetadataByTitleId(app_id, storage_id == NcmStorageId_BuiltInSystem, 0);
if (!cur_title_info->app_metadata && storage_id == NcmStorageId_BuiltInSystem)
{
/* Generate dummy system metadata entry if we have no hardcoded information for this system title. */
@ -2113,7 +2113,7 @@ static bool titleRefreshGameCardTitleInfo(void)
titleGetApplicationIdByDeltaId(cur_title_info->meta_key.id))));
/* Do not proceed if application metadata has already been retrieved, or if we can successfully retrieve it. */
if (cur_title_info->app_metadata != NULL || (cur_title_info->app_metadata = titleFindApplicationMetadataByTitleId(app_id, false)) != NULL) continue;
if (cur_title_info->app_metadata != NULL || (cur_title_info->app_metadata = titleFindApplicationMetadataByTitleId(app_id, false, extra_app_count)) != NULL) continue;
/* Retrieve application metadata pointer. */
TitleApplicationMetadata *cur_app_metadata = g_userMetadata[g_userMetadataCount + extra_app_count];