Config: Add setting for SD card file size when converting.

This commit is contained in:
Admiral H. Curtiss 2023-02-26 22:45:55 +01:00
parent 1a2dcc53f2
commit d861b8caca
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
3 changed files with 13 additions and 3 deletions

View File

@ -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);

View File

@ -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<bool>& GetInfoForSimulateKonga(int channel)
const Info<bool> MAIN_WII_SD_CARD{{System::Main, "Core", "WiiSDCard"}, true};
const Info<bool> MAIN_WII_SD_CARD_ENABLE_FOLDER_SYNC{
{System::Main, "Core", "WiiSDCardEnableFolderSync"}, false};
const Info<u64> MAIN_WII_SD_CARD_FILESIZE{{System::Main, "Core", "WiiSDCardFilesize"}, 0};
const Info<bool> MAIN_WII_KEYBOARD{{System::Main, "Core", "WiiKeyboard"}, false};
const Info<bool> MAIN_WIIMOTE_CONTINUOUS_SCANNING{
{System::Main, "Core", "WiimoteContinuousScanning"}, false};

View File

@ -9,6 +9,7 @@
#include <utility>
#include "Common/Common.h"
#include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "DiscIO/Enums.h"
@ -98,6 +99,7 @@ const Info<bool>& GetInfoForAdapterRumble(int channel);
const Info<bool>& GetInfoForSimulateKonga(int channel);
extern const Info<bool> MAIN_WII_SD_CARD;
extern const Info<bool> MAIN_WII_SD_CARD_ENABLE_FOLDER_SYNC;
extern const Info<u64> MAIN_WII_SD_CARD_FILESIZE;
extern const Info<bool> MAIN_WII_KEYBOARD;
extern const Info<bool> MAIN_WIIMOTE_CONTINUOUS_SCANNING;
extern const Info<bool> MAIN_WIIMOTE_ENABLE_SPEAKER;