1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-26 12:12:02 +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"); consolePrint("waiting for gamecard...\n");
u8 status = GameCardStatus_NotInserted; u8 status = GameCardStatus_NotInserted;
while(status <= GameCardStatus_Processing) status = gamecardGetStatus();
while(true)
{
status = gamecardGetStatus();
if (status > GameCardStatus_NotInserted) break;
}
switch(status) switch(status)
{ {
@ -401,6 +396,7 @@ static bool waitForGameCardAndUsb(void)
if (status != GameCardStatus_InsertedAndInfoLoaded) if (status != GameCardStatus_InsertedAndInfoLoaded)
{ {
consolePrint("press any button\n");
utilsWaitForButtonPress(0); utilsWaitForButtonPress(0);
return false; return false;
} }

View file

@ -443,7 +443,7 @@ static bool titleGenerateMetadataEntriesFromNsRecords(void);
static TitleApplicationMetadata *titleGenerateDummySystemMetadataEntry(u64 title_id); static TitleApplicationMetadata *titleGenerateDummySystemMetadataEntry(u64 title_id);
static bool titleRetrieveUserApplicationMetadataByTitleId(u64 title_id, TitleApplicationMetadata *out); 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 titleGenerateTitleInfoEntriesForTitleStorage(TitleStorage *title_storage);
static bool titleGetMetaKeysFromContentDatabase(NcmContentMetaDatabase *ncm_db, NcmContentMetaKey **out_meta_keys, u32 *out_meta_key_count); 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; 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; 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); 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++) 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) : \ (cur_title_info->meta_key.type == NcmContentMetaType_AddOnContent ? titleGetApplicationIdByAddOnContentId(cur_title_info->meta_key.id) : \
titleGetApplicationIdByDeltaId(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) 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. */ /* 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)))); titleGetApplicationIdByDeltaId(cur_title_info->meta_key.id))));
/* Do not proceed if application metadata has already been retrieved, or if we can successfully retrieve it. */ /* 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. */ /* Retrieve application metadata pointer. */
TitleApplicationMetadata *cur_app_metadata = g_userMetadata[g_userMetadataCount + extra_app_count]; TitleApplicationMetadata *cur_app_metadata = g_userMetadata[g_userMetadataCount + extra_app_count];