summaryrefslogtreecommitdiff
path: root/Source/Core/Common/FatFsUtil.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2023-06-02 20:52:08 +0200
committerGitHub <noreply@github.com>2023-06-02 20:52:08 +0200
commitca484c7a650449373ac15e96ec06066b6420b0c9 (patch)
treeb051230a54d241a84310c6dbe3c9d11eebf052a1 /Source/Core/Common/FatFsUtil.cpp
parent7bbd530eb5046bd218636d9b6ba0b7c318a09e55 (diff)
parent9600bf1af98c090329d13c7193ff43cab5143f76 (diff)
Merge pull request #11609 from AdmiralCurtiss/sd-size-select
Add SD card size option for converting folder -> file.
Diffstat (limited to 'Source/Core/Common/FatFsUtil.cpp')
-rw-r--r--Source/Core/Common/FatFsUtil.cpp12
1 files changed, 9 insertions, 3 deletions
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<bool()>& 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);