mirror of https://github.com/PCSX2/pcsx2.git
FolderMemoryCard: Abort Flush operation when remnants of an incomplete save operation are found.
This commit is contained in:
parent
541a254c60
commit
c3694c4ad1
|
@ -487,7 +487,7 @@ u8* FolderMemoryCard::GetSystemBlockPointer( const u32 adr ) {
|
|||
} else if ( block == m_superBlock.data.backup_block1 ) {
|
||||
src = &m_backupBlock1[( page % 16 ) * PageSize + offset];
|
||||
} else if ( block == m_superBlock.data.backup_block2 ) {
|
||||
src = &m_backupBlock2[( page % 16 ) * PageSize + offset];
|
||||
src = &m_backupBlock2.raw[( page % 16 ) * PageSize + offset];
|
||||
} else {
|
||||
// trying to access indirect FAT?
|
||||
for ( int i = 0; i < IndirectFatClusterCount; ++i ) {
|
||||
|
@ -737,6 +737,14 @@ void FolderMemoryCard::Flush() {
|
|||
FlushBlock( 0 );
|
||||
if ( !IsFormatted() ) { return; }
|
||||
|
||||
// check if we were interrupted in the middle of a save operation, if yes abort
|
||||
FlushBlock( m_superBlock.data.backup_block1 );
|
||||
FlushBlock( m_superBlock.data.backup_block2 );
|
||||
if ( m_backupBlock2.programmedBlock != 0xFFFFFFFFu ) {
|
||||
Console.Warning( L"(FolderMcd) Aborting flush of slot %u, emulation was interrupted during save process!", m_slot );
|
||||
return;
|
||||
}
|
||||
|
||||
const u32 clusterCount = GetSizeInClusters();
|
||||
const u32 pageCount = clusterCount * 2;
|
||||
|
||||
|
|
|
@ -191,7 +191,10 @@ protected:
|
|||
u8 raw[IndirectFatClusterCount][ClusterSize / 4][ClusterSize];
|
||||
} m_fat;
|
||||
u8 m_backupBlock1[BlockSize];
|
||||
u8 m_backupBlock2[BlockSize];
|
||||
union backupBlock2Union {
|
||||
u32 programmedBlock;
|
||||
u8 raw[BlockSize];
|
||||
} m_backupBlock2;
|
||||
|
||||
// stores directory and file metadata
|
||||
std::map<u32, MemoryCardFileEntryCluster> m_fileEntryDict;
|
||||
|
|
Loading…
Reference in New Issue