Browse Source
[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>
pull/3941/head
lizzie
2 weeks ago
committed by
crueter
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
1 changed files with
10 additions and
3 deletions
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