Compare commits

...

3 Commits

Author SHA1 Message Date
GovanifY
1dc009f752 pcsx2/SIO: correctly detect whether format status of folder mcd 2025-02-20 16:00:40 +01:00
GovanifY
009b4ff5e7 QT/Settings: ensure that a memory card is formatted before conversion 2025-02-20 16:00:40 +01:00
PCSX2 Bot
f1a947af92 [ci skip] Qt: Update Base Translation. 2025-02-19 21:00:23 -05:00
5 changed files with 227 additions and 183 deletions

View File

@@ -183,6 +183,14 @@ QString MemoryCardSettingsWidget::getSelectedCard() const
return ret;
}
bool MemoryCardSettingsWidget::isSelectedCardFormatted() const
{
const QList<QTreeWidgetItem*> selection(m_ui.cardList->selectedItems());
if (!selection.empty())
return selection[0]->data(0, Qt::UserRole).toBool();
return false;
}
void MemoryCardSettingsWidget::updateCardActions()
{
QString selectedCard = getSelectedCard();
@@ -263,6 +271,12 @@ void MemoryCardSettingsWidget::convertCard()
if (selectedCard.isEmpty())
return;
if (!isSelectedCardFormatted())
{
QMessageBox::critical(this, tr("Error"), tr("Cannot convert an unformatted memory card."));
return;
}
MemoryCardConvertDialog dialog(QtUtils::GetRootWidget(this), selectedCard);
if (dialog.IsSetup() && dialog.exec() == QDialog::Accepted)
@@ -442,6 +456,10 @@ void MemoryCardListWidget::refresh(SettingsWindow* dialog)
item->setText(1, getSizeSummary(mcd));
item->setText(2, mcd.formatted ? tr("Yes") : tr("No"));
item->setText(3, mtime.toString(QLocale::system().dateTimeFormat(QLocale::ShortFormat)));
// store formatted metadata
item->setData(0, Qt::UserRole, mcd.formatted);
addTopLevelItem(item);
}
}

View File

@@ -97,6 +97,7 @@ private:
void createCard();
QString getSelectedCard() const;
bool isSelectedCardFormatted() const;
void updateCardActions();
void deleteCard();
void renameCard();

File diff suppressed because it is too large Load Diff

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);
};
};