From e6e50ee62191de9e7d234871730e99d0fd5fda5a Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Tue, 29 Jul 2014 21:42:57 -0700 Subject: [PATCH] GCI Folder: try to leave 10% of the blocks free. only applies if the save is not for the current game --- Source/Core/Core/HW/GCMemcardDirectory.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/HW/GCMemcardDirectory.cpp b/Source/Core/Core/HW/GCMemcardDirectory.cpp index 0aef9cf8cb..0ac4199a82 100644 --- a/Source/Core/Core/HW/GCMemcardDirectory.cpp +++ b/Source/Core/Core/HW/GCMemcardDirectory.cpp @@ -90,9 +90,22 @@ int GCMemcardDirectory::LoadGCI(std::string fileName, DiscIO::IVolume::ECountry { gci.LoadSaveBlocks(); } - else if (currentGameOnly) + else { - return NO_INDEX; + 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)