diff options
| author | lizzie <lizzie@eden-emu.dev> | 2026-05-09 05:28:22 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-05-09 05:28:22 +0200 |
| commit | a6423a88cc068f8213db8707900a1d1b38b9566d (patch) | |
| tree | 804c6923e839f17e1ea1d8a10930a36245cc6661 /src/core/file_sys | |
| parent | f87b1dafc83d50b7e363409444a9a2a8fdff76cb (diff) | |
[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>
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/sdmc_factory.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/core/file_sys/sdmc_factory.cpp b/src/core/file_sys/sdmc_factory.cpp index f3e2e21f4c..a2903dbacf 100644 --- a/src/core/file_sys/sdmc_factory.cpp +++ b/src/core/file_sys/sdmc_factory.cpp @@ -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 |
