mirror of https://github.com/PCSX2/pcsx2.git
folderMemoryCard: hack - don't hang PCSX2 if a file has zero size
I'm not sure if it breaks the state of the folderMemoryCard (FMC) or not, but at least it doesn't hang PCSX2. Might need followup to make sure the state ends up valid.
This commit is contained in:
parent
e576f259e4
commit
ef9016e363
|
@ -413,6 +413,11 @@ bool FolderMemoryCard::AddFile( MemoryCardFileEntry* const dirEntry, const wxStr
|
||||||
// make sure we have enough space on the memcard to hold the data
|
// make sure we have enough space on the memcard to hold the data
|
||||||
const u32 clusterSize = m_superBlock.data.pages_per_cluster * m_superBlock.data.page_len;
|
const u32 clusterSize = m_superBlock.data.pages_per_cluster * m_superBlock.data.page_len;
|
||||||
const u32 filesize = file.Length();
|
const u32 filesize = file.Length();
|
||||||
|
if (!filesize) {
|
||||||
|
Console.Error(L"(MCDF) Empty file. Aborting.");
|
||||||
|
file.Close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const u32 countClusters = ( filesize % clusterSize ) != 0 ? ( filesize / clusterSize + 1 ) : ( filesize / clusterSize );
|
const u32 countClusters = ( filesize % clusterSize ) != 0 ? ( filesize / clusterSize + 1 ) : ( filesize / clusterSize );
|
||||||
const u32 newNeededClusters = ( dirEntry->entry.data.length % 2 ) == 0 ? countClusters + 1 : countClusters;
|
const u32 newNeededClusters = ( dirEntry->entry.data.length % 2 ) == 0 ? countClusters + 1 : countClusters;
|
||||||
if ( newNeededClusters > GetAmountFreeDataClusters() ) {
|
if ( newNeededClusters > GetAmountFreeDataClusters() ) {
|
||||||
|
|
Loading…
Reference in New Issue