diff --git a/Source/Core/Common/FatFsUtil.cpp b/Source/Core/Common/FatFsUtil.cpp index f194dc22a3..88d746e8ea 100644 --- a/Source/Core/Common/FatFsUtil.cpp +++ b/Source/Core/Common/FatFsUtil.cpp @@ -26,6 +26,8 @@ #include "Common/ScopeGuard.h" #include "Common/StringUtil.h" +#include "Core/Config/MainSettings.h" + enum : u32 { SECTOR_SIZE = 512, @@ -513,9 +515,13 @@ bool SyncSDFolderToSDImage(const std::function& cancelled, bool determin if (!CheckIfFATCompatible(root)) return false; - u64 size = GetSize(root); - // Allocate a reasonable amount of free space - size += std::clamp(size / 2, MebibytesToBytes(512), GibibytesToBytes(8)); + u64 size = Config::Get(Config::MAIN_WII_SD_CARD_FILESIZE); + if (size == 0) + { + size = GetSize(root); + // Allocate a reasonable amount of free space + size += std::clamp(size / 2, MebibytesToBytes(512), GibibytesToBytes(8)); + } size = AlignUp(size, MAX_CLUSTER_SIZE); std::lock_guard lk(s_fatfs_mutex); diff --git a/Source/Core/Core/Config/MainSettings.cpp b/Source/Core/Core/Config/MainSettings.cpp index 1a7c523d6e..7023ec411b 100644 --- a/Source/Core/Core/Config/MainSettings.cpp +++ b/Source/Core/Core/Config/MainSettings.cpp @@ -10,6 +10,7 @@ #include "AudioCommon/AudioCommon.h" #include "Common/Assert.h" #include "Common/CommonPaths.h" +#include "Common/CommonTypes.h" #include "Common/Config/Config.h" #include "Common/EnumMap.h" #include "Common/FileUtil.h" @@ -175,6 +176,7 @@ const Info& GetInfoForSimulateKonga(int channel) const Info MAIN_WII_SD_CARD{{System::Main, "Core", "WiiSDCard"}, true}; const Info MAIN_WII_SD_CARD_ENABLE_FOLDER_SYNC{ {System::Main, "Core", "WiiSDCardEnableFolderSync"}, false}; +const Info MAIN_WII_SD_CARD_FILESIZE{{System::Main, "Core", "WiiSDCardFilesize"}, 0}; const Info MAIN_WII_KEYBOARD{{System::Main, "Core", "WiiKeyboard"}, false}; const Info MAIN_WIIMOTE_CONTINUOUS_SCANNING{ {System::Main, "Core", "WiimoteContinuousScanning"}, false}; diff --git a/Source/Core/Core/Config/MainSettings.h b/Source/Core/Core/Config/MainSettings.h index 546696476f..dd8f1632f8 100644 --- a/Source/Core/Core/Config/MainSettings.h +++ b/Source/Core/Core/Config/MainSettings.h @@ -9,6 +9,7 @@ #include #include "Common/Common.h" +#include "Common/CommonTypes.h" #include "Common/Config/Config.h" #include "DiscIO/Enums.h" @@ -98,6 +99,7 @@ const Info& GetInfoForAdapterRumble(int channel); const Info& GetInfoForSimulateKonga(int channel); extern const Info MAIN_WII_SD_CARD; extern const Info MAIN_WII_SD_CARD_ENABLE_FOLDER_SYNC; +extern const Info MAIN_WII_SD_CARD_FILESIZE; extern const Info MAIN_WII_KEYBOARD; extern const Info MAIN_WIIMOTE_CONTINUOUS_SCANNING; extern const Info MAIN_WIIMOTE_ENABLE_SPEAKER;