From e9dc378b7a7df077350e7fcee5e99963aff68160 Mon Sep 17 00:00:00 2001 From: d0k3 Date: Tue, 23 Jan 2018 01:59:06 +0100 Subject: [PATCH] Fix crashes when viewing metainfo for certain CIAs --- arm9/source/utils/gameutil.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arm9/source/utils/gameutil.c b/arm9/source/utils/gameutil.c index d0ffc9d..366ffa1 100644 --- a/arm9/source/utils/gameutil.c +++ b/arm9/source/utils/gameutil.c @@ -1512,12 +1512,14 @@ u32 LoadSmdhFromGameFile(const char* path, Smdh* smdh) { } u32 ShowSmdhTitleInfo(Smdh* smdh) { + const u8 smdh_magic[] = { SMDH_MAGIC }; const u32 lwrap = 24; u8* icon = (u8*) (TEMP_BUFFER + sizeof(Smdh)); char* desc_l = (char*) icon + SMDH_SIZE_ICON_BIG; char* desc_s = (char*) desc_l + SMDH_SIZE_DESC_LONG; char* pub = (char*) desc_s + SMDH_SIZE_DESC_SHORT; - if ((GetSmdhIconBig(icon, smdh) != 0) || + if ((memcmp(smdh->magic, smdh_magic, 4) != 0) || + (GetSmdhIconBig(icon, smdh) != 0) || (GetSmdhDescLong(desc_l, smdh) != 0) || (GetSmdhDescShort(desc_s, smdh) != 0) || (GetSmdhPublisher(pub, smdh) != 0))