Fix module loading when modules unmount the sd card

This commit is contained in:
Maschell 2022-09-04 18:35:38 +02:00
parent 37211a4068
commit 1f6a2e4bf0

View File

@ -4,6 +4,7 @@
#include <coreinit/cache.h>
#include <coreinit/debug.h>
#include <coreinit/dynload.h>
#include <coreinit/filesystem_fsa.h>
#include <coreinit/foreground.h>
#include <coreinit/ios.h>
#include <coreinit/screen.h>
@ -186,6 +187,14 @@ int main(int argc, char **argv) {
continue;
}
// Some module may unmount the sd card on exit.
FSAInit();
auto client = FSAAddClient(nullptr);
if (client) {
FSAMount(client, "/dev/sdcard01", "/vol/external01", static_cast<FSAMountFlags>(0), nullptr, 0);
FSADelClient(client);
}
uint32_t destination_address_end = ((uint32_t) gModuleData) & 0xFFFF0000;
memset((void *) gModuleData, 0, sizeof(module_information_t));
DEBUG_FUNCTION_LINE("Trying to run %s.", setupModules.GetFilepath(i), destination_address_end, ((uint32_t) gModuleData) - MEMORY_REGION_START);