Core: If configured, sync SD card image with SD card folder on emulation start and end.

Co-authored-by: Pablo Stebler <pablo@stebler.xyz>
This commit is contained in:
Admiral H. Curtiss 2022-04-17 06:08:59 +02:00
parent b66cc1caf6
commit 77d4591fb4
No known key found for this signature in database
GPG key ID: F051B4C4044F33FB
5 changed files with 445 additions and 7 deletions

View file

@ -25,6 +25,7 @@
#include "Common/CommonTypes.h"
#include "Common/Event.h"
#include "Common/FPURoundMode.h"
#include "Common/FatFsUtil.h"
#include "Common/FileUtil.h"
#include "Common/Flag.h"
#include "Common/Logging/Log.h"
@ -495,6 +496,16 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
const bool delete_savestate =
boot_session_data.GetDeleteSavestate() == DeleteSavestateAfterBoot::Yes;
bool sync_sd_folder = core_parameter.bWii && Config::Get(Config::MAIN_WII_SD_CARD) &&
Config::Get(Config::MAIN_WII_SD_CARD_ENABLE_FOLDER_SYNC);
if (sync_sd_folder)
sync_sd_folder = Common::SyncSDFolderToSDImage();
Common::ScopeGuard sd_folder_sync_guard{[sync_sd_folder] {
if (sync_sd_folder && Config::Get(Config::MAIN_ALLOW_SD_WRITES))
Common::SyncSDImageToSDFolder();
}};
// Load and Init Wiimotes - only if we are booting in Wii mode
bool init_wiimotes = false;
if (core_parameter.bWii && !Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED))