From a18a28091b3dbb2793d461191abc108df3e32350 Mon Sep 17 00:00:00 2001 From: Maschell Date: Tue, 28 Sep 2021 18:18:03 +0200 Subject: [PATCH] Add `RL_UnmountCurrentRunningBundle` export --- src/RPXLoading.cpp | 21 +++++++++++++++++++-- src/utils/FileReaderCompressed.h | 1 - 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/RPXLoading.cpp b/src/RPXLoading.cpp index b78e96b..be73e17 100644 --- a/src/RPXLoading.cpp +++ b/src/RPXLoading.cpp @@ -245,12 +245,28 @@ int32_t RL_UnmountBundle(const char *name) { return romfsUnmount(name); } +bool RL_UnmountCurrentRunningBundle(){ + if(gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted == false){ + return true; + } + if (gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE) { + if (gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted) { + DEBUG_FUNCTION_LINE("Unmount /vol/content"); + romfsUnmount("rom"); + gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted = false; + DCFlushRange(&gReplacementInfo, sizeof(gReplacementInfo)); + return true; + } + } + return false; +} + int32_t RL_FileOpen(const char *name, uint32_t *handle) { if (handle == nullptr) { return -1; } - FileReader *reader = nullptr; + FileReader *reader; std::string path = std::string(name); std::string pathGZ = path + ".gz"; @@ -315,4 +331,5 @@ WUMS_EXPORT_FUNCTION(RL_FileRead); WUMS_EXPORT_FUNCTION(RL_FileClose); WUMS_EXPORT_FUNCTION(RL_FileExists); WUMS_EXPORT_FUNCTION(RL_RedirectContentWithFallback); -WUMS_EXPORT_FUNCTION(RL_DisableContentRedirection); \ No newline at end of file +WUMS_EXPORT_FUNCTION(RL_DisableContentRedirection); +WUMS_EXPORT_FUNCTION(RL_UnmountCurrentRunningBundle); \ No newline at end of file diff --git a/src/utils/FileReaderCompressed.h b/src/utils/FileReaderCompressed.h index 8ed85da..2f026fe 100644 --- a/src/utils/FileReaderCompressed.h +++ b/src/utils/FileReaderCompressed.h @@ -13,7 +13,6 @@ public: explicit FileReaderCompressed(std::string &file); ~FileReaderCompressed() override { - DEBUG_FUNCTION_LINE(""); } int read(uint8_t *buffer, uint32_t size) override;