mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-09 23:57:59 +00:00
[file_sys] resize SD card size in 4GiB chunks (#3921)
some homebrew theoretically would freak out when 1TB is reached... so let's just magically resize the SD card :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3921 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
This commit is contained in:
parent
f87b1dafc8
commit
a6423a88cc
|
|
@ -1,7 +1,12 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <memory>
|
||||
#include "common/alignment.h"
|
||||
#include "common/literals.h"
|
||||
#include "core/file_sys/registered_cache.h"
|
||||
#include "core/file_sys/sdmc_factory.h"
|
||||
#include "core/file_sys/vfs/vfs.h"
|
||||
|
|
@ -9,8 +14,6 @@
|
|||
|
||||
namespace FileSys {
|
||||
|
||||
constexpr u64 SDMC_TOTAL_SIZE = 0x10000000000; // 1 TiB
|
||||
|
||||
SDMCFactory::SDMCFactory(VirtualDir sd_dir_, VirtualDir sd_mod_dir_)
|
||||
: sd_dir(std::move(sd_dir_)), sd_mod_dir(std::move(sd_mod_dir_)),
|
||||
contents(std::make_unique<RegisteredCache>(
|
||||
|
|
@ -56,7 +59,11 @@ u64 SDMCFactory::GetSDMCFreeSpace() const {
|
|||
}
|
||||
|
||||
u64 SDMCFactory::GetSDMCTotalSpace() const {
|
||||
return SDMC_TOTAL_SIZE;
|
||||
// Resize the SD space automatically, always leaving around 4GiB last from next chunk block
|
||||
using namespace Common::Literals;
|
||||
auto const bytes_per_sector = 512;
|
||||
auto const size_block = (sd_dir->GetSize() + 4_GiB) / 4_GiB;
|
||||
return Common::AlignUp(size_block * 4_GiB, bytes_per_sector);
|
||||
}
|
||||
|
||||
} // namespace FileSys
|
||||
|
|
|
|||
Loading…
Reference in a new issue