MemoryCardFolder: Add write osd notification.

This commit is contained in:
Stuart Kenny 2022-08-03 10:56:13 +01:00 committed by lightningterror
parent 14e0aeb4f3
commit 2915a1a145
2 changed files with 18 additions and 1 deletions

View File

@ -15,12 +15,14 @@
#include "PrecompiledHeader.h"
#include "common/SafeArray.inl"
#include "common/Path.h"
#include "MemoryCardFile.h"
#include "MemoryCardFolder.h"
#include "System.h"
#include "Config.h"
#include "Host.h"
#include "common/FileSystem.h"
#include "common/Path.h"
@ -1578,6 +1580,11 @@ bool FolderMemoryCard::WriteToFile(const u8* src, u32 adr, u32 dataLength)
return false;
}
std::string FolderMemoryCard::GetFolderName()
{
return m_folderName;
}
void FolderMemoryCard::CopyEntryDictIntoTree(std::vector<MemoryCardFileEntryTreeNode>* fileEntryTree, const u32 cluster, const u32 fileCount)
{
const MemoryCardFileEntryCluster* entryCluster = &m_fileEntryDict[cluster];
@ -2322,7 +2329,15 @@ s32 FolderMemoryCardAggregator::Read(uint slot, u8* dest, u32 adr, int size)
s32 FolderMemoryCardAggregator::Save(uint slot, const u8* src, u32 adr, int size)
{
return m_cards[slot].Save(src, adr, size);
const s32 saveResult = m_cards[slot].Save(src, adr, size);
if (saveResult)
{
const std::string_view filename = Path::GetFileName(m_cards[slot].GetFolderName());
Host::AddKeyedFormattedOSDMessage(StringUtil::StdStringFromFormat("MemoryCardSave%u", slot), 10.0f,
"Memory Card %.*s written.", static_cast<int>(filename.size()), static_cast<const char*>(filename.data()));
}
return saveResult;
}
s32 FolderMemoryCardAggregator::EraseBlock(uint slot, u32 adr)

View File

@ -363,6 +363,8 @@ public:
void WriteToFile(const std::string& filename);
std::string GetFolderName();
protected:
struct EnumeratedFileEntry
{