pcsx2/SIO: correctly detect whether format status of folder mcd

This commit is contained in:
GovanifY 2025-02-20 13:49:45 +01:00
parent eae9fd8902
commit 40e5511596
No known key found for this signature in database
GPG Key ID: 11A944C07CE37C4E
3 changed files with 11 additions and 7 deletions

View File

@ -185,8 +185,6 @@ QString MemoryCardSettingsWidget::getSelectedCard() const
bool MemoryCardSettingsWidget::isSelectedCardFormatted() const
{
QString ret;
const QList<QTreeWidgetItem*> selection(m_ui.cardList->selectedItems());
if (!selection.empty())
return selection[0]->data(0, Qt::UserRole).toBool();
@ -279,7 +277,6 @@ void MemoryCardSettingsWidget::convertCard()
return;
}
MemoryCardConvertDialog dialog(QtUtils::GetRootWidget(this), selectedCard);
if (dialog.IsSetup() && dialog.exec() == QDialog::Accepted)

View File

@ -865,8 +865,15 @@ std::vector<AvailableMcdInfo> FileMcd_GetAvailableCards(bool include_in_use_card
if (!IsMemoryCardFolder(fd.FileName))
continue;
FolderMemoryCard sourceFolderMemoryCard;
Pcsx2Config::McdOptions config;
config.Enabled = true;
config.Type = MemoryCardType::Folder;
sourceFolderMemoryCard.Open(fd.FileName, config, (8 * 1024 * 1024) / FolderMemoryCard::ClusterSize, false, "");
mcds.push_back({std::move(basename), std::move(fd.FileName), fd.ModificationTime,
MemoryCardType::Folder, MemoryCardFileType::Unknown, 0u, true});
MemoryCardType::Folder, MemoryCardFileType::Unknown, 0u, sourceFolderMemoryCard.IsFormatted()});
sourceFolderMemoryCard.Close(false);
}
else
{

View File

@ -318,6 +318,8 @@ public:
void Open(std::string fullPath, const Pcsx2Config::McdOptions& mcdOptions, const u32 sizeInClusters, const bool enableFiltering, std::string filter, bool simulateFileWrites = false);
// Close the memory card and flush changes to the file system. Set flush to false to not store changes.
void Close(bool flush = true);
// Checks whether the Memory Card is formatted.
bool IsFormatted() const;
// Closes and reopens card with given filter options if they differ from the current ones (returns true),
// or does nothing if they match already (returns false).
@ -363,8 +365,6 @@ protected:
// initializes memory card data, as if it was fresh from the factory
void InitializeInternalData();
bool IsFormatted() const;
// returns the in-memory address of data the given memory card adr corresponds to
// returns nullptr if adr corresponds to a folder or file entry
u8* GetSystemBlockPointer(const u32 adr);
@ -558,4 +558,4 @@ public:
u64 GetCRC(uint slot);
void NextFrame(uint slot);
bool ReIndex(uint slot, const bool enableFiltering, const std::string& filter);
};
};