From ed641b2e85fbd7deccc3e871e8d63b7364d967b5 Mon Sep 17 00:00:00 2001 From: Lekoopapaul Date: Wed, 29 May 2024 22:08:04 +0200 Subject: [PATCH] When the save redirection fails it will start without mods --- src/modpackSelector.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/modpackSelector.cpp b/src/modpackSelector.cpp index 5c83ac3..960bb4a 100644 --- a/src/modpackSelector.cpp +++ b/src/modpackSelector.cpp @@ -317,9 +317,34 @@ void HandleMultiModPacks(uint64_t titleID) { bool ReplaceContentInternal(const std::string &basePath, const std::string &subdir, CRLayerHandle *layerHandle,FSLayerType layerType); bool ReplaceContent(const std::string &basePath, const std::string &modpack) { + bool saveRes = ReplaceContentInternal(basePath, "save", &gSaveLayerHandle,FS_LAYER_TYPE_SAVE_REPLACE); + + if(!saveRes){ + + auto screenWasAllocated = screenBuffer_0 != nullptr; + + if (!ScreenInit()) { + OSFatal("SDCafiine plugin: Failed to apply the modpack."); + } + uint32_t sleepTime = 3000; + DEBUG_FUNCTION_LINE_ERR("Failed to apply the save redirection. Starting without mods."); + OSScreenClearBufferEx(SCREEN_TV, 0); + OSScreenClearBufferEx(SCREEN_DRC, 0); + console_print_pos(-2, -1, "SDCafiine plugin " VERSION VERSION_EXTRA); + console_print_pos(-2, 1, "Failed to apply the save redirection. Starting without mods..."); + + OSScreenFlipBuffersEx(SCREEN_TV); + OSScreenFlipBuffersEx(SCREEN_DRC); + + OSSleepTicks(OSMillisecondsToTicks(sleepTime)); + if (!screenWasAllocated) { + ScreenDeInit(); + } + return false; + } + bool contentRes = ReplaceContentInternal(basePath, "content", &gContentLayerHandle,FS_LAYER_TYPE_CONTENT_MERGE); bool aocRes = ReplaceContentInternal(basePath, "aoc", &gAocLayerHandle,FS_LAYER_TYPE_AOC_MERGE); - bool saveRes = ReplaceContentInternal(basePath, "save", &gSaveLayerHandle,FS_LAYER_TYPE_SAVE_REPLACE); if (!contentRes && !aocRes) { auto screenWasAllocated = screenBuffer_0 != nullptr;