GCI Folder: try to leave 10% of the blocks free. only applies if the save is not for the current game

This commit is contained in:
LPFaint99 2014-07-29 21:42:57 -07:00
parent f6d89c5c98
commit e6e50ee621
1 changed files with 15 additions and 2 deletions

View File

@ -90,10 +90,23 @@ int GCMemcardDirectory::LoadGCI(std::string fileName, DiscIO::IVolume::ECountry
{
gci.LoadSaveBlocks();
}
else if (currentGameOnly)
else
{
if (currentGameOnly)
{
return NO_INDEX;
}
int totalBlocks = BE16(m_hdr.SizeMb)*MBIT_TO_BLOCKS - MC_FST_BLOCKS;
int freeBlocks = BE16(m_bat1.FreeBlocks);
if (totalBlocks > freeBlocks * 10)
{
PanicAlertT("%s\nwas not loaded because there is less than 10%% free space on the memorycard\n"\
"Total Blocks: %d; Free Blocks: %d",
gci.m_filename.c_str(), totalBlocks, freeBlocks);
return NO_INDEX;
}
}
u16 first_block = m_bat1.AssignBlocksContiguous(numBlocks);
if (first_block == 0xFFFF)
{