From 18f51e9b2e7db346a45c674d71e7783deb5247d4 Mon Sep 17 00:00:00 2001 From: misson20000 Date: Wed, 10 Oct 2018 20:46:43 -0700 Subject: [PATCH] loader: add NpdmUtils function for invalidating the cache for a specific title --- stratosphere/loader/source/ldr_npdm.cpp | 8 +++++++- stratosphere/loader/source/ldr_npdm.hpp | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/stratosphere/loader/source/ldr_npdm.cpp b/stratosphere/loader/source/ldr_npdm.cpp index e7a110ced..ad688f85e 100644 --- a/stratosphere/loader/source/ldr_npdm.cpp +++ b/stratosphere/loader/source/ldr_npdm.cpp @@ -500,4 +500,10 @@ u32 NpdmUtils::GetApplicationTypeRaw(u32 *caps, size_t num_caps) { } } return application_type; -} \ No newline at end of file +} + +void NpdmUtils::InvalidateCache(u64 tid) { + if (g_npdm_cache.info.title_id == tid) { + g_npdm_cache.info = (const NpdmUtils::NpdmInfo){0}; + } +} diff --git a/stratosphere/loader/source/ldr_npdm.hpp b/stratosphere/loader/source/ldr_npdm.hpp index b04606046..8b9c2dd1e 100644 --- a/stratosphere/loader/source/ldr_npdm.hpp +++ b/stratosphere/loader/source/ldr_npdm.hpp @@ -108,6 +108,8 @@ class NpdmUtils { static FILE *OpenNpdm(u64 tid); static Result LoadNpdm(u64 tid, NpdmInfo *out); static Result LoadNpdmFromCache(u64 tid, NpdmInfo *out); + + static void InvalidateCache(u64 tid); private: static Result LoadNpdmInternal(FILE *f_npdm, NpdmCache *cache); -}; \ No newline at end of file +};